jt3d.es.js 5.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896
  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. var tooltip = "";
  1074. function setSessionid$1(num) {
  1075. let len = num || 32;
  1076. let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
  1077. let maxPos = chars.length;
  1078. let pwd = "";
  1079. for (let i2 = 0; i2 < len; i2++) {
  1080. pwd += chars.charAt(Math.floor(Math.random() * maxPos));
  1081. }
  1082. return pwd;
  1083. }
  1084. function guid() {
  1085. function S4() {
  1086. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  1087. }
  1088. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  1089. }
  1090. function getGuid(removeMinus) {
  1091. let d2 = new Date().getTime();
  1092. let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
  1093. const r2 = (d2 + Math.random() * 16) % 16 | 0;
  1094. d2 = Math.floor(d2 / 16);
  1095. return (c === "x" ? r2 : r2 & 3 | 8).toString(16);
  1096. });
  1097. if (removeMinus) {
  1098. uuid = uuid.replace(/-/g, "");
  1099. }
  1100. return uuid;
  1101. }
  1102. function getHeigthByLngLat(viewer2, options2) {
  1103. if (!viewer2)
  1104. throw new Cesium.DeveloperError("no viewer object!");
  1105. if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
  1106. throw new Cesium.DeveloperError("longitude and latitude are required.");
  1107. }
  1108. options2.level = Cesium.defaultValue(options2.level, 11);
  1109. let positions = Cesium.Cartographic.fromDegrees(options2.longitude, options2.latitude);
  1110. let terrainProvider = viewer2.terrainProvider;
  1111. return new Promise((resolve2, reject2) => {
  1112. new Cesium.sampleTerrain(terrainProvider, options2.level, [positions]).then(function(updatedPositions) {
  1113. if (updatedPositions) {
  1114. resolve2(updatedPositions[0].height);
  1115. }
  1116. });
  1117. });
  1118. }
  1119. function getHeigthByPoints(viewer2, options2) {
  1120. if (!viewer2)
  1121. throw new Cesium.DeveloperError("no viewer object!");
  1122. if (!Cesium.defined(options2)) {
  1123. throw new Cesium.DeveloperError("options is required.");
  1124. }
  1125. options2.level = Cesium.defaultValue(options2.level, 11);
  1126. let positions = [];
  1127. let points2 = options2.points;
  1128. for (let i2 = 0; i2 < points2.length; i2++) {
  1129. let pointX = points2[i2][0];
  1130. let pointY = points2[i2][1];
  1131. positions.push(
  1132. Cesium.Cartographic.fromDegrees(pointX, pointY)
  1133. );
  1134. }
  1135. let terrainProvider = viewer2.terrainProvider;
  1136. return new Promise((resolve2, reject2) => {
  1137. new Cesium.sampleTerrain(terrainProvider, options2.level, positions).then(function(updatedPositions) {
  1138. if (updatedPositions) {
  1139. resolve2(updatedPositions);
  1140. }
  1141. });
  1142. });
  1143. }
  1144. function getHeigthByPointsMostDetailed(viewer2, points2) {
  1145. if (!viewer2)
  1146. throw new Cesium.DeveloperError("no viewer object!");
  1147. if (!Cesium.defined(points2)) {
  1148. throw new Cesium.DeveloperError("points is required.");
  1149. }
  1150. let positions = [];
  1151. for (let i2 = 0; i2 < points2.length; i2++) {
  1152. let pointX = points2[i2][0];
  1153. let pointY = points2[i2][1];
  1154. positions.push(Cesium.Cartographic.fromDegrees(pointX, pointY));
  1155. }
  1156. let terrainProvider = viewer2.terrainProvider;
  1157. return new Promise((resolve2, reject2) => {
  1158. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  1159. promise.then(function(updatedPositions) {
  1160. resolve2(updatedPositions);
  1161. });
  1162. });
  1163. }
  1164. function getHeigthByPointMostDetailed(viewer2, points2) {
  1165. if (!viewer2)
  1166. throw new Cesium.DeveloperError("no viewer object!");
  1167. if (!Cesium.defined(points2)) {
  1168. throw new Cesium.DeveloperError("points is required.");
  1169. }
  1170. let positions = Cesium.Cartographic.fromDegrees(points2[0], points2[1]);
  1171. let terrainProvider = viewer2.terrainProvider;
  1172. return new Promise((resolve2, reject2) => {
  1173. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  1174. promise.then(function(updatedPositions) {
  1175. resolve2(updatedPositions);
  1176. });
  1177. });
  1178. }
  1179. function createTooltip(frameDiv) {
  1180. var tooltip2 = function(frameDiv2) {
  1181. var div = document.createElement("DIV");
  1182. div.className = "twipsy right";
  1183. var arrow = document.createElement("DIV");
  1184. arrow.className = "twipsy-arrow";
  1185. div.appendChild(arrow);
  1186. var title = document.createElement("DIV");
  1187. title.className = "twipsy-inner";
  1188. div.appendChild(title);
  1189. this._div = div;
  1190. this._title = title;
  1191. frameDiv2.appendChild(div);
  1192. };
  1193. tooltip2.prototype.setVisible = function(visible) {
  1194. this._div.style.display = visible ? "block" : "none";
  1195. };
  1196. tooltip2.prototype.showAt = function(position2, message) {
  1197. if (position2 && message) {
  1198. this.setVisible(true);
  1199. this._title.innerHTML = message;
  1200. this._div.style.left = position2.x + 10 + "px";
  1201. this._div.style.top = position2.y - this._div.clientHeight / 2 + "px";
  1202. }
  1203. };
  1204. return new tooltip2(frameDiv);
  1205. }
  1206. var common = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  1207. __proto__: null,
  1208. setSessionid: setSessionid$1,
  1209. guid,
  1210. getGuid,
  1211. getHeigthByLngLat,
  1212. getHeigthByPoints,
  1213. getHeigthByPointsMostDetailed,
  1214. getHeigthByPointMostDetailed,
  1215. createTooltip
  1216. }, Symbol.toStringTag, { value: "Module" }));
  1217. class PointObject {
  1218. constructor(viewer2) {
  1219. if (!viewer2)
  1220. throw new Cesium.DeveloperError("no viewer object!");
  1221. this._viewer = viewer2;
  1222. }
  1223. }
  1224. Object.assign(PointObject.prototype, {
  1225. addLabel(points2, options2) {
  1226. return new Promise((resolve2, reject2) => {
  1227. if (!Cesium.defined(points2)) {
  1228. throw new Cesium.DeveloperError("points is required.");
  1229. }
  1230. let position2;
  1231. if (points2 instanceof Cesium.Cartesian3) {
  1232. position2 = points2;
  1233. } else {
  1234. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1235. }
  1236. options2 = options2 || {};
  1237. options2.id = options2.id || setSessionid$1();
  1238. let label2 = options2.label || {};
  1239. label2.text = Cesium.defaultValue(label2.text, "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0");
  1240. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1241. if (label2.fillColor instanceof Cesium.Color) {
  1242. label2.fillColor = label2.fillColor;
  1243. } else if (label2.fillColor instanceof Array) {
  1244. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1245. } else if (typeof label2.fillColor === "string") {
  1246. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1247. } else {
  1248. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1249. }
  1250. if (label2.outlineColor instanceof Cesium.Color) {
  1251. label2.outlineColor = label2.outlineColor;
  1252. } else if (label2.outlineColor instanceof Array) {
  1253. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1254. } else if (typeof label2.outlineColor === "string") {
  1255. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1256. } else {
  1257. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1258. }
  1259. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1260. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1261. if (label2.backgroundColor instanceof Cesium.Color) {
  1262. label2.backgroundColor = label2.backgroundColor;
  1263. } else if (label2.backgroundColor instanceof Array) {
  1264. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1265. } else if (typeof label2.backgroundColor === "string") {
  1266. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1267. } else {
  1268. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1269. }
  1270. if (label2.backgroundPadding) {
  1271. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1272. }
  1273. let entity = new Cesium.Entity({
  1274. position: position2,
  1275. label: {
  1276. text: label2.text,
  1277. font: label2.font,
  1278. fillColor: label2.fillColor,
  1279. outlineColor: label2.outlineColor,
  1280. outlineWidth: label2.outlineWidth,
  1281. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1282. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1283. showBackground: label2.showBackground,
  1284. backgroundColor: label2.backgroundColor,
  1285. backgroundPadding: label2.backgroundPadding,
  1286. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1287. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1288. clampToGround: true
  1289. }
  1290. });
  1291. if (label2.pixelOffset) {
  1292. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1293. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1294. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1295. }
  1296. if (label2.scaleByDistance) {
  1297. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1298. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1299. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1300. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1301. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1302. }
  1303. resolve2(entity);
  1304. });
  1305. },
  1306. addPoint(points2, options2) {
  1307. return new Promise((resolve2, reject2) => {
  1308. if (!Cesium.defined(points2)) {
  1309. throw new Cesium.DeveloperError("points is required.");
  1310. }
  1311. let position2;
  1312. if (points2 instanceof Cesium.Cartesian3) {
  1313. position2 = points2;
  1314. } else {
  1315. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1316. }
  1317. options2 = options2 || {};
  1318. options2.id = options2.id || setSessionid$1();
  1319. let point2 = options2.point || {};
  1320. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  1321. if (point2.color instanceof Cesium.Color) {
  1322. point2.color = point2.color;
  1323. } else if (point2.color instanceof Array) {
  1324. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  1325. } else if (typeof point2.color === "string") {
  1326. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  1327. } else {
  1328. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  1329. }
  1330. if (point2.outlineColor instanceof Cesium.Color) {
  1331. point2.outlineColor = point2.outlineColor;
  1332. } else if (point2.outlineColor instanceof Array) {
  1333. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  1334. } else if (typeof point2.outlineColor === "string") {
  1335. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  1336. } else {
  1337. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1338. }
  1339. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  1340. let entity = new Cesium.Entity({
  1341. position: position2,
  1342. point: {
  1343. pixelSize: point2.pixelSize,
  1344. color: point2.color,
  1345. outlineColor: point2.outlineColor,
  1346. outlineWidth: point2.outlineWidth,
  1347. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1348. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1349. clampToGround: true
  1350. }
  1351. });
  1352. if (options2.label) {
  1353. let label2 = options2.label || {};
  1354. label2.text = Cesium.defaultValue(label2.text, "");
  1355. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1356. if (label2.fillColor instanceof Cesium.Color) {
  1357. label2.fillColor = label2.outlineColor;
  1358. } else if (label2.fillColor instanceof Array) {
  1359. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1360. } else if (typeof label2.fillColor === "string") {
  1361. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1362. } else {
  1363. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1364. }
  1365. if (label2.outlineColor instanceof Cesium.Color) {
  1366. label2.outlineColor = label2.outlineColor;
  1367. } else if (label2.outlineColor instanceof Array) {
  1368. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1369. } else if (typeof label2.outlineColor === "string") {
  1370. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1371. } else {
  1372. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1373. }
  1374. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1375. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1376. if (label2.backgroundColor instanceof Cesium.Color) {
  1377. label2.backgroundColor = label2.backgroundColor;
  1378. } else if (label2.backgroundColor instanceof Array) {
  1379. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1380. } else if (typeof label2.backgroundColor === "string") {
  1381. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1382. } else {
  1383. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1384. }
  1385. if (label2.backgroundPadding) {
  1386. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1387. }
  1388. entity.label = {
  1389. text: label2.text,
  1390. font: label2.font,
  1391. fillColor: label2.fillColor,
  1392. outlineColor: label2.outlineColor,
  1393. outlineWidth: label2.outlineWidth,
  1394. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1395. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1396. showBackground: label2.showBackground,
  1397. backgroundColor: label2.backgroundColor,
  1398. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1399. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1400. clampToGround: true
  1401. };
  1402. if (label2.pixelOffset) {
  1403. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1404. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1405. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1406. }
  1407. if (label2.scaleByDistance) {
  1408. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1409. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1410. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1411. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1412. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1413. }
  1414. }
  1415. resolve2(entity);
  1416. });
  1417. },
  1418. addBillboard(points2, options2) {
  1419. return new Promise((resolve2, reject2) => {
  1420. if (!Cesium.defined(points2)) {
  1421. throw new Cesium.DeveloperError("points is required.");
  1422. }
  1423. let position2;
  1424. if (points2 instanceof Cesium.Cartesian3) {
  1425. position2 = points2;
  1426. } else {
  1427. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1428. }
  1429. options2 = options2 || {};
  1430. options2.id = options2.id || setSessionid$1();
  1431. let billboard = options2.billboard || {};
  1432. billboard.image = billboard.imgUrl || "jt3dSDK/imgs/point/point3.png";
  1433. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1434. let entity = new Cesium.Entity({
  1435. name: "add billboard",
  1436. position: position2,
  1437. billboard: {
  1438. image: billboard.image,
  1439. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1440. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1441. scale: billboard.scale,
  1442. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1443. }
  1444. });
  1445. if (options2.properties) {
  1446. entity.properties = options2.properties;
  1447. }
  1448. if (billboard.pixelOffset) {
  1449. billboard.pixelOffset.x = Cesium.defaultValue(billboard.pixelOffset.x, 0);
  1450. billboard.pixelOffset.y = Cesium.defaultValue(billboard.pixelOffset.y, 0);
  1451. entity.billboard.pixelOffset = new Cesium.Cartesian2(billboard.pixelOffset.x, billboard.pixelOffset.y);
  1452. }
  1453. if (billboard.scaleByDistance) {
  1454. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  1455. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  1456. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  1457. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  1458. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  1459. }
  1460. if (options2.label) {
  1461. let label2 = options2.label || {};
  1462. label2.text = Cesium.defaultValue(label2.text, "");
  1463. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1464. if (label2.fillColor instanceof Cesium.Color) {
  1465. label2.fillColor = label2.fillColor;
  1466. } else if (label2.fillColor instanceof Array) {
  1467. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1468. } else if (typeof label2.fillColor === "string") {
  1469. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1470. } else {
  1471. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1472. }
  1473. if (label2.outlineColor instanceof Cesium.Color) {
  1474. label2.outlineColor = label2.outlineColor;
  1475. } else if (label2.outlineColor instanceof Array) {
  1476. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1477. } else if (typeof label2.outlineColor === "string") {
  1478. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1479. } else {
  1480. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1481. }
  1482. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1483. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1484. if (label2.backgroundColor instanceof Cesium.Color) {
  1485. label2.backgroundColor = label2.backgroundColor;
  1486. } else if (label2.backgroundColor instanceof Array) {
  1487. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1488. } else if (typeof label2.backgroundColor === "string") {
  1489. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1490. } else {
  1491. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1492. }
  1493. if (label2.backgroundPadding) {
  1494. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1495. }
  1496. entity.label = {
  1497. text: label2.text,
  1498. font: label2.font,
  1499. fillColor: label2.fillColor,
  1500. outlineColor: label2.outlineColor,
  1501. outlineWidth: label2.outlineWidth,
  1502. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1503. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1504. showBackground: label2.showBackground,
  1505. backgroundColor: label2.backgroundColor,
  1506. backgroundPadding: label2.backgroundPadding,
  1507. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1508. };
  1509. if (label2.pixelOffset) {
  1510. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1511. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1512. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1513. }
  1514. if (label2.scaleByDistance) {
  1515. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1516. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1517. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1518. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1519. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1520. }
  1521. }
  1522. resolve2(entity);
  1523. });
  1524. },
  1525. addModel: function(points2, options2) {
  1526. this._viewer;
  1527. return new Promise((resolve2, reject2) => {
  1528. if (!Cesium.defined(points2)) {
  1529. throw new Cesium.DeveloperError("points is required.");
  1530. }
  1531. let position2;
  1532. if (points2 instanceof Cesium.Cartesian3) {
  1533. position2 = points2;
  1534. } else {
  1535. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1536. }
  1537. options2 = options2 || {};
  1538. options2.id = options2.id || setSessionid$1();
  1539. let model = options2.model || {};
  1540. model.alpha = Cesium.defaultValue(model.alpha, 1);
  1541. model.heading = Cesium.defaultValue(model.heading, 0);
  1542. model.pitch = Cesium.defaultValue(model.pitch, 0);
  1543. model.roll = Cesium.defaultValue(model.roll, 0);
  1544. var heading = Cesium.Math.toRadians(model.heading);
  1545. var pitch = model.pitch;
  1546. var roll = model.roll;
  1547. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1548. let entity = new Cesium.Entity({
  1549. position: position2,
  1550. model: {
  1551. uri: model.url,
  1552. incrementallyLoadTextures: true,
  1553. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  1554. colorBlendAmount: 0.1,
  1555. color: Cesium.Color.WHITE.withAlpha(model.alpha),
  1556. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  1557. runAnimations: true,
  1558. show: true,
  1559. debugWireframe: false,
  1560. debugShowBoundingVolume: false,
  1561. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1562. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1563. clampToGround: true
  1564. }
  1565. });
  1566. if (model.minimumPixelSize) {
  1567. entity.model.minimumPixelSize = model.minimumPixelSize;
  1568. }
  1569. if (model.maximumScale) {
  1570. entity.model.maximumScale = model.maximumScale;
  1571. }
  1572. if (options2.silhouetteColor) {
  1573. if (model.silhouetteColor instanceof Cesium.Color) {
  1574. model.silhouetteColor = model.silhouetteColor;
  1575. } else if (model.silhouetteColor instanceof Array) {
  1576. model.silhouetteColor = new Cesium.Color(model.silhouetteColor[0] / 255, model.silhouetteColor[1] / 255, model.silhouetteColor[2] / 255, model.silhouetteColor[3]);
  1577. } else if (typeof model.silhouetteColor === "string") {
  1578. model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  1579. } else {
  1580. model.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1581. }
  1582. }
  1583. model.silhouetteSize = Cesium.defaultValue(model.silhouetteSize, 1);
  1584. resolve2(entity);
  1585. });
  1586. },
  1587. generatePoint(points2, options2) {
  1588. return new Promise((resolve2, reject2) => {
  1589. let _self = this;
  1590. if (!Cesium.defined(points2)) {
  1591. throw new Cesium.DeveloperError("points is required.");
  1592. }
  1593. options2 = options2 || {};
  1594. options2.id = options2.id || setSessionid$1();
  1595. let point2 = options2.point || {};
  1596. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  1597. if (point2.color instanceof Cesium.Color) {
  1598. point2.color = point2.color;
  1599. } else if (point2.color instanceof Array) {
  1600. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  1601. } else if (typeof point2.color === "string") {
  1602. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  1603. } else {
  1604. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  1605. }
  1606. if (point2.outlineColor instanceof Cesium.Color) {
  1607. point2.outlineColor = point2.outlineColor;
  1608. } else if (point2.outlineColor instanceof Array) {
  1609. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  1610. } else if (typeof point2.outlineColor === "string") {
  1611. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  1612. } else {
  1613. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1614. }
  1615. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  1616. let terrainAltitude = getHeigthByPointsMostDetailed(_self._viewer, [points2]);
  1617. terrainAltitude.then(function(updatedPositions) {
  1618. let position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], updatedPositions[0].height);
  1619. let entity = new Cesium.Entity({
  1620. id: options2.id,
  1621. position: position2,
  1622. point: {
  1623. pixelSize: point2.pixelSize,
  1624. color: point2.color,
  1625. outlineColor: point2.outlineColor,
  1626. outlineWidth: point2.outlineWidth,
  1627. heightReference: Cesium.HeightReference.NONE,
  1628. disableDepthTestDistance: updatedPositions[0].height,
  1629. clampToGround: true
  1630. }
  1631. });
  1632. if (options2.label) {
  1633. let label2 = options2.label || {};
  1634. label2.text = Cesium.defaultValue(label2.text, "");
  1635. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1636. if (label2.fillColor instanceof Cesium.Color) {
  1637. label2.fillColor = label2.fillColor;
  1638. } else if (label2.fillColor instanceof Array) {
  1639. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1640. } else if (typeof label2.fillColor === "string") {
  1641. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1642. } else {
  1643. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1644. }
  1645. if (label2.outlineColor instanceof Cesium.Color) {
  1646. label2.outlineColor = label2.outlineColor;
  1647. } else if (label2.outlineColor instanceof Array) {
  1648. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1649. } else if (typeof label2.outlineColor === "string") {
  1650. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1651. } else {
  1652. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1653. }
  1654. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1655. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1656. if (label2.backgroundColor instanceof Cesium.Color) {
  1657. label2.backgroundColor = label2.backgroundColor;
  1658. } else if (label2.backgroundColor instanceof Array) {
  1659. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1660. } else if (typeof label2.backgroundColor === "string") {
  1661. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1662. } else {
  1663. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1664. }
  1665. label2.scale = Cesium.defaultValue(label2.scale, 1);
  1666. entity.label = {
  1667. text: label2.text,
  1668. font: label2.font,
  1669. fillColor: label2.fillColor,
  1670. outlineColor: label2.outlineColor,
  1671. outlineWidth: label2.outlineWidth,
  1672. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1673. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1674. showBackground: label2.showBackground,
  1675. backgroundColor: label2.backgroundColor,
  1676. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1677. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1678. scale: label2.scale,
  1679. clampToGround: true
  1680. };
  1681. if (label2.pixelOffset) {
  1682. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1683. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1684. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1685. }
  1686. if (label2.scaleByDistance) {
  1687. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1688. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1689. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1690. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1691. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1692. }
  1693. }
  1694. resolve2(entity);
  1695. });
  1696. });
  1697. },
  1698. addBillboardByGeoJson: function(geoJsonUrl, options2) {
  1699. return new Promise((resolve2, reject2) => {
  1700. let viewer2 = this._viewer;
  1701. if (!Cesium.defined(geoJsonUrl)) {
  1702. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  1703. }
  1704. options2 = options2 || {};
  1705. options2.id = options2.id || setSessionid$1();
  1706. let billboard = options2.billboard || {};
  1707. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  1708. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1709. let label2 = options2.label || {};
  1710. label2.text = Cesium.defaultValue(label2.text, "");
  1711. label2.textField = Cesium.defaultValue(label2.textField, "");
  1712. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1713. if (label2.fillColor instanceof Cesium.Color) {
  1714. label2.fillColor = label2.fillColor;
  1715. } else if (label2.fillColor instanceof Array) {
  1716. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1717. } else if (typeof label2.fillColor === "string") {
  1718. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1719. } else {
  1720. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1721. }
  1722. if (label2.outlineColor instanceof Cesium.Color) {
  1723. label2.outlineColor = label2.outlineColor;
  1724. } else if (label2.outlineColor instanceof Array) {
  1725. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1726. } else if (typeof label2.outlineColor === "string") {
  1727. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1728. } else {
  1729. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1730. }
  1731. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1732. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1733. if (label2.backgroundColor instanceof Cesium.Color) {
  1734. label2.backgroundColor = label2.backgroundColor;
  1735. } else if (label2.backgroundColor instanceof Array) {
  1736. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1737. } else if (typeof label2.backgroundColor === "string") {
  1738. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1739. } else {
  1740. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1741. }
  1742. label2.scale = Cesium.defaultValue(label2.scale, 1);
  1743. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  1744. dataSource.load(geoJsonUrl, {
  1745. clampToGround: true
  1746. }).then(function(data) {
  1747. viewer2.dataSources.add(data);
  1748. const entities2 = data.entities.values;
  1749. entities2.forEach((entity) => {
  1750. entity.billboard = {
  1751. image: billboard.imgUrl,
  1752. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1753. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1754. scale: billboard.scale,
  1755. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1756. };
  1757. let labelText = label2.text;
  1758. if (entity.properties[label2.textField]) {
  1759. labelText = entity.properties[label2.textField]._value;
  1760. }
  1761. if (labelText === "") {
  1762. labelText = (i + 1).toString();
  1763. }
  1764. entity.label = {
  1765. text: labelText.toString(),
  1766. font: label2.font,
  1767. fillColor: label2.fillColor,
  1768. outlineColor: label2.outlineColor,
  1769. outlineWidth: label2.outlineWidth,
  1770. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1771. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1772. showBackground: label2.showBackground,
  1773. backgroundColor: label2.backgroundColor,
  1774. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1775. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1776. scale: label2.scale
  1777. };
  1778. if (label2.scaleByDistance) {
  1779. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1780. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1781. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1782. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1783. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1784. }
  1785. });
  1786. });
  1787. });
  1788. },
  1789. addGltf: function(options2) {
  1790. let viewer2 = this._viewer;
  1791. return new Promise((resolve2, reject2) => {
  1792. if (!Cesium.defined(options2.points)) {
  1793. resolve2("options.points is required.");
  1794. throw new Cesium.DeveloperError("options.points is required.");
  1795. }
  1796. if (!Cesium.defined(options2.url)) {
  1797. resolve2("options.url is required.");
  1798. throw new Cesium.DeveloperError("options.url is required.");
  1799. }
  1800. options2.id = options2.id || setSessionid$1();
  1801. options2.heading = Cesium.defaultValue(options2.heading, 0);
  1802. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  1803. options2.roll = Cesium.defaultValue(options2.roll, 0);
  1804. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1805. let position2 = void 0;
  1806. if (options2.points instanceof Cesium.Cartesian3) {
  1807. position2 = options2.points;
  1808. } else {
  1809. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1810. }
  1811. var heading = Cesium.Math.toRadians(options2.heading);
  1812. var pitch = options2.pitch;
  1813. var roll = options2.roll;
  1814. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1815. var modelGltf = viewer2.entities.add({
  1816. id: options2.id,
  1817. position: position2,
  1818. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  1819. model: {
  1820. uri: options2.url,
  1821. incrementallyLoadTextures: true,
  1822. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  1823. colorBlendAmount: 0.1,
  1824. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  1825. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  1826. runAnimations: true,
  1827. show: true,
  1828. debugWireframe: false,
  1829. debugShowBoundingVolume: false
  1830. }
  1831. });
  1832. if (options2.minimumPixelSize) {
  1833. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  1834. }
  1835. if (options2.maximumScale) {
  1836. modelGltf.model.maximumScale = options2.maximumScale;
  1837. }
  1838. if (options2.silhouetteColor) {
  1839. if (options2.silhouetteColor instanceof Cesium.Color) {
  1840. options2.silhouetteColor = label.silhouetteColor;
  1841. } else if (options2.silhouetteColor instanceof Array) {
  1842. options2.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  1843. } else if (typeof options2.silhouetteColor === "string") {
  1844. options2.silhouetteColor = new Cesium.Color.fromCssColorString(options2.silhouetteColor);
  1845. } else {
  1846. options2.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1847. }
  1848. }
  1849. window[options2.id] = modelGltf;
  1850. resolve2(options2.id);
  1851. });
  1852. },
  1853. addModelFromGltf(points2, options2) {
  1854. let viewer2 = this._viewer;
  1855. return new Promise((resolve2, reject2) => {
  1856. if (!Cesium.defined(options2.points)) {
  1857. resolve2("options.points is required.");
  1858. throw new Cesium.DeveloperError("options.points is required.");
  1859. }
  1860. if (!Cesium.defined(options2.url)) {
  1861. resolve2("options.url is required.");
  1862. throw new Cesium.DeveloperError("options.url is required.");
  1863. }
  1864. options2.id = options2.id || setSessionid$1();
  1865. options2.scale = Cesium.defaultValue(options2.scale, 1);
  1866. let position2 = void 0;
  1867. if (options2.points instanceof Cesium.Cartesian3) {
  1868. position2 = options2.points;
  1869. } else {
  1870. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1871. }
  1872. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  1873. let model = viewer2.scene.primitives.add(
  1874. Cesium.Model.fromGltf({
  1875. show: true,
  1876. url: options2.url,
  1877. modelMatrix,
  1878. lightColor: new Cesium.Cartesian3(10, 10, 10),
  1879. debugWireframe: false,
  1880. debugShowBoundingVolume: false
  1881. })
  1882. );
  1883. model.readyPromise.then(function() {
  1884. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  1885. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  1886. });
  1887. window[options2.id] = model;
  1888. resolve2(options2.id);
  1889. });
  1890. }
  1891. });
  1892. class PolylineObject {
  1893. constructor(viewer2) {
  1894. if (!viewer2)
  1895. throw new Cesium.DeveloperError("no viewer object!");
  1896. this._viewer = viewer2;
  1897. }
  1898. }
  1899. Object.assign(PolylineObject.prototype, {
  1900. addPolyline: function(points2, options2) {
  1901. this._viewer;
  1902. return new Promise((resolve2, reject2) => {
  1903. if (!Cesium.defined(points2)) {
  1904. throw new Cesium.DeveloperError("points is required.");
  1905. }
  1906. if (points2.length < 2) {
  1907. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  1908. }
  1909. let positions;
  1910. if (points2[0] instanceof Cesium.Cartesian3) {
  1911. positions = points2;
  1912. } else {
  1913. positions = points2.map((point2) => {
  1914. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1915. });
  1916. }
  1917. options2 = options2 || {};
  1918. options2 = options2 || {};
  1919. options2.id = options2.id || setSessionid$1();
  1920. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1921. options2.width = Cesium.defaultValue(options2.width, 3);
  1922. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  1923. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  1924. let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
  1925. let material = new PolylineDirectionMaterialProperty(options2);
  1926. let entity = new Cesium.Entity({
  1927. name: "line",
  1928. polyline: {
  1929. positions,
  1930. width: options2.width,
  1931. material,
  1932. distanceDisplayCondition
  1933. }
  1934. });
  1935. if (options2.clampToGround) {
  1936. entity.polyline.clampToGround = true;
  1937. }
  1938. resolve2(entity);
  1939. });
  1940. },
  1941. drawPolylineByGeoJson: function(geoJsonUrl, options2) {
  1942. return new Promise((resolve2, reject2) => {
  1943. let viewer2 = this._viewer;
  1944. if (!Cesium.defined(geoJsonUrl)) {
  1945. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  1946. }
  1947. options2 = options2 || {};
  1948. options2.id = options2.id || setSessionid$1();
  1949. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1950. options2.width = Cesium.defaultValue(options2.width, 3);
  1951. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  1952. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  1953. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  1954. clampToGround: options2.clampToGround
  1955. });
  1956. promise.then((dataSource) => {
  1957. viewer2.dataSources.add(dataSource);
  1958. dataSource.name = options2.id;
  1959. let entities2 = dataSource.entities.values;
  1960. let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
  1961. let material = new PolylineDirectionMaterialProperty(options2);
  1962. for (var i2 = 0; i2 < entities2.length; i2++) {
  1963. var entity = entities2[i2];
  1964. entity.polyline.distanceDisplayCondition = distanceDisplayCondition;
  1965. entity.polyline.material = material;
  1966. entity.polyline.width = options2.width;
  1967. if (options2.clampToGround) {
  1968. entity.polyline.clampToGround = true;
  1969. }
  1970. }
  1971. resolve2(entities2);
  1972. });
  1973. });
  1974. },
  1975. PolylineLinkPulseMaterialProperty: function(points2, options2) {
  1976. return new Promise((resolve2, reject2) => {
  1977. if (!Cesium.defined(points2)) {
  1978. throw new Cesium.DeveloperError("points is required.");
  1979. }
  1980. if (points2.length < 2) {
  1981. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  1982. }
  1983. let positions = points2.map((point2) => {
  1984. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1985. });
  1986. options2 = options2 || {};
  1987. options2.id = options2.id || setSessionid$1();
  1988. options2.width = options2.width || 5;
  1989. let material = new PolylineDirectionMaterialProperty(options2);
  1990. let entity = this._viewer.entities.add({
  1991. id: options2.id,
  1992. name: "Pulse line",
  1993. polyline: {
  1994. positions,
  1995. width: options2.width,
  1996. material,
  1997. clampToGround: true
  1998. }
  1999. });
  2000. resolve2(entity);
  2001. });
  2002. },
  2003. PolylineArrowMaterialProperty: function(points2, options2) {
  2004. return new Promise((resolve2, reject2) => {
  2005. if (!Cesium.defined(points2)) {
  2006. throw new Cesium.DeveloperError("points is required.");
  2007. }
  2008. if (points2.length < 2) {
  2009. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2010. }
  2011. let positions = points2.map((point2) => {
  2012. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2013. });
  2014. options2 = options2 || {};
  2015. options2.id = options2.id || setSessionid$1();
  2016. options2.width = options2.width || 5;
  2017. let material = new PolylineDirectionMaterialProperty(options2);
  2018. let entity = this._viewer.entities.add({
  2019. id: options2.id,
  2020. name: "Pulse line",
  2021. polyline: {
  2022. positions,
  2023. width: options2.width,
  2024. material,
  2025. clampToGround: true
  2026. }
  2027. });
  2028. resolve2(entity);
  2029. });
  2030. },
  2031. drawGlowingLine(points2, options2) {
  2032. return new Promise((resolve2, reject2) => {
  2033. if (!Cesium.defined(points2)) {
  2034. throw new Cesium.DeveloperError("points is required.");
  2035. }
  2036. if (points2.length < 2) {
  2037. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2038. }
  2039. let positions = points2.map((point2) => {
  2040. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2041. });
  2042. options2 = options2 || {};
  2043. options2.id = options2.id || setSessionid$1();
  2044. if (options2.color) {
  2045. if (options2.color instanceof Array) {
  2046. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2047. } else if (typeof options2.color === "string") {
  2048. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2049. } else {
  2050. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2051. }
  2052. }
  2053. options2.width = options2.width || 5;
  2054. options2.glowPower = options2.glowPower || 0.25;
  2055. options2.taperPower = options2.taperPower || 1;
  2056. let entity = this._viewer.entities.add({
  2057. id: options2.id,
  2058. name: "Glowing blue line on the surface",
  2059. polyline: {
  2060. clampToGround: true,
  2061. positions,
  2062. width: options2.width,
  2063. followSurface: true,
  2064. material: new Cesium.PolylineGlowMaterialProperty({
  2065. color: options2.color,
  2066. glowPower: options2.glowPower,
  2067. taperPower: options2.taperPower
  2068. })
  2069. }
  2070. });
  2071. resolve2(entity);
  2072. });
  2073. },
  2074. drawSpecifyColorLine(points2, options2) {
  2075. return new Promise((resolve2, reject2) => {
  2076. if (!Cesium.defined(points2)) {
  2077. reject2("points is required.");
  2078. }
  2079. if (points2.length < 2) {
  2080. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2081. }
  2082. let positions = points2.map((point2) => {
  2083. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2084. });
  2085. options2 = options2 || {};
  2086. options2.id = options2.id || setSessionid$1();
  2087. if (options2.color) {
  2088. if (options2.color instanceof Array) {
  2089. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2090. } else if (typeof options2.color === "string") {
  2091. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2092. } else {
  2093. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2094. }
  2095. }
  2096. options2.width = options2.width || 5;
  2097. let entity = this._viewer.entities.add({
  2098. id: options2.id,
  2099. name: "Red line on the surface",
  2100. polyline: {
  2101. clampToGround: true,
  2102. positions,
  2103. width: options2.width,
  2104. material: options2.color
  2105. }
  2106. });
  2107. resolve2(entity);
  2108. });
  2109. },
  2110. drawSpecifyColorAndOutlineColorLine(points2, options2) {
  2111. return new Promise((resolve2, reject2) => {
  2112. if (!Cesium.defined(points2)) {
  2113. throw new Cesium.DeveloperError("points is required.");
  2114. }
  2115. if (points2.length < 2) {
  2116. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2117. }
  2118. let positions = points2.map((point2) => {
  2119. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2120. });
  2121. options2 = options2 || {};
  2122. options2.id = options2.id || setSessionid$1();
  2123. if (options2.color) {
  2124. if (options2.color instanceof Array) {
  2125. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2126. } else if (typeof options2.color === "string") {
  2127. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2128. } else {
  2129. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2130. }
  2131. }
  2132. options2.width = options2.width || 5;
  2133. if (options2.outlineColor) {
  2134. if (options2.outlineColor instanceof Array) {
  2135. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  2136. } else if (typeof options2.outlineColor === "string") {
  2137. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  2138. } else {
  2139. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  2140. }
  2141. }
  2142. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  2143. let entity = this._viewer.entities.add({
  2144. id: options2.id,
  2145. name: "Orange line with black outline at height and following the surface",
  2146. polyline: {
  2147. clampToGround: true,
  2148. positions,
  2149. width: options2.width,
  2150. material: new Cesium.PolylineOutlineMaterialProperty({
  2151. color: options2.color,
  2152. outlineWidth: options2.outlineWidth,
  2153. outlineColor: options2.outlineColor
  2154. })
  2155. }
  2156. });
  2157. resolve2(entity);
  2158. });
  2159. },
  2160. drawSpecifyColorArrowStaticStateLine(points2, options2) {
  2161. return new Promise((resolve2, reject2) => {
  2162. if (!Cesium.defined(points2)) {
  2163. throw new Cesium.DeveloperError("points is required.");
  2164. }
  2165. if (points2.length < 2) {
  2166. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2167. }
  2168. let positions = points2.map((point2) => {
  2169. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2170. });
  2171. options2 = options2 || {};
  2172. options2.id = options2.id || setSessionid$1();
  2173. if (options2.color) {
  2174. if (options2.color instanceof Array) {
  2175. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2176. } else if (typeof options2.color === "string") {
  2177. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2178. } else {
  2179. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2180. }
  2181. }
  2182. options2.width = options2.width || 5;
  2183. let entity = this._viewer.entities.add({
  2184. id: options2.id,
  2185. name: "Purple straight arrow at height",
  2186. polyline: {
  2187. clampToGround: true,
  2188. positions,
  2189. width: options2.width,
  2190. followSurface: false,
  2191. material: new Cesium.PolylineArrowMaterialProperty(options2.color)
  2192. }
  2193. });
  2194. resolve2(entity);
  2195. });
  2196. },
  2197. drawDashedLine(points2, options2) {
  2198. return new Promise((resolve2, reject2) => {
  2199. if (!Cesium.defined(points2)) {
  2200. throw new Cesium.DeveloperError("points is required.");
  2201. }
  2202. if (points2.length < 2) {
  2203. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2204. }
  2205. let positions = points2.map((point2) => {
  2206. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2207. });
  2208. options2 = options2 || {};
  2209. options2.id = options2.id || setSessionid$1();
  2210. if (options2.color) {
  2211. if (options2.color instanceof Array) {
  2212. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2213. } else if (typeof options2.color === "string") {
  2214. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2215. } else {
  2216. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2217. }
  2218. }
  2219. options2.width = options2.width || 5;
  2220. if (options2.gapColor) {
  2221. if (options2.gapColor instanceof Array) {
  2222. options2.gapColor = new Cesium.Color(options2.gapColor[0] / 255, options2.gapColor[1] / 255, options2.gapColor[2] / 255, options2.gapColor[3]);
  2223. } else if (typeof options2.gapColor === "string") {
  2224. options2.gapColor = new Cesium.Color.fromCssColorString(options2.gapColor);
  2225. } else {
  2226. options2.gapColor = new Cesium.Color.fromCssColorString("#FFFF00");
  2227. }
  2228. }
  2229. options2.dashLength = options2.dashLength || 16;
  2230. options2.dashPattern = options2.dashPattern || 255;
  2231. let entity = this._viewer.entities.add({
  2232. id: options2.id,
  2233. name: "CYAN dashed line",
  2234. polyline: {
  2235. clampToGround: true,
  2236. positions,
  2237. width: options2.width,
  2238. material: new Cesium.PolylineDashMaterialProperty({
  2239. color: options2.color,
  2240. gapColor: options2.gapColor,
  2241. dashLength: options2.dashLength,
  2242. dashPattern: options2.dashPattern
  2243. })
  2244. }
  2245. });
  2246. resolve2(entity);
  2247. });
  2248. }
  2249. });
  2250. function DynamicWallMaterialProperty(options2) {
  2251. this._definitionChanged = new Cesium.Event();
  2252. this._color = void 0;
  2253. this._colorSubscription = void 0;
  2254. this.color = options2.color || Color.BLUE;
  2255. this.duration = options2.duration || 1e3;
  2256. this.trailImage = options2.trailImage;
  2257. this._time = new Date().getTime();
  2258. }
  2259. function _getDirectionWallShader(options2) {
  2260. if (options2 && options2.get) {
  2261. var materail = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";
  2262. if (options2.direction == "vertical") {
  2263. materail += "vec4 colorImage = texture2D(image, vec2(fract(st.s), fract(float(" + options2.count + ")*st.t" + options2.order + " time)));\n ";
  2264. } else {
  2265. materail += "vec4 colorImage = texture2D(image, vec2(fract(float(" + options2.count + ")*st.s " + options2.order + " time), fract(st.t)));\n ";
  2266. }
  2267. 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 }";
  2268. return materail;
  2269. }
  2270. }
  2271. Object.defineProperties(DynamicWallMaterialProperty.prototype, {
  2272. isConstant: {
  2273. get: function() {
  2274. return false;
  2275. }
  2276. },
  2277. definitionChanged: {
  2278. get: function() {
  2279. return this._definitionChanged;
  2280. }
  2281. },
  2282. color: Cesium.createPropertyDescriptor("color")
  2283. });
  2284. var MaterialType = "wallType" + parseInt(Math.random() * 1e3);
  2285. DynamicWallMaterialProperty.prototype.getType = function(time) {
  2286. return MaterialType;
  2287. };
  2288. DynamicWallMaterialProperty.prototype.getValue = function(time, result) {
  2289. if (!Cesium.defined(result)) {
  2290. result = {};
  2291. }
  2292. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
  2293. result.image = this.trailImage;
  2294. if (this.duration) {
  2295. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  2296. }
  2297. viewer.scene.requestRender();
  2298. return result;
  2299. };
  2300. DynamicWallMaterialProperty.prototype.equals = function(other) {
  2301. return this === other || other instanceof DynamicWallMaterialProperty && Cesium.Property.equals(this._color, other._color);
  2302. };
  2303. Cesium.Material._materialCache.addMaterial(MaterialType, {
  2304. fabric: {
  2305. type: MaterialType,
  2306. uniforms: {
  2307. color: new Cesium.Color(1, 0, 0, 0.5),
  2308. image: Cesium.Material.DefaultImageId,
  2309. time: -20
  2310. },
  2311. source: _getDirectionWallShader({
  2312. get: true,
  2313. count: 3,
  2314. direction: "vertical",
  2315. order: "-"
  2316. })
  2317. },
  2318. translucent: function(material) {
  2319. return true;
  2320. }
  2321. });
  2322. Cesium.DynamicWallMaterialProperty = DynamicWallMaterialProperty;
  2323. class WallDiffuseMaterialProperty {
  2324. constructor(options2) {
  2325. this._definitionChanged = new Cesium.Event();
  2326. this._color = void 0;
  2327. this.color = options2.color;
  2328. }
  2329. get isConstant() {
  2330. return false;
  2331. }
  2332. get definitionChanged() {
  2333. return this._definitionChanged;
  2334. }
  2335. getType(time) {
  2336. return Cesium.Material.WallDiffuseMaterialType;
  2337. }
  2338. getValue(time, result) {
  2339. if (!Cesium.defined(result)) {
  2340. result = {};
  2341. }
  2342. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  2343. return result;
  2344. }
  2345. equals(other) {
  2346. return this === other || other instanceof WallDiffuseMaterialProperty && Cesium.Property.equals(this._color, other._color);
  2347. }
  2348. }
  2349. Object.defineProperties(WallDiffuseMaterialProperty.prototype, {
  2350. color: Cesium.createPropertyDescriptor("color")
  2351. });
  2352. Cesium.WallDiffuseMaterialProperty = WallDiffuseMaterialProperty;
  2353. Cesium.Material.WallDiffuseMaterialProperty = "WallDiffuseMaterialProperty";
  2354. Cesium.Material.WallDiffuseMaterialType = "WallDiffuseMaterialType";
  2355. Cesium.Material.WallDiffuseMaterialSource = `
  2356. uniform vec4 color;
  2357. czm_material czm_getMaterial(czm_materialInput materialInput){
  2358. czm_material material = czm_getDefaultMaterial(materialInput);
  2359. vec2 st = materialInput.st;
  2360. material.diffuse = color.rgb * 2.0;
  2361. material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;
  2362. return material;
  2363. }
  2364. `;
  2365. Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseMaterialType, {
  2366. fabric: {
  2367. type: Cesium.Material.WallDiffuseMaterialType,
  2368. uniforms: {
  2369. color: new Cesium.Color(1, 0, 0, 1)
  2370. },
  2371. source: Cesium.Material.WallDiffuseMaterialSource
  2372. },
  2373. translucent: function(material) {
  2374. return true;
  2375. }
  2376. });
  2377. class WallObject {
  2378. constructor(viewer2) {
  2379. if (!viewer2)
  2380. throw new Cesium.DeveloperError("no viewer object!");
  2381. this._viewer = viewer2;
  2382. }
  2383. }
  2384. Object.assign(WallObject.prototype, {
  2385. drawWallByGeoJson: function(geoJsonUrl, options2) {
  2386. return new Promise((resolve2, reject2) => {
  2387. let _self = this;
  2388. let viewer2 = this._viewer;
  2389. if (!Cesium.defined(geoJsonUrl)) {
  2390. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  2391. }
  2392. options2 = options2 || {};
  2393. options2.id = options2.id || setSessionid$1();
  2394. fetch(geoJsonUrl).then((res) => {
  2395. return res.json();
  2396. }).then((res) => {
  2397. let wall = new Cesium.CustomDataSource(options2.id);
  2398. viewer2.dataSources.add(wall);
  2399. for (var i2 = 0; i2 < res.features.length; i2++) {
  2400. if (res.features[i2].geometry) {
  2401. if (res.features[i2].geometry.type === "MultiLineString") {
  2402. let coordinatesList = res.features[i2].geometry.coordinates;
  2403. for (var j = 0; j < coordinatesList.length; j++) {
  2404. let coordinates = coordinatesList[j];
  2405. let positions = coordinates.map((point2) => {
  2406. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2407. });
  2408. _self.addWall(positions, options2).then((entity) => {
  2409. wall.entities.add(entity);
  2410. });
  2411. }
  2412. } else {
  2413. let coordinates = res.features[i2].geometry.coordinates;
  2414. let positions = coordinates.map((point2) => {
  2415. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2416. });
  2417. _self.addWall(positions, options2).then((entity) => {
  2418. wall.entities.add(entity);
  2419. });
  2420. }
  2421. }
  2422. }
  2423. resolve2(options2.id);
  2424. });
  2425. });
  2426. },
  2427. addWall(points2, options2) {
  2428. return new Promise((resolve2, reject2) => {
  2429. if (!Cesium.defined(points2)) {
  2430. throw new Cesium.DeveloperError("points is required.");
  2431. }
  2432. if (points2.length < 2) {
  2433. reject2("\u5899\u4F53\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2434. }
  2435. let positions;
  2436. if (points2[0] instanceof Cesium.Cartesian3) {
  2437. positions = points2;
  2438. } else {
  2439. positions = points2.map((point2) => {
  2440. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2441. });
  2442. }
  2443. options2 = options2 || {};
  2444. options2.id = options2.id || setSessionid$1();
  2445. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  2446. options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
  2447. options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
  2448. if (options2.color) {
  2449. if (options2.color instanceof Cesium.Color) {
  2450. options2.color = options2.color;
  2451. } else if (options2.color instanceof Array) {
  2452. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2453. } else if (typeof options2.color === "string") {
  2454. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2455. } else {
  2456. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2457. }
  2458. }
  2459. options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  2460. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  2461. options2.count = Cesium.defaultValue(options2.count, 1);
  2462. options2.direction = Cesium.defaultValue(options2.direction, "vertical");
  2463. options2.order = Cesium.defaultValue(options2.order, "-");
  2464. let entity = new Cesium.Entity({
  2465. name: "\u7ACB\u4F53\u5899\u6548\u679C",
  2466. wall: {
  2467. positions,
  2468. maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
  2469. minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
  2470. material: new WallMaterialProperty$1(viewer, {
  2471. trailImage: options2.trailImage,
  2472. color: options2.color,
  2473. duration: options2.duration,
  2474. param: {
  2475. count: options2.count,
  2476. direction: options2.direction,
  2477. order: options2.order
  2478. }
  2479. })
  2480. }
  2481. });
  2482. resolve2(entity);
  2483. });
  2484. }
  2485. });
  2486. class LoadMapData {
  2487. constructor(viewer2) {
  2488. if (!viewer2)
  2489. throw new Cesium.DeveloperError("no viewer object!");
  2490. this._viewer = viewer2;
  2491. this._pointObject = new PointObject(viewer2);
  2492. this._polylineObject = new PolylineObject(viewer2);
  2493. this._wallObject = new WallObject(viewer2);
  2494. }
  2495. _addImageryProvider(id, provider) {
  2496. window[id] = this._viewer.imageryLayers.addImageryProvider(provider);
  2497. }
  2498. _removeImageryProvider(serviceId) {
  2499. this._viewer.imageryLayers.remove(window[serviceId]);
  2500. window[serviceId] = null;
  2501. }
  2502. _addTerrainProvider(provider) {
  2503. this._viewer.terrainProvider = provider;
  2504. }
  2505. _setEllipsoidTerrain() {
  2506. this._viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
  2507. }
  2508. _addScenePrimitives(scenePrimitives) {
  2509. this._viewer.scene.primitives.add(scenePrimitives);
  2510. }
  2511. _removeScenePrimitives(serviceId) {
  2512. this._viewer.scene.primitives.remove(window[serviceId]);
  2513. window[serviceId] = null;
  2514. }
  2515. _guid() {
  2516. function S4() {
  2517. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  2518. }
  2519. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  2520. }
  2521. _transformProjection(provider) {
  2522. let webMercatorTilingScheme = provider.tilingScheme;
  2523. let projection = webMercatorTilingScheme._projection;
  2524. projection.x_project = projection.project;
  2525. projection.project = function(cartographic) {
  2526. let point2;
  2527. return point2 = CoordTransform.WGS84ToGCJ02(
  2528. Cesium.Math.toDegrees(cartographic.longitude),
  2529. Cesium.Math.toDegrees(cartographic.latitude)
  2530. ), projection.x_project(
  2531. new Cesium.Cartographic(
  2532. Cesium.Math.toRadians(point2[0]),
  2533. Cesium.Math.toRadians(point2[1])
  2534. )
  2535. );
  2536. };
  2537. projection.x_unproject = projection.unproject;
  2538. projection.unproject = function(cartesian) {
  2539. let point2, cartographic = projection.x_unproject(cartesian);
  2540. return point2 = CoordTransform.GCJ02ToWGS84(
  2541. Cesium.Math.toDegrees(cartographic.longitude),
  2542. Cesium.Math.toDegrees(cartographic.latitude)
  2543. ), new Cesium.Cartographic(
  2544. Cesium.Math.toRadians(point2[0]),
  2545. Cesium.Math.toRadians(point2[1])
  2546. );
  2547. };
  2548. return provider;
  2549. }
  2550. }
  2551. Object.assign(LoadMapData.prototype, {
  2552. addTerrain(options2) {
  2553. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2554. throw new Cesium.DeveloperError("options.url is required.");
  2555. }
  2556. let _ConstructorOptions = {
  2557. url: options2.url
  2558. };
  2559. if (options2.requestVertexNormals) {
  2560. _ConstructorOptions.requestVertexNormals = options2.requestVertexNormals;
  2561. } else {
  2562. _ConstructorOptions.requestVertexNormals = false;
  2563. }
  2564. if (options2.requestWaterMask) {
  2565. _ConstructorOptions.requestWaterMask = options2.requestWaterMask;
  2566. } else {
  2567. _ConstructorOptions.requestWaterMask = false;
  2568. }
  2569. var terrainProvider = new Cesium.CesiumTerrainProvider(_ConstructorOptions);
  2570. this._addTerrainProvider(terrainProvider);
  2571. this.setTerrainExaggeration(options2);
  2572. },
  2573. addMapboxLayer(options2, callSuccess) {
  2574. if (!Cesium.defined(options2) || !Cesium.defined(options2.styleId)) {
  2575. throw new Cesium.DeveloperError("options.styleId is required.");
  2576. }
  2577. if (!Cesium.defined(options2.accessToken)) {
  2578. throw new Cesium.DeveloperError("options.accessToken is required.");
  2579. }
  2580. options2.id = options2.id || this._guid();
  2581. var imageryProvider = new Cesium.MapboxStyleImageryProvider({
  2582. url: options2.url,
  2583. username: options2.username,
  2584. styleId: options2.styleId,
  2585. accessToken: options2.accessToken,
  2586. scaleFactor: options2.scaleFactor
  2587. });
  2588. this._addImageryProvider(options2.id, imageryProvider);
  2589. this.setLayersStyle({
  2590. serviceId: options2.id,
  2591. alpha: options2.alpha
  2592. });
  2593. if (callSuccess)
  2594. callSuccess(options2.id);
  2595. },
  2596. addUrlTemplateImagery: function(options2, callSuccess) {
  2597. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2598. throw new Cesium.DeveloperError("options.url is required.");
  2599. }
  2600. options2.id = options2.id || this._guid();
  2601. options2.CRS = options2.CRS || "";
  2602. let _ConstructorOptions = {
  2603. url: options2.url
  2604. };
  2605. if (options2.minimumLevel) {
  2606. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2607. }
  2608. if (options2.maximumLevel) {
  2609. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2610. } else {
  2611. _ConstructorOptions.maximumLevel = 18;
  2612. }
  2613. var imageryProvider = new Cesium.UrlTemplateImageryProvider(_ConstructorOptions);
  2614. if (options2.CRS.toUpperCase() === "WGS84") {
  2615. imageryProvider.readyPromise.then(() => {
  2616. this._transformProjection(imageryProvider);
  2617. });
  2618. }
  2619. this._addImageryProvider(options2.id, imageryProvider);
  2620. this.setLayersStyle({
  2621. serviceId: options2.id,
  2622. alpha: options2.alpha
  2623. });
  2624. if (callSuccess)
  2625. callSuccess(options2.id);
  2626. },
  2627. addTileMapServiceImagery: function(options2, callSuccess) {
  2628. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2629. throw new Cesium.DeveloperError("options.url is required.");
  2630. }
  2631. options2.id = options2.id || this._guid();
  2632. let _ConstructorOptions = {
  2633. url: options2.url
  2634. };
  2635. if (options2.minimumLevel) {
  2636. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2637. }
  2638. if (options2.maximumLevel) {
  2639. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2640. } else {
  2641. _ConstructorOptions.maximumLevel = 18;
  2642. }
  2643. var imageryProvider = new Cesium.TileMapServiceImageryProvider(_ConstructorOptions);
  2644. this._addImageryProvider(options2.id, imageryProvider);
  2645. this.setLayersStyle({
  2646. serviceId: options2.id,
  2647. alpha: options2.alpha
  2648. });
  2649. if (callSuccess)
  2650. callSuccess(options2.id);
  2651. },
  2652. addWebMapTileService: function(options2, callSuccess) {
  2653. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2654. throw new Cesium.DeveloperError("options.url is required.");
  2655. }
  2656. if (!Cesium.defined(options2.layers)) {
  2657. throw new Cesium.DeveloperError("options.layers is required.");
  2658. }
  2659. if (!Cesium.defined(options2.style)) {
  2660. throw new Cesium.DeveloperError("options.style is required.");
  2661. }
  2662. if (!Cesium.defined(options2.tileMatrixSetID)) {
  2663. throw new Cesium.DeveloperError("options.tileMatrixSetID is required.");
  2664. }
  2665. options2.id = options2.id || this._guid();
  2666. let _ConstructorOptions = {
  2667. url: options2.url,
  2668. layer: options2.layers,
  2669. style: options2.style,
  2670. tileMatrixSetID: options2.tileMatrixSetID,
  2671. format: Cesium.defaultValue(options2.format, "image/png")
  2672. };
  2673. if (options2.tileMatrixLabels) {
  2674. _ConstructorOptions.tileMatrixLabels = options2.tileMatrixLabels;
  2675. }
  2676. if (options2.minimumLevel) {
  2677. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2678. }
  2679. if (options2.maximumLevel) {
  2680. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2681. } else {
  2682. _ConstructorOptions.maximumLevel = 18;
  2683. }
  2684. let imageryProvider = new Cesium.WebMapTileServiceImageryProvider(_ConstructorOptions);
  2685. this._addImageryProvider(options2.id, imageryProvider);
  2686. this.setLayersStyle({
  2687. serviceId: options2.id,
  2688. alpha: options2.alpha
  2689. });
  2690. if (callSuccess)
  2691. callSuccess(options2.id);
  2692. },
  2693. addWebMapService: function(options2, callSuccess) {
  2694. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2695. throw new Cesium.DeveloperError("options.url is required.");
  2696. }
  2697. if (!Cesium.defined(options2.layers)) {
  2698. throw new Cesium.DeveloperError("options.layers is required.");
  2699. }
  2700. options2.id = options2.id || this._guid();
  2701. let _ConstructorOptions = {
  2702. url: options2.url,
  2703. layers: options2.layers
  2704. };
  2705. if (options2.parameters) {
  2706. _ConstructorOptions.parameters = options2.parameters;
  2707. }
  2708. if (options2.minimumLevel) {
  2709. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2710. }
  2711. if (options2.maximumLevel) {
  2712. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2713. } else {
  2714. _ConstructorOptions.maximumLevel = 18;
  2715. }
  2716. let imageryProvider = new Cesium.WebMapServiceImageryProvider(_ConstructorOptions);
  2717. this._addImageryProvider(options2.id, imageryProvider);
  2718. this.setLayersStyle({
  2719. serviceId: options2.id,
  2720. alpha: options2.alpha
  2721. });
  2722. if (callSuccess)
  2723. callSuccess(options2.id);
  2724. },
  2725. addArcGisMapServer: function(options2, callSuccess) {
  2726. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2727. throw new Cesium.DeveloperError("options.url is required.");
  2728. }
  2729. options2.id = options2.id || this._guid();
  2730. let _ConstructorOptions = {
  2731. url: options2.url
  2732. };
  2733. if (options2.layers) {
  2734. _ConstructorOptions.layers = options2.layers;
  2735. }
  2736. let imageryProvider = new Cesium.ArcGisMapServerImageryProvider(_ConstructorOptions);
  2737. this._addImageryProvider(options2.id, imageryProvider);
  2738. this.setLayersStyle({
  2739. serviceId: options2.id,
  2740. alpha: options2.alpha
  2741. });
  2742. if (callSuccess)
  2743. callSuccess(options2.id);
  2744. },
  2745. addCesium3DTileset: function(options2, callSuccess) {
  2746. let _self = this;
  2747. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2748. throw new Cesium.DeveloperError("options.url is required.");
  2749. }
  2750. options2.id = options2.id || this._guid();
  2751. let _ConstructorOptions = {
  2752. url: options2.url,
  2753. skipLevelOfDetail: true
  2754. };
  2755. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  2756. tileSetModel.readyPromise.then((tileset) => {
  2757. console.log("\u52A0\u8F7D\u5B8C\u6210");
  2758. window[options2.id] = tileset;
  2759. _self._addScenePrimitives(tileset);
  2760. _self.set3DTilePosition({
  2761. serviceId: options2.id,
  2762. height: options2.height
  2763. });
  2764. _self.set3DTileStyle({
  2765. serviceId: options2.id,
  2766. alpha: options2.alpha
  2767. });
  2768. if (callSuccess)
  2769. callSuccess(options2.id);
  2770. }).catch(function(error) {
  2771. console.log(error);
  2772. });
  2773. },
  2774. addCesium3DTilesetBm: function(options2, callSuccess) {
  2775. let _self = this;
  2776. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2777. throw new Cesium.DeveloperError("options.url is required.");
  2778. }
  2779. options2.id = options2.id || this._guid();
  2780. let _ConstructorOptions = {
  2781. url: options2.url,
  2782. skipLevelOfDetail: true
  2783. };
  2784. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  2785. tileSetModel.readyPromise.then((tileset) => {
  2786. console.log("\u52A0\u8F7D\u5B8C\u6210");
  2787. window[options2.id] = tileset;
  2788. _self._addScenePrimitives(tileset);
  2789. _self.set3DTileBMStyle({
  2790. serviceId: options2.id,
  2791. color: options2.color
  2792. });
  2793. if (callSuccess)
  2794. callSuccess(options2.id);
  2795. }).catch(function(error) {
  2796. console.log(error);
  2797. });
  2798. },
  2799. addPolygonImageMaterial: function(options2, callSuccess) {
  2800. if (!Cesium.defined(options2.points)) {
  2801. throw new Cesium.DeveloperError("options.points is required.");
  2802. }
  2803. if (options2.points.length < 3) {
  2804. reject("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  2805. }
  2806. let positions = [];
  2807. if (options2.points instanceof Cesium.Cartesian3) {
  2808. positions = options2.points;
  2809. } else {
  2810. positions = options2.points.map((point2) => {
  2811. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2812. });
  2813. }
  2814. options2.id = options2.id || this._guid();
  2815. options2.alpha = options2.alpha || 1;
  2816. this.classificationType = Cesium.ClassificationType.BOTH;
  2817. if (options2.classificationType === "Terrain") {
  2818. this.classificationType = Cesium.ClassificationType.TERRAIN;
  2819. } else if (options2.classificationType === "3DTiles") {
  2820. this.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
  2821. }
  2822. if (options2.url) {
  2823. if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(this._viewer.scene)) {
  2824. window.alert("Terrain Entity materials are not supported on this platform");
  2825. }
  2826. this.material = new Cesium.ImageMaterialProperty({
  2827. image: options2.url,
  2828. repeat: Cesium.Cartesian2(1, 1),
  2829. transparent: true,
  2830. color: Cesium.Color.WHITE.withAlpha(options2.alpha)
  2831. });
  2832. } else {
  2833. this.material = Cesium.Color.RED.withAlpha(options2.alpha);
  2834. }
  2835. window[options2.id] = this._viewer.entities.add({
  2836. id: options2.id,
  2837. polygon: {
  2838. hierarchy: positions,
  2839. material: this.material,
  2840. classificationType: this.classificationType
  2841. }
  2842. });
  2843. if (callSuccess)
  2844. callSuccess(options2.id);
  2845. },
  2846. addEntitiesGltf: function(options2, callSuccess) {
  2847. let viewer2 = this._viewer;
  2848. if (!Cesium.defined(options2.points)) {
  2849. resolve("options.points is required.");
  2850. throw new Cesium.DeveloperError("options.points is required.");
  2851. }
  2852. if (!Cesium.defined(options2.url)) {
  2853. resolve("options.url is required.");
  2854. throw new Cesium.DeveloperError("options.url is required.");
  2855. }
  2856. options2.id = options2.id || this._guid();
  2857. options2.heading = Cesium.defaultValue(options2.heading, 0);
  2858. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  2859. options2.roll = Cesium.defaultValue(options2.roll, 0);
  2860. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  2861. let position2 = void 0;
  2862. if (options2.points instanceof Cesium.Cartesian3) {
  2863. position2 = options2.points;
  2864. } else {
  2865. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  2866. }
  2867. var heading = Cesium.Math.toRadians(options2.heading);
  2868. var pitch = options2.pitch;
  2869. var roll = options2.roll;
  2870. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  2871. var modelGltf = viewer2.entities.add({
  2872. id: options2.id,
  2873. position: position2,
  2874. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  2875. model: {
  2876. uri: options2.url,
  2877. incrementallyLoadTextures: true,
  2878. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  2879. colorBlendAmount: 0.1,
  2880. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  2881. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  2882. runAnimations: true,
  2883. show: true,
  2884. debugWireframe: false,
  2885. debugShowBoundingVolume: false
  2886. }
  2887. });
  2888. if (options2.minimumPixelSize) {
  2889. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  2890. }
  2891. if (options2.maximumScale) {
  2892. modelGltf.model.maximumScale = options2.maximumScale;
  2893. }
  2894. if (options2.silhouetteColor) {
  2895. modelGltf.model.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  2896. }
  2897. window[options2.id] = modelGltf;
  2898. if (callSuccess)
  2899. callSuccess(options2.id);
  2900. },
  2901. addScenePrimitivesGltf(options2, callSuccess) {
  2902. let viewer2 = this._viewer;
  2903. if (!Cesium.defined(options2.points)) {
  2904. resolve("options.points is required.");
  2905. throw new Cesium.DeveloperError("options.points is required.");
  2906. }
  2907. if (!Cesium.defined(options2.url)) {
  2908. resolve("options.url is required.");
  2909. throw new Cesium.DeveloperError("options.url is required.");
  2910. }
  2911. options2.id = options2.id || this._guid();
  2912. options2.scale = Cesium.defaultValue(options2.scale, 1);
  2913. let position2 = void 0;
  2914. if (options2.points instanceof Cesium.Cartesian3) {
  2915. position2 = options2.points;
  2916. } else {
  2917. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  2918. }
  2919. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  2920. let model = viewer2.scene.primitives.add(
  2921. Cesium.Model.fromGltf({
  2922. show: true,
  2923. url: options2.url,
  2924. modelMatrix,
  2925. lightColor: new Cesium.Cartesian3(10, 10, 10),
  2926. scale: options2.scale,
  2927. debugWireframe: false,
  2928. debugShowBoundingVolume: false
  2929. })
  2930. );
  2931. model.readyPromise.then(function() {
  2932. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  2933. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  2934. });
  2935. window[options2.id] = model;
  2936. if (callSuccess)
  2937. callSuccess(options2.id);
  2938. },
  2939. addPolylineByGeoJson(options2, callSuccess) {
  2940. let _self = this;
  2941. this._viewer;
  2942. if (!Cesium.defined(options2.url)) {
  2943. resolve("options.url is required.");
  2944. throw new Cesium.DeveloperError("options.url is required.");
  2945. }
  2946. options2 = options2 || {};
  2947. options2.id = options2.id || this._guid();
  2948. let promise = Cesium.GeoJsonDataSource.load(options2.url, {
  2949. clampToGround: options2.clampToGround
  2950. });
  2951. promise.then((dataSource) => {
  2952. _self._viewer.dataSources.add(dataSource);
  2953. dataSource.name = options2.id;
  2954. let entities2 = dataSource.entities.values;
  2955. let material = new PolylineDirectionMaterialProperty(options2);
  2956. for (var i2 = 0; i2 < entities2.length; i2++) {
  2957. var entity = entities2[i2];
  2958. entity.polyline.material = material;
  2959. entity.polyline.width = options2.width;
  2960. if (options2.clampToGround) {
  2961. entity.polyline.clampToGround = true;
  2962. }
  2963. }
  2964. if (callSuccess)
  2965. callSuccess(options2.id);
  2966. });
  2967. },
  2968. addPolylineByJson(options2, callSuccess) {
  2969. let _self = this;
  2970. let viewer2 = this._viewer;
  2971. if (!Cesium.defined(options2.url)) {
  2972. resolve("options.url is required.");
  2973. throw new Cesium.DeveloperError("options.url is required.");
  2974. }
  2975. options2 = options2 || {};
  2976. options2.id = options2.id || this._guid();
  2977. fetch(options2.url).then((res) => {
  2978. return res.json();
  2979. }).then((res) => {
  2980. let dataSource = new Cesium.CustomDataSource(options2.id);
  2981. viewer2.dataSources.add(dataSource);
  2982. for (var i2 = 0; i2 < res.features.length; i2++) {
  2983. if (res.features[i2].geometry) {
  2984. if (res.features[i2].geometry.type === "MultiLineString") {
  2985. let coordinatesList = res.features[i2].geometry.coordinates;
  2986. for (var j = 0; j < coordinatesList.length; j++) {
  2987. let coordinates = coordinatesList[j];
  2988. let positions = coordinates.map((point2) => {
  2989. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2990. });
  2991. _self._polylineObject.addPolyline(positions, options2).then((entity) => {
  2992. dataSource.entities.add(entity);
  2993. });
  2994. }
  2995. } else {
  2996. let coordinates = res.features[i2].geometry.coordinates;
  2997. let positions = coordinates.map((point2) => {
  2998. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2999. });
  3000. _self._polylineObject.addPolyline(positions, options2).then((entity) => {
  3001. dataSource.entities.add(entity);
  3002. });
  3003. }
  3004. }
  3005. }
  3006. if (callSuccess)
  3007. callSuccess(options2.id);
  3008. });
  3009. },
  3010. addBillboardByGeoJson(options2, callSuccess) {
  3011. let viewer2 = this._viewer;
  3012. if (!Cesium.defined(options2.url)) {
  3013. resolve("options.url is required.");
  3014. throw new Cesium.DeveloperError("options.url is required.");
  3015. }
  3016. options2 = options2 || {};
  3017. options2.id = options2.id || this._guid();
  3018. let billboard = options2.billboard || {};
  3019. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  3020. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  3021. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  3022. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  3023. dataSource.load(options2.url, {
  3024. clampToGround: true
  3025. }).then(function(data) {
  3026. viewer2.dataSources.add(data);
  3027. const entities2 = data.entities.values;
  3028. entities2.forEach((entity) => {
  3029. entity.billboard = {
  3030. image: billboard.imgUrl,
  3031. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  3032. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  3033. scale: billboard.scale,
  3034. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  3035. disableDepthTestDistance: Number.POSITIVE_INFINITY
  3036. };
  3037. if (billboard.scaleByDistance) {
  3038. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  3039. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  3040. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  3041. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  3042. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  3043. }
  3044. if (options2.label) {
  3045. let label2 = options2.label || {};
  3046. label2.text = Cesium.defaultValue(label2.text, "");
  3047. label2.textField = Cesium.defaultValue(label2.textField, "");
  3048. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  3049. if (label2.fillColor instanceof Array) {
  3050. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  3051. } else if (typeof options2.color === "string") {
  3052. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  3053. } else {
  3054. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  3055. }
  3056. if (label2.outlineColor instanceof Array) {
  3057. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  3058. } else if (label2.outlineColor instanceof String) {
  3059. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  3060. } else {
  3061. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  3062. }
  3063. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  3064. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  3065. if (label2.backgroundColor instanceof Array) {
  3066. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  3067. } else if (label2.backgroundColor instanceof String) {
  3068. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  3069. } else {
  3070. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  3071. }
  3072. label2.pixelOffset = Cesium.defaultValue(label2.pixelOffset, 0);
  3073. label2.scale = Cesium.defaultValue(label2.scale, 1);
  3074. label2.near = Cesium.defaultValue(label2.near, 150);
  3075. label2.nearValue = Cesium.defaultValue(label2.nearValue, 1);
  3076. label2.far = Cesium.defaultValue(label2.far, 2400);
  3077. label2.farValue = Cesium.defaultValue(label2.farValue, 0);
  3078. let labelText = label2.text;
  3079. if (entity.properties[label2.textField]) {
  3080. labelText = entity.properties[label2.textField]._value;
  3081. }
  3082. if (labelText === "") {
  3083. labelText = (i + 1).toString();
  3084. }
  3085. entity.label = {
  3086. text: labelText.toString(),
  3087. font: label2.font,
  3088. fillColor: label2.fillColor,
  3089. outlineColor: label2.outlineColor,
  3090. outlineWidth: label2.outlineWidth,
  3091. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  3092. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  3093. showBackground: label2.showBackground,
  3094. backgroundColor: label2.backgroundColor,
  3095. backgroundPadding: new Cesium.Cartesian2(6, 6),
  3096. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  3097. pixelOffset: new Cesium.Cartesian2(0, label2.pixelOffset),
  3098. scale: label2.scale
  3099. };
  3100. if (label2.scaleByDistance) {
  3101. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  3102. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  3103. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  3104. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  3105. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  3106. }
  3107. }
  3108. });
  3109. if (callSuccess)
  3110. callSuccess(options2.id);
  3111. });
  3112. },
  3113. addBillboardByJson(options2, callSuccess) {
  3114. let _self = this;
  3115. let viewer2 = this._viewer;
  3116. if (!Cesium.defined(options2.url)) {
  3117. resolve("options.url is required.");
  3118. throw new Cesium.DeveloperError("options.url is required.");
  3119. }
  3120. options2 = options2 || {};
  3121. let id = options2.id || this._guid();
  3122. viewer2.terrainProvider;
  3123. fetch(options2.url).then((res) => {
  3124. return res.json();
  3125. }).then((res) => {
  3126. let dataSource = new Cesium.CustomDataSource(options2.id);
  3127. viewer2.dataSources.add(dataSource);
  3128. let promiseList = [];
  3129. for (var i2 = 0; i2 < res.features.length; i2++) {
  3130. let geometry2 = res.features[i2].geometry;
  3131. let properties = res.features[i2].properties;
  3132. if (geometry2) {
  3133. if (properties) {
  3134. options2.properties = properties;
  3135. if (options2.label) {
  3136. let label2 = options2.label || {};
  3137. if (properties[label2.textField]) {
  3138. options2.label.text = properties[label2.textField];
  3139. }
  3140. }
  3141. }
  3142. if (geometry2.type === "MultiPoint") {
  3143. let coordinatesList = geometry2.coordinates;
  3144. for (var j = 0; j < coordinatesList.length; j++) {
  3145. let coordinates = coordinatesList[j];
  3146. let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  3147. _self._pointObject.addBillboard(position2, options2).then((entity) => {
  3148. dataSource.entities.add(entity);
  3149. });
  3150. }
  3151. } else {
  3152. let coordinates = geometry2.coordinates;
  3153. let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  3154. let result = _self._pointObject.addBillboard(position2, options2);
  3155. promiseList.push(result);
  3156. }
  3157. }
  3158. }
  3159. Promise.all(promiseList).then((itemList) => {
  3160. console.log("itemList", itemList);
  3161. itemList.forEach((item, index2) => {
  3162. dataSource.entities.add(item);
  3163. });
  3164. if (callSuccess)
  3165. callSuccess(id);
  3166. });
  3167. });
  3168. },
  3169. addWallByJson(options2, callSuccess) {
  3170. let _self = this;
  3171. let viewer2 = this._viewer;
  3172. if (!Cesium.defined(options2.url)) {
  3173. resolve("options.url is required.");
  3174. throw new Cesium.DeveloperError("options.url is required.");
  3175. }
  3176. options2 = options2 || {};
  3177. options2.id = options2.id || setSessionid();
  3178. fetch(options2.url).then((res) => {
  3179. return res.json();
  3180. }).then((res) => {
  3181. let dataSource = new Cesium.CustomDataSource(options2.id);
  3182. viewer2.dataSources.add(dataSource);
  3183. for (var i2 = 0; i2 < res.features.length; i2++) {
  3184. if (res.features[i2].geometry) {
  3185. if (res.features[i2].geometry.type === "MultiLineString") {
  3186. let coordinatesList = res.features[i2].geometry.coordinates;
  3187. for (var j = 0; j < coordinatesList.length; j++) {
  3188. let coordinates = coordinatesList[j];
  3189. let positions = coordinates.map((point2) => {
  3190. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3191. });
  3192. _self._wallObject.addWall(positions, options2).then((entity) => {
  3193. dataSource.entities.add(entity);
  3194. });
  3195. }
  3196. } else {
  3197. let coordinates = res.features[i2].geometry.coordinates;
  3198. let positions = coordinates.map((point2) => {
  3199. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3200. });
  3201. _self._wallObject.addWall(positions, options2).then((entity) => {
  3202. dataSource.entities.add(entity);
  3203. });
  3204. }
  3205. }
  3206. }
  3207. if (callSuccess)
  3208. callSuccess(options2.id);
  3209. });
  3210. }
  3211. });
  3212. Object.assign(LoadMapData.prototype, {
  3213. set3DTileStyle(options2) {
  3214. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3215. throw new Cesium.DeveloperError("options.serviceId is required.");
  3216. }
  3217. if (Cesium.defined(options2.alpha)) {
  3218. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3219. }
  3220. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3221. let tileset = window[options2.serviceId];
  3222. tileset.style = new Cesium.Cesium3DTileStyle({
  3223. color: "color('rgba(255,255,255," + options2.alpha + ")')"
  3224. });
  3225. },
  3226. set3DTileBMStyle: function(options2) {
  3227. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3228. throw new Cesium.DeveloperError("options.serviceId is required.");
  3229. }
  3230. 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)";
  3231. let tileset = window[options2.serviceId];
  3232. tileset.readyPromise.then((tileset2) => {
  3233. tileset2.boundingSphere.radius;
  3234. if (tileset2.boundingSphere.radius > 1e4) {
  3235. tileset2.boundingSphere.radius / 10;
  3236. }
  3237. tileset2.style = new Cesium.Cesium3DTileStyle({
  3238. color: options2.color
  3239. });
  3240. tileset2.tileVisible.addEventListener((tile) => {
  3241. let content = tile.content;
  3242. let featuresLength = content.featuresLength;
  3243. for (let i2 = 0; i2 < featuresLength; i2 += 2) {
  3244. const feature2 = content.getFeature(i2);
  3245. const model = feature2.content._model;
  3246. if (model && model._sourcePrograms && model._rendererResources) {
  3247. Object.keys(model._sourcePrograms).forEach((key) => {
  3248. const program = model._sourcePrograms[key];
  3249. const fragmentShader = model._rendererResources.sourceShaders[program.fragmentShader];
  3250. let vPosition = "";
  3251. if (fragmentShader.indexOf(" v_positionEC;") !== -1) {
  3252. vPosition = "v_positionEC";
  3253. } else if (fragmentShader.indexOf(" v_pos;") !== -1) {
  3254. vPosition = "v_pos";
  3255. }
  3256. const color2 = `vec4(${feature2.color.toString()})`;
  3257. model._rendererResources.sourceShaders[program.fragmentShader] = `
  3258. varying vec3 ${vPosition};
  3259. void main(void){
  3260. vec4 v_helsing_position = czm_inverseModelView * vec4(${vPosition},1);
  3261. float _baseHeight = -30.0;
  3262. float vtxf_height = v_helsing_position.z - _baseHeight;
  3263. float stc_pl = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;
  3264. float stc_sd = vtxf_height / 30.0 + sin(stc_pl) * 0.1;
  3265. gl_FragColor = ${color2};
  3266. gl_FragColor *= vec4(stc_sd, stc_sd, stc_sd, 1.0);
  3267. /* \u626B\u63CF\u7EBF */
  3268. float glowRange = 80.0;
  3269. float stc_a13 = fract(czm_frameNumber / 460.0);
  3270. float stc_h = clamp(v_helsing_position.z / glowRange, 0.0, 1.0);
  3271. stc_a13 = abs(stc_a13 - 0.5) * 1.0;
  3272. float stc_diff = step(0.003, abs(stc_h - stc_a13));
  3273. gl_FragColor.rgb += gl_FragColor.rgb * (1.0 - stc_diff);
  3274. }
  3275. `;
  3276. });
  3277. model._shouldRegenerateShaders = true;
  3278. }
  3279. }
  3280. });
  3281. });
  3282. this._viewer.scene.requestRender();
  3283. },
  3284. set3DTilePosition: function(options2) {
  3285. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3286. throw new Cesium.DeveloperError("options.serviceId is required.");
  3287. }
  3288. options2.height = Cesium.defaultValue(options2.height, 0);
  3289. let boundingSphere = window[options2.serviceId].boundingSphere;
  3290. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  3291. let left = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, options2.height);
  3292. let right = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0);
  3293. let translation = Cesium.Cartesian3.subtract(left, right, new Cesium.Cartesian3());
  3294. window[options2.serviceId].modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  3295. this._viewer.scene.requestRender();
  3296. },
  3297. setLayersStyle(options2) {
  3298. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3299. throw new Cesium.DeveloperError("options.serviceId is required.");
  3300. }
  3301. let layer = window[options2.serviceId];
  3302. if (Cesium.defined(options2.alpha)) {
  3303. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3304. }
  3305. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3306. layer.alpha = options2.alpha;
  3307. if (Cesium.defined(options2.brightness)) {
  3308. Cesium.Check.typeOf.number("brightness", options2.brightness);
  3309. }
  3310. options2.brightness = Cesium.defaultValue(options2.brightness, 1);
  3311. layer.brightness = options2.brightness;
  3312. if (Cesium.defined(options2.contrast)) {
  3313. Cesium.Check.typeOf.number("contrast", options2.contrast);
  3314. }
  3315. options2.contrast = Cesium.defaultValue(options2.contrast, 1);
  3316. layer.contrast = options2.contrast;
  3317. if (Cesium.defined(options2.gamma)) {
  3318. Cesium.Check.typeOf.number("gamma", options2.gamma);
  3319. }
  3320. options2.gamma = Cesium.defaultValue(options2.gamma, 1);
  3321. layer.gamma = options2.gamma;
  3322. if (Cesium.defined(options2.hue)) {
  3323. Cesium.Check.typeOf.number("hue", options2.hue);
  3324. }
  3325. options2.hue = Cesium.defaultValue(options2.hue, 0);
  3326. layer.hue = options2.hue;
  3327. if (Cesium.defined(options2.saturation)) {
  3328. Cesium.Check.typeOf.number("saturation", options2.saturation);
  3329. }
  3330. options2.saturation = Cesium.defaultValue(options2.saturation, 1);
  3331. layer.saturation = options2.saturation;
  3332. },
  3333. setPolygonImageMaterial(options2) {
  3334. if (Cesium.defined(options2.alpha)) {
  3335. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3336. }
  3337. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3338. let entity = window[options2.serviceId];
  3339. entity.polygon.material.color._value.alpha = options2.alpha;
  3340. },
  3341. setModelStyle(options2) {
  3342. if (Cesium.defined(options2.alpha)) {
  3343. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3344. }
  3345. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3346. let entity = window[options2.serviceId];
  3347. if (entity.model) {
  3348. entity.model.color._value.alpha = options2.alpha;
  3349. } else {
  3350. entity.color._value.alpha = options2.alpha;
  3351. }
  3352. },
  3353. setTerrainExaggeration(options2) {
  3354. if (Cesium.defined(options2.terrainExaggeration)) {
  3355. Cesium.Check.typeOf.number("terrainExaggeration", options2.terrainExaggeration);
  3356. }
  3357. options2.terrainExaggeration = Cesium.defaultValue(options2.terrainExaggeration, 1);
  3358. this._viewer.scene.globe.terrainExaggeration = options2.terrainExaggeration;
  3359. }
  3360. });
  3361. Object.assign(LoadMapData.prototype, {
  3362. removeImageryProvider(options2) {
  3363. return new Promise((resolve2, reject2) => {
  3364. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3365. throw new Cesium.DeveloperError("options.serviceId is required.");
  3366. }
  3367. this._removeImageryProvider(options2.serviceId);
  3368. resolve2(true);
  3369. });
  3370. },
  3371. removeTerrain() {
  3372. return new Promise((resolve2, reject2) => {
  3373. this._setEllipsoidTerrain();
  3374. resolve2(true);
  3375. });
  3376. },
  3377. removeScenePrimitives(options2) {
  3378. return new Promise((resolve2, reject2) => {
  3379. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3380. throw new Cesium.DeveloperError("options.serviceId is required.");
  3381. }
  3382. this._removeScenePrimitives(options2.serviceId);
  3383. resolve2(true);
  3384. });
  3385. },
  3386. removeEntity(options2) {
  3387. return new Promise((resolve2, reject2) => {
  3388. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3389. throw new Cesium.DeveloperError("options.serviceId is required.");
  3390. }
  3391. this._viewer.entities.remove(window[options2.serviceId]);
  3392. window[options2.serviceId] = null;
  3393. resolve2(true);
  3394. });
  3395. },
  3396. removeDataSources(options2) {
  3397. let viewer2 = this._viewer;
  3398. return new Promise((resolve2, reject2) => {
  3399. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3400. throw new Cesium.DeveloperError("options.serviceId is required.");
  3401. }
  3402. let list = viewer2.dataSources.getByName(options2.serviceId);
  3403. list.forEach((res, index2) => {
  3404. viewer2.dataSources.remove(res);
  3405. if (index2 === list.length - 1) {
  3406. resolve2(true);
  3407. }
  3408. });
  3409. });
  3410. }
  3411. });
  3412. Date.prototype.Format = function(fmt) {
  3413. var o = {
  3414. "M+": this.getMonth() + 1,
  3415. "d+": this.getDate(),
  3416. "h+": this.getHours(),
  3417. "m+": this.getMinutes(),
  3418. "s+": this.getSeconds(),
  3419. "q+": Math.floor((this.getMonth() + 3) / 3),
  3420. "S": this.getMilliseconds()
  3421. };
  3422. if (/(y+)/.test(fmt))
  3423. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  3424. for (var k in o)
  3425. if (new RegExp("(" + k + ")").test(fmt))
  3426. fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  3427. return fmt;
  3428. };
  3429. class CrImageServerLayer {
  3430. constructor({
  3431. viewer: viewer2,
  3432. url,
  3433. opacity = 0.75,
  3434. show = true
  3435. } = {}) {
  3436. this._viewer = viewer2;
  3437. this._url = url;
  3438. this._opacity = opacity;
  3439. this._renderName = this._guid();
  3440. let dataSource = new Cesium.CustomDataSource(this._renderName);
  3441. this._viewer.dataSources.add(dataSource);
  3442. this._entities = dataSource.entities;
  3443. this._renderEntities = /* @__PURE__ */ new Map();
  3444. this._isUpdateTile = show;
  3445. this._isDebug = false;
  3446. this._init();
  3447. }
  3448. _init() {
  3449. let _self = this;
  3450. this._provider = new Cesium.ArcGisMapServerImageryProvider({
  3451. url: _self._url
  3452. });
  3453. this._provider.readyPromise.then(function(result) {
  3454. _self._rectangle = _self._provider.rectangle;
  3455. if (_self._isDebug)
  3456. _self._printDebug();
  3457. _self._viewer.scene.postRender.addEventListener(() => {
  3458. if (_self._isUpdateTile) {
  3459. _self._isUpdateTile = false;
  3460. _self._renderTiles();
  3461. }
  3462. });
  3463. });
  3464. }
  3465. _guid() {
  3466. function S4() {
  3467. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  3468. }
  3469. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  3470. }
  3471. _printDebug() {
  3472. this._provider.tilingScheme;
  3473. let tiling84 = new Cesium.GeographicTilingScheme();
  3474. this._drawDebugRectangle(this._rectangle, Cesium.Color.GREEN);
  3475. tiling84.tileXYToRectangle(1696, 312, 10);
  3476. }
  3477. _drawDebugRectangle(rectangle, color2) {
  3478. let positions = this._calculateRectangleOutlineCoordinates(rectangle);
  3479. let rectEntity = new Cesium.Entity({
  3480. name: this._renderName,
  3481. polyline: {
  3482. positions,
  3483. material: color2,
  3484. width: 10,
  3485. clampToGround: true
  3486. }
  3487. });
  3488. this._entities.add(rectEntity);
  3489. }
  3490. _console(...rest) {
  3491. if (this._isDebug)
  3492. console.log("===" + new Date().Format("yyyy-MM-dd HH:mm:ss") + ">>>", rest);
  3493. }
  3494. _renderTiles() {
  3495. let _self = this;
  3496. let tilesToRender = this._viewer.scene.globe._surface._tilesToRender;
  3497. if (tilesToRender === void 0 || tilesToRender.length === 0) {
  3498. this._isUpdateTile = true;
  3499. return;
  3500. } else {
  3501. new Promise((resolve2, reject2) => {
  3502. tilesToRender.sort(function(obj1, obj2) {
  3503. let level1 = parseInt(obj1.level);
  3504. let level2 = parseInt(obj2.level);
  3505. return level1 - level2;
  3506. });
  3507. resolve2(tilesToRender);
  3508. }).then((tiles) => {
  3509. _self._asyncProjectionTiles(tiles);
  3510. });
  3511. }
  3512. }
  3513. _createKey(x, y, level) {
  3514. let key = `${this._renderName}_${x}_${y}_${level}`;
  3515. return key;
  3516. }
  3517. _asyncProjectionTiles(tiles) {
  3518. let renderTiles = [];
  3519. for (let tile of tiles) {
  3520. let proTiles = this._projectionTile(tile);
  3521. for (let proTile of proTiles) {
  3522. let key = this._createKey(proTile.x, proTile.y, proTile.level);
  3523. let subTile = renderTiles.find((obj) => {
  3524. return obj.x === proTile.x && obj.y === proTile.y;
  3525. });
  3526. if (subTile === void 0) {
  3527. let isExists = false;
  3528. for (let eTile of renderTiles) {
  3529. if (Cesium.Rectangle.intersection(eTile.rectangle, proTile.rectangle)) {
  3530. eTile.childTiles.push(key);
  3531. isExists = true;
  3532. break;
  3533. }
  3534. }
  3535. if (!isExists) {
  3536. renderTiles.push({
  3537. key,
  3538. x: proTile.x,
  3539. y: proTile.y,
  3540. level: proTile.level,
  3541. rectangle: proTile.rectangle,
  3542. childTiles: []
  3543. });
  3544. }
  3545. }
  3546. }
  3547. }
  3548. let i2 = renderTiles.length;
  3549. let appendTiles = [];
  3550. while (i2--) {
  3551. let findTile = renderTiles[i2];
  3552. if (findTile.childTiles.length >= 1) {
  3553. let tiles2 = this._createFourTiles(findTile);
  3554. for (let tile of tiles2) {
  3555. appendTiles.push(tile);
  3556. }
  3557. renderTiles.splice(i2, 1);
  3558. }
  3559. }
  3560. for (let appendTile of appendTiles) {
  3561. renderTiles.push(appendTile);
  3562. }
  3563. renderTiles.sort(function(obj1, obj2) {
  3564. let level1 = parseInt(obj1.level);
  3565. let level2 = parseInt(obj2.level);
  3566. return level1 - level2;
  3567. });
  3568. this._renderTilesToViewer(renderTiles);
  3569. }
  3570. _createTileByRectangleAndLevel(rectangle, level) {
  3571. let center2 = Cesium.Rectangle.center(rectangle);
  3572. let nLevel = parseInt(level) + 1;
  3573. let query = this._provider.tilingScheme.positionToTileXY(center2, nLevel);
  3574. if (query === void 0)
  3575. return void 0;
  3576. return {
  3577. key: this._createKey(query.x, query.y, nLevel),
  3578. x: query.x,
  3579. y: query.y,
  3580. level: nLevel,
  3581. rectangle,
  3582. childTiles: []
  3583. };
  3584. }
  3585. _createFourTiles(tile) {
  3586. let rects = [];
  3587. let results = [];
  3588. let rectangle = tile.rectangle;
  3589. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0, 0.5, 0.5));
  3590. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0, 1, 0.5));
  3591. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0.5, 0.5, 1));
  3592. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0.5, 1, 1));
  3593. for (let rect of rects) {
  3594. if (Cesium.Rectangle.intersection(rect, this._rectangle)) {
  3595. let newTile = this._createTileByRectangleAndLevel(rect, tile.level);
  3596. if (newTile !== void 0)
  3597. results.push(newTile);
  3598. }
  3599. }
  3600. return results;
  3601. }
  3602. _renderTilesToViewer(tiles) {
  3603. let _self = this;
  3604. let deleteKeys = [];
  3605. for (let [key, tile] of this._renderEntities) {
  3606. let findTile = tiles.find((obj) => {
  3607. return obj.key === key;
  3608. });
  3609. if (findTile === void 0) {
  3610. deleteKeys.push(key);
  3611. }
  3612. }
  3613. for (let key of deleteKeys) {
  3614. this._renderEntities.delete(key);
  3615. this._entities.removeById(key);
  3616. }
  3617. for (let tile of tiles) {
  3618. if (!this._renderEntities.has(tile.key)) {
  3619. let entity = this._renderSimpleTileToViewer(tile);
  3620. this._renderEntities.set(tile.key, entity);
  3621. let workBlob = new Blob([`(${downloadWorker.toString()})()`]);
  3622. let worker = new Worker(URL.createObjectURL(workBlob));
  3623. worker.postMessage({
  3624. key: tile.key,
  3625. url: this._url,
  3626. x: tile.x,
  3627. y: tile.y,
  3628. level: tile.level
  3629. });
  3630. worker.onmessage = function(event2) {
  3631. _self._console(`render x:${event2.data.x} y:${event2.data.y} level:${event2.data.level}`);
  3632. let renderEntity = _self._entities.getById(event2.data.key);
  3633. if (renderEntity !== void 0) {
  3634. event2.data.key;
  3635. const canvas = _self._createCanvas(event2.data, event2.data.image, _self._isDebug);
  3636. renderEntity.rectangle.material = canvas;
  3637. }
  3638. worker.terminate();
  3639. };
  3640. }
  3641. }
  3642. this._isUpdateTile = true;
  3643. }
  3644. _renderSimpleTileToViewer(tile) {
  3645. const canvas = this._createCanvas(tile, void 0, this._isDebug);
  3646. let bjPositions = this._calculateRectangleOutlineCoordinates(tile.rectangle);
  3647. let tileEntity = new Cesium.Entity({
  3648. name: this._renderName,
  3649. id: tile.key,
  3650. rectangle: {
  3651. coordinates: tile.rectangle,
  3652. material: canvas
  3653. },
  3654. polyline: {
  3655. positions: bjPositions,
  3656. material: Cesium.Color.YELLOW.withAlpha(this._isDebug ? 1 : 0),
  3657. width: 1,
  3658. clampToGround: true
  3659. }
  3660. });
  3661. return this._entities.add(tileEntity);
  3662. }
  3663. _createCanvas(tile, image, islabel) {
  3664. let provider = this._provider;
  3665. const canvas = document.createElement("canvas");
  3666. canvas.width = provider.tileWidth;
  3667. canvas.height = provider.tileHeight;
  3668. const context = canvas.getContext("2d");
  3669. if (image !== void 0) {
  3670. context.globalAlpha = this._opacity;
  3671. context.drawImage(event.data.image, 0, 0, canvas.width, canvas.height);
  3672. }
  3673. if (islabel !== void 0 && islabel === true) {
  3674. context.globalAlpha = 1;
  3675. context.font = "20px Arial";
  3676. context.textAlign = "center";
  3677. context.fillStyle = "rgba(255,255,0)";
  3678. context.strokeStyle = "rgba(255,255,255,1)";
  3679. context.lineWidth = 2;
  3680. context.strokeText(`L: ${tile.level}`, 126, 86);
  3681. context.fillText(`L: ${tile.level}`, 126, 86);
  3682. context.strokeText(`X: ${tile.x}`, 126, 136);
  3683. context.fillText(`X: ${tile.x}`, 126, 136);
  3684. context.strokeText(`Y: ${tile.y}`, 126, 186);
  3685. context.fillText(`Y: ${tile.y}`, 126, 186);
  3686. }
  3687. return canvas;
  3688. }
  3689. _projectionTile(tile) {
  3690. let rectangle = tile._rectangle;
  3691. let imageryLevel = parseInt(tile.level);
  3692. let mercatorTilingScheme = this._provider.tilingScheme;
  3693. let res = [];
  3694. let interRectangle = Cesium.Rectangle.intersection(rectangle, this._rectangle);
  3695. if (interRectangle === void 0)
  3696. return res;
  3697. let northwestTileCoordinates = mercatorTilingScheme.positionToTileXY(
  3698. Cesium.Rectangle.northwest(rectangle),
  3699. imageryLevel
  3700. );
  3701. let southeastTileCoordinates = mercatorTilingScheme.positionToTileXY(
  3702. Cesium.Rectangle.southeast(rectangle),
  3703. imageryLevel
  3704. );
  3705. if (northwestTileCoordinates !== void 0 && southeastTileCoordinates !== void 0) {
  3706. for (let i2 = northwestTileCoordinates.x; i2 <= southeastTileCoordinates.x; i2++) {
  3707. for (let j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) {
  3708. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(i2, j, imageryLevel);
  3709. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3710. res.push({
  3711. x: i2,
  3712. y: j,
  3713. level: imageryLevel,
  3714. rectangle: _webRectangle
  3715. });
  3716. }
  3717. }
  3718. }
  3719. } else if (northwestTileCoordinates !== void 0) {
  3720. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  3721. northwestTileCoordinates.x,
  3722. northwestTileCoordinates.y,
  3723. imageryLevel
  3724. );
  3725. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3726. res.push({
  3727. x: northwestTileCoordinates.x,
  3728. y: northwestTileCoordinates.y,
  3729. level: imageryLevel,
  3730. rectangle: _webRectangle
  3731. });
  3732. }
  3733. } else if (southeastTileCoordinates !== void 0) {
  3734. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  3735. southeastTileCoordinates.x,
  3736. southeastTileCoordinates.y,
  3737. imageryLevel
  3738. );
  3739. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3740. res.push({
  3741. x: southeastTileCoordinates.x,
  3742. y: southeastTileCoordinates.y,
  3743. level: imageryLevel,
  3744. rectangle: _webRectangle
  3745. });
  3746. }
  3747. }
  3748. return res;
  3749. }
  3750. _calculateRectangleOutlineCoordinates(rectangle) {
  3751. let south_east = Cesium.Rectangle.southeast(rectangle);
  3752. let se2 = Cesium.Cartographic.toCartesian(south_east);
  3753. let south_west = Cesium.Rectangle.southwest(rectangle);
  3754. let sw = Cesium.Cartographic.toCartesian(south_west);
  3755. let north_east = Cesium.Rectangle.northeast(rectangle);
  3756. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  3757. let north_west = Cesium.Rectangle.northwest(rectangle);
  3758. let nw = Cesium.Cartographic.toCartesian(north_west);
  3759. return [sw, se2, ne2, nw, sw];
  3760. }
  3761. _removeEntityByName(entityName) {
  3762. var entities2 = this._entities;
  3763. if (!entities2 || !entities2.values)
  3764. return;
  3765. var delEntitys = [];
  3766. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  3767. if (entities2.values[i2].name == entityName) {
  3768. delEntitys.push(entities2.values[i2]);
  3769. }
  3770. }
  3771. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  3772. entities2.remove(delEntitys[i2]);
  3773. }
  3774. }
  3775. }
  3776. Object.assign(CrImageServerLayer.prototype, {
  3777. hide: function() {
  3778. this._console("\u9690\u85CF");
  3779. this._isUpdateTile = false;
  3780. this._removeEntityByName(this._renderName);
  3781. this._renderEntities.clear();
  3782. },
  3783. show: function() {
  3784. this._console("\u663E\u793A");
  3785. this._isUpdateTile = true;
  3786. },
  3787. setOpacity: function(opacity) {
  3788. if (opacity === void 0 || typeof opacity !== "number")
  3789. return;
  3790. if (opacity >= 1)
  3791. this._opacity = 1;
  3792. if (opacity <= 0)
  3793. this._opacity = 0;
  3794. this._opacity = parseFloat(opacity);
  3795. }
  3796. });
  3797. function downloadWorker() {
  3798. onmessage = function(event2) {
  3799. let data = event2.data;
  3800. let url = data.url + "/tile/" + data.level + "/" + data.y + "/" + data.x;
  3801. let xhr = new XMLHttpRequest();
  3802. xhr.open("get", url, true);
  3803. xhr.responseType = "blob";
  3804. xhr.onload = function() {
  3805. if (this.status === 200) {
  3806. var blob = this.response;
  3807. var bmpPromise = createImageBitmap(blob, {
  3808. imageOrientation: "none",
  3809. premultiplyAlpha: "none",
  3810. colorSpaceConversion: "default"
  3811. });
  3812. bmpPromise.then(function(image) {
  3813. let outObj = {
  3814. key: data.key,
  3815. x: data.x,
  3816. y: data.y,
  3817. level: data.level,
  3818. image
  3819. };
  3820. postMessage(outObj);
  3821. });
  3822. } else {
  3823. console.log("===>>>", url + " Not found");
  3824. }
  3825. };
  3826. xhr.send();
  3827. };
  3828. }
  3829. class LocateUtil {
  3830. constructor(viewer2) {
  3831. if (!viewer2)
  3832. throw new Cesium.DeveloperError("no viewer object!");
  3833. this._viewer = viewer2;
  3834. this._locationEntity = null;
  3835. }
  3836. }
  3837. Object.assign(LocateUtil.prototype, {
  3838. flyToPoint: function(options2) {
  3839. return new Promise((resolve2, reject2) => {
  3840. if (!Cesium.defined(options2) || !Cesium.defined(options2.longitude) || !Cesium.defined(options2.latitude)) {
  3841. throw new Cesium.DeveloperError("options.longitude and options.latitude are required.");
  3842. }
  3843. options2.height = Cesium.defaultValue(options2.height, 0);
  3844. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3845. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3846. options2.range = Cesium.defaultValue(options2.range, 0);
  3847. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3848. var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(options2.longitude, options2.latitude, options2.height), 0);
  3849. this._viewer.camera.flyToBoundingSphere(boundingSphere, {
  3850. duration: options2.duration,
  3851. complete: function() {
  3852. resolve2(true);
  3853. },
  3854. offset: {
  3855. heading: Cesium.Math.toRadians(options2.heading),
  3856. pitch: Cesium.Math.toRadians(options2.pitch),
  3857. range: options2.range
  3858. }
  3859. });
  3860. });
  3861. },
  3862. flyToEntityByPoints: function(points2, type2, options2) {
  3863. return new Promise((resolve2, reject2) => {
  3864. let _self = this;
  3865. options2 = options2 || {};
  3866. if (points2 === void 0 || points2.length === void 0) {
  3867. reject2("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  3868. return;
  3869. }
  3870. let pointsArray = points2.map((point2) => {
  3871. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3872. });
  3873. switch (type2) {
  3874. case "point":
  3875. _self._locationEntity = _self._viewer.entities.add({
  3876. position: pointsArray[0],
  3877. point: {
  3878. pixelSize: 1
  3879. }
  3880. });
  3881. break;
  3882. case "polyline":
  3883. if (pointsArray.length < 2) {
  3884. reject2("\u7EBF\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  3885. } else {
  3886. _self._locationEntity = _self._viewer.entities.add({
  3887. polyline: {
  3888. positions: pointsArray,
  3889. clampToGround: true,
  3890. material: new Cesium.Color(255, 0, 0, 0.5),
  3891. width: 1
  3892. }
  3893. });
  3894. }
  3895. break;
  3896. case "polygon":
  3897. if (pointsArray.length < 3) {
  3898. reject2("\u9762\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  3899. } else {
  3900. _self._locationEntity = _self._viewer.entities.add({
  3901. polygon: {
  3902. hierarchy: {
  3903. positions: pointsArray
  3904. },
  3905. material: new Cesium.Color(255, 0, 0, 0.5),
  3906. outline: true
  3907. }
  3908. });
  3909. }
  3910. break;
  3911. default:
  3912. reject2("\u5750\u6807\u5F02\u5E38\uFF01");
  3913. break;
  3914. }
  3915. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3916. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3917. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3918. options2.range = Cesium.defaultValue(options2.range, 0);
  3919. let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
  3920. duration: options2.duration,
  3921. offset: {
  3922. heading: Cesium.Math.toRadians(options2.heading),
  3923. pitch: Cesium.Math.toRadians(options2.pitch),
  3924. range: options2.range
  3925. }
  3926. });
  3927. flyPromise.then(function(flag) {
  3928. resolve2(flag);
  3929. });
  3930. });
  3931. },
  3932. flyToEntity: function(entity, options2) {
  3933. return new Promise((resolve2, reject2) => {
  3934. let _self = this;
  3935. options2 = options2 || {};
  3936. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3937. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3938. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3939. options2.range = Cesium.defaultValue(options2.range, 0);
  3940. let flyPromise = _self._viewer.flyTo(entity, {
  3941. duration: options2.duration,
  3942. offset: {
  3943. heading: Cesium.Math.toRadians(options2.heading),
  3944. pitch: Cesium.Math.toRadians(options2.pitch),
  3945. range: options2.range
  3946. }
  3947. });
  3948. flyPromise.then(function(flag) {
  3949. resolve2(flag);
  3950. });
  3951. });
  3952. },
  3953. zoomToTilesets(tileset, options2) {
  3954. return new Promise((resolve2, reject2) => {
  3955. let _self = this;
  3956. if (!Cesium.defined(tileset)) {
  3957. throw new Cesium.DeveloperError("tileset is required.");
  3958. }
  3959. options2 = options2 || {};
  3960. options2.heading = Cesium.defaultValue(options2.heading, 120);
  3961. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  3962. options2.range = Cesium.defaultValue(options2.range, 450);
  3963. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3964. let boundingSphere = tileset.boundingSphere;
  3965. _self._viewer.camera.flyToBoundingSphere(boundingSphere, {
  3966. duration: options2.duration,
  3967. complete: function() {
  3968. resolve2(true);
  3969. },
  3970. offset: {
  3971. heading: Cesium.Math.toRadians(options2.heading),
  3972. pitch: Cesium.Math.toRadians(options2.pitch),
  3973. range: options2.range
  3974. }
  3975. });
  3976. });
  3977. },
  3978. flyToTileset(tileset, options2) {
  3979. return new Promise((resolve2, reject2) => {
  3980. let _self = this;
  3981. if (!Cesium.defined(tileset)) {
  3982. throw new Cesium.DeveloperError("tileset is required.");
  3983. }
  3984. options2 = options2 || {};
  3985. options2.heading = Cesium.defaultValue(options2.heading, 120);
  3986. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  3987. options2.range = Cesium.defaultValue(options2.range, 450);
  3988. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3989. let flyPromise = _self._viewer.flyTo(tileset, {
  3990. duration: options2.duration,
  3991. offset: {
  3992. heading: Cesium.Math.toRadians(options2.heading),
  3993. pitch: Cesium.Math.toRadians(options2.pitch),
  3994. range: options2.range
  3995. }
  3996. });
  3997. flyPromise.then(function(flag) {
  3998. resolve2(flag);
  3999. });
  4000. });
  4001. }
  4002. });
  4003. const CreateRemindertip = function(arr, position2, show) {
  4004. let tooltip2 = document.getElementById("toolTip");
  4005. let style, _x, _y, _color;
  4006. if (arr && typeof arr === "object") {
  4007. style = arr;
  4008. }
  4009. if (style && style.origin) {
  4010. style.origin === "center" && (_x = 15, _y = -12);
  4011. style.origin === "top" && (_x = 15, _y = -44);
  4012. style.origin === "bottom" && (_x = 15, _y = 20);
  4013. } else {
  4014. _x = 15, _y = 20;
  4015. }
  4016. if (style && style.color) {
  4017. style.color === "white" && (_color = "background: rgba(255, 255, 255, 0.8);color: black;");
  4018. style.color === "black" && (_color = "background: rgba(0, 0, 0, 0.65);color: white;");
  4019. style.color === "yellow" && (_color = "color: black;background-color: #ffcc33;border: 1px solid white;");
  4020. } else {
  4021. _color = "background: rgba(0, 0, 0, 0.65);color: white;";
  4022. }
  4023. if (!tooltip2) {
  4024. const viewerDom = document.getElementsByClassName("cesium-viewer")[0];
  4025. let elementbottom = document.createElement("div");
  4026. viewerDom.append(elementbottom);
  4027. 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>';
  4028. viewerDom.insertAdjacentHTML("beforeend", html);
  4029. tooltip2 = document.getElementById("toolTip");
  4030. }
  4031. if (show) {
  4032. tooltip2.innerHTML = arr;
  4033. tooltip2.style.left = position2.x + _x + "px";
  4034. tooltip2.style.top = position2.y + _y + "px";
  4035. tooltip2.style.display = "block";
  4036. } else {
  4037. tooltip2.style.display = "none";
  4038. }
  4039. return {
  4040. tooltip: tooltip2,
  4041. style,
  4042. showAt: function(position3, text) {
  4043. this.tooltip.innerHTML = text;
  4044. if (this.style && this.style.origin) {
  4045. this.style.origin === "center" && (_x = 15, _y = -this.tooltip.offsetHeight / 2);
  4046. this.style.origin === "top" && (_x = 15, _y = -this.tooltip.offsetHeight - 20);
  4047. this.style.origin === "bottom" && (_x = 15, _y = 20);
  4048. } else {
  4049. _x = 15, _y = -this.tooltip.offsetHeight / 2;
  4050. }
  4051. this.tooltip.style.left = position3.x + _x + "px";
  4052. this.tooltip.style.top = position3.y + _y + "px";
  4053. this.tooltip.style.display = "block";
  4054. },
  4055. show: function(show2) {
  4056. if (show2) {
  4057. this.tooltip.style.display = "block";
  4058. } else {
  4059. this.tooltip.style.display = "none";
  4060. }
  4061. }
  4062. };
  4063. };
  4064. class SightLine {
  4065. constructor(viewer2) {
  4066. if (!viewer2)
  4067. throw new Cesium.DeveloperError("no viewer object!");
  4068. this._viewer = viewer2;
  4069. this._resultObject = {
  4070. viewPoint: void 0,
  4071. targetPoints: [],
  4072. targetPoint: void 0,
  4073. objectExclude: [],
  4074. entities: []
  4075. };
  4076. }
  4077. _distance(point1, point2) {
  4078. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  4079. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  4080. let geodesic = new Cesium.EllipsoidGeodesic();
  4081. geodesic.setEndPoints(point1cartographic, point2cartographic);
  4082. let s = geodesic.surfaceDistance;
  4083. s = Math.sqrt(
  4084. Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2)
  4085. );
  4086. return s;
  4087. }
  4088. _checkAppOrWeb() {
  4089. if (window.navigator.userAgent.match(
  4090. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  4091. )) {
  4092. return SightLine.RuntimeEnvironment.App;
  4093. } else {
  4094. return SightLine.RuntimeEnvironment.Web;
  4095. }
  4096. }
  4097. _isRuntimeApp() {
  4098. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.App) {
  4099. return true;
  4100. }
  4101. return false;
  4102. }
  4103. _isRuntimeWeb() {
  4104. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.Web) {
  4105. return true;
  4106. }
  4107. return false;
  4108. }
  4109. _createOperationMainDom() {
  4110. let buttonDiv = document.createElement("div");
  4111. buttonDiv.id = "drawButtonDiv";
  4112. buttonDiv.style.width = "80px";
  4113. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  4114. buttonDiv.style.borderRadius = "5px";
  4115. buttonDiv.style.display = "flex";
  4116. buttonDiv.style.flexDirection = "column";
  4117. buttonDiv.style.padding = "8px";
  4118. buttonDiv.style.justifyContent = "center";
  4119. buttonDiv.style.position = "absolute";
  4120. buttonDiv.style.bottom = "150px";
  4121. buttonDiv.style.right = "10px";
  4122. let btnCompletion = document.createElement("button");
  4123. btnCompletion.id = "btnDrawComplete";
  4124. btnCompletion.style.height = "30px";
  4125. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  4126. btnCompletion.style.color = "rgb(255, 255, 255)";
  4127. btnCompletion.style.border = "0px solid red";
  4128. btnCompletion.style.borderRadius = "5px";
  4129. btnCompletion.innerHTML = "\u5B8C\u6210";
  4130. btnCompletion.style.fontSize = "13px";
  4131. btnCompletion.style.cursor = "pointer";
  4132. buttonDiv.appendChild(btnCompletion);
  4133. document.body.appendChild(buttonDiv);
  4134. }
  4135. _showTooltipMessage(message) {
  4136. let msgMainDom = document.getElementById("messageMainDom");
  4137. if (msgMainDom !== null && msgMainDom !== void 0) {
  4138. document.body.removeChild(msgMainDom);
  4139. }
  4140. msgMainDom = document.createElement("div");
  4141. msgMainDom.style.width = "30%";
  4142. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  4143. msgMainDom.style.height = "45px";
  4144. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  4145. msgMainDom.style.borderRadius = "8px";
  4146. msgMainDom.style.display = "flex";
  4147. msgMainDom.style.alignItems = "center";
  4148. msgMainDom.style.paddingLeft = "10px";
  4149. msgMainDom.style.color = "rgb(91, 188, 48)";
  4150. msgMainDom.style.fontSize = "14px";
  4151. msgMainDom.style.fontWeight = "600";
  4152. msgMainDom.style.position = "absolute";
  4153. msgMainDom.style.left = "35%";
  4154. msgMainDom.style.transition = "transform 1s";
  4155. msgMainDom.style.transform = "translateY(-90px)";
  4156. msgMainDom.style.top = "0px";
  4157. msgMainDom.style.zIndex = 1e3;
  4158. document.body.appendChild(msgMainDom);
  4159. let strHtml = "";
  4160. strHtml += "<div style='";
  4161. strHtml += "background-color: rgb(88, 185, 45);";
  4162. strHtml += "color: rgb(255, 255, 255);";
  4163. strHtml += "height: 24px;";
  4164. strHtml += "width: 24px;";
  4165. strHtml += "border-radius: 20px;";
  4166. strHtml += "display: flex;";
  4167. strHtml += "justify-content: center;";
  4168. strHtml += "align-items: center;";
  4169. strHtml += "font-size: 14px;";
  4170. strHtml += "margin-right: 18px;";
  4171. strHtml += "'>&#10003</div>";
  4172. strHtml += "<div>" + message + "</div>";
  4173. msgMainDom.innerHTML = strHtml;
  4174. msgMainDom.addEventListener("transitionend", function() {
  4175. setTimeout(function() {
  4176. document.body.removeChild(msgMainDom);
  4177. }, 1e3);
  4178. }, false);
  4179. setTimeout(function() {
  4180. msgMainDom.style.transform = "translateY(50px)";
  4181. }, 100);
  4182. }
  4183. }
  4184. Object.assign(SightLine.prototype, {
  4185. startSightLine() {
  4186. let _self = this;
  4187. _self.clearAll();
  4188. let toolTip = "\u5DE6\u952E\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  4189. if (this._isRuntimeApp()) {
  4190. toolTip = "\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  4191. _self._showTooltipMessage(toolTip);
  4192. }
  4193. _self.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  4194. _self.handler.setInputAction((event2) => {
  4195. let loc2 = CoordTransform._transfromFromScreenPoint(_self._viewer, event2.position);
  4196. toolTip = "\u5DE6\u952E\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9\uFF0C\u53F3\u952E\u7ED3\u675F\u901A\u89C6\u5206\u6790";
  4197. if (this._isRuntimeApp()) {
  4198. toolTip = "\u518D\u6B21\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9";
  4199. _self._showTooltipMessage(toolTip);
  4200. }
  4201. if (!Cesium.defined(loc2.sLocation))
  4202. return;
  4203. let cartesian = loc2.sLocation;
  4204. if (!_self._resultObject.viewPoint) {
  4205. _self._resultObject.viewPoint = cartesian;
  4206. let pointEntity = _self._viewer.entities.add({
  4207. position: cartesian,
  4208. point: {
  4209. color: Cesium.Color.YELLOW,
  4210. pixelSize: 5
  4211. },
  4212. label: {
  4213. text: "\u89C2\u5BDF\u4F4D\u7F6E",
  4214. font: "12px sans-serif",
  4215. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  4216. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  4217. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  4218. outlineWidth: 1,
  4219. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  4220. pixelOffset: new Cesium.Cartesian2(0, -28),
  4221. showBackground: true,
  4222. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  4223. disableDepthTestDistance: Number.POSITIVE_INFINITY
  4224. }
  4225. });
  4226. _self._resultObject.objectExclude.push(pointEntity);
  4227. _self._resultObject.entities.push(pointEntity);
  4228. } else {
  4229. _self._resultObject.targetPoint = cartesian;
  4230. let pointEntity = _self._viewer.entities.add({
  4231. position: cartesian,
  4232. point: {
  4233. color: Cesium.Color.YELLOW,
  4234. pixelSize: 5
  4235. },
  4236. label: {
  4237. text: "\u76EE\u6807\u4F4D\u7F6E",
  4238. font: "12px sans-serif",
  4239. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  4240. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  4241. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  4242. outlineWidth: 1,
  4243. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  4244. pixelOffset: new Cesium.Cartesian2(0, -28),
  4245. showBackground: true,
  4246. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  4247. disableDepthTestDistance: Number.POSITIVE_INFINITY
  4248. }
  4249. });
  4250. _self._resultObject.objectExclude.push(pointEntity);
  4251. _self._resultObject.entities.push(pointEntity);
  4252. let direction = Cesium.Cartesian3.normalize(
  4253. Cesium.Cartesian3.subtract(
  4254. _self._resultObject.targetPoint,
  4255. _self._resultObject.viewPoint,
  4256. new Cesium.Cartesian3()
  4257. ),
  4258. new Cesium.Cartesian3()
  4259. );
  4260. let ray = new Cesium.Ray(_self._resultObject.viewPoint, direction);
  4261. let result = _self._viewer.scene.pickFromRay(ray, _self._resultObject.objectExclude);
  4262. if (result) {
  4263. let dis0 = _self._distance(
  4264. _self._resultObject.viewPoint,
  4265. _self._resultObject.targetPoint
  4266. );
  4267. let dis1 = _self._distance(
  4268. _self._resultObject.viewPoint,
  4269. result.position
  4270. );
  4271. let dis2 = _self._distance(
  4272. result.position,
  4273. _self._resultObject.targetPoint
  4274. );
  4275. console.log(dis0, dis1, dis2);
  4276. if (dis0 > dis1) {
  4277. let _poly0 = _self._viewer.entities.add({
  4278. polyline: {
  4279. positions: [_self._resultObject.viewPoint, result.position],
  4280. material: Cesium.Color.GREEN,
  4281. width: 3
  4282. }
  4283. });
  4284. _self._resultObject.entities.push(_poly0);
  4285. let _poly1 = _self._viewer.entities.add({
  4286. polyline: {
  4287. positions: [result.position, _self._resultObject.targetPoint],
  4288. material: Cesium.Color.RED,
  4289. width: 3
  4290. }
  4291. });
  4292. _self._resultObject.entities.push(_poly1);
  4293. _self._resultObject.targetPoints.push({
  4294. targetPoint: cartesian,
  4295. visual: false,
  4296. distance: [dis0, dis1, dis2]
  4297. });
  4298. } else {
  4299. let _poly2 = _self._viewer.entities.add({
  4300. polyline: {
  4301. positions: [
  4302. _self._resultObject.viewPoint,
  4303. _self._resultObject.targetPoint
  4304. ],
  4305. material: Cesium.Color.GREEN,
  4306. width: 3
  4307. }
  4308. });
  4309. _self._resultObject.entities.push(_poly2);
  4310. _self._resultObject.targetPoints.push({
  4311. targetPoint: cartesian,
  4312. visual: true,
  4313. distance: [dis0, dis1, dis2]
  4314. });
  4315. }
  4316. }
  4317. }
  4318. if (_self._resultObject.objectExclude.length === 2) {
  4319. if (this._isRuntimeApp()) {
  4320. _self._createOperationMainDom();
  4321. document.getElementById("btnDrawComplete").onclick = () => {
  4322. CreateRemindertip(toolTip, event2.endPosition, false);
  4323. _self.handler.destroy();
  4324. let buttonDiv = document.getElementById("drawButtonDiv");
  4325. if (buttonDiv) {
  4326. document.body.removeChild(buttonDiv);
  4327. }
  4328. };
  4329. }
  4330. }
  4331. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  4332. _self.handler.setInputAction(function(move) {
  4333. if (_self._isRuntimeApp())
  4334. return;
  4335. CreateRemindertip(toolTip, move.endPosition, true);
  4336. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  4337. _self.handler.setInputAction((event2) => {
  4338. CreateRemindertip(toolTip, event2.endPosition, false);
  4339. _self.handler.destroy();
  4340. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  4341. },
  4342. clearAll() {
  4343. this._resultObject.entities.forEach((element) => {
  4344. this._viewer.entities.remove(element);
  4345. });
  4346. this._resultObject = {
  4347. viewPoint: void 0,
  4348. targetPoints: [],
  4349. targetPoint: void 0,
  4350. objectExclude: [],
  4351. entities: []
  4352. };
  4353. if (this.handler) {
  4354. this.handler.destroy();
  4355. }
  4356. let buttonDiv = document.getElementById("drawButtonDiv");
  4357. if (buttonDiv) {
  4358. document.body.removeChild(buttonDiv);
  4359. }
  4360. }
  4361. });
  4362. SightLine.RuntimeEnvironment = Object.freeze({
  4363. App: "app",
  4364. Web: "web"
  4365. });
  4366. /*!
  4367. * author: [object Object]
  4368. * @sakitam-gis/kriging v0.1.0
  4369. * build-time: 2019-7-6 20:41
  4370. * LICENSE: MIT
  4371. * (c) 2019-2019 https://github.com/sakitam-gis/kriging.js
  4372. */
  4373. function max(source) {
  4374. return Math.max.apply(null, source);
  4375. }
  4376. function min(source) {
  4377. return Math.min.apply(null, source);
  4378. }
  4379. function rep(source, n) {
  4380. var array = [];
  4381. for (var i2 = 0; i2 < n; i2++) {
  4382. array.push(source);
  4383. }
  4384. return array;
  4385. }
  4386. function pip(source, x, y) {
  4387. var i2 = 0;
  4388. var j = source.length - 1;
  4389. var c = false;
  4390. var length = source.length;
  4391. for (; i2 < length; j = i2++) {
  4392. 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]) {
  4393. c = !c;
  4394. }
  4395. }
  4396. return c;
  4397. }
  4398. function matrixDiag(c, n) {
  4399. var i2 = 0;
  4400. var Z2 = rep(0, n * n);
  4401. for (; i2 < n; i2++) {
  4402. Z2[i2 * n + i2] = c;
  4403. }
  4404. return Z2;
  4405. }
  4406. function matrixTranspose(X2, n, m) {
  4407. var i2 = 0;
  4408. var j;
  4409. var Z2 = Array(m * n);
  4410. for (; i2 < n; i2++) {
  4411. j = 0;
  4412. for (; j < m; j++) {
  4413. Z2[j * n + i2] = X2[i2 * m + j];
  4414. }
  4415. }
  4416. return Z2;
  4417. }
  4418. function matrixAdd(X2, Y, n, m) {
  4419. var i2 = 0;
  4420. var j;
  4421. var Z2 = Array(n * m);
  4422. for (; i2 < n; i2++) {
  4423. j = 0;
  4424. for (; j < m; j++) {
  4425. Z2[i2 * m + j] = X2[i2 * m + j] + Y[i2 * m + j];
  4426. }
  4427. }
  4428. return Z2;
  4429. }
  4430. function matrixMultiply(X2, Y, n, m, p) {
  4431. var i2 = 0;
  4432. var j;
  4433. var k;
  4434. var Z2 = Array(n * p);
  4435. for (; i2 < n; i2++) {
  4436. j = 0;
  4437. for (; j < p; j++) {
  4438. Z2[i2 * p + j] = 0;
  4439. k = 0;
  4440. for (; k < m; k++) {
  4441. Z2[i2 * p + j] += X2[i2 * m + k] * Y[k * p + j];
  4442. }
  4443. }
  4444. }
  4445. return Z2;
  4446. }
  4447. function matrixChol(X2, n) {
  4448. var i2;
  4449. var j;
  4450. var k;
  4451. var p = Array(n);
  4452. for (i2 = 0; i2 < n; i2++)
  4453. p[i2] = X2[i2 * n + i2];
  4454. for (i2 = 0; i2 < n; i2++) {
  4455. for (j = 0; j < i2; j++)
  4456. p[i2] -= X2[i2 * n + j] * X2[i2 * n + j];
  4457. if (p[i2] <= 0)
  4458. return false;
  4459. p[i2] = Math.sqrt(p[i2]);
  4460. for (j = i2 + 1; j < n; j++) {
  4461. for (k = 0; k < i2; k++)
  4462. X2[j * n + i2] -= X2[j * n + k] * X2[i2 * n + k];
  4463. X2[j * n + i2] /= p[i2];
  4464. }
  4465. }
  4466. for (i2 = 0; i2 < n; i2++)
  4467. X2[i2 * n + i2] = p[i2];
  4468. return true;
  4469. }
  4470. function matrixChol2inv(X2, n) {
  4471. var i2;
  4472. var j;
  4473. var k;
  4474. var sum;
  4475. for (i2 = 0; i2 < n; i2++) {
  4476. X2[i2 * n + i2] = 1 / X2[i2 * n + i2];
  4477. for (j = i2 + 1; j < n; j++) {
  4478. sum = 0;
  4479. for (k = i2; k < j; k++)
  4480. sum -= X2[j * n + k] * X2[k * n + i2];
  4481. X2[j * n + i2] = sum / X2[j * n + j];
  4482. }
  4483. }
  4484. for (i2 = 0; i2 < n; i2++)
  4485. for (j = i2 + 1; j < n; j++)
  4486. X2[i2 * n + j] = 0;
  4487. for (i2 = 0; i2 < n; i2++) {
  4488. X2[i2 * n + i2] *= X2[i2 * n + i2];
  4489. for (k = i2 + 1; k < n; k++)
  4490. X2[i2 * n + i2] += X2[k * n + i2] * X2[k * n + i2];
  4491. for (j = i2 + 1; j < n; j++)
  4492. for (k = j; k < n; k++)
  4493. X2[i2 * n + j] += X2[k * n + i2] * X2[k * n + j];
  4494. }
  4495. for (i2 = 0; i2 < n; i2++)
  4496. for (j = 0; j < i2; j++)
  4497. X2[i2 * n + j] = X2[j * n + i2];
  4498. }
  4499. function matrixSolve(X2, n) {
  4500. var m = n;
  4501. var b = Array(n * n);
  4502. var indxc = Array(n);
  4503. var indxr = Array(n);
  4504. var ipiv = Array(n);
  4505. var i2;
  4506. var icol = 0;
  4507. var irow = 0;
  4508. var j;
  4509. var k;
  4510. var l;
  4511. var ll;
  4512. var big;
  4513. var dum;
  4514. var pivinv;
  4515. var temp;
  4516. for (i2 = 0; i2 < n; i2++) {
  4517. for (j = 0; j < n; j++) {
  4518. if (i2 === j)
  4519. b[i2 * n + j] = 1;
  4520. else
  4521. b[i2 * n + j] = 0;
  4522. }
  4523. }
  4524. for (j = 0; j < n; j++)
  4525. ipiv[j] = 0;
  4526. for (i2 = 0; i2 < n; i2++) {
  4527. big = 0;
  4528. for (j = 0; j < n; j++) {
  4529. if (ipiv[j] !== 1) {
  4530. for (k = 0; k < n; k++) {
  4531. if (ipiv[k] === 0) {
  4532. if (Math.abs(X2[j * n + k]) >= big) {
  4533. big = Math.abs(X2[j * n + k]);
  4534. irow = j;
  4535. icol = k;
  4536. }
  4537. }
  4538. }
  4539. }
  4540. }
  4541. ++ipiv[icol];
  4542. if (irow !== icol) {
  4543. for (l = 0; l < n; l++) {
  4544. temp = X2[irow * n + l];
  4545. X2[irow * n + l] = X2[icol * n + l];
  4546. X2[icol * n + l] = temp;
  4547. }
  4548. for (l = 0; l < m; l++) {
  4549. temp = b[irow * n + l];
  4550. b[irow * n + l] = b[icol * n + l];
  4551. b[icol * n + l] = temp;
  4552. }
  4553. }
  4554. indxr[i2] = irow;
  4555. indxc[i2] = icol;
  4556. if (X2[icol * n + icol] === 0)
  4557. return false;
  4558. pivinv = 1 / X2[icol * n + icol];
  4559. X2[icol * n + icol] = 1;
  4560. for (l = 0; l < n; l++)
  4561. X2[icol * n + l] *= pivinv;
  4562. for (l = 0; l < m; l++)
  4563. b[icol * n + l] *= pivinv;
  4564. for (ll = 0; ll < n; ll++) {
  4565. if (ll !== icol) {
  4566. dum = X2[ll * n + icol];
  4567. X2[ll * n + icol] = 0;
  4568. for (l = 0; l < n; l++)
  4569. X2[ll * n + l] -= X2[icol * n + l] * dum;
  4570. for (l = 0; l < m; l++)
  4571. b[ll * n + l] -= b[icol * n + l] * dum;
  4572. }
  4573. }
  4574. }
  4575. for (l = n - 1; l >= 0; l--) {
  4576. if (indxr[l] !== indxc[l]) {
  4577. for (k = 0; k < n; k++) {
  4578. temp = X2[k * n + indxr[l]];
  4579. X2[k * n + indxr[l]] = X2[k * n + indxc[l]];
  4580. X2[k * n + indxc[l]] = temp;
  4581. }
  4582. }
  4583. }
  4584. return true;
  4585. }
  4586. function variogramGaussian(h2, nugget, range3, sill, A) {
  4587. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * Math.pow(h2 / range3, 2)));
  4588. }
  4589. function variogramExponential(h2, nugget, range3, sill, A) {
  4590. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * (h2 / range3)));
  4591. }
  4592. function variogramSpherical(h2, nugget, range3, sill) {
  4593. if (h2 > range3)
  4594. return nugget + (sill - nugget) / range3;
  4595. return nugget + (sill - nugget) / range3 * (1.5 * (h2 / range3) - 0.5 * Math.pow(h2 / range3, 3));
  4596. }
  4597. function train(t2, x, y, model, sigma2, alpha) {
  4598. var variogram = {
  4599. t: t2,
  4600. x,
  4601. y,
  4602. nugget: 0,
  4603. range: 0,
  4604. sill: 0,
  4605. A: 1 / 3,
  4606. n: 0,
  4607. model: variogramExponential,
  4608. K: [],
  4609. M: []
  4610. };
  4611. switch (model) {
  4612. case "gaussian":
  4613. variogram.model = variogramGaussian;
  4614. break;
  4615. case "exponential":
  4616. variogram.model = variogramExponential;
  4617. break;
  4618. case "spherical":
  4619. variogram.model = variogramSpherical;
  4620. break;
  4621. default:
  4622. variogram.model = variogramExponential;
  4623. }
  4624. var i2;
  4625. var j;
  4626. var k;
  4627. var l;
  4628. var n = t2.length;
  4629. var distance2 = Array((n * n - n) / 2);
  4630. for (i2 = 0, k = 0; i2 < n; i2++) {
  4631. for (j = 0; j < i2; j++, k++) {
  4632. distance2[k] = Array(2);
  4633. distance2[k][0] = Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5);
  4634. distance2[k][1] = Math.abs(t2[i2] - t2[j]);
  4635. }
  4636. }
  4637. distance2.sort(function(a, b) {
  4638. return a[0] - b[0];
  4639. });
  4640. variogram.range = distance2[(n * n - n) / 2 - 1][0];
  4641. var lags = (n * n - n) / 2 > 30 ? 30 : (n * n - n) / 2;
  4642. var tolerance = variogram.range / lags;
  4643. var lag = rep(0, lags);
  4644. var semi = rep(0, lags);
  4645. if (lags < 30) {
  4646. for (l = 0; l < lags; l++) {
  4647. lag[l] = distance2[l][0];
  4648. semi[l] = distance2[l][1];
  4649. }
  4650. } else {
  4651. for (i2 = 0, j = 0, k = 0, l = 0; i2 < lags && j < (n * n - n) / 2; i2++, k = 0) {
  4652. while (distance2[j][0] <= (i2 + 1) * tolerance) {
  4653. lag[l] += distance2[j][0];
  4654. semi[l] += distance2[j][1];
  4655. j++;
  4656. k++;
  4657. if (j >= (n * n - n) / 2)
  4658. break;
  4659. }
  4660. if (k > 0) {
  4661. lag[l] /= k;
  4662. semi[l] /= k;
  4663. l++;
  4664. }
  4665. }
  4666. if (l < 2)
  4667. return variogram;
  4668. }
  4669. n = l;
  4670. variogram.range = lag[n - 1] - lag[0];
  4671. var X2 = rep(1, 2 * n);
  4672. var Y = Array(n);
  4673. var A = variogram.A;
  4674. for (i2 = 0; i2 < n; i2++) {
  4675. switch (model) {
  4676. case "gaussian":
  4677. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * Math.pow(lag[i2] / variogram.range, 2));
  4678. break;
  4679. case "exponential":
  4680. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * lag[i2] / variogram.range);
  4681. break;
  4682. case "spherical":
  4683. X2[i2 * 2 + 1] = 1.5 * (lag[i2] / variogram.range) - 0.5 * Math.pow(lag[i2] / variogram.range, 3);
  4684. break;
  4685. }
  4686. Y[i2] = semi[i2];
  4687. }
  4688. var Xt2 = matrixTranspose(X2, n, 2);
  4689. var Z2 = matrixMultiply(Xt2, X2, 2, n, 2);
  4690. Z2 = matrixAdd(Z2, matrixDiag(1 / alpha, 2), 2, 2);
  4691. var cloneZ = Z2.slice(0);
  4692. if (matrixChol(Z2, 2)) {
  4693. matrixChol2inv(Z2, 2);
  4694. } else {
  4695. matrixSolve(cloneZ, 2);
  4696. Z2 = cloneZ;
  4697. }
  4698. var W2 = matrixMultiply(matrixMultiply(Z2, Xt2, 2, 2, n), Y, 2, n, 1);
  4699. variogram.nugget = W2[0];
  4700. variogram.sill = W2[1] * variogram.range + variogram.nugget;
  4701. variogram.n = x.length;
  4702. n = x.length;
  4703. var K2 = Array(n * n);
  4704. for (i2 = 0; i2 < n; i2++) {
  4705. for (j = 0; j < i2; j++) {
  4706. 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);
  4707. K2[j * n + i2] = K2[i2 * n + j];
  4708. }
  4709. K2[i2 * n + i2] = variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A);
  4710. }
  4711. var C2 = matrixAdd(K2, matrixDiag(sigma2, n), n, n);
  4712. var cloneC = C2.slice(0);
  4713. if (matrixChol(C2, n)) {
  4714. matrixChol2inv(C2, n);
  4715. } else {
  4716. matrixSolve(cloneC, n);
  4717. C2 = cloneC;
  4718. }
  4719. var K1 = C2.slice(0);
  4720. var M = matrixMultiply(C2, t2, n, n, 1);
  4721. variogram.K = K1;
  4722. variogram.M = M;
  4723. return variogram;
  4724. }
  4725. function predict(x, y, variogram) {
  4726. var i2;
  4727. var k = Array(variogram.n);
  4728. for (i2 = 0; i2 < variogram.n; i2++) {
  4729. 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);
  4730. }
  4731. return matrixMultiply(k, variogram.M, 1, variogram.n, 1)[0];
  4732. }
  4733. function variance(x, y, variogram) {
  4734. var i2;
  4735. var k = Array(variogram.n);
  4736. for (i2 = 0; i2 < variogram.n; i2++) {
  4737. 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);
  4738. }
  4739. var val = matrixMultiply(matrixMultiply(k, variogram.K, 1, variogram.n, variogram.n), k, 1, variogram.n, 1)[0];
  4740. return variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A) + val;
  4741. }
  4742. function grid(polygons2, variogram, width2) {
  4743. var i2;
  4744. var j;
  4745. var k;
  4746. var n = polygons2.length;
  4747. if (n === 0)
  4748. return;
  4749. var xlim = [polygons2[0][0][0], polygons2[0][0][0]];
  4750. var ylim = [polygons2[0][0][1], polygons2[0][0][1]];
  4751. for (i2 = 0; i2 < n; i2++) {
  4752. for (j = 0; j < polygons2[i2].length; j++) {
  4753. if (polygons2[i2][j][0] < xlim[0])
  4754. xlim[0] = polygons2[i2][j][0];
  4755. if (polygons2[i2][j][0] > xlim[1])
  4756. xlim[1] = polygons2[i2][j][0];
  4757. if (polygons2[i2][j][1] < ylim[0])
  4758. ylim[0] = polygons2[i2][j][1];
  4759. if (polygons2[i2][j][1] > ylim[1])
  4760. ylim[1] = polygons2[i2][j][1];
  4761. }
  4762. }
  4763. var xtarget;
  4764. var ytarget;
  4765. var a = Array(2);
  4766. var b = Array(2);
  4767. var lxlim = Array(2);
  4768. var lylim = Array(2);
  4769. var x = Math.ceil((xlim[1] - xlim[0]) / width2);
  4770. var y = Math.ceil((ylim[1] - ylim[0]) / width2);
  4771. var A = Array(x + 1);
  4772. for (i2 = 0; i2 <= x; i2++)
  4773. A[i2] = Array(y + 1);
  4774. for (i2 = 0; i2 < n; i2++) {
  4775. lxlim[0] = polygons2[i2][0][0];
  4776. lxlim[1] = lxlim[0];
  4777. lylim[0] = polygons2[i2][0][1];
  4778. lylim[1] = lylim[0];
  4779. for (j = 1; j < polygons2[i2].length; j++) {
  4780. if (polygons2[i2][j][0] < lxlim[0])
  4781. lxlim[0] = polygons2[i2][j][0];
  4782. if (polygons2[i2][j][0] > lxlim[1])
  4783. lxlim[1] = polygons2[i2][j][0];
  4784. if (polygons2[i2][j][1] < lylim[0])
  4785. lylim[0] = polygons2[i2][j][1];
  4786. if (polygons2[i2][j][1] > lylim[1])
  4787. lylim[1] = polygons2[i2][j][1];
  4788. }
  4789. a[0] = Math.floor((lxlim[0] - (lxlim[0] - xlim[0]) % width2 - xlim[0]) / width2);
  4790. a[1] = Math.ceil((lxlim[1] - (lxlim[1] - xlim[1]) % width2 - xlim[0]) / width2);
  4791. b[0] = Math.floor((lylim[0] - (lylim[0] - ylim[0]) % width2 - ylim[0]) / width2);
  4792. b[1] = Math.ceil((lylim[1] - (lylim[1] - ylim[1]) % width2 - ylim[0]) / width2);
  4793. for (j = a[0]; j <= a[1]; j++) {
  4794. for (k = b[0]; k <= b[1]; k++) {
  4795. xtarget = xlim[0] + j * width2;
  4796. ytarget = ylim[0] + k * width2;
  4797. if (pip(polygons2[i2], xtarget, ytarget)) {
  4798. A[j][k] = predict(xtarget, ytarget, variogram);
  4799. }
  4800. }
  4801. }
  4802. }
  4803. return {
  4804. xlim,
  4805. ylim,
  4806. width: width2,
  4807. data: A,
  4808. zlim: [min(variogram.t), max(variogram.t)]
  4809. };
  4810. }
  4811. function plot(canvas, grid2, xlim, ylim, colors) {
  4812. var ctx = canvas.getContext("2d");
  4813. var data = grid2.data, zlim = grid2.zlim, width2 = grid2.width;
  4814. if (ctx) {
  4815. ctx.clearRect(0, 0, canvas.width, canvas.height);
  4816. var range3 = [xlim[1] - xlim[0], ylim[1] - ylim[0], zlim[1] - zlim[0]];
  4817. var i2 = void 0;
  4818. var j = void 0;
  4819. var x = void 0;
  4820. var y = void 0;
  4821. var z = void 0;
  4822. var n = data.length;
  4823. var m = data[0].length;
  4824. var wx = Math.ceil(width2 * canvas.width / (xlim[1] - xlim[0]));
  4825. var wy = Math.ceil(width2 * canvas.height / (ylim[1] - ylim[0]));
  4826. for (i2 = 0; i2 < n; i2++) {
  4827. for (j = 0; j < m; j++) {
  4828. if (data[i2][j] === void 0)
  4829. continue;
  4830. x = canvas.width * (i2 * width2 + grid2.xlim[0] - xlim[0]) / range3[0];
  4831. y = canvas.height * (1 - (j * width2 + grid2.ylim[0] - ylim[0]) / range3[1]);
  4832. z = (data[i2][j] - zlim[0]) / range3[2];
  4833. if (z < 0)
  4834. z = 0;
  4835. if (z > 1)
  4836. z = 1;
  4837. ctx.fillStyle = colors[Math.floor((colors.length - 1) * z)];
  4838. ctx.fillRect(Math.round(x - wx / 2), Math.round(y - wy / 2), wx, wy);
  4839. }
  4840. }
  4841. }
  4842. }
  4843. var index = {
  4844. train,
  4845. predict,
  4846. variance,
  4847. grid,
  4848. plot,
  4849. max,
  4850. min,
  4851. pip,
  4852. rep,
  4853. matrixDiag,
  4854. matrixTranspose,
  4855. matrixAdd,
  4856. matrixMultiply,
  4857. matrixChol,
  4858. matrixChol2inv,
  4859. matrixSolve,
  4860. variogramGaussian,
  4861. variogramExponential,
  4862. variogramSpherical
  4863. };
  4864. var earthRadius = 63710088e-1;
  4865. var factors = {
  4866. centimeters: earthRadius * 100,
  4867. centimetres: earthRadius * 100,
  4868. degrees: earthRadius / 111325,
  4869. feet: earthRadius * 3.28084,
  4870. inches: earthRadius * 39.37,
  4871. kilometers: earthRadius / 1e3,
  4872. kilometres: earthRadius / 1e3,
  4873. meters: earthRadius,
  4874. metres: earthRadius,
  4875. miles: earthRadius / 1609.344,
  4876. millimeters: earthRadius * 1e3,
  4877. millimetres: earthRadius * 1e3,
  4878. nauticalmiles: earthRadius / 1852,
  4879. radians: 1,
  4880. yards: earthRadius * 1.0936
  4881. };
  4882. var unitsFactors = {
  4883. centimeters: 100,
  4884. centimetres: 100,
  4885. degrees: 1 / 111325,
  4886. feet: 3.28084,
  4887. inches: 39.37,
  4888. kilometers: 1 / 1e3,
  4889. kilometres: 1 / 1e3,
  4890. meters: 1,
  4891. metres: 1,
  4892. miles: 1 / 1609.344,
  4893. millimeters: 1e3,
  4894. millimetres: 1e3,
  4895. nauticalmiles: 1 / 1852,
  4896. radians: 1 / earthRadius,
  4897. yards: 1.0936133
  4898. };
  4899. var areaFactors = {
  4900. acres: 247105e-9,
  4901. centimeters: 1e4,
  4902. centimetres: 1e4,
  4903. feet: 10.763910417,
  4904. hectares: 1e-4,
  4905. inches: 1550.003100006,
  4906. kilometers: 1e-6,
  4907. kilometres: 1e-6,
  4908. meters: 1,
  4909. metres: 1,
  4910. miles: 386e-9,
  4911. millimeters: 1e6,
  4912. millimetres: 1e6,
  4913. yards: 1.195990046
  4914. };
  4915. function feature(geom, properties, options2) {
  4916. if (options2 === void 0) {
  4917. options2 = {};
  4918. }
  4919. var feat = { type: "Feature" };
  4920. if (options2.id === 0 || options2.id) {
  4921. feat.id = options2.id;
  4922. }
  4923. if (options2.bbox) {
  4924. feat.bbox = options2.bbox;
  4925. }
  4926. feat.properties = properties || {};
  4927. feat.geometry = geom;
  4928. return feat;
  4929. }
  4930. function geometry(type2, coordinates, _options) {
  4931. switch (type2) {
  4932. case "Point":
  4933. return point(coordinates).geometry;
  4934. case "LineString":
  4935. return lineString(coordinates).geometry;
  4936. case "Polygon":
  4937. return polygon(coordinates).geometry;
  4938. case "MultiPoint":
  4939. return multiPoint(coordinates).geometry;
  4940. case "MultiLineString":
  4941. return multiLineString(coordinates).geometry;
  4942. case "MultiPolygon":
  4943. return multiPolygon(coordinates).geometry;
  4944. default:
  4945. throw new Error(type2 + " is invalid");
  4946. }
  4947. }
  4948. function point(coordinates, properties, options2) {
  4949. if (options2 === void 0) {
  4950. options2 = {};
  4951. }
  4952. if (!coordinates) {
  4953. throw new Error("coordinates is required");
  4954. }
  4955. if (!Array.isArray(coordinates)) {
  4956. throw new Error("coordinates must be an Array");
  4957. }
  4958. if (coordinates.length < 2) {
  4959. throw new Error("coordinates must be at least 2 numbers long");
  4960. }
  4961. if (!isNumber$1(coordinates[0]) || !isNumber$1(coordinates[1])) {
  4962. throw new Error("coordinates must contain numbers");
  4963. }
  4964. var geom = {
  4965. type: "Point",
  4966. coordinates
  4967. };
  4968. return feature(geom, properties, options2);
  4969. }
  4970. function points(coordinates, properties, options2) {
  4971. if (options2 === void 0) {
  4972. options2 = {};
  4973. }
  4974. return featureCollection$1(coordinates.map(function(coords) {
  4975. return point(coords, properties);
  4976. }), options2);
  4977. }
  4978. function polygon(coordinates, properties, options2) {
  4979. if (options2 === void 0) {
  4980. options2 = {};
  4981. }
  4982. for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
  4983. var ring = coordinates_1[_i];
  4984. if (ring.length < 4) {
  4985. throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  4986. }
  4987. for (var j = 0; j < ring[ring.length - 1].length; j++) {
  4988. if (ring[ring.length - 1][j] !== ring[0][j]) {
  4989. throw new Error("First and last Position are not equivalent.");
  4990. }
  4991. }
  4992. }
  4993. var geom = {
  4994. type: "Polygon",
  4995. coordinates
  4996. };
  4997. return feature(geom, properties, options2);
  4998. }
  4999. function polygons(coordinates, properties, options2) {
  5000. if (options2 === void 0) {
  5001. options2 = {};
  5002. }
  5003. return featureCollection$1(coordinates.map(function(coords) {
  5004. return polygon(coords, properties);
  5005. }), options2);
  5006. }
  5007. function lineString(coordinates, properties, options2) {
  5008. if (options2 === void 0) {
  5009. options2 = {};
  5010. }
  5011. if (coordinates.length < 2) {
  5012. throw new Error("coordinates must be an array of two or more positions");
  5013. }
  5014. var geom = {
  5015. type: "LineString",
  5016. coordinates
  5017. };
  5018. return feature(geom, properties, options2);
  5019. }
  5020. function lineStrings(coordinates, properties, options2) {
  5021. if (options2 === void 0) {
  5022. options2 = {};
  5023. }
  5024. return featureCollection$1(coordinates.map(function(coords) {
  5025. return lineString(coords, properties);
  5026. }), options2);
  5027. }
  5028. function featureCollection$1(features, options2) {
  5029. if (options2 === void 0) {
  5030. options2 = {};
  5031. }
  5032. var fc = { type: "FeatureCollection" };
  5033. if (options2.id) {
  5034. fc.id = options2.id;
  5035. }
  5036. if (options2.bbox) {
  5037. fc.bbox = options2.bbox;
  5038. }
  5039. fc.features = features;
  5040. return fc;
  5041. }
  5042. function multiLineString(coordinates, properties, options2) {
  5043. if (options2 === void 0) {
  5044. options2 = {};
  5045. }
  5046. var geom = {
  5047. type: "MultiLineString",
  5048. coordinates
  5049. };
  5050. return feature(geom, properties, options2);
  5051. }
  5052. function multiPoint(coordinates, properties, options2) {
  5053. if (options2 === void 0) {
  5054. options2 = {};
  5055. }
  5056. var geom = {
  5057. type: "MultiPoint",
  5058. coordinates
  5059. };
  5060. return feature(geom, properties, options2);
  5061. }
  5062. function multiPolygon(coordinates, properties, options2) {
  5063. if (options2 === void 0) {
  5064. options2 = {};
  5065. }
  5066. var geom = {
  5067. type: "MultiPolygon",
  5068. coordinates
  5069. };
  5070. return feature(geom, properties, options2);
  5071. }
  5072. function geometryCollection(geometries, properties, options2) {
  5073. if (options2 === void 0) {
  5074. options2 = {};
  5075. }
  5076. var geom = {
  5077. type: "GeometryCollection",
  5078. geometries
  5079. };
  5080. return feature(geom, properties, options2);
  5081. }
  5082. function round(num, precision) {
  5083. if (precision === void 0) {
  5084. precision = 0;
  5085. }
  5086. if (precision && !(precision >= 0)) {
  5087. throw new Error("precision must be a positive number");
  5088. }
  5089. var multiplier = Math.pow(10, precision || 0);
  5090. return Math.round(num * multiplier) / multiplier;
  5091. }
  5092. function radiansToLength(radians, units) {
  5093. if (units === void 0) {
  5094. units = "kilometers";
  5095. }
  5096. var factor = factors[units];
  5097. if (!factor) {
  5098. throw new Error(units + " units is invalid");
  5099. }
  5100. return radians * factor;
  5101. }
  5102. function lengthToRadians(distance2, units) {
  5103. if (units === void 0) {
  5104. units = "kilometers";
  5105. }
  5106. var factor = factors[units];
  5107. if (!factor) {
  5108. throw new Error(units + " units is invalid");
  5109. }
  5110. return distance2 / factor;
  5111. }
  5112. function lengthToDegrees(distance2, units) {
  5113. return radiansToDegrees(lengthToRadians(distance2, units));
  5114. }
  5115. function bearingToAzimuth(bearing2) {
  5116. var angle = bearing2 % 360;
  5117. if (angle < 0) {
  5118. angle += 360;
  5119. }
  5120. return angle;
  5121. }
  5122. function radiansToDegrees(radians) {
  5123. var degrees = radians % (2 * Math.PI);
  5124. return degrees * 180 / Math.PI;
  5125. }
  5126. function degreesToRadians(degrees) {
  5127. var radians = degrees % 360;
  5128. return radians * Math.PI / 180;
  5129. }
  5130. function convertLength(length, originalUnit, finalUnit) {
  5131. if (originalUnit === void 0) {
  5132. originalUnit = "kilometers";
  5133. }
  5134. if (finalUnit === void 0) {
  5135. finalUnit = "kilometers";
  5136. }
  5137. if (!(length >= 0)) {
  5138. throw new Error("length must be a positive number");
  5139. }
  5140. return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
  5141. }
  5142. function convertArea(area, originalUnit, finalUnit) {
  5143. if (originalUnit === void 0) {
  5144. originalUnit = "meters";
  5145. }
  5146. if (finalUnit === void 0) {
  5147. finalUnit = "kilometers";
  5148. }
  5149. if (!(area >= 0)) {
  5150. throw new Error("area must be a positive number");
  5151. }
  5152. var startFactor = areaFactors[originalUnit];
  5153. if (!startFactor) {
  5154. throw new Error("invalid original units");
  5155. }
  5156. var finalFactor = areaFactors[finalUnit];
  5157. if (!finalFactor) {
  5158. throw new Error("invalid final units");
  5159. }
  5160. return area / startFactor * finalFactor;
  5161. }
  5162. function isNumber$1(num) {
  5163. return !isNaN(num) && num !== null && !Array.isArray(num);
  5164. }
  5165. function isObject$6(input) {
  5166. return !!input && input.constructor === Object;
  5167. }
  5168. function validateBBox(bbox2) {
  5169. if (!bbox2) {
  5170. throw new Error("bbox is required");
  5171. }
  5172. if (!Array.isArray(bbox2)) {
  5173. throw new Error("bbox must be an Array");
  5174. }
  5175. if (bbox2.length !== 4 && bbox2.length !== 6) {
  5176. throw new Error("bbox must be an Array of 4 or 6 numbers");
  5177. }
  5178. bbox2.forEach(function(num) {
  5179. if (!isNumber$1(num)) {
  5180. throw new Error("bbox must only contain numbers");
  5181. }
  5182. });
  5183. }
  5184. function validateId(id) {
  5185. if (!id) {
  5186. throw new Error("id is required");
  5187. }
  5188. if (["string", "number"].indexOf(typeof id) === -1) {
  5189. throw new Error("id must be a number or a string");
  5190. }
  5191. }
  5192. var es$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5193. __proto__: null,
  5194. earthRadius,
  5195. factors,
  5196. unitsFactors,
  5197. areaFactors,
  5198. feature,
  5199. geometry,
  5200. point,
  5201. points,
  5202. polygon,
  5203. polygons,
  5204. lineString,
  5205. lineStrings,
  5206. featureCollection: featureCollection$1,
  5207. multiLineString,
  5208. multiPoint,
  5209. multiPolygon,
  5210. geometryCollection,
  5211. round,
  5212. radiansToLength,
  5213. lengthToRadians,
  5214. lengthToDegrees,
  5215. bearingToAzimuth,
  5216. radiansToDegrees,
  5217. degreesToRadians,
  5218. convertLength,
  5219. convertArea,
  5220. isNumber: isNumber$1,
  5221. isObject: isObject$6,
  5222. validateBBox,
  5223. validateId
  5224. }, Symbol.toStringTag, { value: "Module" }));
  5225. function coordEach(geojson, callback2, excludeWrapCoord) {
  5226. if (geojson === null)
  5227. return;
  5228. 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;
  5229. for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
  5230. geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
  5231. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  5232. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  5233. for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
  5234. var multiFeatureIndex = 0;
  5235. var geometryIndex = 0;
  5236. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
  5237. if (geometry2 === null)
  5238. continue;
  5239. coords = geometry2.coordinates;
  5240. var geomType = geometry2.type;
  5241. wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
  5242. switch (geomType) {
  5243. case null:
  5244. break;
  5245. case "Point":
  5246. if (callback2(
  5247. coords,
  5248. coordIndex,
  5249. featureIndex,
  5250. multiFeatureIndex,
  5251. geometryIndex
  5252. ) === false)
  5253. return false;
  5254. coordIndex++;
  5255. multiFeatureIndex++;
  5256. break;
  5257. case "LineString":
  5258. case "MultiPoint":
  5259. for (j = 0; j < coords.length; j++) {
  5260. if (callback2(
  5261. coords[j],
  5262. coordIndex,
  5263. featureIndex,
  5264. multiFeatureIndex,
  5265. geometryIndex
  5266. ) === false)
  5267. return false;
  5268. coordIndex++;
  5269. if (geomType === "MultiPoint")
  5270. multiFeatureIndex++;
  5271. }
  5272. if (geomType === "LineString")
  5273. multiFeatureIndex++;
  5274. break;
  5275. case "Polygon":
  5276. case "MultiLineString":
  5277. for (j = 0; j < coords.length; j++) {
  5278. for (k = 0; k < coords[j].length - wrapShrink; k++) {
  5279. if (callback2(
  5280. coords[j][k],
  5281. coordIndex,
  5282. featureIndex,
  5283. multiFeatureIndex,
  5284. geometryIndex
  5285. ) === false)
  5286. return false;
  5287. coordIndex++;
  5288. }
  5289. if (geomType === "MultiLineString")
  5290. multiFeatureIndex++;
  5291. if (geomType === "Polygon")
  5292. geometryIndex++;
  5293. }
  5294. if (geomType === "Polygon")
  5295. multiFeatureIndex++;
  5296. break;
  5297. case "MultiPolygon":
  5298. for (j = 0; j < coords.length; j++) {
  5299. geometryIndex = 0;
  5300. for (k = 0; k < coords[j].length; k++) {
  5301. for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
  5302. if (callback2(
  5303. coords[j][k][l],
  5304. coordIndex,
  5305. featureIndex,
  5306. multiFeatureIndex,
  5307. geometryIndex
  5308. ) === false)
  5309. return false;
  5310. coordIndex++;
  5311. }
  5312. geometryIndex++;
  5313. }
  5314. multiFeatureIndex++;
  5315. }
  5316. break;
  5317. case "GeometryCollection":
  5318. for (j = 0; j < geometry2.geometries.length; j++)
  5319. if (coordEach(geometry2.geometries[j], callback2, excludeWrapCoord) === false)
  5320. return false;
  5321. break;
  5322. default:
  5323. throw new Error("Unknown Geometry Type");
  5324. }
  5325. }
  5326. }
  5327. }
  5328. function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) {
  5329. var previousValue = initialValue;
  5330. coordEach(
  5331. geojson,
  5332. function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
  5333. if (coordIndex === 0 && initialValue === void 0)
  5334. previousValue = currentCoord;
  5335. else
  5336. previousValue = callback2(
  5337. previousValue,
  5338. currentCoord,
  5339. coordIndex,
  5340. featureIndex,
  5341. multiFeatureIndex,
  5342. geometryIndex
  5343. );
  5344. },
  5345. excludeWrapCoord
  5346. );
  5347. return previousValue;
  5348. }
  5349. function propEach(geojson, callback2) {
  5350. var i2;
  5351. switch (geojson.type) {
  5352. case "FeatureCollection":
  5353. for (i2 = 0; i2 < geojson.features.length; i2++) {
  5354. if (callback2(geojson.features[i2].properties, i2) === false)
  5355. break;
  5356. }
  5357. break;
  5358. case "Feature":
  5359. callback2(geojson.properties, 0);
  5360. break;
  5361. }
  5362. }
  5363. function propReduce(geojson, callback2, initialValue) {
  5364. var previousValue = initialValue;
  5365. propEach(geojson, function(currentProperties, featureIndex) {
  5366. if (featureIndex === 0 && initialValue === void 0)
  5367. previousValue = currentProperties;
  5368. else
  5369. previousValue = callback2(previousValue, currentProperties, featureIndex);
  5370. });
  5371. return previousValue;
  5372. }
  5373. function featureEach$1(geojson, callback2) {
  5374. if (geojson.type === "Feature") {
  5375. callback2(geojson, 0);
  5376. } else if (geojson.type === "FeatureCollection") {
  5377. for (var i2 = 0; i2 < geojson.features.length; i2++) {
  5378. if (callback2(geojson.features[i2], i2) === false)
  5379. break;
  5380. }
  5381. }
  5382. }
  5383. function featureReduce(geojson, callback2, initialValue) {
  5384. var previousValue = initialValue;
  5385. featureEach$1(geojson, function(currentFeature, featureIndex) {
  5386. if (featureIndex === 0 && initialValue === void 0)
  5387. previousValue = currentFeature;
  5388. else
  5389. previousValue = callback2(previousValue, currentFeature, featureIndex);
  5390. });
  5391. return previousValue;
  5392. }
  5393. function coordAll(geojson) {
  5394. var coords = [];
  5395. coordEach(geojson, function(coord) {
  5396. coords.push(coord);
  5397. });
  5398. return coords;
  5399. }
  5400. function geomEach(geojson, callback2) {
  5401. 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;
  5402. for (i2 = 0; i2 < stop; i2++) {
  5403. geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
  5404. featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
  5405. featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
  5406. featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
  5407. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  5408. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  5409. for (g = 0; g < stopG; g++) {
  5410. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
  5411. if (geometry2 === null) {
  5412. if (callback2(
  5413. null,
  5414. featureIndex,
  5415. featureProperties,
  5416. featureBBox,
  5417. featureId
  5418. ) === false)
  5419. return false;
  5420. continue;
  5421. }
  5422. switch (geometry2.type) {
  5423. case "Point":
  5424. case "LineString":
  5425. case "MultiPoint":
  5426. case "Polygon":
  5427. case "MultiLineString":
  5428. case "MultiPolygon": {
  5429. if (callback2(
  5430. geometry2,
  5431. featureIndex,
  5432. featureProperties,
  5433. featureBBox,
  5434. featureId
  5435. ) === false)
  5436. return false;
  5437. break;
  5438. }
  5439. case "GeometryCollection": {
  5440. for (j = 0; j < geometry2.geometries.length; j++) {
  5441. if (callback2(
  5442. geometry2.geometries[j],
  5443. featureIndex,
  5444. featureProperties,
  5445. featureBBox,
  5446. featureId
  5447. ) === false)
  5448. return false;
  5449. }
  5450. break;
  5451. }
  5452. default:
  5453. throw new Error("Unknown Geometry Type");
  5454. }
  5455. }
  5456. featureIndex++;
  5457. }
  5458. }
  5459. function geomReduce(geojson, callback2, initialValue) {
  5460. var previousValue = initialValue;
  5461. geomEach(
  5462. geojson,
  5463. function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
  5464. if (featureIndex === 0 && initialValue === void 0)
  5465. previousValue = currentGeometry;
  5466. else
  5467. previousValue = callback2(
  5468. previousValue,
  5469. currentGeometry,
  5470. featureIndex,
  5471. featureProperties,
  5472. featureBBox,
  5473. featureId
  5474. );
  5475. }
  5476. );
  5477. return previousValue;
  5478. }
  5479. function flattenEach(geojson, callback2) {
  5480. geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
  5481. var type2 = geometry2 === null ? null : geometry2.type;
  5482. switch (type2) {
  5483. case null:
  5484. case "Point":
  5485. case "LineString":
  5486. case "Polygon":
  5487. if (callback2(
  5488. feature(geometry2, properties, { bbox: bbox2, id }),
  5489. featureIndex,
  5490. 0
  5491. ) === false)
  5492. return false;
  5493. return;
  5494. }
  5495. var geomType;
  5496. switch (type2) {
  5497. case "MultiPoint":
  5498. geomType = "Point";
  5499. break;
  5500. case "MultiLineString":
  5501. geomType = "LineString";
  5502. break;
  5503. case "MultiPolygon":
  5504. geomType = "Polygon";
  5505. break;
  5506. }
  5507. for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
  5508. var coordinate = geometry2.coordinates[multiFeatureIndex];
  5509. var geom = {
  5510. type: geomType,
  5511. coordinates: coordinate
  5512. };
  5513. if (callback2(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
  5514. return false;
  5515. }
  5516. });
  5517. }
  5518. function flattenReduce(geojson, callback2, initialValue) {
  5519. var previousValue = initialValue;
  5520. flattenEach(
  5521. geojson,
  5522. function(currentFeature, featureIndex, multiFeatureIndex) {
  5523. if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
  5524. previousValue = currentFeature;
  5525. else
  5526. previousValue = callback2(
  5527. previousValue,
  5528. currentFeature,
  5529. featureIndex,
  5530. multiFeatureIndex
  5531. );
  5532. }
  5533. );
  5534. return previousValue;
  5535. }
  5536. function segmentEach(geojson, callback2) {
  5537. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  5538. var segmentIndex = 0;
  5539. if (!feature2.geometry)
  5540. return;
  5541. var type2 = feature2.geometry.type;
  5542. if (type2 === "Point" || type2 === "MultiPoint")
  5543. return;
  5544. var previousCoords;
  5545. var previousFeatureIndex = 0;
  5546. var previousMultiIndex = 0;
  5547. var prevGeomIndex = 0;
  5548. if (coordEach(
  5549. feature2,
  5550. function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
  5551. if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
  5552. previousCoords = currentCoord;
  5553. previousFeatureIndex = featureIndex;
  5554. previousMultiIndex = multiPartIndexCoord;
  5555. prevGeomIndex = geometryIndex;
  5556. segmentIndex = 0;
  5557. return;
  5558. }
  5559. var currentSegment = lineString(
  5560. [previousCoords, currentCoord],
  5561. feature2.properties
  5562. );
  5563. if (callback2(
  5564. currentSegment,
  5565. featureIndex,
  5566. multiFeatureIndex,
  5567. geometryIndex,
  5568. segmentIndex
  5569. ) === false)
  5570. return false;
  5571. segmentIndex++;
  5572. previousCoords = currentCoord;
  5573. }
  5574. ) === false)
  5575. return false;
  5576. });
  5577. }
  5578. function segmentReduce(geojson, callback2, initialValue) {
  5579. var previousValue = initialValue;
  5580. var started = false;
  5581. segmentEach(
  5582. geojson,
  5583. function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
  5584. if (started === false && initialValue === void 0)
  5585. previousValue = currentSegment;
  5586. else
  5587. previousValue = callback2(
  5588. previousValue,
  5589. currentSegment,
  5590. featureIndex,
  5591. multiFeatureIndex,
  5592. geometryIndex,
  5593. segmentIndex
  5594. );
  5595. started = true;
  5596. }
  5597. );
  5598. return previousValue;
  5599. }
  5600. function lineEach(geojson, callback2) {
  5601. if (!geojson)
  5602. throw new Error("geojson is required");
  5603. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  5604. if (feature2.geometry === null)
  5605. return;
  5606. var type2 = feature2.geometry.type;
  5607. var coords = feature2.geometry.coordinates;
  5608. switch (type2) {
  5609. case "LineString":
  5610. if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)
  5611. return false;
  5612. break;
  5613. case "Polygon":
  5614. for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {
  5615. if (callback2(
  5616. lineString(coords[geometryIndex], feature2.properties),
  5617. featureIndex,
  5618. multiFeatureIndex,
  5619. geometryIndex
  5620. ) === false)
  5621. return false;
  5622. }
  5623. break;
  5624. }
  5625. });
  5626. }
  5627. function lineReduce(geojson, callback2, initialValue) {
  5628. var previousValue = initialValue;
  5629. lineEach(
  5630. geojson,
  5631. function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {
  5632. if (featureIndex === 0 && initialValue === void 0)
  5633. previousValue = currentLine;
  5634. else
  5635. previousValue = callback2(
  5636. previousValue,
  5637. currentLine,
  5638. featureIndex,
  5639. multiFeatureIndex,
  5640. geometryIndex
  5641. );
  5642. }
  5643. );
  5644. return previousValue;
  5645. }
  5646. function findSegment(geojson, options2) {
  5647. options2 = options2 || {};
  5648. if (!isObject$6(options2))
  5649. throw new Error("options is invalid");
  5650. var featureIndex = options2.featureIndex || 0;
  5651. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  5652. var geometryIndex = options2.geometryIndex || 0;
  5653. var segmentIndex = options2.segmentIndex || 0;
  5654. var properties = options2.properties;
  5655. var geometry2;
  5656. switch (geojson.type) {
  5657. case "FeatureCollection":
  5658. if (featureIndex < 0)
  5659. featureIndex = geojson.features.length + featureIndex;
  5660. properties = properties || geojson.features[featureIndex].properties;
  5661. geometry2 = geojson.features[featureIndex].geometry;
  5662. break;
  5663. case "Feature":
  5664. properties = properties || geojson.properties;
  5665. geometry2 = geojson.geometry;
  5666. break;
  5667. case "Point":
  5668. case "MultiPoint":
  5669. return null;
  5670. case "LineString":
  5671. case "Polygon":
  5672. case "MultiLineString":
  5673. case "MultiPolygon":
  5674. geometry2 = geojson;
  5675. break;
  5676. default:
  5677. throw new Error("geojson is invalid");
  5678. }
  5679. if (geometry2 === null)
  5680. return null;
  5681. var coords = geometry2.coordinates;
  5682. switch (geometry2.type) {
  5683. case "Point":
  5684. case "MultiPoint":
  5685. return null;
  5686. case "LineString":
  5687. if (segmentIndex < 0)
  5688. segmentIndex = coords.length + segmentIndex - 1;
  5689. return lineString(
  5690. [coords[segmentIndex], coords[segmentIndex + 1]],
  5691. properties,
  5692. options2
  5693. );
  5694. case "Polygon":
  5695. if (geometryIndex < 0)
  5696. geometryIndex = coords.length + geometryIndex;
  5697. if (segmentIndex < 0)
  5698. segmentIndex = coords[geometryIndex].length + segmentIndex - 1;
  5699. return lineString(
  5700. [
  5701. coords[geometryIndex][segmentIndex],
  5702. coords[geometryIndex][segmentIndex + 1]
  5703. ],
  5704. properties,
  5705. options2
  5706. );
  5707. case "MultiLineString":
  5708. if (multiFeatureIndex < 0)
  5709. multiFeatureIndex = coords.length + multiFeatureIndex;
  5710. if (segmentIndex < 0)
  5711. segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;
  5712. return lineString(
  5713. [
  5714. coords[multiFeatureIndex][segmentIndex],
  5715. coords[multiFeatureIndex][segmentIndex + 1]
  5716. ],
  5717. properties,
  5718. options2
  5719. );
  5720. case "MultiPolygon":
  5721. if (multiFeatureIndex < 0)
  5722. multiFeatureIndex = coords.length + multiFeatureIndex;
  5723. if (geometryIndex < 0)
  5724. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  5725. if (segmentIndex < 0)
  5726. segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;
  5727. return lineString(
  5728. [
  5729. coords[multiFeatureIndex][geometryIndex][segmentIndex],
  5730. coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]
  5731. ],
  5732. properties,
  5733. options2
  5734. );
  5735. }
  5736. throw new Error("geojson is invalid");
  5737. }
  5738. function findPoint(geojson, options2) {
  5739. options2 = options2 || {};
  5740. if (!isObject$6(options2))
  5741. throw new Error("options is invalid");
  5742. var featureIndex = options2.featureIndex || 0;
  5743. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  5744. var geometryIndex = options2.geometryIndex || 0;
  5745. var coordIndex = options2.coordIndex || 0;
  5746. var properties = options2.properties;
  5747. var geometry2;
  5748. switch (geojson.type) {
  5749. case "FeatureCollection":
  5750. if (featureIndex < 0)
  5751. featureIndex = geojson.features.length + featureIndex;
  5752. properties = properties || geojson.features[featureIndex].properties;
  5753. geometry2 = geojson.features[featureIndex].geometry;
  5754. break;
  5755. case "Feature":
  5756. properties = properties || geojson.properties;
  5757. geometry2 = geojson.geometry;
  5758. break;
  5759. case "Point":
  5760. case "MultiPoint":
  5761. return null;
  5762. case "LineString":
  5763. case "Polygon":
  5764. case "MultiLineString":
  5765. case "MultiPolygon":
  5766. geometry2 = geojson;
  5767. break;
  5768. default:
  5769. throw new Error("geojson is invalid");
  5770. }
  5771. if (geometry2 === null)
  5772. return null;
  5773. var coords = geometry2.coordinates;
  5774. switch (geometry2.type) {
  5775. case "Point":
  5776. return point(coords, properties, options2);
  5777. case "MultiPoint":
  5778. if (multiFeatureIndex < 0)
  5779. multiFeatureIndex = coords.length + multiFeatureIndex;
  5780. return point(coords[multiFeatureIndex], properties, options2);
  5781. case "LineString":
  5782. if (coordIndex < 0)
  5783. coordIndex = coords.length + coordIndex;
  5784. return point(coords[coordIndex], properties, options2);
  5785. case "Polygon":
  5786. if (geometryIndex < 0)
  5787. geometryIndex = coords.length + geometryIndex;
  5788. if (coordIndex < 0)
  5789. coordIndex = coords[geometryIndex].length + coordIndex;
  5790. return point(coords[geometryIndex][coordIndex], properties, options2);
  5791. case "MultiLineString":
  5792. if (multiFeatureIndex < 0)
  5793. multiFeatureIndex = coords.length + multiFeatureIndex;
  5794. if (coordIndex < 0)
  5795. coordIndex = coords[multiFeatureIndex].length + coordIndex;
  5796. return point(coords[multiFeatureIndex][coordIndex], properties, options2);
  5797. case "MultiPolygon":
  5798. if (multiFeatureIndex < 0)
  5799. multiFeatureIndex = coords.length + multiFeatureIndex;
  5800. if (geometryIndex < 0)
  5801. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  5802. if (coordIndex < 0)
  5803. coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;
  5804. return point(
  5805. coords[multiFeatureIndex][geometryIndex][coordIndex],
  5806. properties,
  5807. options2
  5808. );
  5809. }
  5810. throw new Error("geojson is invalid");
  5811. }
  5812. var es$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5813. __proto__: null,
  5814. coordAll,
  5815. coordEach,
  5816. coordReduce,
  5817. featureEach: featureEach$1,
  5818. featureReduce,
  5819. findPoint,
  5820. findSegment,
  5821. flattenEach,
  5822. flattenReduce,
  5823. geomEach,
  5824. geomReduce,
  5825. lineEach,
  5826. lineReduce,
  5827. propEach,
  5828. propReduce,
  5829. segmentEach,
  5830. segmentReduce
  5831. }, Symbol.toStringTag, { value: "Module" }));
  5832. function bbox$1(geojson) {
  5833. var result = [Infinity, Infinity, -Infinity, -Infinity];
  5834. coordEach(geojson, function(coord) {
  5835. if (result[0] > coord[0]) {
  5836. result[0] = coord[0];
  5837. }
  5838. if (result[1] > coord[1]) {
  5839. result[1] = coord[1];
  5840. }
  5841. if (result[2] < coord[0]) {
  5842. result[2] = coord[0];
  5843. }
  5844. if (result[3] < coord[1]) {
  5845. result[3] = coord[1];
  5846. }
  5847. });
  5848. return result;
  5849. }
  5850. bbox$1["default"] = bbox$1;
  5851. var es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5852. __proto__: null,
  5853. "default": bbox$1
  5854. }, Symbol.toStringTag, { value: "Module" }));
  5855. function getCoord(coord) {
  5856. if (!coord) {
  5857. throw new Error("coord is required");
  5858. }
  5859. if (!Array.isArray(coord)) {
  5860. if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
  5861. return coord.geometry.coordinates;
  5862. }
  5863. if (coord.type === "Point") {
  5864. return coord.coordinates;
  5865. }
  5866. }
  5867. if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
  5868. return coord;
  5869. }
  5870. throw new Error("coord must be GeoJSON Point or an Array of numbers");
  5871. }
  5872. function getCoords(coords) {
  5873. if (Array.isArray(coords)) {
  5874. return coords;
  5875. }
  5876. if (coords.type === "Feature") {
  5877. if (coords.geometry !== null) {
  5878. return coords.geometry.coordinates;
  5879. }
  5880. } else {
  5881. if (coords.coordinates) {
  5882. return coords.coordinates;
  5883. }
  5884. }
  5885. throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
  5886. }
  5887. function getGeom(geojson) {
  5888. if (geojson.type === "Feature") {
  5889. return geojson.geometry;
  5890. }
  5891. return geojson;
  5892. }
  5893. function getType(geojson, _name) {
  5894. if (geojson.type === "FeatureCollection") {
  5895. return "FeatureCollection";
  5896. }
  5897. if (geojson.type === "GeometryCollection") {
  5898. return "GeometryCollection";
  5899. }
  5900. if (geojson.type === "Feature" && geojson.geometry !== null) {
  5901. return geojson.geometry.type;
  5902. }
  5903. return geojson.type;
  5904. }
  5905. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  5906. function getDefaultExportFromCjs(x) {
  5907. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  5908. }
  5909. function getAugmentedNamespace(n) {
  5910. if (n.__esModule)
  5911. return n;
  5912. var a = Object.defineProperty({}, "__esModule", { value: true });
  5913. Object.keys(n).forEach(function(k) {
  5914. var d2 = Object.getOwnPropertyDescriptor(n, k);
  5915. Object.defineProperty(a, k, d2.get ? d2 : {
  5916. enumerable: true,
  5917. get: function() {
  5918. return n[k];
  5919. }
  5920. });
  5921. });
  5922. return a;
  5923. }
  5924. var concaveman$2 = { exports: {} };
  5925. var rbush_min$1 = { exports: {} };
  5926. (function(module2, exports2) {
  5927. !function(t2, i2) {
  5928. module2.exports = i2();
  5929. }(commonjsGlobal, function() {
  5930. function t2(t3, r3, e2, a2, h3) {
  5931. !function t4(n2, r4, e3, a3, h4) {
  5932. for (; a3 > e3; ) {
  5933. if (a3 - e3 > 600) {
  5934. 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));
  5935. t4(n2, r4, m2, c2, h4);
  5936. }
  5937. var p2 = n2[r4], d3 = e3, x = a3;
  5938. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  5939. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  5940. d3++;
  5941. for (; h4(n2[x], p2) > 0; )
  5942. x--;
  5943. }
  5944. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  5945. }
  5946. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  5947. }
  5948. function i2(t3, i3, n2) {
  5949. var r3 = t3[i3];
  5950. t3[i3] = t3[n2], t3[n2] = r3;
  5951. }
  5952. function n(t3, i3) {
  5953. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  5954. }
  5955. var r2 = function(t3) {
  5956. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  5957. };
  5958. function e(t3, i3, n2) {
  5959. if (!n2)
  5960. return i3.indexOf(t3);
  5961. for (var r3 = 0; r3 < i3.length; r3++)
  5962. if (n2(t3, i3[r3]))
  5963. return r3;
  5964. return -1;
  5965. }
  5966. function a(t3, i3) {
  5967. h2(t3, 0, t3.children.length, i3, t3);
  5968. }
  5969. function h2(t3, i3, n2, r3, e2) {
  5970. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  5971. for (var a2 = i3; a2 < n2; a2++) {
  5972. var h3 = t3.children[a2];
  5973. o(e2, t3.leaf ? r3(h3) : h3);
  5974. }
  5975. return e2;
  5976. }
  5977. function o(t3, i3) {
  5978. 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;
  5979. }
  5980. function s(t3, i3) {
  5981. return t3.minX - i3.minX;
  5982. }
  5983. function l(t3, i3) {
  5984. return t3.minY - i3.minY;
  5985. }
  5986. function f(t3) {
  5987. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  5988. }
  5989. function u(t3) {
  5990. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  5991. }
  5992. function m(t3, i3) {
  5993. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  5994. }
  5995. function c(t3, i3) {
  5996. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  5997. }
  5998. function p(t3) {
  5999. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  6000. }
  6001. function d2(i3, n2, r3, e2, a2) {
  6002. for (var h3 = [n2, r3]; h3.length; )
  6003. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  6004. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  6005. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  6006. }
  6007. }
  6008. return r2.prototype.all = function() {
  6009. return this._all(this.data, []);
  6010. }, r2.prototype.search = function(t3) {
  6011. var i3 = this.data, n2 = [];
  6012. if (!c(t3, i3))
  6013. return n2;
  6014. for (var r3 = this.toBBox, e2 = []; i3; ) {
  6015. for (var a2 = 0; a2 < i3.children.length; a2++) {
  6016. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  6017. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  6018. }
  6019. i3 = e2.pop();
  6020. }
  6021. return n2;
  6022. }, r2.prototype.collides = function(t3) {
  6023. var i3 = this.data;
  6024. if (!c(t3, i3))
  6025. return false;
  6026. for (var n2 = []; i3; ) {
  6027. for (var r3 = 0; r3 < i3.children.length; r3++) {
  6028. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  6029. if (c(t3, a2)) {
  6030. if (i3.leaf || m(t3, a2))
  6031. return true;
  6032. n2.push(e2);
  6033. }
  6034. }
  6035. i3 = n2.pop();
  6036. }
  6037. return false;
  6038. }, r2.prototype.load = function(t3) {
  6039. if (!t3 || !t3.length)
  6040. return this;
  6041. if (t3.length < this._minEntries) {
  6042. for (var i3 = 0; i3 < t3.length; i3++)
  6043. this.insert(t3[i3]);
  6044. return this;
  6045. }
  6046. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  6047. if (this.data.children.length)
  6048. if (this.data.height === n2.height)
  6049. this._splitRoot(this.data, n2);
  6050. else {
  6051. if (this.data.height < n2.height) {
  6052. var r3 = this.data;
  6053. this.data = n2, n2 = r3;
  6054. }
  6055. this._insert(n2, this.data.height - n2.height - 1, true);
  6056. }
  6057. else
  6058. this.data = n2;
  6059. return this;
  6060. }, r2.prototype.insert = function(t3) {
  6061. return t3 && this._insert(t3, this.data.height - 1), this;
  6062. }, r2.prototype.clear = function() {
  6063. return this.data = p([]), this;
  6064. }, r2.prototype.remove = function(t3, i3) {
  6065. if (!t3)
  6066. return this;
  6067. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  6068. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  6069. var f2 = e(t3, h3.children, i3);
  6070. if (-1 !== f2)
  6071. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  6072. }
  6073. 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]);
  6074. }
  6075. return this;
  6076. }, r2.prototype.toBBox = function(t3) {
  6077. return t3;
  6078. }, r2.prototype.compareMinX = function(t3, i3) {
  6079. return t3.minX - i3.minX;
  6080. }, r2.prototype.compareMinY = function(t3, i3) {
  6081. return t3.minY - i3.minY;
  6082. }, r2.prototype.toJSON = function() {
  6083. return this.data;
  6084. }, r2.prototype.fromJSON = function(t3) {
  6085. return this.data = t3, this;
  6086. }, r2.prototype._all = function(t3, i3) {
  6087. for (var n2 = []; t3; )
  6088. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  6089. return i3;
  6090. }, r2.prototype._build = function(t3, i3, n2, r3) {
  6091. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  6092. if (h3 <= o2)
  6093. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  6094. 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;
  6095. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  6096. d2(t3, i3, n2, l2, this.compareMinX);
  6097. for (var f2 = i3; f2 <= n2; f2 += l2) {
  6098. var u2 = Math.min(f2 + l2 - 1, n2);
  6099. d2(t3, f2, u2, s2, this.compareMinY);
  6100. for (var m2 = f2; m2 <= u2; m2 += s2) {
  6101. var c2 = Math.min(m2 + s2 - 1, u2);
  6102. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  6103. }
  6104. }
  6105. return a(e2, this.toBBox), e2;
  6106. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  6107. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  6108. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  6109. 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);
  6110. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  6111. }
  6112. i3 = h3 || i3.children[0];
  6113. }
  6114. var m2, c2;
  6115. return i3;
  6116. }, r2.prototype._insert = function(t3, i3, n2) {
  6117. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  6118. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  6119. this._split(e2, i3), i3--;
  6120. this._adjustParentBBoxes(r3, e2, i3);
  6121. }, r2.prototype._split = function(t3, i3) {
  6122. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  6123. this._chooseSplitAxis(n2, e2, r3);
  6124. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  6125. 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);
  6126. }, r2.prototype._splitRoot = function(t3, i3) {
  6127. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  6128. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  6129. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  6130. 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);
  6131. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  6132. }
  6133. return r3 || n2 - i3;
  6134. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  6135. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  6136. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  6137. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  6138. t3.children.sort(r3);
  6139. 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++) {
  6140. var m2 = t3.children[f2];
  6141. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  6142. }
  6143. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  6144. var p2 = t3.children[c2];
  6145. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  6146. }
  6147. return l2;
  6148. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  6149. for (var r3 = n2; r3 >= 0; r3--)
  6150. o(i3[r3], t3);
  6151. }, r2.prototype._condense = function(t3) {
  6152. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  6153. 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);
  6154. }, r2;
  6155. });
  6156. })(rbush_min$1);
  6157. class TinyQueue {
  6158. constructor(data = [], compare = defaultCompare) {
  6159. this.data = data;
  6160. this.length = this.data.length;
  6161. this.compare = compare;
  6162. if (this.length > 0) {
  6163. for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--)
  6164. this._down(i2);
  6165. }
  6166. }
  6167. push(item) {
  6168. this.data.push(item);
  6169. this.length++;
  6170. this._up(this.length - 1);
  6171. }
  6172. pop() {
  6173. if (this.length === 0)
  6174. return void 0;
  6175. const top = this.data[0];
  6176. const bottom = this.data.pop();
  6177. this.length--;
  6178. if (this.length > 0) {
  6179. this.data[0] = bottom;
  6180. this._down(0);
  6181. }
  6182. return top;
  6183. }
  6184. peek() {
  6185. return this.data[0];
  6186. }
  6187. _up(pos) {
  6188. const { data, compare } = this;
  6189. const item = data[pos];
  6190. while (pos > 0) {
  6191. const parent = pos - 1 >> 1;
  6192. const current = data[parent];
  6193. if (compare(item, current) >= 0)
  6194. break;
  6195. data[pos] = current;
  6196. pos = parent;
  6197. }
  6198. data[pos] = item;
  6199. }
  6200. _down(pos) {
  6201. const { data, compare } = this;
  6202. const halfLength = this.length >> 1;
  6203. const item = data[pos];
  6204. while (pos < halfLength) {
  6205. let left = (pos << 1) + 1;
  6206. let best = data[left];
  6207. const right = left + 1;
  6208. if (right < this.length && compare(data[right], best) < 0) {
  6209. left = right;
  6210. best = data[right];
  6211. }
  6212. if (compare(best, item) >= 0)
  6213. break;
  6214. data[pos] = best;
  6215. pos = left;
  6216. }
  6217. data[pos] = item;
  6218. }
  6219. }
  6220. function defaultCompare(a, b) {
  6221. return a < b ? -1 : a > b ? 1 : 0;
  6222. }
  6223. var tinyqueue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  6224. __proto__: null,
  6225. "default": TinyQueue
  6226. }, Symbol.toStringTag, { value: "Module" }));
  6227. var require$$1$2 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue);
  6228. var pointInPolygon$1 = { exports: {} };
  6229. var flat = function pointInPolygonFlat(point2, vs, start2, end) {
  6230. var x = point2[0], y = point2[1];
  6231. var inside2 = false;
  6232. if (start2 === void 0)
  6233. start2 = 0;
  6234. if (end === void 0)
  6235. end = vs.length;
  6236. var len = (end - start2) / 2;
  6237. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  6238. var xi = vs[start2 + i2 * 2 + 0], yi = vs[start2 + i2 * 2 + 1];
  6239. var xj = vs[start2 + j * 2 + 0], yj = vs[start2 + j * 2 + 1];
  6240. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  6241. if (intersect)
  6242. inside2 = !inside2;
  6243. }
  6244. return inside2;
  6245. };
  6246. var nested = function pointInPolygonNested(point2, vs, start2, end) {
  6247. var x = point2[0], y = point2[1];
  6248. var inside2 = false;
  6249. if (start2 === void 0)
  6250. start2 = 0;
  6251. if (end === void 0)
  6252. end = vs.length;
  6253. var len = end - start2;
  6254. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  6255. var xi = vs[i2 + start2][0], yi = vs[i2 + start2][1];
  6256. var xj = vs[j + start2][0], yj = vs[j + start2][1];
  6257. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  6258. if (intersect)
  6259. inside2 = !inside2;
  6260. }
  6261. return inside2;
  6262. };
  6263. var pointInPolygonFlat2 = flat;
  6264. var pointInPolygonNested2 = nested;
  6265. pointInPolygon$1.exports = function pointInPolygon(point2, vs, start2, end) {
  6266. if (vs.length > 0 && Array.isArray(vs[0])) {
  6267. return pointInPolygonNested2(point2, vs, start2, end);
  6268. } else {
  6269. return pointInPolygonFlat2(point2, vs, start2, end);
  6270. }
  6271. };
  6272. pointInPolygon$1.exports.nested = pointInPolygonNested2;
  6273. pointInPolygon$1.exports.flat = pointInPolygonFlat2;
  6274. var orient2d_min = { exports: {} };
  6275. (function(module2, exports2) {
  6276. !function(t2, e) {
  6277. e(exports2);
  6278. }(commonjsGlobal, function(t2) {
  6279. const e = 134217729, n = 33306690738754706e-32;
  6280. function r2(t3, e2, n2, r3, o2) {
  6281. let f2, i3, u2, c2, s2 = e2[0], a2 = r3[0], d3 = 0, l2 = 0;
  6282. a2 > s2 == a2 > -s2 ? (f2 = s2, s2 = e2[++d3]) : (f2 = a2, a2 = r3[++l2]);
  6283. let p = 0;
  6284. if (d3 < t3 && l2 < n2)
  6285. 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; )
  6286. 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);
  6287. for (; d3 < t3; )
  6288. u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  6289. for (; l2 < n2; )
  6290. u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  6291. return 0 === f2 && 0 !== p || (o2[p++] = f2), p;
  6292. }
  6293. function o(t3) {
  6294. return new Float64Array(t3);
  6295. }
  6296. 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);
  6297. t2.orient2d = function(t3, o2, p, b, y, h2) {
  6298. const M = (o2 - h2) * (p - y), x = (t3 - y) * (b - h2), j = M - x;
  6299. if (0 === M || 0 === x || M > 0 != x > 0)
  6300. return j;
  6301. const m = Math.abs(M + x);
  6302. return Math.abs(j) >= f * m ? j : -function(t4, o3, f2, p2, b2, y2, h3) {
  6303. let M2, x2, j2, m2, _, v, w, A, F, O, P2, g, k, q2, z, B2, C2, D;
  6304. const E2 = t4 - b2, G2 = f2 - b2, H2 = o3 - y2, I2 = p2 - y2;
  6305. _ = (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;
  6306. let J2 = function(t5, e2) {
  6307. let n2 = e2[0];
  6308. for (let r3 = 1; r3 < t5; r3++)
  6309. n2 += e2[r3];
  6310. return n2;
  6311. }(4, c), K2 = i2 * h3;
  6312. if (J2 >= K2 || -J2 >= K2)
  6313. return J2;
  6314. 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)
  6315. return J2;
  6316. if (K2 = u * h3 + n * Math.abs(J2), (J2 += E2 * m2 + I2 * M2 - (H2 * j2 + G2 * x2)) >= K2 || -J2 >= K2)
  6317. return J2;
  6318. _ = (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;
  6319. const L = r2(4, c, 4, l, s);
  6320. _ = (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;
  6321. const N2 = r2(L, s, 4, l, a);
  6322. _ = (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;
  6323. const Q2 = r2(N2, a, 4, l, d2);
  6324. return d2[Q2 - 1];
  6325. }(t3, o2, p, b, y, h2, m);
  6326. }, t2.orient2dfast = function(t3, e2, n2, r3, o2, f2) {
  6327. return (e2 - f2) * (n2 - o2) - (t3 - o2) * (r3 - f2);
  6328. }, Object.defineProperty(t2, "__esModule", { value: true });
  6329. });
  6330. })(orient2d_min, orient2d_min.exports);
  6331. var RBush = rbush_min$1.exports;
  6332. var Queue = require$$1$2;
  6333. var pointInPolygon2 = pointInPolygon$1.exports;
  6334. var orient = orient2d_min.exports.orient2d;
  6335. if (Queue.default) {
  6336. Queue = Queue.default;
  6337. }
  6338. concaveman$2.exports = concaveman;
  6339. concaveman$2.exports.default = concaveman;
  6340. function concaveman(points2, concavity, lengthThreshold) {
  6341. concavity = Math.max(0, concavity === void 0 ? 2 : concavity);
  6342. lengthThreshold = lengthThreshold || 0;
  6343. var hull = fastConvexHull(points2);
  6344. var tree = new RBush(16);
  6345. tree.toBBox = function(a2) {
  6346. return {
  6347. minX: a2[0],
  6348. minY: a2[1],
  6349. maxX: a2[0],
  6350. maxY: a2[1]
  6351. };
  6352. };
  6353. tree.compareMinX = function(a2, b2) {
  6354. return a2[0] - b2[0];
  6355. };
  6356. tree.compareMinY = function(a2, b2) {
  6357. return a2[1] - b2[1];
  6358. };
  6359. tree.load(points2);
  6360. var queue = [];
  6361. for (var i2 = 0, last; i2 < hull.length; i2++) {
  6362. var p = hull[i2];
  6363. tree.remove(p);
  6364. last = insertNode(p, last);
  6365. queue.push(last);
  6366. }
  6367. var segTree = new RBush(16);
  6368. for (i2 = 0; i2 < queue.length; i2++)
  6369. segTree.insert(updateBBox(queue[i2]));
  6370. var sqConcavity = concavity * concavity;
  6371. var sqLenThreshold = lengthThreshold * lengthThreshold;
  6372. while (queue.length) {
  6373. var node = queue.shift();
  6374. var a = node.p;
  6375. var b = node.next.p;
  6376. var sqLen = getSqDist(a, b);
  6377. if (sqLen < sqLenThreshold)
  6378. continue;
  6379. var maxSqLen = sqLen / sqConcavity;
  6380. p = findCandidate(tree, node.prev.p, a, b, node.next.next.p, maxSqLen, segTree);
  6381. if (p && Math.min(getSqDist(p, a), getSqDist(p, b)) <= maxSqLen) {
  6382. queue.push(node);
  6383. queue.push(insertNode(p, node));
  6384. tree.remove(p);
  6385. segTree.remove(node);
  6386. segTree.insert(updateBBox(node));
  6387. segTree.insert(updateBBox(node.next));
  6388. }
  6389. }
  6390. node = last;
  6391. var concave = [];
  6392. do {
  6393. concave.push(node.p);
  6394. node = node.next;
  6395. } while (node !== last);
  6396. concave.push(node.p);
  6397. return concave;
  6398. }
  6399. function findCandidate(tree, a, b, c, d2, maxDist, segTree) {
  6400. var queue = new Queue([], compareDist);
  6401. var node = tree.data;
  6402. while (node) {
  6403. for (var i2 = 0; i2 < node.children.length; i2++) {
  6404. var child = node.children[i2];
  6405. var dist = node.leaf ? sqSegDist(child, b, c) : sqSegBoxDist(b, c, child);
  6406. if (dist > maxDist)
  6407. continue;
  6408. queue.push({
  6409. node: child,
  6410. dist
  6411. });
  6412. }
  6413. while (queue.length && !queue.peek().node.children) {
  6414. var item = queue.pop();
  6415. var p = item.node;
  6416. var d0 = sqSegDist(p, a, b);
  6417. var d1 = sqSegDist(p, c, d2);
  6418. if (item.dist < d0 && item.dist < d1 && noIntersections(b, p, segTree) && noIntersections(c, p, segTree))
  6419. return p;
  6420. }
  6421. node = queue.pop();
  6422. if (node)
  6423. node = node.node;
  6424. }
  6425. return null;
  6426. }
  6427. function compareDist(a, b) {
  6428. return a.dist - b.dist;
  6429. }
  6430. function sqSegBoxDist(a, b, bbox2) {
  6431. if (inside(a, bbox2) || inside(b, bbox2))
  6432. return 0;
  6433. var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.maxX, bbox2.minY);
  6434. if (d1 === 0)
  6435. return 0;
  6436. var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.minX, bbox2.maxY);
  6437. if (d2 === 0)
  6438. return 0;
  6439. var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.maxX, bbox2.minY, bbox2.maxX, bbox2.maxY);
  6440. if (d3 === 0)
  6441. return 0;
  6442. var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.maxY, bbox2.maxX, bbox2.maxY);
  6443. if (d4 === 0)
  6444. return 0;
  6445. return Math.min(d1, d2, d3, d4);
  6446. }
  6447. function inside(a, bbox2) {
  6448. return a[0] >= bbox2.minX && a[0] <= bbox2.maxX && a[1] >= bbox2.minY && a[1] <= bbox2.maxY;
  6449. }
  6450. function noIntersections(a, b, segTree) {
  6451. var minX = Math.min(a[0], b[0]);
  6452. var minY = Math.min(a[1], b[1]);
  6453. var maxX = Math.max(a[0], b[0]);
  6454. var maxY = Math.max(a[1], b[1]);
  6455. var edges = segTree.search({ minX, minY, maxX, maxY });
  6456. for (var i2 = 0; i2 < edges.length; i2++) {
  6457. if (intersects$1(edges[i2].p, edges[i2].next.p, a, b))
  6458. return false;
  6459. }
  6460. return true;
  6461. }
  6462. function cross(p1, p2, p3) {
  6463. return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
  6464. }
  6465. function intersects$1(p1, q1, p2, q2) {
  6466. 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;
  6467. }
  6468. function updateBBox(node) {
  6469. var p1 = node.p;
  6470. var p2 = node.next.p;
  6471. node.minX = Math.min(p1[0], p2[0]);
  6472. node.minY = Math.min(p1[1], p2[1]);
  6473. node.maxX = Math.max(p1[0], p2[0]);
  6474. node.maxY = Math.max(p1[1], p2[1]);
  6475. return node;
  6476. }
  6477. function fastConvexHull(points2) {
  6478. var left = points2[0];
  6479. var top = points2[0];
  6480. var right = points2[0];
  6481. var bottom = points2[0];
  6482. for (var i2 = 0; i2 < points2.length; i2++) {
  6483. var p = points2[i2];
  6484. if (p[0] < left[0])
  6485. left = p;
  6486. if (p[0] > right[0])
  6487. right = p;
  6488. if (p[1] < top[1])
  6489. top = p;
  6490. if (p[1] > bottom[1])
  6491. bottom = p;
  6492. }
  6493. var cull = [left, top, right, bottom];
  6494. var filtered = cull.slice();
  6495. for (i2 = 0; i2 < points2.length; i2++) {
  6496. if (!pointInPolygon2(points2[i2], cull))
  6497. filtered.push(points2[i2]);
  6498. }
  6499. return convexHull(filtered);
  6500. }
  6501. function insertNode(p, prev) {
  6502. var node = {
  6503. p,
  6504. prev: null,
  6505. next: null,
  6506. minX: 0,
  6507. minY: 0,
  6508. maxX: 0,
  6509. maxY: 0
  6510. };
  6511. if (!prev) {
  6512. node.prev = node;
  6513. node.next = node;
  6514. } else {
  6515. node.next = prev.next;
  6516. node.prev = prev;
  6517. prev.next.prev = node;
  6518. prev.next = node;
  6519. }
  6520. return node;
  6521. }
  6522. function getSqDist(p1, p2) {
  6523. var dx = p1[0] - p2[0], dy = p1[1] - p2[1];
  6524. return dx * dx + dy * dy;
  6525. }
  6526. function sqSegDist(p, p1, p2) {
  6527. var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
  6528. if (dx !== 0 || dy !== 0) {
  6529. var t2 = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy);
  6530. if (t2 > 1) {
  6531. x = p2[0];
  6532. y = p2[1];
  6533. } else if (t2 > 0) {
  6534. x += dx * t2;
  6535. y += dy * t2;
  6536. }
  6537. }
  6538. dx = p[0] - x;
  6539. dy = p[1] - y;
  6540. return dx * dx + dy * dy;
  6541. }
  6542. function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {
  6543. var ux = x1 - x0;
  6544. var uy = y1 - y0;
  6545. var vx = x3 - x2;
  6546. var vy = y3 - y2;
  6547. var wx = x0 - x2;
  6548. var wy = y0 - y2;
  6549. var a = ux * ux + uy * uy;
  6550. var b = ux * vx + uy * vy;
  6551. var c = vx * vx + vy * vy;
  6552. var d2 = ux * wx + uy * wy;
  6553. var e = vx * wx + vy * wy;
  6554. var D = a * c - b * b;
  6555. var sc, sN, tc, tN;
  6556. var sD = D;
  6557. var tD = D;
  6558. if (D === 0) {
  6559. sN = 0;
  6560. sD = 1;
  6561. tN = e;
  6562. tD = c;
  6563. } else {
  6564. sN = b * e - c * d2;
  6565. tN = a * e - b * d2;
  6566. if (sN < 0) {
  6567. sN = 0;
  6568. tN = e;
  6569. tD = c;
  6570. } else if (sN > sD) {
  6571. sN = sD;
  6572. tN = e + b;
  6573. tD = c;
  6574. }
  6575. }
  6576. if (tN < 0) {
  6577. tN = 0;
  6578. if (-d2 < 0)
  6579. sN = 0;
  6580. else if (-d2 > a)
  6581. sN = sD;
  6582. else {
  6583. sN = -d2;
  6584. sD = a;
  6585. }
  6586. } else if (tN > tD) {
  6587. tN = tD;
  6588. if (-d2 + b < 0)
  6589. sN = 0;
  6590. else if (-d2 + b > a)
  6591. sN = sD;
  6592. else {
  6593. sN = -d2 + b;
  6594. sD = a;
  6595. }
  6596. }
  6597. sc = sN === 0 ? 0 : sN / sD;
  6598. tc = tN === 0 ? 0 : tN / tD;
  6599. var cx = (1 - sc) * x0 + sc * x1;
  6600. var cy = (1 - sc) * y0 + sc * y1;
  6601. var cx2 = (1 - tc) * x2 + tc * x3;
  6602. var cy2 = (1 - tc) * y2 + tc * y3;
  6603. var dx = cx2 - cx;
  6604. var dy = cy2 - cy;
  6605. return dx * dx + dy * dy;
  6606. }
  6607. function compareByX(a, b) {
  6608. return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0];
  6609. }
  6610. function convexHull(points2) {
  6611. points2.sort(compareByX);
  6612. var lower = [];
  6613. for (var i2 = 0; i2 < points2.length; i2++) {
  6614. while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], points2[i2]) <= 0) {
  6615. lower.pop();
  6616. }
  6617. lower.push(points2[i2]);
  6618. }
  6619. var upper = [];
  6620. for (var ii = points2.length - 1; ii >= 0; ii--) {
  6621. while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], points2[ii]) <= 0) {
  6622. upper.pop();
  6623. }
  6624. upper.push(points2[ii]);
  6625. }
  6626. upper.pop();
  6627. lower.pop();
  6628. return lower.concat(upper);
  6629. }
  6630. var concaveman$1 = concaveman$2.exports;
  6631. function convex(geojson, options2) {
  6632. if (options2 === void 0) {
  6633. options2 = {};
  6634. }
  6635. options2.concavity = options2.concavity || Infinity;
  6636. var points2 = [];
  6637. coordEach(geojson, function(coord) {
  6638. points2.push([coord[0], coord[1]]);
  6639. });
  6640. if (!points2.length) {
  6641. return null;
  6642. }
  6643. var convexHull2 = concaveman$1(points2, options2.concavity);
  6644. if (convexHull2.length > 3) {
  6645. return polygon([convexHull2]);
  6646. }
  6647. return null;
  6648. }
  6649. function booleanPointInPolygon(point2, polygon2, options2) {
  6650. if (options2 === void 0) {
  6651. options2 = {};
  6652. }
  6653. if (!point2) {
  6654. throw new Error("point is required");
  6655. }
  6656. if (!polygon2) {
  6657. throw new Error("polygon is required");
  6658. }
  6659. var pt2 = getCoord(point2);
  6660. var geom = getGeom(polygon2);
  6661. var type2 = geom.type;
  6662. var bbox2 = polygon2.bbox;
  6663. var polys = geom.coordinates;
  6664. if (bbox2 && inBBox(pt2, bbox2) === false) {
  6665. return false;
  6666. }
  6667. if (type2 === "Polygon") {
  6668. polys = [polys];
  6669. }
  6670. var insidePoly = false;
  6671. for (var i2 = 0; i2 < polys.length && !insidePoly; i2++) {
  6672. if (inRing(pt2, polys[i2][0], options2.ignoreBoundary)) {
  6673. var inHole = false;
  6674. var k = 1;
  6675. while (k < polys[i2].length && !inHole) {
  6676. if (inRing(pt2, polys[i2][k], !options2.ignoreBoundary)) {
  6677. inHole = true;
  6678. }
  6679. k++;
  6680. }
  6681. if (!inHole) {
  6682. insidePoly = true;
  6683. }
  6684. }
  6685. }
  6686. return insidePoly;
  6687. }
  6688. function inRing(pt2, ring, ignoreBoundary) {
  6689. var isInside = false;
  6690. if (ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1]) {
  6691. ring = ring.slice(0, ring.length - 1);
  6692. }
  6693. for (var i2 = 0, j = ring.length - 1; i2 < ring.length; j = i2++) {
  6694. var xi = ring[i2][0];
  6695. var yi = ring[i2][1];
  6696. var xj = ring[j][0];
  6697. var yj = ring[j][1];
  6698. 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;
  6699. if (onBoundary) {
  6700. return !ignoreBoundary;
  6701. }
  6702. var intersect = yi > pt2[1] !== yj > pt2[1] && pt2[0] < (xj - xi) * (pt2[1] - yi) / (yj - yi) + xi;
  6703. if (intersect) {
  6704. isInside = !isInside;
  6705. }
  6706. }
  6707. return isInside;
  6708. }
  6709. function inBBox(pt2, bbox2) {
  6710. return bbox2[0] <= pt2[0] && bbox2[1] <= pt2[1] && bbox2[2] >= pt2[0] && bbox2[3] >= pt2[1];
  6711. }
  6712. function distance(from3, to, options2) {
  6713. if (options2 === void 0) {
  6714. options2 = {};
  6715. }
  6716. var coordinates1 = getCoord(from3);
  6717. var coordinates2 = getCoord(to);
  6718. var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
  6719. var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
  6720. var lat1 = degreesToRadians(coordinates1[1]);
  6721. var lat2 = degreesToRadians(coordinates2[1]);
  6722. var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
  6723. return radiansToLength(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), options2.units);
  6724. }
  6725. function bboxPolygon(bbox2, options2) {
  6726. if (options2 === void 0) {
  6727. options2 = {};
  6728. }
  6729. var west = Number(bbox2[0]);
  6730. var south = Number(bbox2[1]);
  6731. var east = Number(bbox2[2]);
  6732. var north = Number(bbox2[3]);
  6733. if (bbox2.length === 6) {
  6734. throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
  6735. }
  6736. var lowLeft = [west, south];
  6737. var topLeft = [west, north];
  6738. var topRight = [east, north];
  6739. var lowRight = [east, south];
  6740. return polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options2.properties, { bbox: bbox2, id: options2.id });
  6741. }
  6742. function destination(origin, distance2, bearing2, options2) {
  6743. if (options2 === void 0) {
  6744. options2 = {};
  6745. }
  6746. var coordinates1 = getCoord(origin);
  6747. var longitude1 = degreesToRadians(coordinates1[0]);
  6748. var latitude1 = degreesToRadians(coordinates1[1]);
  6749. var bearingRad = degreesToRadians(bearing2);
  6750. var radians = lengthToRadians(distance2, options2.units);
  6751. var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad));
  6752. var longitude2 = longitude1 + Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
  6753. var lng = radiansToDegrees(longitude2);
  6754. var lat = radiansToDegrees(latitude2);
  6755. return point([lng, lat], options2.properties);
  6756. }
  6757. function bearing(start2, end, options2) {
  6758. if (options2 === void 0) {
  6759. options2 = {};
  6760. }
  6761. if (options2.final === true) {
  6762. return calculateFinalBearing(start2, end);
  6763. }
  6764. var coordinates1 = getCoord(start2);
  6765. var coordinates2 = getCoord(end);
  6766. var lon1 = degreesToRadians(coordinates1[0]);
  6767. var lon2 = degreesToRadians(coordinates2[0]);
  6768. var lat1 = degreesToRadians(coordinates1[1]);
  6769. var lat2 = degreesToRadians(coordinates2[1]);
  6770. var a = Math.sin(lon2 - lon1) * Math.cos(lat2);
  6771. var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
  6772. return radiansToDegrees(Math.atan2(a, b));
  6773. }
  6774. function calculateFinalBearing(start2, end) {
  6775. var bear = bearing(end, start2);
  6776. bear = (bear + 180) % 360;
  6777. return bear;
  6778. }
  6779. function midpoint(point1, point2) {
  6780. var dist = distance(point1, point2);
  6781. var heading = bearing(point1, point2);
  6782. var midpoint2 = destination(point1, dist / 2, heading);
  6783. return midpoint2;
  6784. }
  6785. function center(geojson, options2) {
  6786. if (options2 === void 0) {
  6787. options2 = {};
  6788. }
  6789. var ext = bbox$1(geojson);
  6790. var x = (ext[0] + ext[2]) / 2;
  6791. var y = (ext[1] + ext[3]) / 2;
  6792. return point([x, y], options2.properties, options2);
  6793. }
  6794. function centroid(geojson, options2) {
  6795. if (options2 === void 0) {
  6796. options2 = {};
  6797. }
  6798. var xSum = 0;
  6799. var ySum = 0;
  6800. var len = 0;
  6801. coordEach(geojson, function(coord) {
  6802. xSum += coord[0];
  6803. ySum += coord[1];
  6804. len++;
  6805. }, true);
  6806. return point([xSum / len, ySum / len], options2.properties);
  6807. }
  6808. function centerOfMass(geojson, options2) {
  6809. if (options2 === void 0) {
  6810. options2 = {};
  6811. }
  6812. switch (getType(geojson)) {
  6813. case "Point":
  6814. return point(getCoord(geojson), options2.properties);
  6815. case "Polygon":
  6816. var coords = [];
  6817. coordEach(geojson, function(coord) {
  6818. coords.push(coord);
  6819. });
  6820. var centre = centroid(geojson, { properties: options2.properties });
  6821. var translation = centre.geometry.coordinates;
  6822. var sx = 0;
  6823. var sy = 0;
  6824. var sArea = 0;
  6825. var i2, pi, pj, xi, xj, yi, yj, a;
  6826. var neutralizedPoints = coords.map(function(point2) {
  6827. return [point2[0] - translation[0], point2[1] - translation[1]];
  6828. });
  6829. for (i2 = 0; i2 < coords.length - 1; i2++) {
  6830. pi = neutralizedPoints[i2];
  6831. xi = pi[0];
  6832. yi = pi[1];
  6833. pj = neutralizedPoints[i2 + 1];
  6834. xj = pj[0];
  6835. yj = pj[1];
  6836. a = xi * yj - xj * yi;
  6837. sArea += a;
  6838. sx += (xi + xj) * a;
  6839. sy += (yi + yj) * a;
  6840. }
  6841. if (sArea === 0) {
  6842. return centre;
  6843. } else {
  6844. var area = sArea * 0.5;
  6845. var areaFactor = 1 / (6 * area);
  6846. return point([translation[0] + areaFactor * sx, translation[1] + areaFactor * sy], options2.properties);
  6847. }
  6848. default:
  6849. var hull = convex(geojson);
  6850. if (hull)
  6851. return centerOfMass(hull, { properties: options2.properties });
  6852. else
  6853. return centroid(geojson, { properties: options2.properties });
  6854. }
  6855. }
  6856. function lineSegment(geojson) {
  6857. if (!geojson) {
  6858. throw new Error("geojson is required");
  6859. }
  6860. var results = [];
  6861. flattenEach(geojson, function(feature2) {
  6862. lineSegmentFeature(feature2, results);
  6863. });
  6864. return featureCollection$1(results);
  6865. }
  6866. function lineSegmentFeature(geojson, results) {
  6867. var coords = [];
  6868. var geometry2 = geojson.geometry;
  6869. if (geometry2 !== null) {
  6870. switch (geometry2.type) {
  6871. case "Polygon":
  6872. coords = getCoords(geometry2);
  6873. break;
  6874. case "LineString":
  6875. coords = [getCoords(geometry2)];
  6876. }
  6877. coords.forEach(function(coord) {
  6878. var segments = createSegments(coord, geojson.properties);
  6879. segments.forEach(function(segment) {
  6880. segment.id = results.length;
  6881. results.push(segment);
  6882. });
  6883. });
  6884. }
  6885. }
  6886. function createSegments(coords, properties) {
  6887. var segments = [];
  6888. coords.reduce(function(previousCoords, currentCoords) {
  6889. var segment = lineString([previousCoords, currentCoords], properties);
  6890. segment.bbox = bbox(previousCoords, currentCoords);
  6891. segments.push(segment);
  6892. return currentCoords;
  6893. });
  6894. return segments;
  6895. }
  6896. function bbox(coords1, coords2) {
  6897. var x1 = coords1[0];
  6898. var y1 = coords1[1];
  6899. var x2 = coords2[0];
  6900. var y2 = coords2[1];
  6901. var west = x1 < x2 ? x1 : x2;
  6902. var south = y1 < y2 ? y1 : y2;
  6903. var east = x1 > x2 ? x1 : x2;
  6904. var north = y1 > y2 ? y1 : y2;
  6905. return [west, south, east, north];
  6906. }
  6907. var geojsonRbush$1 = { exports: {} };
  6908. var rbush_min = { exports: {} };
  6909. (function(module2, exports2) {
  6910. !function(t2, i2) {
  6911. module2.exports = i2();
  6912. }(commonjsGlobal, function() {
  6913. function t2(t3, r3, e2, a2, h3) {
  6914. !function t4(n2, r4, e3, a3, h4) {
  6915. for (; a3 > e3; ) {
  6916. if (a3 - e3 > 600) {
  6917. 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));
  6918. t4(n2, r4, m2, c2, h4);
  6919. }
  6920. var p2 = n2[r4], d3 = e3, x = a3;
  6921. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  6922. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  6923. d3++;
  6924. for (; h4(n2[x], p2) > 0; )
  6925. x--;
  6926. }
  6927. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  6928. }
  6929. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  6930. }
  6931. function i2(t3, i3, n2) {
  6932. var r3 = t3[i3];
  6933. t3[i3] = t3[n2], t3[n2] = r3;
  6934. }
  6935. function n(t3, i3) {
  6936. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  6937. }
  6938. var r2 = function(t3) {
  6939. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  6940. };
  6941. function e(t3, i3, n2) {
  6942. if (!n2)
  6943. return i3.indexOf(t3);
  6944. for (var r3 = 0; r3 < i3.length; r3++)
  6945. if (n2(t3, i3[r3]))
  6946. return r3;
  6947. return -1;
  6948. }
  6949. function a(t3, i3) {
  6950. h2(t3, 0, t3.children.length, i3, t3);
  6951. }
  6952. function h2(t3, i3, n2, r3, e2) {
  6953. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  6954. for (var a2 = i3; a2 < n2; a2++) {
  6955. var h3 = t3.children[a2];
  6956. o(e2, t3.leaf ? r3(h3) : h3);
  6957. }
  6958. return e2;
  6959. }
  6960. function o(t3, i3) {
  6961. 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;
  6962. }
  6963. function s(t3, i3) {
  6964. return t3.minX - i3.minX;
  6965. }
  6966. function l(t3, i3) {
  6967. return t3.minY - i3.minY;
  6968. }
  6969. function f(t3) {
  6970. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  6971. }
  6972. function u(t3) {
  6973. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  6974. }
  6975. function m(t3, i3) {
  6976. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  6977. }
  6978. function c(t3, i3) {
  6979. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  6980. }
  6981. function p(t3) {
  6982. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  6983. }
  6984. function d2(i3, n2, r3, e2, a2) {
  6985. for (var h3 = [n2, r3]; h3.length; )
  6986. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  6987. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  6988. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  6989. }
  6990. }
  6991. return r2.prototype.all = function() {
  6992. return this._all(this.data, []);
  6993. }, r2.prototype.search = function(t3) {
  6994. var i3 = this.data, n2 = [];
  6995. if (!c(t3, i3))
  6996. return n2;
  6997. for (var r3 = this.toBBox, e2 = []; i3; ) {
  6998. for (var a2 = 0; a2 < i3.children.length; a2++) {
  6999. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  7000. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  7001. }
  7002. i3 = e2.pop();
  7003. }
  7004. return n2;
  7005. }, r2.prototype.collides = function(t3) {
  7006. var i3 = this.data;
  7007. if (!c(t3, i3))
  7008. return false;
  7009. for (var n2 = []; i3; ) {
  7010. for (var r3 = 0; r3 < i3.children.length; r3++) {
  7011. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  7012. if (c(t3, a2)) {
  7013. if (i3.leaf || m(t3, a2))
  7014. return true;
  7015. n2.push(e2);
  7016. }
  7017. }
  7018. i3 = n2.pop();
  7019. }
  7020. return false;
  7021. }, r2.prototype.load = function(t3) {
  7022. if (!t3 || !t3.length)
  7023. return this;
  7024. if (t3.length < this._minEntries) {
  7025. for (var i3 = 0; i3 < t3.length; i3++)
  7026. this.insert(t3[i3]);
  7027. return this;
  7028. }
  7029. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  7030. if (this.data.children.length)
  7031. if (this.data.height === n2.height)
  7032. this._splitRoot(this.data, n2);
  7033. else {
  7034. if (this.data.height < n2.height) {
  7035. var r3 = this.data;
  7036. this.data = n2, n2 = r3;
  7037. }
  7038. this._insert(n2, this.data.height - n2.height - 1, true);
  7039. }
  7040. else
  7041. this.data = n2;
  7042. return this;
  7043. }, r2.prototype.insert = function(t3) {
  7044. return t3 && this._insert(t3, this.data.height - 1), this;
  7045. }, r2.prototype.clear = function() {
  7046. return this.data = p([]), this;
  7047. }, r2.prototype.remove = function(t3, i3) {
  7048. if (!t3)
  7049. return this;
  7050. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  7051. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  7052. var f2 = e(t3, h3.children, i3);
  7053. if (-1 !== f2)
  7054. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  7055. }
  7056. 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]);
  7057. }
  7058. return this;
  7059. }, r2.prototype.toBBox = function(t3) {
  7060. return t3;
  7061. }, r2.prototype.compareMinX = function(t3, i3) {
  7062. return t3.minX - i3.minX;
  7063. }, r2.prototype.compareMinY = function(t3, i3) {
  7064. return t3.minY - i3.minY;
  7065. }, r2.prototype.toJSON = function() {
  7066. return this.data;
  7067. }, r2.prototype.fromJSON = function(t3) {
  7068. return this.data = t3, this;
  7069. }, r2.prototype._all = function(t3, i3) {
  7070. for (var n2 = []; t3; )
  7071. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  7072. return i3;
  7073. }, r2.prototype._build = function(t3, i3, n2, r3) {
  7074. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  7075. if (h3 <= o2)
  7076. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  7077. 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;
  7078. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  7079. d2(t3, i3, n2, l2, this.compareMinX);
  7080. for (var f2 = i3; f2 <= n2; f2 += l2) {
  7081. var u2 = Math.min(f2 + l2 - 1, n2);
  7082. d2(t3, f2, u2, s2, this.compareMinY);
  7083. for (var m2 = f2; m2 <= u2; m2 += s2) {
  7084. var c2 = Math.min(m2 + s2 - 1, u2);
  7085. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  7086. }
  7087. }
  7088. return a(e2, this.toBBox), e2;
  7089. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  7090. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  7091. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  7092. 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);
  7093. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  7094. }
  7095. i3 = h3 || i3.children[0];
  7096. }
  7097. var m2, c2;
  7098. return i3;
  7099. }, r2.prototype._insert = function(t3, i3, n2) {
  7100. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  7101. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  7102. this._split(e2, i3), i3--;
  7103. this._adjustParentBBoxes(r3, e2, i3);
  7104. }, r2.prototype._split = function(t3, i3) {
  7105. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  7106. this._chooseSplitAxis(n2, e2, r3);
  7107. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  7108. 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);
  7109. }, r2.prototype._splitRoot = function(t3, i3) {
  7110. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  7111. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  7112. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  7113. 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);
  7114. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  7115. }
  7116. return r3 || n2 - i3;
  7117. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  7118. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  7119. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  7120. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  7121. t3.children.sort(r3);
  7122. 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++) {
  7123. var m2 = t3.children[f2];
  7124. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  7125. }
  7126. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  7127. var p2 = t3.children[c2];
  7128. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  7129. }
  7130. return l2;
  7131. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  7132. for (var r3 = n2; r3 >= 0; r3--)
  7133. o(i3[r3], t3);
  7134. }, r2.prototype._condense = function(t3) {
  7135. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  7136. 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);
  7137. }, r2;
  7138. });
  7139. })(rbush_min);
  7140. var require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(es$2);
  7141. var require$$2 = /* @__PURE__ */ getAugmentedNamespace(es$1);
  7142. var require$$3 = /* @__PURE__ */ getAugmentedNamespace(es);
  7143. var rbush = rbush_min.exports;
  7144. var helpers = require$$1$1;
  7145. var meta = require$$2;
  7146. var turfBBox = require$$3.default;
  7147. var featureEach = meta.featureEach;
  7148. meta.coordEach;
  7149. helpers.polygon;
  7150. var featureCollection = helpers.featureCollection;
  7151. function geojsonRbush(maxEntries) {
  7152. var tree = new rbush(maxEntries);
  7153. tree.insert = function(feature2) {
  7154. if (feature2.type !== "Feature")
  7155. throw new Error("invalid feature");
  7156. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7157. return rbush.prototype.insert.call(this, feature2);
  7158. };
  7159. tree.load = function(features) {
  7160. var load = [];
  7161. if (Array.isArray(features)) {
  7162. features.forEach(function(feature2) {
  7163. if (feature2.type !== "Feature")
  7164. throw new Error("invalid features");
  7165. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7166. load.push(feature2);
  7167. });
  7168. } else {
  7169. featureEach(features, function(feature2) {
  7170. if (feature2.type !== "Feature")
  7171. throw new Error("invalid features");
  7172. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7173. load.push(feature2);
  7174. });
  7175. }
  7176. return rbush.prototype.load.call(this, load);
  7177. };
  7178. tree.remove = function(feature2, equals) {
  7179. if (feature2.type !== "Feature")
  7180. throw new Error("invalid feature");
  7181. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7182. return rbush.prototype.remove.call(this, feature2, equals);
  7183. };
  7184. tree.clear = function() {
  7185. return rbush.prototype.clear.call(this);
  7186. };
  7187. tree.search = function(geojson) {
  7188. var features = rbush.prototype.search.call(this, this.toBBox(geojson));
  7189. return featureCollection(features);
  7190. };
  7191. tree.collides = function(geojson) {
  7192. return rbush.prototype.collides.call(this, this.toBBox(geojson));
  7193. };
  7194. tree.all = function() {
  7195. var features = rbush.prototype.all.call(this);
  7196. return featureCollection(features);
  7197. };
  7198. tree.toJSON = function() {
  7199. return rbush.prototype.toJSON.call(this);
  7200. };
  7201. tree.fromJSON = function(json) {
  7202. return rbush.prototype.fromJSON.call(this, json);
  7203. };
  7204. tree.toBBox = function(geojson) {
  7205. var bbox2;
  7206. if (geojson.bbox)
  7207. bbox2 = geojson.bbox;
  7208. else if (Array.isArray(geojson) && geojson.length === 4)
  7209. bbox2 = geojson;
  7210. else if (Array.isArray(geojson) && geojson.length === 6)
  7211. bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
  7212. else if (geojson.type === "Feature")
  7213. bbox2 = turfBBox(geojson);
  7214. else if (geojson.type === "FeatureCollection")
  7215. bbox2 = turfBBox(geojson);
  7216. else
  7217. throw new Error("invalid geojson");
  7218. return {
  7219. minX: bbox2[0],
  7220. minY: bbox2[1],
  7221. maxX: bbox2[2],
  7222. maxY: bbox2[3]
  7223. };
  7224. };
  7225. return tree;
  7226. }
  7227. geojsonRbush$1.exports = geojsonRbush;
  7228. geojsonRbush$1.exports.default = geojsonRbush;
  7229. var rbush$1 = geojsonRbush$1.exports;
  7230. function lineIntersect(line1, line2) {
  7231. var unique = {};
  7232. var results = [];
  7233. if (line1.type === "LineString") {
  7234. line1 = feature(line1);
  7235. }
  7236. if (line2.type === "LineString") {
  7237. line2 = feature(line2);
  7238. }
  7239. 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) {
  7240. var intersect = intersects(line1, line2);
  7241. if (intersect) {
  7242. results.push(intersect);
  7243. }
  7244. return featureCollection$1(results);
  7245. }
  7246. var tree = rbush$1();
  7247. tree.load(lineSegment(line2));
  7248. featureEach$1(lineSegment(line1), function(segment) {
  7249. featureEach$1(tree.search(segment), function(match) {
  7250. var intersect2 = intersects(segment, match);
  7251. if (intersect2) {
  7252. var key = getCoords(intersect2).join(",");
  7253. if (!unique[key]) {
  7254. unique[key] = true;
  7255. results.push(intersect2);
  7256. }
  7257. }
  7258. });
  7259. });
  7260. return featureCollection$1(results);
  7261. }
  7262. function intersects(line1, line2) {
  7263. var coords1 = getCoords(line1);
  7264. var coords2 = getCoords(line2);
  7265. if (coords1.length !== 2) {
  7266. throw new Error("<intersects> line1 must only contain 2 coordinates");
  7267. }
  7268. if (coords2.length !== 2) {
  7269. throw new Error("<intersects> line2 must only contain 2 coordinates");
  7270. }
  7271. var x1 = coords1[0][0];
  7272. var y1 = coords1[0][1];
  7273. var x2 = coords1[1][0];
  7274. var y2 = coords1[1][1];
  7275. var x3 = coords2[0][0];
  7276. var y3 = coords2[0][1];
  7277. var x4 = coords2[1][0];
  7278. var y4 = coords2[1][1];
  7279. var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
  7280. var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
  7281. var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
  7282. if (denom === 0) {
  7283. if (numeA === 0 && numeB === 0) {
  7284. return null;
  7285. }
  7286. return null;
  7287. }
  7288. var uA = numeA / denom;
  7289. var uB = numeB / denom;
  7290. if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
  7291. var x = x1 + uA * (x2 - x1);
  7292. var y = y1 + uA * (y2 - y1);
  7293. return point([x, y]);
  7294. }
  7295. return null;
  7296. }
  7297. function booleanPointOnLine(pt2, line, options2) {
  7298. if (options2 === void 0) {
  7299. options2 = {};
  7300. }
  7301. var ptCoords = getCoord(pt2);
  7302. var lineCoords = getCoords(line);
  7303. for (var i2 = 0; i2 < lineCoords.length - 1; i2++) {
  7304. var ignoreBoundary = false;
  7305. if (options2.ignoreEndVertices) {
  7306. if (i2 === 0) {
  7307. ignoreBoundary = "start";
  7308. }
  7309. if (i2 === lineCoords.length - 2) {
  7310. ignoreBoundary = "end";
  7311. }
  7312. if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
  7313. ignoreBoundary = "both";
  7314. }
  7315. }
  7316. if (isPointOnLineSegment$1(lineCoords[i2], lineCoords[i2 + 1], ptCoords, ignoreBoundary, typeof options2.epsilon === "undefined" ? null : options2.epsilon)) {
  7317. return true;
  7318. }
  7319. }
  7320. return false;
  7321. }
  7322. function isPointOnLineSegment$1(lineSegmentStart, lineSegmentEnd, pt2, excludeBoundary, epsilon) {
  7323. var x = pt2[0];
  7324. var y = pt2[1];
  7325. var x1 = lineSegmentStart[0];
  7326. var y1 = lineSegmentStart[1];
  7327. var x2 = lineSegmentEnd[0];
  7328. var y2 = lineSegmentEnd[1];
  7329. var dxc = pt2[0] - x1;
  7330. var dyc = pt2[1] - y1;
  7331. var dxl = x2 - x1;
  7332. var dyl = y2 - y1;
  7333. var cross2 = dxc * dyl - dyc * dxl;
  7334. if (epsilon !== null) {
  7335. if (Math.abs(cross2) > epsilon) {
  7336. return false;
  7337. }
  7338. } else if (cross2 !== 0) {
  7339. return false;
  7340. }
  7341. if (!excludeBoundary) {
  7342. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7343. return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;
  7344. }
  7345. return dyl > 0 ? y1 <= y && y <= y2 : y2 <= y && y <= y1;
  7346. } else if (excludeBoundary === "start") {
  7347. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7348. return dxl > 0 ? x1 < x && x <= x2 : x2 <= x && x < x1;
  7349. }
  7350. return dyl > 0 ? y1 < y && y <= y2 : y2 <= y && y < y1;
  7351. } else if (excludeBoundary === "end") {
  7352. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7353. return dxl > 0 ? x1 <= x && x < x2 : x2 < x && x <= x1;
  7354. }
  7355. return dyl > 0 ? y1 <= y && y < y2 : y2 < y && y <= y1;
  7356. } else if (excludeBoundary === "both") {
  7357. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7358. return dxl > 0 ? x1 < x && x < x2 : x2 < x && x < x1;
  7359. }
  7360. return dyl > 0 ? y1 < y && y < y2 : y2 < y && y < y1;
  7361. }
  7362. return false;
  7363. }
  7364. function booleanWithin(feature1, feature2) {
  7365. var geom1 = getGeom(feature1);
  7366. var geom2 = getGeom(feature2);
  7367. var type1 = geom1.type;
  7368. var type2 = geom2.type;
  7369. switch (type1) {
  7370. case "Point":
  7371. switch (type2) {
  7372. case "MultiPoint":
  7373. return isPointInMultiPoint(geom1, geom2);
  7374. case "LineString":
  7375. return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
  7376. case "Polygon":
  7377. case "MultiPolygon":
  7378. return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
  7379. default:
  7380. throw new Error("feature2 " + type2 + " geometry not supported");
  7381. }
  7382. case "MultiPoint":
  7383. switch (type2) {
  7384. case "MultiPoint":
  7385. return isMultiPointInMultiPoint(geom1, geom2);
  7386. case "LineString":
  7387. return isMultiPointOnLine(geom1, geom2);
  7388. case "Polygon":
  7389. case "MultiPolygon":
  7390. return isMultiPointInPoly(geom1, geom2);
  7391. default:
  7392. throw new Error("feature2 " + type2 + " geometry not supported");
  7393. }
  7394. case "LineString":
  7395. switch (type2) {
  7396. case "LineString":
  7397. return isLineOnLine$1(geom1, geom2);
  7398. case "Polygon":
  7399. case "MultiPolygon":
  7400. return isLineInPoly$1(geom1, geom2);
  7401. default:
  7402. throw new Error("feature2 " + type2 + " geometry not supported");
  7403. }
  7404. case "Polygon":
  7405. switch (type2) {
  7406. case "Polygon":
  7407. case "MultiPolygon":
  7408. return isPolyInPoly$1(geom1, geom2);
  7409. default:
  7410. throw new Error("feature2 " + type2 + " geometry not supported");
  7411. }
  7412. default:
  7413. throw new Error("feature1 " + type1 + " geometry not supported");
  7414. }
  7415. }
  7416. function isPointInMultiPoint(point2, multiPoint2) {
  7417. var i2;
  7418. var output = false;
  7419. for (i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7420. if (compareCoords$1(multiPoint2.coordinates[i2], point2.coordinates)) {
  7421. output = true;
  7422. break;
  7423. }
  7424. }
  7425. return output;
  7426. }
  7427. function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
  7428. for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
  7429. var anyMatch = false;
  7430. for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
  7431. if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
  7432. anyMatch = true;
  7433. }
  7434. }
  7435. if (!anyMatch) {
  7436. return false;
  7437. }
  7438. }
  7439. return true;
  7440. }
  7441. function isMultiPointOnLine(multiPoint2, lineString2) {
  7442. var foundInsidePoint = false;
  7443. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7444. if (!booleanPointOnLine(multiPoint2.coordinates[i2], lineString2)) {
  7445. return false;
  7446. }
  7447. if (!foundInsidePoint) {
  7448. foundInsidePoint = booleanPointOnLine(multiPoint2.coordinates[i2], lineString2, { ignoreEndVertices: true });
  7449. }
  7450. }
  7451. return foundInsidePoint;
  7452. }
  7453. function isMultiPointInPoly(multiPoint2, polygon2) {
  7454. var output = true;
  7455. var isInside = false;
  7456. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7457. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2);
  7458. if (!isInside) {
  7459. output = false;
  7460. break;
  7461. }
  7462. {
  7463. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2, {
  7464. ignoreBoundary: true
  7465. });
  7466. }
  7467. }
  7468. return output && isInside;
  7469. }
  7470. function isLineOnLine$1(lineString1, lineString2) {
  7471. for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
  7472. if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
  7473. return false;
  7474. }
  7475. }
  7476. return true;
  7477. }
  7478. function isLineInPoly$1(linestring, polygon2) {
  7479. var polyBbox = bbox$1(polygon2);
  7480. var lineBbox = bbox$1(linestring);
  7481. if (!doBBoxOverlap(polyBbox, lineBbox)) {
  7482. return false;
  7483. }
  7484. var foundInsidePoint = false;
  7485. for (var i2 = 0; i2 < linestring.coordinates.length - 1; i2++) {
  7486. if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
  7487. return false;
  7488. }
  7489. if (!foundInsidePoint) {
  7490. foundInsidePoint = booleanPointInPolygon(linestring.coordinates[i2], polygon2, { ignoreBoundary: true });
  7491. }
  7492. if (!foundInsidePoint) {
  7493. var midpoint2 = getMidpoint(linestring.coordinates[i2], linestring.coordinates[i2 + 1]);
  7494. foundInsidePoint = booleanPointInPolygon(midpoint2, polygon2, {
  7495. ignoreBoundary: true
  7496. });
  7497. }
  7498. }
  7499. return foundInsidePoint;
  7500. }
  7501. function isPolyInPoly$1(geometry1, geometry2) {
  7502. var poly1Bbox = bbox$1(geometry1);
  7503. var poly2Bbox = bbox$1(geometry2);
  7504. if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {
  7505. return false;
  7506. }
  7507. for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
  7508. if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
  7509. return false;
  7510. }
  7511. }
  7512. return true;
  7513. }
  7514. function doBBoxOverlap(bbox1, bbox2) {
  7515. if (bbox1[0] > bbox2[0])
  7516. return false;
  7517. if (bbox1[2] < bbox2[2])
  7518. return false;
  7519. if (bbox1[1] > bbox2[1])
  7520. return false;
  7521. if (bbox1[3] < bbox2[3])
  7522. return false;
  7523. return true;
  7524. }
  7525. function compareCoords$1(pair1, pair2) {
  7526. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  7527. }
  7528. function getMidpoint(pair1, pair2) {
  7529. return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
  7530. }
  7531. function pointGrid(bbox2, cellSide, options2) {
  7532. if (options2 === void 0) {
  7533. options2 = {};
  7534. }
  7535. if (options2.mask && !options2.units)
  7536. options2.units = "kilometers";
  7537. var results = [];
  7538. var west = bbox2[0];
  7539. var south = bbox2[1];
  7540. var east = bbox2[2];
  7541. var north = bbox2[3];
  7542. var xFraction = cellSide / distance([west, south], [east, south], options2);
  7543. var cellWidth = xFraction * (east - west);
  7544. var yFraction = cellSide / distance([west, south], [west, north], options2);
  7545. var cellHeight = yFraction * (north - south);
  7546. var bboxWidth = east - west;
  7547. var bboxHeight = north - south;
  7548. var columns = Math.floor(bboxWidth / cellWidth);
  7549. var rows = Math.floor(bboxHeight / cellHeight);
  7550. var deltaX = (bboxWidth - columns * cellWidth) / 2;
  7551. var deltaY = (bboxHeight - rows * cellHeight) / 2;
  7552. var currentX = west + deltaX;
  7553. while (currentX <= east) {
  7554. var currentY = south + deltaY;
  7555. while (currentY <= north) {
  7556. var cellPt = point([currentX, currentY], options2.properties);
  7557. if (options2.mask) {
  7558. if (booleanWithin(cellPt, options2.mask))
  7559. results.push(cellPt);
  7560. } else {
  7561. results.push(cellPt);
  7562. }
  7563. currentY += cellHeight;
  7564. }
  7565. currentX += cellWidth;
  7566. }
  7567. return featureCollection$1(results);
  7568. }
  7569. function polygonToLine(poly, options2) {
  7570. if (options2 === void 0) {
  7571. options2 = {};
  7572. }
  7573. var geom = getGeom(poly);
  7574. if (!options2.properties && poly.type === "Feature") {
  7575. options2.properties = poly.properties;
  7576. }
  7577. switch (geom.type) {
  7578. case "Polygon":
  7579. return polygonToLine$1(geom, options2);
  7580. case "MultiPolygon":
  7581. return multiPolygonToLine(geom, options2);
  7582. default:
  7583. throw new Error("invalid poly");
  7584. }
  7585. }
  7586. function polygonToLine$1(poly, options2) {
  7587. if (options2 === void 0) {
  7588. options2 = {};
  7589. }
  7590. var geom = getGeom(poly);
  7591. var coords = geom.coordinates;
  7592. var properties = options2.properties ? options2.properties : poly.type === "Feature" ? poly.properties : {};
  7593. return coordsToLine(coords, properties);
  7594. }
  7595. function multiPolygonToLine(multiPoly, options2) {
  7596. if (options2 === void 0) {
  7597. options2 = {};
  7598. }
  7599. var geom = getGeom(multiPoly);
  7600. var coords = geom.coordinates;
  7601. var properties = options2.properties ? options2.properties : multiPoly.type === "Feature" ? multiPoly.properties : {};
  7602. var lines = [];
  7603. coords.forEach(function(coord) {
  7604. lines.push(coordsToLine(coord, properties));
  7605. });
  7606. return featureCollection$1(lines);
  7607. }
  7608. function coordsToLine(coords, properties) {
  7609. if (coords.length > 1) {
  7610. return multiLineString(coords, properties);
  7611. }
  7612. return lineString(coords[0], properties);
  7613. }
  7614. function booleanClockwise(line) {
  7615. var ring = getCoords(line);
  7616. var sum = 0;
  7617. var i2 = 1;
  7618. var prev;
  7619. var cur;
  7620. while (i2 < ring.length) {
  7621. prev = cur || ring[0];
  7622. cur = ring[i2];
  7623. sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
  7624. i2++;
  7625. }
  7626. return sum > 0;
  7627. }
  7628. function booleanDisjoint(feature1, feature2) {
  7629. var bool = true;
  7630. flattenEach(feature1, function(flatten1) {
  7631. flattenEach(feature2, function(flatten22) {
  7632. if (bool === false) {
  7633. return false;
  7634. }
  7635. bool = disjoint(flatten1.geometry, flatten22.geometry);
  7636. });
  7637. });
  7638. return bool;
  7639. }
  7640. function disjoint(geom1, geom2) {
  7641. switch (geom1.type) {
  7642. case "Point":
  7643. switch (geom2.type) {
  7644. case "Point":
  7645. return !compareCoords(geom1.coordinates, geom2.coordinates);
  7646. case "LineString":
  7647. return !isPointOnLine(geom2, geom1);
  7648. case "Polygon":
  7649. return !booleanPointInPolygon(geom1, geom2);
  7650. }
  7651. break;
  7652. case "LineString":
  7653. switch (geom2.type) {
  7654. case "Point":
  7655. return !isPointOnLine(geom1, geom2);
  7656. case "LineString":
  7657. return !isLineOnLine(geom1, geom2);
  7658. case "Polygon":
  7659. return !isLineInPoly(geom2, geom1);
  7660. }
  7661. break;
  7662. case "Polygon":
  7663. switch (geom2.type) {
  7664. case "Point":
  7665. return !booleanPointInPolygon(geom2, geom1);
  7666. case "LineString":
  7667. return !isLineInPoly(geom1, geom2);
  7668. case "Polygon":
  7669. return !isPolyInPoly(geom2, geom1);
  7670. }
  7671. }
  7672. return false;
  7673. }
  7674. function isPointOnLine(lineString2, pt2) {
  7675. for (var i2 = 0; i2 < lineString2.coordinates.length - 1; i2++) {
  7676. if (isPointOnLineSegment(lineString2.coordinates[i2], lineString2.coordinates[i2 + 1], pt2.coordinates)) {
  7677. return true;
  7678. }
  7679. }
  7680. return false;
  7681. }
  7682. function isLineOnLine(lineString1, lineString2) {
  7683. var doLinesIntersect = lineIntersect(lineString1, lineString2);
  7684. if (doLinesIntersect.features.length > 0) {
  7685. return true;
  7686. }
  7687. return false;
  7688. }
  7689. function isLineInPoly(polygon2, lineString2) {
  7690. for (var _i = 0, _a2 = lineString2.coordinates; _i < _a2.length; _i++) {
  7691. var coord = _a2[_i];
  7692. if (booleanPointInPolygon(coord, polygon2)) {
  7693. return true;
  7694. }
  7695. }
  7696. var doLinesIntersect = lineIntersect(lineString2, polygonToLine(polygon2));
  7697. if (doLinesIntersect.features.length > 0) {
  7698. return true;
  7699. }
  7700. return false;
  7701. }
  7702. function isPolyInPoly(feature1, feature2) {
  7703. for (var _i = 0, _a2 = feature1.coordinates[0]; _i < _a2.length; _i++) {
  7704. var coord1 = _a2[_i];
  7705. if (booleanPointInPolygon(coord1, feature2)) {
  7706. return true;
  7707. }
  7708. }
  7709. for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
  7710. var coord2 = _c[_b];
  7711. if (booleanPointInPolygon(coord2, feature1)) {
  7712. return true;
  7713. }
  7714. }
  7715. var doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
  7716. if (doLinesIntersect.features.length > 0) {
  7717. return true;
  7718. }
  7719. return false;
  7720. }
  7721. function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt2) {
  7722. var dxc = pt2[0] - lineSegmentStart[0];
  7723. var dyc = pt2[1] - lineSegmentStart[1];
  7724. var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
  7725. var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
  7726. var cross2 = dxc * dyl - dyc * dxl;
  7727. if (cross2 !== 0) {
  7728. return false;
  7729. }
  7730. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7731. if (dxl > 0) {
  7732. return lineSegmentStart[0] <= pt2[0] && pt2[0] <= lineSegmentEnd[0];
  7733. } else {
  7734. return lineSegmentEnd[0] <= pt2[0] && pt2[0] <= lineSegmentStart[0];
  7735. }
  7736. } else if (dyl > 0) {
  7737. return lineSegmentStart[1] <= pt2[1] && pt2[1] <= lineSegmentEnd[1];
  7738. } else {
  7739. return lineSegmentEnd[1] <= pt2[1] && pt2[1] <= lineSegmentStart[1];
  7740. }
  7741. }
  7742. function compareCoords(pair1, pair2) {
  7743. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  7744. }
  7745. function booleanIntersects(feature1, feature2) {
  7746. var bool = false;
  7747. flattenEach(feature1, function(flatten1) {
  7748. flattenEach(feature2, function(flatten22) {
  7749. if (bool === true) {
  7750. return true;
  7751. }
  7752. bool = !booleanDisjoint(flatten1.geometry, flatten22.geometry);
  7753. });
  7754. });
  7755. return bool;
  7756. }
  7757. function rectangleGrid(bbox2, cellWidth, cellHeight, options2) {
  7758. if (options2 === void 0) {
  7759. options2 = {};
  7760. }
  7761. var results = [];
  7762. var west = bbox2[0];
  7763. var south = bbox2[1];
  7764. var east = bbox2[2];
  7765. var north = bbox2[3];
  7766. var xFraction = cellWidth / distance([west, south], [east, south], options2);
  7767. var cellWidthDeg = xFraction * (east - west);
  7768. var yFraction = cellHeight / distance([west, south], [west, north], options2);
  7769. var cellHeightDeg = yFraction * (north - south);
  7770. var bboxWidth = east - west;
  7771. var bboxHeight = north - south;
  7772. var columns = Math.floor(bboxWidth / cellWidthDeg);
  7773. var rows = Math.floor(bboxHeight / cellHeightDeg);
  7774. var deltaX = (bboxWidth - columns * cellWidthDeg) / 2;
  7775. var deltaY = (bboxHeight - rows * cellHeightDeg) / 2;
  7776. var currentX = west + deltaX;
  7777. for (var column = 0; column < columns; column++) {
  7778. var currentY = south + deltaY;
  7779. for (var row = 0; row < rows; row++) {
  7780. var cellPoly = polygon([
  7781. [
  7782. [currentX, currentY],
  7783. [currentX, currentY + cellHeightDeg],
  7784. [currentX + cellWidthDeg, currentY + cellHeightDeg],
  7785. [currentX + cellWidthDeg, currentY],
  7786. [currentX, currentY]
  7787. ]
  7788. ], options2.properties);
  7789. if (options2.mask) {
  7790. if (booleanIntersects(options2.mask, cellPoly)) {
  7791. results.push(cellPoly);
  7792. }
  7793. } else {
  7794. results.push(cellPoly);
  7795. }
  7796. currentY += cellHeightDeg;
  7797. }
  7798. currentX += cellWidthDeg;
  7799. }
  7800. return featureCollection$1(results);
  7801. }
  7802. function squareGrid(bbox2, cellSide, options2) {
  7803. if (options2 === void 0) {
  7804. options2 = {};
  7805. }
  7806. return rectangleGrid(bbox2, cellSide, cellSide, options2);
  7807. }
  7808. class ViewShed {
  7809. constructor(viewer2) {
  7810. if (!viewer2)
  7811. throw new Cesium.DeveloperError("no viewer object!");
  7812. this.viewer = viewer2;
  7813. this.handler = void 0;
  7814. this.lightCamera;
  7815. this.pyramid;
  7816. this.frustumPrimitive;
  7817. this.viewershedPolygon;
  7818. }
  7819. initHandler() {
  7820. if (this.handler) {
  7821. this.handler.destroy();
  7822. this.handler = void 0;
  7823. }
  7824. let canvas = document.getElementById("canvasMap");
  7825. if (canvas == null) {
  7826. canvas = document.createElement("canvas");
  7827. canvas.id = "canvasMap";
  7828. canvas.style.display = "none";
  7829. canvas.style.top = "0px";
  7830. canvas.style.position = "absolute";
  7831. document.body.append(canvas);
  7832. }
  7833. this.canvasEle = canvas;
  7834. }
  7835. ReturnDistance(pos0, pos1) {
  7836. let point1cartographic = Cesium.Cartographic.fromCartesian(pos0);
  7837. let point2cartographic = Cesium.Cartographic.fromCartesian(pos1);
  7838. let geodesic = new Cesium.EllipsoidGeodesic();
  7839. geodesic.setEndPoints(point1cartographic, point2cartographic);
  7840. let s = geodesic.surfaceDistance;
  7841. return s;
  7842. }
  7843. getHeight(x, y, objectsToExclude) {
  7844. let endCartographic = Cesium.Cartographic.fromDegrees(x, y);
  7845. let endHeight = this.viewer.scene.sampleHeight(
  7846. endCartographic,
  7847. objectsToExclude
  7848. );
  7849. return endHeight;
  7850. }
  7851. cartesian3ToDegree(Cartesian32) {
  7852. let _ellipsoid = this.viewer.scene.globe.ellipsoid;
  7853. let _cartographic = _ellipsoid.cartesianToCartographic(Cartesian32);
  7854. let _lat = Cesium.Math.toDegrees(_cartographic.latitude);
  7855. let _lng = Cesium.Math.toDegrees(_cartographic.longitude);
  7856. let _alt = _cartographic.height;
  7857. return [_lng, _lat, _alt];
  7858. }
  7859. getAngle(lng1, lat1, lng2, lat2) {
  7860. let dRotateAngle = Math.atan2(Math.abs(lng1 - lng2), Math.abs(lat1 - lat2));
  7861. if (lng2 >= lng1) {
  7862. dRotateAngle = lat2 < lat1 ? Math.PI - dRotateAngle : dRotateAngle;
  7863. } else {
  7864. dRotateAngle = lat2 >= lat1 ? 2 * Math.PI - dRotateAngle : Math.PI + dRotateAngle;
  7865. }
  7866. dRotateAngle = dRotateAngle * 180 / Math.PI;
  7867. return dRotateAngle;
  7868. }
  7869. getPitch(pointA, pointB) {
  7870. let transfrom = Cesium.Transforms.eastNorthUpToFixedFrame(pointA);
  7871. const vector = Cesium.Cartesian3.subtract(
  7872. pointB,
  7873. pointA,
  7874. new Cesium.Cartesian3()
  7875. );
  7876. let direction = Cesium.Matrix4.multiplyByPointAsVector(
  7877. Cesium.Matrix4.inverse(transfrom, transfrom),
  7878. vector,
  7879. vector
  7880. );
  7881. Cesium.Cartesian3.normalize(direction, direction);
  7882. return Cesium.Math.PI_OVER_TWO - Cesium.Math.acosClamped(direction.z);
  7883. }
  7884. updateViewShed() {
  7885. this.clear();
  7886. this.setLightCamera();
  7887. this.addVisualPyramid();
  7888. this.createFrustum();
  7889. }
  7890. clear() {
  7891. if (this.pyramid) {
  7892. this.viewer.entities.removeById(this.pyramid.id);
  7893. this.pyramid = void 0;
  7894. }
  7895. if (this.frustumPrimitive) {
  7896. this.viewer.scene.primitives.remove(this.frustumPrimitive);
  7897. this.frustumPrimitive = void 0;
  7898. }
  7899. if (this.debugModelMatrixPrimitive) {
  7900. this.viewer.scene.primitives.remove(this.debugModelMatrixPrimitive);
  7901. this.debugModelMatrixPrimitive = void 0;
  7902. }
  7903. }
  7904. addVisualPyramid() {
  7905. let options2 = this.ViewShedOptions;
  7906. let position2 = options2.viewPosition;
  7907. let visualRange = Number(options2.visualRange);
  7908. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  7909. this.debugModelMatrixPrimitive = this.viewer.scene.primitives.add(
  7910. new Cesium.DebugModelMatrixPrimitive({
  7911. modelMatrix: transform3,
  7912. length: 5
  7913. })
  7914. );
  7915. const halfClock = options2.horizontalViewAngle / 2;
  7916. const halfCone = options2.verticalViewAngle / 2;
  7917. const pitch = Cesium.Math.toDegrees(options2.pitch);
  7918. const ellipsoid = new Cesium.EllipsoidGraphics({
  7919. radii: new Cesium.Cartesian3(visualRange, visualRange, visualRange),
  7920. minimumClock: Cesium.Math.toRadians(90 - options2.direction - halfClock),
  7921. maximumClock: Cesium.Math.toRadians(90 - options2.direction + halfClock),
  7922. minimumCone: Cesium.Math.toRadians(90 - pitch - halfCone),
  7923. maximumCone: Cesium.Math.toRadians(90 - pitch + halfCone),
  7924. fill: false,
  7925. outline: true,
  7926. subdivisions: 256,
  7927. stackPartitions: 64,
  7928. slicePartitions: 64,
  7929. outlineColor: Cesium.Color.YELLOWGREEN.withAlpha(0.5)
  7930. });
  7931. const pyramidEntity = new Cesium.Entity({
  7932. position: position2,
  7933. ellipsoid
  7934. });
  7935. this.pyramid = this.viewer.entities.add(pyramidEntity);
  7936. }
  7937. setLightCamera() {
  7938. if (!this.lightCamera) {
  7939. this.lightCamera = new Cesium.Camera(this.viewer.scene);
  7940. }
  7941. let options2 = this.ViewShedOptions;
  7942. let visualRange = Number(options2.visualRange);
  7943. this.lightCamera.position = options2.viewPosition;
  7944. this.lightCamera.frustum.near = 0.1;
  7945. this.lightCamera.frustum.far = visualRange;
  7946. const hr = Cesium.Math.toRadians(options2.horizontalViewAngle);
  7947. const vr = Cesium.Math.toRadians(options2.verticalViewAngle);
  7948. this.lightCamera.frustum.aspectRatio = visualRange * Math.tan(hr / 2) * 2 / (visualRange * Math.tan(vr / 2) * 2);
  7949. this.lightCamera.frustum.fov = hr > vr ? hr : vr;
  7950. this.lightCamera.setView({
  7951. destination: options2.viewPosition,
  7952. orientation: {
  7953. heading: Cesium.Math.toRadians(options2.direction || 0),
  7954. pitch: options2.pitch || 0,
  7955. roll: 0
  7956. }
  7957. });
  7958. }
  7959. createFrustum() {
  7960. const scratchRight = new Cesium.Cartesian3();
  7961. const scratchRotation = new Cesium.Matrix3();
  7962. const scratchOrientation = new Cesium.Quaternion();
  7963. const direction = this.lightCamera.directionWC;
  7964. const up = this.lightCamera.upWC;
  7965. let right = this.lightCamera.rightWC;
  7966. right = Cesium.Cartesian3.negate(right, scratchRight);
  7967. let rotation = scratchRotation;
  7968. Cesium.Matrix3.setColumn(rotation, 0, right, rotation);
  7969. Cesium.Matrix3.setColumn(rotation, 1, up, rotation);
  7970. Cesium.Matrix3.setColumn(rotation, 2, direction, rotation);
  7971. let orientation = Cesium.Quaternion.fromRotationMatrix(
  7972. rotation,
  7973. scratchOrientation
  7974. );
  7975. let instanceOutline = new Cesium.GeometryInstance({
  7976. geometry: new Cesium.FrustumOutlineGeometry({
  7977. frustum: this.lightCamera.frustum,
  7978. origin: this.ViewShedOptions.viewPosition,
  7979. orientation
  7980. }),
  7981. id: "\u89C6\u690E\u4F53\u8F6E\u5ED3\u7EBF" + Math.random().toString(36).substr(2),
  7982. attributes: {
  7983. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  7984. new Cesium.Color(0, 1, 0, 1)
  7985. ),
  7986. show: new Cesium.ShowGeometryInstanceAttribute(true)
  7987. }
  7988. });
  7989. this.frustumPrimitive = this.viewer.scene.primitives.add(
  7990. new Cesium.Primitive({
  7991. geometryInstances: instanceOutline,
  7992. appearance: new Cesium.PerInstanceColorAppearance({
  7993. flat: true,
  7994. translucent: false,
  7995. closed: true
  7996. })
  7997. })
  7998. );
  7999. }
  8000. addViewershedPolygon(positionArr) {
  8001. let polygon2 = new Cesium.PolygonGeometry({
  8002. polygonHierarchy: new Cesium.PolygonHierarchy(
  8003. Cesium.Cartesian3.fromDegreesArray(positionArr)
  8004. ),
  8005. height: 0,
  8006. extrudedHeight: 0,
  8007. vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
  8008. stRotation: 0,
  8009. ellipsoid: Cesium.Ellipsoid.WGS84,
  8010. granularity: Cesium.Math.RADIANS_PER_DEGREE,
  8011. perPositionHeight: false,
  8012. closeTop: true,
  8013. closeBottom: true,
  8014. arcType: Cesium.ArcType.GEODESIC
  8015. });
  8016. let polygonInstance = new Cesium.GeometryInstance({
  8017. geometry: polygon2,
  8018. name: "ViewershedPolygon",
  8019. attributes: {
  8020. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8021. Cesium.Color.BLUE.withAlpha(0.6)
  8022. ),
  8023. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8024. }
  8025. });
  8026. this.viewershedPolygon = this.viewer.scene.primitives.add(
  8027. new Cesium.GroundPrimitive({
  8028. geometryInstances: polygonInstance,
  8029. appearance: new Cesium.EllipsoidSurfaceAppearance({
  8030. aboveGround: true,
  8031. material: new Cesium.Material({
  8032. fabric: {
  8033. type: "Image",
  8034. uniforms: {
  8035. image: this.returnImgae()
  8036. }
  8037. }
  8038. })
  8039. })
  8040. })
  8041. );
  8042. }
  8043. drawViewershed(precision) {
  8044. const pos = this.cartesian3ToDegree(this.ViewShedOptions.viewPosition);
  8045. const radius = this.ViewShedOptions.visualRange;
  8046. const direction = this.ViewShedOptions.direction;
  8047. let boundary = this.computeBoundaryOptions(pos, radius, direction);
  8048. const bbox2 = boundary.bbox;
  8049. let mask = polygon([boundary.boundaryPoints]);
  8050. const dis = this.ViewShedOptions.visualRange / (precision * 1e3);
  8051. let gridPoints = pointGrid(bbox2, dis, {
  8052. mask
  8053. });
  8054. console.log(this.ViewShedOptions.visualRange, precision, dis);
  8055. let pointsResult = this.createTargetPoints(gridPoints, dis, pos);
  8056. let variogram = index.train(
  8057. pointsResult.values,
  8058. pointsResult.lngs,
  8059. pointsResult.lats,
  8060. "exponential",
  8061. 0,
  8062. 100
  8063. );
  8064. let grid2 = index.grid([boundary.boundaryPoints], variogram, dis / 1e3);
  8065. const colors = [
  8066. "#ff000080",
  8067. "#ff000080",
  8068. "#ff000080",
  8069. "#ff000080",
  8070. "#ff000080",
  8071. "#ff000080",
  8072. "#00ff0080",
  8073. "#00ff0080",
  8074. "#00ff0080",
  8075. "#00ff0080",
  8076. "#00ff0080",
  8077. "#00ff0080"
  8078. ];
  8079. this.canvasEle.width = 3840;
  8080. this.canvasEle.height = 2160;
  8081. index.plot(
  8082. this.canvasEle,
  8083. grid2,
  8084. [bbox2[0], bbox2[2]],
  8085. [bbox2[1], bbox2[3]],
  8086. colors
  8087. );
  8088. this.addViewershedPolygon(boundary.positionArr);
  8089. }
  8090. computeBoundaryOptions(pos, radius, angle) {
  8091. let Ea = 6378137;
  8092. let Eb = 6356725;
  8093. const lng = pos[0], lat = pos[1];
  8094. const bbox2 = [lng, lat, lng, lat];
  8095. let positionArr = [];
  8096. let boundaryPoints = [];
  8097. positionArr.push(lng, lat);
  8098. boundaryPoints.push([lng, lat]);
  8099. let start2 = angle + 45 > 360 ? angle - 45 - 360 : angle - 45;
  8100. let end = start2 + 90;
  8101. for (let i2 = start2; i2 <= end; i2++) {
  8102. let dx = radius * Math.sin(i2 * Math.PI / 180);
  8103. let dy = radius * Math.cos(i2 * Math.PI / 180);
  8104. let ec = Eb + (Ea - Eb) * (90 - lat) / 90;
  8105. let ed = ec * Math.cos(lat * Math.PI / 180);
  8106. let BJD = lng + dx / ed * 180 / Math.PI;
  8107. let BWD = lat + dy / ec * 180 / Math.PI;
  8108. positionArr.push(BJD, BWD);
  8109. boundaryPoints.push([BJD, BWD]);
  8110. this.refreshBBox(bbox2, BJD, BWD);
  8111. }
  8112. boundaryPoints.push([lng, lat]);
  8113. return {
  8114. positionArr,
  8115. boundaryPoints,
  8116. bbox: bbox2
  8117. };
  8118. }
  8119. refreshBBox(result, x, y) {
  8120. result[0] = x < result[0] ? x : result[0];
  8121. result[1] = y < result[1] ? y : result[1];
  8122. result[2] = x > result[2] ? x : result[2];
  8123. result[3] = y > result[3] ? y : result[3];
  8124. }
  8125. createTargetPoints(gridPoints, step, sourcePos) {
  8126. let positionArr = [];
  8127. let objectsToExclude = [
  8128. this.frustumPrimitive,
  8129. this.pyramid,
  8130. this.debugModelMatrixPrimitive
  8131. ];
  8132. let values3 = [], lngs = [], lats = [];
  8133. let height2 = this.getHeight(sourcePos[0], sourcePos[1], objectsToExclude);
  8134. positionArr.push({
  8135. x: sourcePos[0],
  8136. y: sourcePos[1],
  8137. z: height2
  8138. });
  8139. let viewPoint = this.ViewShedOptions.viewPosition;
  8140. for (let index2 = 0; index2 < gridPoints.features.length; index2++) {
  8141. const feature2 = gridPoints.features[index2];
  8142. const coords = feature2.geometry.coordinates;
  8143. const x = coords[0], y = coords[1];
  8144. let h2 = this.getHeight(x, y, objectsToExclude);
  8145. let endPoint = Cesium.Cartesian3.fromDegrees(x, y, h2);
  8146. let direction = Cesium.Cartesian3.normalize(
  8147. Cesium.Cartesian3.subtract(
  8148. endPoint,
  8149. viewPoint,
  8150. new Cesium.Cartesian3()
  8151. ),
  8152. new Cesium.Cartesian3()
  8153. );
  8154. let ray = new Cesium.Ray(viewPoint, direction);
  8155. let result = this.viewer.scene.pickFromRay(ray, objectsToExclude);
  8156. if (result) {
  8157. let buffer = this.ReturnDistance(endPoint, result.position);
  8158. if (buffer > step) {
  8159. values3.push(0);
  8160. } else {
  8161. values3.push(1);
  8162. }
  8163. lngs.push(x);
  8164. lats.push(y);
  8165. }
  8166. }
  8167. return {
  8168. values: values3,
  8169. lngs,
  8170. lats
  8171. };
  8172. }
  8173. returnImgae() {
  8174. return this.canvasEle.toDataURL("image/png");
  8175. }
  8176. }
  8177. Object.assign(ViewShed.prototype, {
  8178. createViewshed: function(precision) {
  8179. let _self = this;
  8180. let scene = _self.viewer.scene;
  8181. _self.initHandler();
  8182. _self.clearAll();
  8183. let count = 0;
  8184. let toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u8D77\u70B9";
  8185. _self.handler = new Cesium.ScreenSpaceEventHandler(_self.viewer.canvas);
  8186. _self.handler.setInputAction((event2) => {
  8187. count++;
  8188. if (count === 1) {
  8189. toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u7EC8\u70B9";
  8190. let earthPosition = scene.pickPosition(event2.position);
  8191. let pos = _self.cartesian3ToDegree(earthPosition);
  8192. _self.handler.setInputAction(function(move) {
  8193. CreateRemindertip(toolTip, move.endPosition, true);
  8194. let newPosition = scene.pickPosition(move.endPosition);
  8195. if (Cesium.defined(newPosition)) {
  8196. let pos1 = _self.cartesian3ToDegree(newPosition);
  8197. let distance2 = Cesium.Cartesian3.distance(newPosition, earthPosition);
  8198. let angle = _self.getAngle(pos[0], pos[1], pos1[0], pos1[1]);
  8199. let pitch = _self.getPitch(earthPosition, newPosition);
  8200. _self.ViewShedOptions = {
  8201. viewPosition: earthPosition,
  8202. endPosition: newPosition,
  8203. direction: angle,
  8204. pitch,
  8205. horizontalViewAngle: 90,
  8206. verticalViewAngle: 60,
  8207. visibleAreaColor: Cesium.Color.GREEN,
  8208. invisibleAreaColor: Cesium.Color.RED,
  8209. visualRange: distance2
  8210. };
  8211. _self.updateViewShed();
  8212. }
  8213. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8214. }
  8215. if (count === 2) {
  8216. _self.initHandler();
  8217. _self.drawViewershed(precision);
  8218. CreateRemindertip(toolTip, event2.endPosition, false);
  8219. }
  8220. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  8221. _self.handler.setInputAction(function(move) {
  8222. CreateRemindertip(toolTip, move.endPosition, true);
  8223. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8224. },
  8225. clearAll: function() {
  8226. this.clear();
  8227. if (this.viewershedPolygon) {
  8228. this.viewer.scene.primitives.remove(this.viewershedPolygon);
  8229. this.viewershedPolygon = void 0;
  8230. }
  8231. }
  8232. });
  8233. class SunshineShadow {
  8234. constructor(viewer2) {
  8235. if (!viewer2)
  8236. throw new Cesium.DeveloperError("no viewer object!");
  8237. this._viewer = viewer2;
  8238. this._stopTime = null;
  8239. }
  8240. }
  8241. Object.assign(SunshineShadow.prototype, {
  8242. startSunShine(options2) {
  8243. options2 = options2 || {};
  8244. if (!Cesium.defined(options2.startTime)) {
  8245. options2.startTime = new Date().getTime();
  8246. }
  8247. if (!Cesium.defined(options2.stopTime)) {
  8248. options2.stopTime = new Date().getTime() + 1e3;
  8249. }
  8250. if (!Cesium.defined(options2.speed)) {
  8251. options2.speed = 1600;
  8252. }
  8253. if (this._stopTime) {
  8254. this._viewer.clock.shouldAnimate = true;
  8255. this._viewer.clock.currentTime = this._stopTime;
  8256. } else {
  8257. this._viewer.scene.globe.enableLighting = true;
  8258. this._viewer.shadows = true;
  8259. this._viewer.clock.startTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8260. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8261. this._viewer.clock.stopTime = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  8262. console.log(this._viewer.clock.currentTime);
  8263. this._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  8264. this._viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER;
  8265. this._viewer.clock.multiplier = options2.speed;
  8266. this._viewer.clock.canAnimate = true;
  8267. this._viewer.clock.shouldAnimate = true;
  8268. }
  8269. },
  8270. stopSunShine() {
  8271. this._stopTime = this._viewer.clock.currentTime;
  8272. console.log(this._viewer.clock.currentTime);
  8273. this._viewer.clock.shouldAnimate = false;
  8274. },
  8275. removeSunShine() {
  8276. if (this._stopTime) {
  8277. this._viewer.clock.shouldAnimate = true;
  8278. this._viewer.clock.currentTime = this._stopTime;
  8279. console.log(this._viewer.clock.currentTime);
  8280. }
  8281. this._viewer.scene.globe.enableLighting = false;
  8282. this._viewer.shadows = false;
  8283. this._stopTime = null;
  8284. }
  8285. });
  8286. Object.assign(SunshineShadow.prototype, {
  8287. start(options2) {
  8288. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  8289. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "block";
  8290. }
  8291. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  8292. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "block";
  8293. }
  8294. this._viewer.shadows = true;
  8295. options2 = options2 || {};
  8296. if (!Cesium.defined(options2.startTime)) {
  8297. options2.startTime = new Date(new Date().toLocaleDateString()).getTime();
  8298. console.log("\u5F53\u5929\u51CC\u66680\u70B9", new Date(new Date().toLocaleDateString()));
  8299. }
  8300. if (!Cesium.defined(options2.stopTime)) {
  8301. options2.stopTime = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1e3 - 1;
  8302. console.log("\u5F53\u592923\u70B959\u520659\u79D2", new Date(new Date(new Date().toLocaleDateString()).getTime() + 4 * 60 * 60 * 1e3));
  8303. }
  8304. if (!Cesium.defined(options2.speed)) {
  8305. options2.speed = 1600;
  8306. }
  8307. let start2 = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8308. let stop = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  8309. viewer.timeline.zoomTo(start2, stop);
  8310. let clock2 = viewer.clock;
  8311. clock2.shouldAnimate = false;
  8312. clock2.startTime = start2;
  8313. clock2.stopTime = stop;
  8314. clock2.currentTime = start2;
  8315. clock2.clockRange = Cesium.ClockRange.UNBOUNDED;
  8316. clock2.multiplier = options2.speed;
  8317. },
  8318. remove() {
  8319. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  8320. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "none";
  8321. }
  8322. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  8323. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "none";
  8324. }
  8325. this._viewer.shadows = false;
  8326. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(new Date().getTime()));
  8327. this._viewer.clock.shouldAnimate = false;
  8328. }
  8329. });
  8330. class Profile {
  8331. constructor(viewer2) {
  8332. if (!viewer2)
  8333. throw new Cesium.DeveloperError("no viewer object!");
  8334. this._viewer = viewer2;
  8335. this._profileEntities = [];
  8336. }
  8337. _interPoints(positions, objectsToExclude) {
  8338. let positionsCartographic = [];
  8339. let terrainSamplePositions = [];
  8340. for (let index2 = 0; index2 < positions.length; index2++) {
  8341. const element = positions[index2];
  8342. let ellipsoid = this._viewer.scene.globe.ellipsoid;
  8343. let cartographic = ellipsoid.cartesianToCartographic(element);
  8344. positionsCartographic.push(cartographic);
  8345. }
  8346. for (let i2 = 0; i2 < positionsCartographic.length; i2++) {
  8347. const m_Cartographic0 = positionsCartographic[i2];
  8348. const m_Cartographic1 = positionsCartographic[i2 + 1];
  8349. if (m_Cartographic1) {
  8350. let a = Math.abs(m_Cartographic0.longitude - m_Cartographic1.longitude) * 1e7;
  8351. let b = Math.abs(m_Cartographic0.latitude - m_Cartographic1.latitude) * 1e7;
  8352. if (a > b)
  8353. b = a;
  8354. let length = parseInt(b / 2);
  8355. if (length > 1e3)
  8356. length = 1e3;
  8357. if (length < 2)
  8358. length = 2;
  8359. for (let j = 0; j < length; j++) {
  8360. terrainSamplePositions.push(
  8361. new Cesium.Cartographic(
  8362. Cesium.Math.lerp(
  8363. m_Cartographic0.longitude,
  8364. m_Cartographic1.longitude,
  8365. j / (length - 1)
  8366. ),
  8367. Cesium.Math.lerp(
  8368. m_Cartographic0.latitude,
  8369. m_Cartographic1.latitude,
  8370. j / (length - 1)
  8371. )
  8372. )
  8373. );
  8374. }
  8375. terrainSamplePositions.pop();
  8376. } else {
  8377. terrainSamplePositions.push(m_Cartographic0);
  8378. }
  8379. }
  8380. let positions_Inter = [];
  8381. let distance2 = 0;
  8382. for (let n = 0; n < terrainSamplePositions.length; n++) {
  8383. let curCartographic = terrainSamplePositions[n];
  8384. let height2 = this._viewer.scene.sampleHeight(curCartographic, objectsToExclude);
  8385. const lon = curCartographic.longitude / Math.PI * 180;
  8386. const lat = curCartographic.latitude / Math.PI * 180;
  8387. let point2 = Cesium.Cartesian3.fromDegrees(lon, lat, height2);
  8388. let preCartographic = terrainSamplePositions[n - 1];
  8389. if (preCartographic) {
  8390. const lon1 = preCartographic.longitude / Math.PI * 180;
  8391. const lat1 = preCartographic.latitude / Math.PI * 180;
  8392. let point1 = Cesium.Cartesian3.fromDegrees(lon1, lat1, height2);
  8393. let curDis = Cesium.Cartesian3.distance(point1, point2);
  8394. distance2 += curDis;
  8395. }
  8396. positions_Inter.push({
  8397. position: {
  8398. lon,
  8399. lat,
  8400. height: height2
  8401. },
  8402. distance: distance2
  8403. });
  8404. }
  8405. return positions_Inter;
  8406. }
  8407. }
  8408. Object.assign(Profile.prototype, {
  8409. startProfileAnalysis(points2, entity) {
  8410. return new Promise((resolve2, reject2) => {
  8411. let _self = this;
  8412. let positions = points2.map((point2) => {
  8413. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8414. });
  8415. _self.removeProfileAnalysis();
  8416. entity.clampToGround = true;
  8417. console.log(positions);
  8418. let pointsList = _self._interPoints(positions, [entity]);
  8419. console.log(pointsList);
  8420. resolve2(pointsList);
  8421. });
  8422. },
  8423. removeProfileAnalysis() {
  8424. let _self = this;
  8425. if (_self._profileEntities && _self._profileEntities.length > 0) {
  8426. _self._profileEntities.forEach((element) => {
  8427. _self._viewer.entities.remove(element);
  8428. });
  8429. }
  8430. _self._profileEntities = [];
  8431. }
  8432. });
  8433. class CutFill {
  8434. constructor(viewer2) {
  8435. if (!viewer2)
  8436. throw new Cesium.DeveloperError("no viewer object!");
  8437. this._viewer = viewer2;
  8438. this.delEntitys = [];
  8439. this.maxHeigh = -1e6;
  8440. }
  8441. _VolumeAnalysis(options2) {
  8442. let _self = this;
  8443. let cutArea = 0, cutVolume = 0, fillArea = 0, fillVolume = 0;
  8444. const indices = options2.geom.indices;
  8445. const positions = options2.geom.attributes.position.values;
  8446. for (let index2 = 0; index2 < indices.length; index2 += 3) {
  8447. const pos0 = _self._returnPosition(positions, indices[index2]);
  8448. const pos1 = _self._returnPosition(positions, indices[index2 + 1]);
  8449. const pos2 = _self._returnPosition(positions, indices[index2 + 2]);
  8450. let _entities = _self._viewer.entities.add({
  8451. name: "\u4E09\u89D2\u9762",
  8452. polygon: {
  8453. hierarchy: [pos0.heightPos, pos1.heightPos, pos2.heightPos],
  8454. perPositionHeight: true,
  8455. material: Cesium.Color.fromRandom(),
  8456. extrudedHeight: options2.height,
  8457. outline: true,
  8458. outlineColor: Cesium.Color.BLACK
  8459. }
  8460. });
  8461. _self.delEntitys.push(_entities);
  8462. const area = _self._computeArea4Triangle(
  8463. pos0.noHeightPos,
  8464. pos1.noHeightPos,
  8465. pos2.noHeightPos
  8466. );
  8467. const height2 = (pos0.height + pos1.height + pos2.height) / 3;
  8468. if (height2 < options2.height) {
  8469. fillArea += area;
  8470. const volume = area * (options2.height - height2);
  8471. fillVolume += volume;
  8472. } else {
  8473. cutArea += area;
  8474. const volume = area * (height2 - options2.height);
  8475. cutVolume += volume;
  8476. }
  8477. }
  8478. let allArea = cutArea + fillArea;
  8479. allArea = allArea.toFixed(2);
  8480. cutArea = cutArea.toFixed(2);
  8481. cutVolume = cutVolume.toFixed(2);
  8482. fillArea = fillArea.toFixed(2);
  8483. fillVolume = fillVolume.toFixed(2);
  8484. let result = {
  8485. allArea,
  8486. cutArea,
  8487. cutVolume,
  8488. fillArea,
  8489. fillVolume
  8490. };
  8491. return result;
  8492. }
  8493. _computeArea4Triangle(pos1, pos2, pos3) {
  8494. let a = Cesium.Cartesian3.distance(pos1, pos2);
  8495. let b = Cesium.Cartesian3.distance(pos2, pos3);
  8496. let c = Cesium.Cartesian3.distance(pos3, pos1);
  8497. let S = (a + b + c) / 2;
  8498. return Math.sqrt(S * (S - a) * (S - b) * (S - c));
  8499. }
  8500. _returnPosition(positions, index2) {
  8501. let cartesian = new Cesium.Cartesian3(
  8502. positions[index2 * 3],
  8503. positions[index2 * 3 + 1],
  8504. positions[index2 * 3 + 2]
  8505. );
  8506. let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  8507. let height2 = this._viewer.scene.sampleHeightSupported ? this._viewer.scene.sampleHeight(cartographic) : this._viewer.scene.globe.getHeight(cartographic);
  8508. if (height2 > this.maxHeigh) {
  8509. this.maxHeigh = height2;
  8510. }
  8511. return {
  8512. heightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height2),
  8513. noHeightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0),
  8514. height: height2
  8515. };
  8516. }
  8517. }
  8518. Object.assign(CutFill.prototype, {
  8519. createPolygonGeo(points2, options2) {
  8520. return new Promise((resolve2, reject2) => {
  8521. let _self = this;
  8522. options2 = options2 || {};
  8523. options2.precision = Cesium.defaultValue(options2.precision, 256);
  8524. options2.height = Cesium.defaultValue(options2.height, 10);
  8525. _self.remove();
  8526. let positions = [];
  8527. for (let i2 = 0; i2 < points2.length; i2++) {
  8528. if (points2[i2] instanceof Cesium.Cartesian3) {
  8529. positions.push(points2[i2]);
  8530. } else {
  8531. positions.push(Cesium.Cartesian3.fromDegrees(points2[i2][0], points2[i2][1], points2[i2][1] || 0));
  8532. }
  8533. }
  8534. let granularity = Math.PI / Math.pow(2, 11);
  8535. granularity = granularity / options2.precision;
  8536. let polygonGeometry = new Cesium.PolygonGeometry.fromPositions({
  8537. positions,
  8538. vertexFormat: Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
  8539. granularity
  8540. });
  8541. options2.geom = new Cesium.PolygonGeometry.createGeometry(polygonGeometry);
  8542. let result = _self._VolumeAnalysis(options2);
  8543. _self._viewer.scene.globe.baseColor = new Cesium.Color(1, 1, 1, 0.9);
  8544. _self._viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
  8545. _self._viewer.scene.globe.translucency.enabled = true;
  8546. resolve2(result);
  8547. });
  8548. },
  8549. remove() {
  8550. for (var i2 = 0; i2 < this.delEntitys.length; i2++) {
  8551. this._viewer.entities.remove(this.delEntitys[i2]);
  8552. }
  8553. this._viewer.scene.screenSpaceCameraController.enableCollisionDetection = true;
  8554. this._viewer.scene.globe.translucency.enabled = false;
  8555. }
  8556. });
  8557. class HeightLimit {
  8558. constructor(viewer2) {
  8559. if (!viewer2)
  8560. throw new Cesium.DeveloperError("no viewer object!");
  8561. this._viewer = viewer2;
  8562. this.targetY = 0;
  8563. }
  8564. _setPolygon(options2) {
  8565. let _self = this;
  8566. _self.HiePolygon = _self._viewer.entities.add({
  8567. polygon: {
  8568. hierarchy: new Cesium.PolygonHierarchy(_self.data),
  8569. material: _self._handleColor("#FFF8DC", options2.alpha),
  8570. height: new Cesium.CallbackProperty(_self._createPolygonUpdateFunction(), false),
  8571. perPositionHeight: false,
  8572. outline: true,
  8573. outlineColor: _self._handleColor("red", options2.alpha),
  8574. outlineWidth: 1
  8575. }
  8576. });
  8577. }
  8578. _createPolygonUpdateFunction() {
  8579. let _self = this;
  8580. return function() {
  8581. return _self.targetY;
  8582. };
  8583. }
  8584. _handleColor(color2, alpha) {
  8585. return Cesium.Color.fromCssColorString(color2).withAlpha(alpha || 1);
  8586. }
  8587. _getMinHeight(points2) {
  8588. let height2 = 0;
  8589. points2.map((point2) => {
  8590. let _height = point2[2] || 0;
  8591. height2 = _height;
  8592. if (_height < height2) {
  8593. height2 = _height;
  8594. }
  8595. });
  8596. return height2;
  8597. }
  8598. }
  8599. Object.assign(HeightLimit.prototype, {
  8600. addPrimitive(points2, options2) {
  8601. this.removePrimitive();
  8602. options2 = options2 || {};
  8603. options2.height = Cesium.defaultValue(options2.height, 50);
  8604. options2.baseHeight = Cesium.defaultValue(options2.baseHeight, 50);
  8605. options2.color = Cesium.defaultValue(options2.color, "red");
  8606. options2.alpha = Cesium.defaultValue(options2.alpha, 0.6);
  8607. let positions = points2.map((point2) => {
  8608. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8609. });
  8610. let _self = this;
  8611. _self.data = positions;
  8612. _self.baseHeight = options2.baseHeight;
  8613. _self.targetY = options2.baseHeight + options2.height;
  8614. let polygonInstance = new Cesium.GeometryInstance({
  8615. geometry: new Cesium.PolygonGeometry({
  8616. polygonHierarchy: new Cesium.PolygonHierarchy(_self.data),
  8617. height: _self.baseHeight,
  8618. extrudedHeight: _self.baseHeight + 3e3
  8619. }),
  8620. attributes: {
  8621. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8622. Cesium.Color.fromCssColorString(options2.color).withAlpha(options2.alpha)
  8623. ),
  8624. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8625. }
  8626. });
  8627. _self.limitHeightPrimitive = _self._viewer.scene.primitives.add(
  8628. new Cesium.ClassificationPrimitive({
  8629. geometryInstances: polygonInstance,
  8630. releaseGeometryInstances: false,
  8631. classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
  8632. })
  8633. );
  8634. _self._setPolygon(options2);
  8635. },
  8636. removePrimitive() {
  8637. if (this.HiePolygon) {
  8638. this._viewer.entities.remove(this.HiePolygon);
  8639. }
  8640. if (this.limitHeightPrimitive) {
  8641. this._viewer.scene.primitives.remove(this.limitHeightPrimitive);
  8642. }
  8643. },
  8644. changeHeight(height2) {
  8645. if (!this.limitHeightPrimitive)
  8646. return;
  8647. this.targetY = this.baseHeight + height2;
  8648. let cartographic = Cesium.Cartographic.fromCartesian(this.limitHeightPrimitive._primitive._boundingSpheres[0].center);
  8649. let surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight);
  8650. let offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight + height2);
  8651. let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
  8652. this.limitHeightPrimitive._primitive.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  8653. }
  8654. });
  8655. class Cutting {
  8656. constructor(viewer2) {
  8657. if (!viewer2)
  8658. throw new Cesium.DeveloperError("no viewer object!");
  8659. this._viewer = viewer2;
  8660. this._camera = this._viewer.camera;
  8661. this._scene = this._viewer.scene;
  8662. this.targetY = 0;
  8663. this._mouseHandler();
  8664. }
  8665. _mouseHandler() {
  8666. let _self = this;
  8667. let viewer2 = _self._viewer;
  8668. let scene = _self._scene;
  8669. let selectedPlane;
  8670. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8671. downHandler.setInputAction(function(movement) {
  8672. let pickedObject = scene.pick(movement.position);
  8673. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  8674. selectedPlane = pickedObject.id.plane;
  8675. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  8676. selectedPlane.outlineColor = Cesium.Color.RED;
  8677. scene.screenSpaceCameraController.enableInputs = false;
  8678. }
  8679. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  8680. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8681. upHandler.setInputAction(function() {
  8682. if (Cesium.defined(selectedPlane)) {
  8683. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  8684. selectedPlane.outlineColor = Cesium.Color.RED;
  8685. selectedPlane = void 0;
  8686. }
  8687. scene.screenSpaceCameraController.enableInputs = true;
  8688. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  8689. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8690. moveHandler.setInputAction(function(movement) {
  8691. if (Cesium.defined(selectedPlane)) {
  8692. let deltaY = movement.startPosition.y - movement.endPosition.y;
  8693. _self.targetY += deltaY;
  8694. }
  8695. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8696. }
  8697. _createPlaneUpdateFunction(plane) {
  8698. let _self = this;
  8699. return function() {
  8700. plane.distance = _self.targetY;
  8701. return plane;
  8702. };
  8703. }
  8704. _createPlane(p1, p2, inverseTransform) {
  8705. let _self = this;
  8706. let p1C3 = _self._getOriginCoordinateSystemPoint(p1, inverseTransform);
  8707. let p2C3 = _self._getOriginCoordinateSystemPoint(p2, inverseTransform);
  8708. let up = new Cesium.Cartesian3(0, 0, 10);
  8709. let right = Cesium.Cartesian3.subtract(p2C3, p1C3, new Cesium.Cartesian3());
  8710. let normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3());
  8711. normal = Cesium.Cartesian3.normalize(normal, normal);
  8712. let planeTmp = Cesium.Plane.fromPointNormal(p1C3, normal);
  8713. return Cesium.ClippingPlane.fromPlane(planeTmp);
  8714. }
  8715. _getOriginCoordinateSystemPoint(point2, inverseTransform) {
  8716. let val = Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  8717. return Cesium.Matrix4.multiplyByPoint(
  8718. inverseTransform,
  8719. val,
  8720. new Cesium.Cartesian3(0, 0, 0)
  8721. );
  8722. }
  8723. _getInverseTransform(tileSet) {
  8724. let transform3;
  8725. const tmp = tileSet.root.transform;
  8726. if (tmp && tmp.equals(Cesium.Matrix4.IDENTITY) || !tmp) {
  8727. transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(tileSet.boundingSphere.center);
  8728. } else {
  8729. transform3 = Cesium.Matrix4.fromArray(tileSet.root.transform);
  8730. }
  8731. return Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  8732. }
  8733. _isDirRes(polygon2, isClockwise) {
  8734. var lineStringList = [];
  8735. polygon2.forEach((p) => {
  8736. lineStringList.push([p.lng, p.lat]);
  8737. });
  8738. var clockwiseRing = lineString(lineStringList);
  8739. let isR = booleanClockwise(clockwiseRing);
  8740. var points2 = [];
  8741. if (isClockwise) {
  8742. if (!isR) {
  8743. points2 = polygon2;
  8744. } else {
  8745. var count = 0;
  8746. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  8747. points2[count] = polygon2[ii];
  8748. count++;
  8749. }
  8750. }
  8751. } else {
  8752. if (isR) {
  8753. points2 = polygon2;
  8754. } else {
  8755. var count = 0;
  8756. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  8757. points2[count] = polygon2[ii];
  8758. count++;
  8759. }
  8760. }
  8761. }
  8762. return points2;
  8763. }
  8764. }
  8765. Object.assign(Cutting.prototype, {
  8766. activate(tileset) {
  8767. let _self = this;
  8768. let viewer2 = _self._viewer;
  8769. let inverseTransform = _self._getInverseTransform(tileset);
  8770. const clippingPlanes1 = [];
  8771. clippingPlanes1.push(_self._createPlane([121.55814450142213, 37.39658788787028], [121.65814450142213, 37.49658788787028], inverseTransform));
  8772. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8773. planes: [
  8774. new Cesium.ClippingPlane(
  8775. new Cesium.Cartesian3(0, 1, 0),
  8776. -10
  8777. )
  8778. ],
  8779. edgeWidth: 1
  8780. });
  8781. _self.tileset = tileset;
  8782. tileset.clippingPlanes = clippingPlanes;
  8783. tileset.debugShowBoundingVolume = false;
  8784. return tileset.readyPromise.then(function() {
  8785. let boundingSphere = tileset.boundingSphere;
  8786. let radius = boundingSphere.radius;
  8787. viewer2.zoomTo(
  8788. tileset,
  8789. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 5)
  8790. );
  8791. if (!Cesium.Matrix4.equals(
  8792. tileset.root.transform,
  8793. Cesium.Matrix4.IDENTITY
  8794. )) {
  8795. const transformCenter = Cesium.Matrix4.getTranslation(tileset.root.transform, new Cesium.Cartesian3());
  8796. const transformCartographic = Cesium.Cartographic.fromCartesian(transformCenter);
  8797. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
  8798. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  8799. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  8800. }
  8801. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  8802. const plane = clippingPlanes.get(i2);
  8803. viewer2.entities.add({
  8804. position: boundingSphere.center,
  8805. plane: {
  8806. dimensions: new Cesium.Cartesian2(
  8807. radius / 10,
  8808. radius / 10
  8809. ),
  8810. material: Cesium.Color.WHITE.withAlpha(0.1),
  8811. plane: new Cesium.CallbackProperty(
  8812. _self._createPlaneUpdateFunction(plane),
  8813. false
  8814. ),
  8815. outline: true,
  8816. outlineColor: Cesium.Color.WHITE
  8817. }
  8818. });
  8819. }
  8820. return tileset;
  8821. });
  8822. },
  8823. addTiles(my3dtiles, pointsArray) {
  8824. let _self = this;
  8825. let viewer2 = _self._viewer;
  8826. let tileset = my3dtiles;
  8827. _self.polygon = pointsArray;
  8828. _self.tileset = tileset;
  8829. return tileset.readyPromise.then(function() {
  8830. let inverseTransform = _self._getInverseTransform(tileset);
  8831. _self.polygon = _self._isDirRes(_self.polygon, false);
  8832. const clippingPlanes1 = [];
  8833. for (let i2 = 0; i2 < _self.polygon.length; i2++) {
  8834. if (i2 === _self.polygon.length - 1) {
  8835. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[0], inverseTransform));
  8836. } else {
  8837. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform));
  8838. }
  8839. }
  8840. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8841. planes: clippingPlanes1,
  8842. edgeWidth: 1,
  8843. edgeColor: Cesium.Color.RED,
  8844. unionClippingRegions: false
  8845. });
  8846. _self.clippingPlanes = clippingPlanes;
  8847. tileset.clippingPlanes = clippingPlanes;
  8848. tileset.debugShowBoundingVolume = false;
  8849. let boundingSphere = tileset.boundingSphere;
  8850. let radius = boundingSphere.radius;
  8851. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  8852. let plane = clippingPlanes.get(i2);
  8853. viewer2.entities.add({
  8854. position: boundingSphere.center,
  8855. plane: {
  8856. dimensions: new Cesium.Cartesian2(
  8857. radius / 10,
  8858. radius / 10
  8859. ),
  8860. material: Cesium.Color.RED.withAlpha(0.1),
  8861. plane: new Cesium.CallbackProperty(
  8862. _self._createPlaneUpdateFunction(plane),
  8863. false
  8864. ),
  8865. outline: true,
  8866. outlineColor: Cesium.Color.RED
  8867. }
  8868. });
  8869. }
  8870. return tileset;
  8871. });
  8872. },
  8873. addTiles2(my3dtiles, pointsArray) {
  8874. let _self = this;
  8875. _self._viewer;
  8876. let tileset = my3dtiles;
  8877. _self.polygon = pointsArray;
  8878. _self.tileset = tileset;
  8879. Cesium.Matrix4.fromArray(
  8880. [
  8881. 1,
  8882. 5551115123125783e-31,
  8883. 5898416033378595e-24,
  8884. 0,
  8885. -6106226635438361e-31,
  8886. 1,
  8887. -11355608731111744e-24,
  8888. 0,
  8889. -5898416061134171e-24,
  8890. 11355608731111744e-24,
  8891. 0.9999999999999999,
  8892. 0,
  8893. 9.912469893228263,
  8894. -19.08345020748675,
  8895. -14.613607150502503,
  8896. 1
  8897. ]
  8898. );
  8899. let transform3 = Cesium.Matrix4.fromArray(
  8900. [
  8901. -0.8874246461620654,
  8902. -0.46095281470464317,
  8903. 0,
  8904. 0,
  8905. 0.2602796082288922,
  8906. -0.5010893346724129,
  8907. 0.8253266045740758,
  8908. 0,
  8909. -0.3804366214290463,
  8910. 0.7324151700322881,
  8911. 0.5646556435405804,
  8912. 0,
  8913. -2429070591483741e-9,
  8914. 467643767731705e-8,
  8915. 3581165448379543e-9,
  8916. 1
  8917. ]
  8918. );
  8919. let inverseTransform = Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  8920. let clippingPlanes1 = [];
  8921. for (let i2 = 0; i2 < _self.polygon.length - 1; i2++) {
  8922. let plane = _self.createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform);
  8923. clippingPlanes1.push(plane);
  8924. }
  8925. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8926. planes: clippingPlanes1,
  8927. edgeWidth: 1,
  8928. edgeColor: Cesium.Color.RED,
  8929. unionClippingRegions: false
  8930. });
  8931. _self.clippingPlanes = clippingPlanes;
  8932. return tileset.readyPromise.then(function() {
  8933. tileset.clippingPlanes = clippingPlanes;
  8934. tileset.debugShowBoundingVolume = false;
  8935. let boundingSphere = tileset.boundingSphere;
  8936. boundingSphere.radius;
  8937. return tileset;
  8938. });
  8939. },
  8940. toggleClipping() {
  8941. let _self = this;
  8942. _self.tileset = null;
  8943. }
  8944. });
  8945. class GeologyClipPlan {
  8946. constructor(viewer2) {
  8947. if (!viewer2)
  8948. throw new Cesium.DeveloperError("no viewer object!");
  8949. this._viewer = viewer2;
  8950. this._camera = this._viewer.camera;
  8951. this._scene = this._viewer.scene;
  8952. this.tileset = void 0;
  8953. this.targetY = 0;
  8954. this.planeEntities = [];
  8955. this._mouseHandler();
  8956. }
  8957. _mouseHandler() {
  8958. let _self = this;
  8959. let viewer2 = _self._viewer;
  8960. let scene = _self._scene;
  8961. let selectedPlane;
  8962. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8963. downHandler.setInputAction(function(movement) {
  8964. let pickedObject = scene.pick(movement.position);
  8965. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  8966. selectedPlane = pickedObject.id.plane;
  8967. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  8968. selectedPlane.outlineColor = Cesium.Color.RED;
  8969. scene.screenSpaceCameraController.enableInputs = false;
  8970. }
  8971. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  8972. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8973. upHandler.setInputAction(function() {
  8974. if (Cesium.defined(selectedPlane)) {
  8975. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  8976. selectedPlane.outlineColor = Cesium.Color.RED;
  8977. selectedPlane = void 0;
  8978. }
  8979. scene.screenSpaceCameraController.enableInputs = true;
  8980. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  8981. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8982. moveHandler.setInputAction(function(movement) {
  8983. if (Cesium.defined(selectedPlane)) {
  8984. let deltaY = movement.startPosition.y - movement.endPosition.y;
  8985. _self.targetY += deltaY;
  8986. }
  8987. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8988. }
  8989. _createPlaneUpdateFunction(plane) {
  8990. let _self = this;
  8991. return function() {
  8992. plane.distance = _self.targetY;
  8993. return plane;
  8994. };
  8995. }
  8996. }
  8997. Object.assign(GeologyClipPlan.prototype, {
  8998. activate(tileset, options2) {
  8999. let _self = this;
  9000. let viewer2 = _self._viewer;
  9001. let distance2 = 1e5;
  9002. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  9003. planes: [
  9004. new Cesium.ClippingPlane(
  9005. new Cesium.Cartesian3(0, 0, -1),
  9006. distance2
  9007. )
  9008. ],
  9009. edgeWidth: 1
  9010. });
  9011. _self.tileset = tileset;
  9012. tileset.clippingPlanes = clippingPlanes;
  9013. tileset.debugShowBoundingVolume = false;
  9014. return tileset.readyPromise.then(function() {
  9015. let boundingSphere = tileset.boundingSphere;
  9016. let radius = boundingSphere.radius;
  9017. if (!Cesium.Matrix4.equals(
  9018. tileset.root.transform,
  9019. Cesium.Matrix4.IDENTITY
  9020. )) {
  9021. const transformCenter = Cesium.Matrix4.getTranslation(
  9022. tileset.root.transform,
  9023. new Cesium.Cartesian3()
  9024. );
  9025. const transformCartographic = Cesium.Cartographic.fromCartesian(
  9026. transformCenter
  9027. );
  9028. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
  9029. tileset.boundingSphere.center
  9030. );
  9031. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  9032. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  9033. }
  9034. viewer2.zoomTo(
  9035. tileset,
  9036. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 10)
  9037. );
  9038. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  9039. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  9040. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  9041. cartographic.height;
  9042. var Cartesian33 = Cesium.Cartesian3.fromDegrees(lng, lat, 105);
  9043. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  9044. let plane = clippingPlanes.get(i2);
  9045. let planeEntity = viewer2.entities.add({
  9046. position: Cartesian33,
  9047. plane: {
  9048. dimensions: new Cesium.Cartesian2(
  9049. radius / 10,
  9050. radius / 20
  9051. ),
  9052. material: Cesium.Color.RED.withAlpha(0.1),
  9053. plane: new Cesium.CallbackProperty(
  9054. _self._createPlaneUpdateFunction(plane),
  9055. false
  9056. ),
  9057. outline: true,
  9058. outlineColor: Cesium.Color.RED
  9059. }
  9060. });
  9061. _self.planeEntities.push(planeEntity);
  9062. }
  9063. return tileset;
  9064. });
  9065. },
  9066. toggleClipping() {
  9067. let _self = this;
  9068. for (let i2 = 0; i2 < _self.planeEntities.length; i2++) {
  9069. _self._viewer.entities.remove(_self.planeEntities[i2]);
  9070. }
  9071. _self.planeEntities = [];
  9072. _self.targetY = 0;
  9073. let boundingSphere = _self.tileset.boundingSphere;
  9074. _self._camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(120), Cesium.Math.toRadians(-10), boundingSphere.radius * 2.5));
  9075. _self._camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  9076. },
  9077. reset() {
  9078. this.planeEntities = [];
  9079. this.targetY = 0;
  9080. }
  9081. });
  9082. let SpatialAnalysis = {
  9083. SightLine,
  9084. ViewShed,
  9085. SunshineShadow,
  9086. Profile,
  9087. CutFill,
  9088. HeightLimit,
  9089. Cutting,
  9090. GeologyClipPlan
  9091. };
  9092. class TerrainExcavation {
  9093. constructor(viewer2) {
  9094. if (!viewer2)
  9095. throw new Error("no viewer object!");
  9096. this.viewer = viewer2;
  9097. }
  9098. prepareWell(activePoints) {
  9099. let pointLength = activePoints.length;
  9100. let heightDiff = this.excavateMinHeight - this.height;
  9101. let no_height_top = [], bottom_pos = [], lerp_pos = [];
  9102. for (let l = 0; l < pointLength; l++) {
  9103. let u = l == pointLength - 1 ? 0 : l + 1;
  9104. let point0 = [
  9105. Cesium.Cartographic.fromCartesian(activePoints[l]).longitude,
  9106. Cesium.Cartographic.fromCartesian(activePoints[l]).latitude
  9107. ];
  9108. let point1 = [
  9109. Cesium.Cartographic.fromCartesian(activePoints[u]).longitude,
  9110. Cesium.Cartographic.fromCartesian(activePoints[u]).latitude
  9111. ];
  9112. if (0 == l) {
  9113. lerp_pos.push(new Cesium.Cartographic(point0[0], point0[1]));
  9114. bottom_pos.push(
  9115. Cesium.Cartesian3.fromRadians(point0[0], point0[1], heightDiff)
  9116. );
  9117. no_height_top.push(
  9118. Cesium.Cartesian3.fromRadians(point0[0], point0[1], 0)
  9119. );
  9120. }
  9121. for (let p = 1; p <= this.splitNum; p++) {
  9122. let m = Cesium.Math.lerp(point0[0], point1[0], p / this.splitNum);
  9123. let g = Cesium.Math.lerp(point0[1], point1[1], p / this.splitNum);
  9124. 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)));
  9125. }
  9126. }
  9127. this.wellData = {
  9128. lerp_pos,
  9129. bottom_pos,
  9130. no_height_top
  9131. };
  9132. }
  9133. createWell(wallData) {
  9134. let $this = this;
  9135. if (this.viewer.terrainProvider._layers) {
  9136. this.createBottomSurface(wallData.bottom_pos);
  9137. let positions = Cesium.sampleTerrainMostDetailed(
  9138. this.viewer.terrainProvider,
  9139. wallData.lerp_pos
  9140. );
  9141. positions.then(function(pos) {
  9142. let positionList = [];
  9143. for (let index2 = 0; index2 < pos.length; index2++) {
  9144. const element = pos[index2];
  9145. let curPos = Cesium.Cartesian3.fromRadians(
  9146. element.longitude,
  9147. element.latitude,
  9148. element.height
  9149. );
  9150. positionList.push(curPos);
  9151. }
  9152. $this.createWellWall(wallData.bottom_pos, positionList);
  9153. });
  9154. } else {
  9155. this.createBottomSurface(wallData.bottom_pos);
  9156. this.createWellWall(wallData.bottom_pos, wallData.no_height_top);
  9157. }
  9158. }
  9159. ellipsoidToDegree(pos) {
  9160. let cartesian3 = new Cesium.Cartesian3(pos.x, pos.y, pos.z);
  9161. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian3);
  9162. return {
  9163. longitude: Cesium.Math.toDegrees(cartographic.longitude),
  9164. latitude: Cesium.Math.toDegrees(cartographic.latitude),
  9165. altitude: cartographic.height
  9166. };
  9167. }
  9168. createBottomSurface(points2) {
  9169. if (points2.length) {
  9170. let minHeight = this.getMinHeight(points2);
  9171. let positions = [];
  9172. for (let i2 = 0; i2 < points2.length; i2++) {
  9173. let curPoint = this.ellipsoidToDegree(points2[i2]);
  9174. positions.push(curPoint.longitude, curPoint.latitude, minHeight);
  9175. }
  9176. let polygon2 = new Cesium.PolygonGeometry({
  9177. polygonHierarchy: new Cesium.PolygonHierarchy(
  9178. Cesium.Cartesian3.fromDegreesArrayHeights(positions)
  9179. ),
  9180. perPositionHeight: true
  9181. });
  9182. let material = new Cesium.Material({
  9183. fabric: {
  9184. type: "Image",
  9185. uniforms: {
  9186. image: this.bottomImg
  9187. }
  9188. }
  9189. });
  9190. let appearance = new Cesium.MaterialAppearance({
  9191. translucent: false,
  9192. flat: true,
  9193. material
  9194. });
  9195. this.bottomSurface = new Cesium.Primitive({
  9196. geometryInstances: new Cesium.GeometryInstance({
  9197. geometry: Cesium.PolygonGeometry.createGeometry(polygon2)
  9198. }),
  9199. appearance,
  9200. asynchronous: false
  9201. });
  9202. this.viewer.scene.primitives.add(this.bottomSurface);
  9203. }
  9204. }
  9205. createWellWall(bottomPos, positionList) {
  9206. let minHeight = this.getMinHeight(bottomPos);
  9207. let maxHeights = [], minHeights = [];
  9208. for (let i2 = 0; i2 < positionList.length; i2++) {
  9209. maxHeights.push(this.ellipsoidToDegree(positionList[i2]).altitude);
  9210. minHeights.push(minHeight);
  9211. }
  9212. let wall = new Cesium.WallGeometry({
  9213. positions: positionList,
  9214. maximumHeights: maxHeights,
  9215. minimumHeights: minHeights
  9216. });
  9217. let geometry2 = Cesium.WallGeometry.createGeometry(wall);
  9218. let material = new Cesium.Material({
  9219. fabric: {
  9220. type: "Image",
  9221. uniforms: {
  9222. image: this.wallImg
  9223. }
  9224. }
  9225. });
  9226. let appearance = new Cesium.MaterialAppearance({
  9227. translucent: false,
  9228. flat: true,
  9229. material
  9230. });
  9231. this.wellWall = new Cesium.Primitive({
  9232. geometryInstances: new Cesium.GeometryInstance({
  9233. geometry: geometry2,
  9234. attributes: {
  9235. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9236. Cesium.Color.GREY
  9237. )
  9238. },
  9239. id: "PitWall"
  9240. }),
  9241. appearance,
  9242. asynchronous: false
  9243. });
  9244. this.viewer.scene.primitives.add(this.wellWall);
  9245. }
  9246. getMinHeight(points2) {
  9247. let minHeight = 5e6;
  9248. let minPoint = null;
  9249. for (let i2 = 0; i2 < points2.length; i2++) {
  9250. let height2 = points2[i2]["z"];
  9251. if (height2 < minHeight) {
  9252. minHeight = height2;
  9253. minPoint = this.ellipsoidToDegree(points2[i2]);
  9254. }
  9255. }
  9256. return minPoint.altitude;
  9257. }
  9258. switchExcavate(show) {
  9259. if (show) {
  9260. this.viewer.scene.globe.material = null;
  9261. this.wellWall.show = true;
  9262. this.bottomSurface.show = true;
  9263. } else {
  9264. this.viewer.scene.globe.material = null;
  9265. this.wellWall.show = false;
  9266. this.bottomSurface.show = false;
  9267. }
  9268. }
  9269. updateExcavateDepth(height2) {
  9270. this.viewer.scene.primitives.remove(this.bottomSurface);
  9271. this.viewer.scene.primitives.remove(this.wellWall);
  9272. console.log(this.wellData, this.excavateMinHeight);
  9273. let lerp_pos = this.wellData.lerp_pos;
  9274. let posList = [];
  9275. for (let n = 0; n < lerp_pos.length; n++) {
  9276. posList.push(
  9277. Cesium.Cartesian3.fromRadians(
  9278. lerp_pos[n].longitude,
  9279. lerp_pos[n].latitude,
  9280. this.excavateMinHeight - height2
  9281. )
  9282. );
  9283. }
  9284. this.wellData.bottom_pos = posList;
  9285. this.createWell(this.wellData);
  9286. }
  9287. }
  9288. Object.defineProperties(TerrainExcavation.prototype, {
  9289. show: {
  9290. get: function() {
  9291. return this._show;
  9292. },
  9293. set: function(e) {
  9294. this._show = e;
  9295. this.switchExcavate(e);
  9296. }
  9297. },
  9298. height: {
  9299. get: function() {
  9300. return this._height;
  9301. },
  9302. set: function(e) {
  9303. this._height = e;
  9304. this.updateExcavateDepth(e);
  9305. }
  9306. }
  9307. });
  9308. Object.assign(TerrainExcavation.prototype, {
  9309. add(activePoints, options2) {
  9310. options2 = options2 || {};
  9311. this._height = options2.excavateDepth || 10;
  9312. this.bottomImg = options2.bottomImg || "jt3dSDK/imgs/polygon/ground.png";
  9313. this.wallImg = options2.wallImg || "jt3dSDK/imgs/polygon/ground.png";
  9314. this.splitNum = Cesium.defaultValue(options2.splitNum, 50);
  9315. activePoints = activePoints.map((point2) => {
  9316. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9317. });
  9318. let viewer2 = this.viewer;
  9319. this.clear();
  9320. let clippingPlanesList = [];
  9321. let car3Difference = Cesium.Cartesian3.subtract(
  9322. activePoints[0],
  9323. activePoints[1],
  9324. new Cesium.Cartesian3()
  9325. );
  9326. let boolDiff = car3Difference.x > 0;
  9327. this.excavateMinHeight = 999999999;
  9328. for (let index2 = 0; index2 < activePoints.length; ++index2) {
  9329. let s = (index2 + 1) % activePoints.length;
  9330. let curMidPoint = Cesium.Cartesian3.midpoint(
  9331. activePoints[index2],
  9332. activePoints[s],
  9333. new Cesium.Cartesian3()
  9334. );
  9335. let cartographic = Cesium.Cartographic.fromCartesian(activePoints[index2]);
  9336. let curHeight = viewer2.scene.globe.getHeight(cartographic) || cartographic.height;
  9337. console.log(curHeight);
  9338. if (curHeight < this.excavateMinHeight) {
  9339. this.excavateMinHeight = curHeight;
  9340. }
  9341. let curMidPointNormal = Cesium.Cartesian3.normalize(
  9342. curMidPoint,
  9343. new Cesium.Cartesian3()
  9344. );
  9345. let curMidPointDifference = boolDiff ? Cesium.Cartesian3.subtract(
  9346. activePoints[index2],
  9347. curMidPoint,
  9348. new Cesium.Cartesian3()
  9349. ) : Cesium.Cartesian3.subtract(
  9350. activePoints[s],
  9351. curMidPoint,
  9352. new Cesium.Cartesian3()
  9353. );
  9354. curMidPointDifference = Cesium.Cartesian3.normalize(
  9355. curMidPointDifference,
  9356. curMidPointDifference
  9357. );
  9358. let curMidPointCross = Cesium.Cartesian3.cross(
  9359. curMidPointDifference,
  9360. curMidPointNormal,
  9361. new Cesium.Cartesian3()
  9362. );
  9363. curMidPointCross = Cesium.Cartesian3.normalize(
  9364. curMidPointCross,
  9365. curMidPointCross
  9366. );
  9367. let plane = new Cesium.Plane(curMidPointCross, 0);
  9368. let distance2 = Cesium.Plane.getPointDistance(plane, curMidPoint);
  9369. clippingPlanesList.push(
  9370. new Cesium.ClippingPlane(curMidPointCross, distance2)
  9371. );
  9372. }
  9373. this.viewer.scene.globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
  9374. planes: clippingPlanesList,
  9375. edgeWidth: 1,
  9376. edgeColor: Cesium.Color.WHITE,
  9377. enabled: true
  9378. });
  9379. this.prepareWell(activePoints);
  9380. this.createWell(this.wellData);
  9381. },
  9382. clear() {
  9383. if (this.viewer.scene.globe.clippingPlanes) {
  9384. this.viewer.scene.globe.clippingPlanes.removeAll();
  9385. this.viewer.scene.primitives.remove(this.bottomSurface);
  9386. this.viewer.scene.primitives.remove(this.wellWall);
  9387. this.viewer.scene.render();
  9388. }
  9389. }
  9390. });
  9391. class SlopeAspect {
  9392. constructor(viewer2) {
  9393. if (!viewer2)
  9394. throw new Cesium.DeveloperError("no viewer object!");
  9395. this._viewer = viewer2;
  9396. this.result = [];
  9397. this.handler = void 0;
  9398. this.toolTip = "";
  9399. }
  9400. _openTip() {
  9401. let _self = this;
  9402. this.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  9403. this.handler.setInputAction(function(movement) {
  9404. let endPos = movement.endPosition;
  9405. var pick = _self._viewer.scene.pick(endPos);
  9406. if (pick && pick.id && pick.id.type === "SlopeAspect") {
  9407. _self.toolTip = pick.id.value.toFixed(2);
  9408. CreateRemindertip(_self.toolTip, endPos, true);
  9409. } else {
  9410. _self.toolTip = "";
  9411. CreateRemindertip(_self.toolTip, endPos, false);
  9412. }
  9413. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9414. }
  9415. _createEllipse(gridSquare) {
  9416. let _self = this;
  9417. let boxResults = [];
  9418. for (let index2 = 0; index2 < gridSquare.features.length; index2++) {
  9419. const feature2 = gridSquare.features[index2];
  9420. const coordinates = feature2.geometry.coordinates[0];
  9421. const centerdegree = [
  9422. (coordinates[0][0] + coordinates[2][0]) / 2,
  9423. (coordinates[0][1] + coordinates[2][1]) / 2
  9424. ];
  9425. let centerCartographic = Cesium.Cartographic.fromDegrees(
  9426. centerdegree[0],
  9427. centerdegree[1]
  9428. );
  9429. boxResults.push(centerCartographic);
  9430. for (let i2 = 0; i2 < coordinates.length; i2++) {
  9431. const coord = coordinates[i2];
  9432. let cartographic = Cesium.Cartographic.fromDegrees(coord[0], coord[1]);
  9433. boxResults.push(cartographic);
  9434. const coord1 = coordinates[i2 + 1];
  9435. if (coord1) {
  9436. let newCoord = [(coord[0] + coord1[0]) / 2, (coord[1] + coord1[1]) / 2];
  9437. let newCartographic = Cesium.Cartographic.fromDegrees(newCoord[0], newCoord[1]);
  9438. boxResults.push(newCartographic);
  9439. }
  9440. }
  9441. }
  9442. Cesium.sampleTerrainMostDetailed(
  9443. _self._viewer.scene.terrainProvider,
  9444. boxResults
  9445. ).then((updatePositions) => {
  9446. let arrr = [];
  9447. let ellipseResults = updatePositions.reduce(function(pre, item, index2, updatePositions2) {
  9448. var begin = index2 * 10;
  9449. var end = begin + 10;
  9450. var res = updatePositions2.slice(begin, end);
  9451. if (res.length != 0) {
  9452. arrr[index2] = res;
  9453. }
  9454. return arrr;
  9455. }, []);
  9456. _self._calculateSlope(ellipseResults);
  9457. _self._openTip();
  9458. });
  9459. }
  9460. _createPolygonInsrance(points2, color2) {
  9461. let positions = [];
  9462. for (let index2 = 1; index2 < points2.length - 1; index2++) {
  9463. const element = points2[index2];
  9464. positions.push(Cesium.Cartographic.toCartesian(element));
  9465. }
  9466. let polygon2 = new Cesium.PolygonGeometry({
  9467. polygonHierarchy: new Cesium.PolygonHierarchy(positions)
  9468. });
  9469. let polygonInstance = new Cesium.GeometryInstance({
  9470. geometry: polygon2,
  9471. attributes: {
  9472. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9473. Cesium.Color.fromCssColorString(color2)
  9474. ),
  9475. show: new Cesium.ShowGeometryInstanceAttribute(true)
  9476. }
  9477. });
  9478. return polygonInstance;
  9479. }
  9480. _createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope) {
  9481. let cartographic_0 = new Cesium.Cartographic(
  9482. (targetPoint.longitude + center2.longitude) / 2,
  9483. (targetPoint.latitude + center2.latitude) / 2,
  9484. (targetPoint.height + center2.height) / 2
  9485. );
  9486. let cartographic_1 = new Cesium.Cartographic(
  9487. (diagonalPoint.longitude + center2.longitude) / 2,
  9488. (diagonalPoint.latitude + center2.latitude) / 2,
  9489. (diagonalPoint.height + center2.height) / 2
  9490. );
  9491. let positions1 = heightDifference > 0 ? [
  9492. Cesium.Cartographic.toCartesian(cartographic_0),
  9493. Cesium.Cartographic.toCartesian(cartographic_1)
  9494. ] : [
  9495. Cesium.Cartographic.toCartesian(cartographic_1),
  9496. Cesium.Cartographic.toCartesian(cartographic_0)
  9497. ];
  9498. const instance = new Cesium.GeometryInstance({
  9499. id: {
  9500. type: "SlopeAspect",
  9501. value: curSlope
  9502. },
  9503. geometry: new Cesium.GroundPolylineGeometry({
  9504. positions: positions1,
  9505. width: this.arrowWidth
  9506. }),
  9507. attributes: {
  9508. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9509. Cesium.Color.BLUE.withAlpha(0.6)
  9510. ),
  9511. show: new Cesium.ShowGeometryInstanceAttribute(true)
  9512. }
  9513. });
  9514. return instance;
  9515. }
  9516. _calculateSlope(ellipseResults) {
  9517. let _self = this;
  9518. let instances = [];
  9519. let polygonInstance = [];
  9520. for (let index2 = 0; index2 < ellipseResults.length; index2++) {
  9521. const ellipse = ellipseResults[index2];
  9522. const center2 = ellipse[0];
  9523. let heightDifference = 0;
  9524. let maxIndex = 0;
  9525. for (let i2 = 1; i2 < ellipse.length - 1; i2++) {
  9526. const point2 = ellipse[i2];
  9527. let curHD = point2.height - center2.height;
  9528. if (Math.abs(curHD) > heightDifference) {
  9529. heightDifference = curHD;
  9530. maxIndex = i2;
  9531. }
  9532. }
  9533. let pos0 = new Cesium.Cartographic(center2.longitude, center2.latitude, 0);
  9534. let pos1 = new Cesium.Cartographic(
  9535. ellipse[maxIndex].longitude,
  9536. ellipse[maxIndex].latitude,
  9537. 0
  9538. );
  9539. let distance2 = Cesium.Cartesian3.distance(
  9540. Cesium.Cartographic.toCartesian(pos0),
  9541. Cesium.Cartographic.toCartesian(pos1)
  9542. );
  9543. let curSlope = Math.abs(heightDifference / distance2);
  9544. let curColor = _self._calculateSlopeColor(curSlope, 0.4);
  9545. const curPolygonInstance = _self._createPolygonInsrance(ellipse, curColor);
  9546. polygonInstance.push(curPolygonInstance);
  9547. let diagonalPoint = maxIndex > 4 ? ellipse[maxIndex - 4] : ellipse[maxIndex + 4];
  9548. let targetPoint = ellipse[maxIndex];
  9549. const arrowInstance = _self._createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope);
  9550. instances.push(arrowInstance);
  9551. }
  9552. const mapPrimitive = _self._viewer.scene.primitives.add(
  9553. new Cesium.GroundPrimitive({
  9554. geometryInstances: polygonInstance,
  9555. appearance: new Cesium.PerInstanceColorAppearance({
  9556. translucent: true,
  9557. closed: false
  9558. })
  9559. })
  9560. );
  9561. const arrowPrimitive = _self._viewer.scene.primitives.add(
  9562. new Cesium.GroundPolylinePrimitive({
  9563. geometryInstances: instances,
  9564. appearance: new Cesium.PolylineMaterialAppearance({
  9565. material: new Cesium.Material({
  9566. fabric: {
  9567. type: "PolylineArrow",
  9568. uniforms: {
  9569. color: new Cesium.Color(1, 1, 0, 0.8)
  9570. }
  9571. }
  9572. })
  9573. })
  9574. })
  9575. );
  9576. _self.result.push(arrowPrimitive, mapPrimitive);
  9577. }
  9578. _calculateSlopeColor(value, alpha) {
  9579. if (value < 0.00872686779075879) {
  9580. return "rgba(85,182,43," + alpha + ")";
  9581. } else if (value < 0.03492076949174773) {
  9582. return "rgba(135,211,43," + alpha + ")";
  9583. } else if (value < 0.08748866352592401) {
  9584. return "rgba(204,244,44," + alpha + ")";
  9585. } else if (value < 0.2679491924311227) {
  9586. return "rgba(245,233,44," + alpha + ")";
  9587. } else if (value < 0.7002075382097097) {
  9588. return "rgba(255,138,43," + alpha + ")";
  9589. } else if (value < 1.4281480067421144) {
  9590. return "rgba(255,84,43," + alpha + ")";
  9591. } else {
  9592. return "rgba(255,32,43," + alpha + ")";
  9593. }
  9594. }
  9595. }
  9596. Object.assign(SlopeAspect.prototype, {
  9597. createNew4Distance(points2, polygon$1, options2) {
  9598. let _self = this;
  9599. options2 = options2 || {};
  9600. options2.distance = options2.distance || 0.1;
  9601. let width2 = options2.distance * 200 > 35 ? 35 : options2.distance * 200;
  9602. _self.arrowWidth = width2 < 15 ? 15 : width2;
  9603. let positions = points2.map((point2) => {
  9604. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9605. });
  9606. _self.clearAll();
  9607. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  9608. let boundary = [];
  9609. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  9610. for (let index2 = 0; index2 < degrees.length; index2++) {
  9611. const element = degrees[index2];
  9612. const x = element.lng;
  9613. const y = element.lat;
  9614. boundary.push([x, y]);
  9615. minX = x < minX ? x : minX;
  9616. minY = y < minY ? y : minY;
  9617. maxX = x > maxX ? x : maxX;
  9618. maxY = y > maxY ? y : maxY;
  9619. }
  9620. boundary.push(boundary[0]);
  9621. let bbox2 = [minX, minY, maxX, maxY];
  9622. polygon([boundary]);
  9623. let gridSquare = squareGrid(bbox2, options2.distance, {});
  9624. _self._createEllipse(gridSquare);
  9625. },
  9626. createNew4Num(points2, polygon$1, options2) {
  9627. let _self = this;
  9628. options2 = options2 || {};
  9629. options2.num = Cesium.defaultValue(options2.num, 10);
  9630. let positions = points2.map((point2) => {
  9631. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9632. });
  9633. _self.clearAll();
  9634. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  9635. let boundary = [];
  9636. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  9637. for (let index2 = 0; index2 < degrees.length; index2++) {
  9638. const element = degrees[index2];
  9639. const x = element.lng;
  9640. const y = element.lat;
  9641. boundary.push([x, y]);
  9642. minX = x < minX ? x : minX;
  9643. minY = y < minY ? y : minY;
  9644. maxX = x > maxX ? x : maxX;
  9645. maxY = y > maxY ? y : maxY;
  9646. }
  9647. boundary.push(boundary[0]);
  9648. let bbox2 = [minX, minY, maxX, maxY];
  9649. let a = maxX - minX;
  9650. let b = maxY - minY;
  9651. b = b > a ? b : a;
  9652. const step = b / options2.num;
  9653. let width2 = step * 2e3 > 35 ? 35 : step * 2e3;
  9654. _self.arrowWidth = width2 < 15 ? 15 : width2;
  9655. polygon([boundary]);
  9656. let gridSquare = squareGrid(bbox2, step, {
  9657. units: "degrees"
  9658. });
  9659. _self._createEllipse(gridSquare);
  9660. },
  9661. clearAll() {
  9662. this.result.forEach((element) => {
  9663. this._viewer.scene.primitives.remove(element);
  9664. });
  9665. this.result = [];
  9666. if (this.handler) {
  9667. this.handler.destroy();
  9668. this.handler = void 0;
  9669. }
  9670. }
  9671. });
  9672. let TerrainAnalysis = {
  9673. TerrainExcavation,
  9674. SlopeAspect
  9675. };
  9676. class Weather {
  9677. constructor(viewer2) {
  9678. if (!viewer2)
  9679. throw new Cesium.DeveloperError("no viewer object!");
  9680. this._viewer = viewer2;
  9681. }
  9682. _initRain() {
  9683. this.rainStage = new Cesium.PostProcessStage({
  9684. name: "jt_rain",
  9685. fragmentShader: this._rain(),
  9686. uniforms: {
  9687. tiltAngle: () => {
  9688. return this.tiltAngle;
  9689. },
  9690. rainSize: () => {
  9691. return this.rainSize;
  9692. },
  9693. rainSpeed: () => {
  9694. return this.rainSpeed;
  9695. }
  9696. }
  9697. });
  9698. this._viewer.scene.postProcessStages.add(this.rainStage);
  9699. }
  9700. _initSnow() {
  9701. this.snowStage = new Cesium.PostProcessStage({
  9702. name: "jt_snow",
  9703. fragmentShader: this._snow(),
  9704. uniforms: {
  9705. snowSize: () => {
  9706. return this.snowSize;
  9707. },
  9708. snowSpeed: () => {
  9709. return this.snowSpeed;
  9710. }
  9711. }
  9712. });
  9713. this._viewer.scene.postProcessStages.add(this.snowStage);
  9714. }
  9715. _initFog() {
  9716. this.fogStage = new Cesium.PostProcessStage({
  9717. name: "jt_fog",
  9718. fragmentShader: this._fog(),
  9719. uniforms: {
  9720. visibility: () => {
  9721. return this.visibility;
  9722. },
  9723. fogColor: () => {
  9724. return this.color;
  9725. }
  9726. }
  9727. });
  9728. this._viewer.scene.postProcessStages.add(this.fogStage);
  9729. }
  9730. _rain() {
  9731. 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 ";
  9732. }
  9733. _snow() {
  9734. 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 ";
  9735. }
  9736. _fog() {
  9737. 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";
  9738. }
  9739. _removeSnow() {
  9740. if (!this._viewer || !this.snowStage)
  9741. return;
  9742. this._viewer.scene.postProcessStages.remove(this.snowStage);
  9743. delete this.snowSize;
  9744. delete this.snowSpeed;
  9745. }
  9746. _removeRain() {
  9747. if (!this._viewer || !this.rainStage)
  9748. return;
  9749. this._viewer.scene.postProcessStages.remove(this.rainStage);
  9750. delete this.tiltAngle;
  9751. delete this.rainSize;
  9752. delete this.rainSpeed;
  9753. }
  9754. _removeFog() {
  9755. if (!this._viewer || !this.fogStage)
  9756. return;
  9757. this._viewer.scene.postProcessStages.remove(this.fogStage);
  9758. delete this.visibility;
  9759. delete this.color;
  9760. }
  9761. }
  9762. Object.assign(Weather.prototype, {
  9763. addRainEffect(options2) {
  9764. options2 = options2 || {};
  9765. this.tiltAngle = Cesium.defaultValue(options2.tiltAngle, -0.6);
  9766. this.rainSize = Cesium.defaultValue(options2.rainSize, 0.3);
  9767. this.rainSpeed = Cesium.defaultValue(options2.rainSpeed, 60);
  9768. this._initRain();
  9769. },
  9770. addSnowEffect(options2) {
  9771. options2 = options2 || {};
  9772. this.snowSize = Cesium.defaultValue(options2.snowSize, 0.02);
  9773. this.snowSpeed = Cesium.defaultValue(options2.snowSpeed, 60);
  9774. this._initSnow();
  9775. },
  9776. addFogEffect(options2) {
  9777. options2 = options2 || {};
  9778. this.visibility = Cesium.defaultValue(options2.visibility, 0.1);
  9779. this.color = Cesium.defaultValue(options2.color, new Cesium.Color(0.8, 0.8, 0.8, 0.5));
  9780. this._show = Cesium.defaultValue(options2.show, true);
  9781. this._initFog();
  9782. },
  9783. removeEffect() {
  9784. if (this.snowStage) {
  9785. this._removeSnow();
  9786. }
  9787. if (this.rainStage) {
  9788. this._removeRain();
  9789. }
  9790. if (this.fogStage) {
  9791. this._removeFog();
  9792. }
  9793. }
  9794. });
  9795. const BoxGeometry = Cesium.BoxGeometry;
  9796. const Cartesian3 = Cesium.Cartesian3;
  9797. const defaultValue = Cesium.defaultValue;
  9798. const defined = Cesium.defined;
  9799. const destroyObject = Cesium.destroyObject;
  9800. const DeveloperError$1 = Cesium.DeveloperError;
  9801. const GeometryPipeline = Cesium.GeometryPipeline;
  9802. const Matrix3 = Cesium.Matrix3;
  9803. const Matrix4 = Cesium.Matrix4;
  9804. const Transforms = Cesium.Transforms;
  9805. const VertexFormat = Cesium.VertexFormat;
  9806. const BufferUsage = Cesium.BufferUsage;
  9807. const CubeMap = Cesium.CubeMap;
  9808. const DrawCommand = Cesium.DrawCommand;
  9809. const loadCubeMap = Cesium.loadCubeMap;
  9810. const RenderState = Cesium.RenderState;
  9811. const VertexArray = Cesium.VertexArray;
  9812. const BlendingState = Cesium.BlendingState;
  9813. const SceneMode = Cesium.SceneMode;
  9814. const ShaderProgram = Cesium.ShaderProgram;
  9815. const ShaderSource = Cesium.ShaderSource;
  9816. 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 ";
  9817. 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 ";
  9818. if (!Cesium.defined(Cesium.Matrix4.getRotation)) {
  9819. Cesium.Matrix4.getRotation = Cesium.Matrix4.getMatrix3;
  9820. }
  9821. class SkyBoxOnGround {
  9822. constructor(options2) {
  9823. this.sources = options2.sources;
  9824. this._sources = void 0;
  9825. this.show = defaultValue(options2.show, true);
  9826. this._command = new DrawCommand({
  9827. modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
  9828. owner: this
  9829. });
  9830. this._cubeMap = void 0;
  9831. this._attributeLocations = void 0;
  9832. this._useHdr = void 0;
  9833. }
  9834. }
  9835. const skyboxMatrix3 = new Matrix3();
  9836. SkyBoxOnGround.prototype.update = function(frameState, useHdr) {
  9837. const that = this;
  9838. if (!this.show) {
  9839. return void 0;
  9840. }
  9841. if (frameState.mode !== SceneMode.SCENE3D && frameState.mode !== SceneMode.MORPHING) {
  9842. return void 0;
  9843. }
  9844. if (!frameState.passes.render) {
  9845. return void 0;
  9846. }
  9847. const context = frameState.context;
  9848. if (this._sources !== this.sources) {
  9849. this._sources = this.sources;
  9850. const sources = this.sources;
  9851. if (!defined(sources.positiveX) || !defined(sources.negativeX) || !defined(sources.positiveY) || !defined(sources.negativeY) || !defined(sources.positiveZ) || !defined(sources.negativeZ)) {
  9852. throw new DeveloperError$1(
  9853. "this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  9854. );
  9855. }
  9856. 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) {
  9857. throw new DeveloperError$1(
  9858. "this.sources properties must all be the same type."
  9859. );
  9860. }
  9861. if (typeof sources.positiveX === "string") {
  9862. loadCubeMap(context, this._sources).then(function(cubeMap) {
  9863. that._cubeMap = that._cubeMap && that._cubeMap.destroy();
  9864. that._cubeMap = cubeMap;
  9865. });
  9866. } else {
  9867. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  9868. this._cubeMap = new CubeMap({
  9869. context,
  9870. source: sources
  9871. });
  9872. }
  9873. }
  9874. const command = this._command;
  9875. command.modelMatrix = Transforms.eastNorthUpToFixedFrame(
  9876. frameState.camera._positionWC
  9877. );
  9878. if (!defined(command.vertexArray)) {
  9879. command.uniformMap = {
  9880. u_cubeMap: function() {
  9881. return that._cubeMap;
  9882. },
  9883. u_rotateMatrix: function() {
  9884. return Matrix4.getRotation(command.modelMatrix, skyboxMatrix3);
  9885. }
  9886. };
  9887. const geometry2 = BoxGeometry.createGeometry(
  9888. BoxGeometry.fromDimensions({
  9889. dimensions: new Cartesian3(2, 2, 2),
  9890. vertexFormat: VertexFormat.POSITION_ONLY
  9891. })
  9892. );
  9893. const attributeLocations = this._attributeLocations = GeometryPipeline.createAttributeLocations(
  9894. geometry2
  9895. );
  9896. command.vertexArray = VertexArray.fromGeometry({
  9897. context,
  9898. geometry: geometry2,
  9899. attributeLocations,
  9900. bufferUsage: BufferUsage._DRAW
  9901. });
  9902. command.renderState = RenderState.fromCache({
  9903. blending: BlendingState.ALPHA_BLEND
  9904. });
  9905. }
  9906. if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
  9907. const fs = new ShaderSource({
  9908. defines: [useHdr ? "HDR" : ""],
  9909. sources: [SkyBoxFS]
  9910. });
  9911. command.shaderProgram = ShaderProgram.fromCache({
  9912. context,
  9913. vertexShaderSource: SkyBoxVS,
  9914. fragmentShaderSource: fs,
  9915. attributeLocations: this._attributeLocations
  9916. });
  9917. this._useHdr = useHdr;
  9918. }
  9919. if (!defined(this._cubeMap)) {
  9920. return void 0;
  9921. }
  9922. return command;
  9923. };
  9924. SkyBoxOnGround.prototype.isDestroyed = function() {
  9925. return false;
  9926. };
  9927. SkyBoxOnGround.prototype.destroy = function() {
  9928. const command = this._command;
  9929. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  9930. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  9931. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  9932. return destroyObject(this);
  9933. };
  9934. class SkyBox {
  9935. constructor(viewer2) {
  9936. if (!viewer2)
  9937. throw new Cesium.DeveloperError("no viewer object!");
  9938. this._viewer = viewer2;
  9939. this._farSkyBox = viewer2.scene.skyBox;
  9940. }
  9941. }
  9942. Object.assign(SkyBox.prototype, {
  9943. setGroundSkyBox(options2) {
  9944. options2 = options2 || {};
  9945. options2.height = options2.height || 2e5;
  9946. options2.type = options2.type || "\u84DD\u5929";
  9947. if (!options2.sources) {
  9948. switch (options2.type) {
  9949. case "\u665A\u971E":
  9950. options2.sources = {
  9951. positiveX: "jt3dSDK/imgs/skybox/01/px.png",
  9952. negativeX: "jt3dSDK/imgs/skybox/01/nx.png",
  9953. positiveY: "jt3dSDK/imgs/skybox/01/py.png",
  9954. negativeY: "jt3dSDK/imgs/skybox/01/ny.png",
  9955. positiveZ: "jt3dSDK/imgs/skybox/01/pz.png",
  9956. negativeZ: "jt3dSDK/imgs/skybox/01/nz.png"
  9957. };
  9958. break;
  9959. case "\u9634\u5929":
  9960. options2.sources = {
  9961. positiveX: "jt3dSDK/imgs/skybox/02/px.jpg",
  9962. negativeX: "jt3dSDK/imgs/skybox/02/nx.jpg",
  9963. positiveY: "jt3dSDK/imgs/skybox/02/py.jpg",
  9964. negativeY: "jt3dSDK/imgs/skybox/02/ny.jpg",
  9965. positiveZ: "jt3dSDK/imgs/skybox/02/pz.jpg",
  9966. negativeZ: "jt3dSDK/imgs/skybox/02/nz.jpg"
  9967. };
  9968. break;
  9969. case "\u84DD\u5929":
  9970. options2.sources = {
  9971. positiveX: "jt3dSDK/imgs/skybox/03/px.jpg",
  9972. negativeX: "jt3dSDK/imgs/skybox/03/nx.jpg",
  9973. positiveY: "jt3dSDK/imgs/skybox/03/py.jpg",
  9974. negativeY: "jt3dSDK/imgs/skybox/03/ny.jpg",
  9975. positiveZ: "jt3dSDK/imgs/skybox/03/pz.jpg",
  9976. negativeZ: "jt3dSDK/imgs/skybox/03/nz.jpg"
  9977. };
  9978. break;
  9979. case "\u7D2B\u8272\u661F\u7A7A":
  9980. options2.sources = {
  9981. positiveX: "jt3dSDK/imgs/skybox/04/px.jpg",
  9982. negativeX: "jt3dSDK/imgs/skybox/04/nx.jpg",
  9983. positiveY: "jt3dSDK/imgs/skybox/04/py.jpg",
  9984. negativeY: "jt3dSDK/imgs/skybox/04/ny.jpg",
  9985. positiveZ: "jt3dSDK/imgs/skybox/04/pz.jpg",
  9986. negativeZ: "jt3dSDK/imgs/skybox/04/nz.jpg"
  9987. };
  9988. break;
  9989. case "\u84DD\u8272\u661F\u7A7A":
  9990. options2.sources = {
  9991. positiveX: "jt3dSDK/imgs/skybox/05/px.jpg",
  9992. negativeX: "jt3dSDK/imgs/skybox/05/nx.jpg",
  9993. positiveY: "jt3dSDK/imgs/skybox/05/py.jpg",
  9994. negativeY: "jt3dSDK/imgs/skybox/05/ny.jpg",
  9995. positiveZ: "jt3dSDK/imgs/skybox/05/pz.jpg",
  9996. negativeZ: "jt3dSDK/imgs/skybox/05/nz.jpg"
  9997. };
  9998. break;
  9999. }
  10000. } 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)) {
  10001. throw new Cesium.DeveloperError(
  10002. "options.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  10003. );
  10004. }
  10005. let _self = this;
  10006. let groundSkyBox = new SkyBoxOnGround({
  10007. sources: options2.sources,
  10008. show: true
  10009. });
  10010. _self._viewer.scene.postRender.addEventListener(() => {
  10011. var e = _self._viewer.camera.position;
  10012. if (Cesium.Cartographic.fromCartesian(e).height < options2.height) {
  10013. _self._viewer.scene.skyBox = groundSkyBox;
  10014. } else {
  10015. _self._viewer.scene.skyBox = _self._defaultSkyBox;
  10016. }
  10017. });
  10018. }
  10019. });
  10020. class ParticleSystem {
  10021. constructor(viewer2) {
  10022. if (!viewer2)
  10023. throw new DeveloperError("no viewer object!");
  10024. this.viewer = viewer2;
  10025. }
  10026. }
  10027. Object.assign(ParticleSystem.prototype, {
  10028. createParticleFire: function(coordinates) {
  10029. this.viewer.clock.shouldAnimate = true;
  10030. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  10031. var entity = this.viewer.entities.add({
  10032. position: position2
  10033. });
  10034. function computeModelMatrix(entity2, time) {
  10035. var position3 = Cesium.Property.getValueOrUndefined(entity2.position);
  10036. var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position3);
  10037. return modelMatrix;
  10038. }
  10039. var viewModel = {
  10040. startScale: 3,
  10041. endScale: 1.5,
  10042. minimumParticleLife: 1.5,
  10043. maximumParticleLife: 1.8,
  10044. minimumSpeed: 7,
  10045. maximumSpeed: 9,
  10046. particleSize: 2,
  10047. emissionRate: 200
  10048. };
  10049. var primitive = this.viewer.scene.primitives.add(
  10050. new Cesium.ParticleSystem({
  10051. image: "jt3dSDK/imgs/particlesystem/fire.png",
  10052. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  10053. startColor: new Cesium.Color(1, 1, 1, 1),
  10054. endColor: new Cesium.Color(0.5, 0, 0, 0),
  10055. startScale: viewModel.startScale,
  10056. endScale: viewModel.endScale,
  10057. minimumParticleLife: viewModel.minimumParticleLife,
  10058. maximumParticleLife: viewModel.maximumParticleLife,
  10059. minimumSpeed: viewModel.minimumSpeed,
  10060. maximumSpeed: viewModel.maximumSpeed,
  10061. emissionRate: viewModel.emissionRate,
  10062. lifetime: 16,
  10063. loop: true,
  10064. sizeInMeters: true,
  10065. emitter: new Cesium.ConeEmitter(Cesium.Math.toRadians(45)),
  10066. modelMatrix: computeModelMatrix(entity, Cesium.JulianDate.now())
  10067. })
  10068. );
  10069. entity.remove = function() {
  10070. viewer.entities.remove(entity);
  10071. viewer.scene.primitives.remove(primitive);
  10072. };
  10073. return entity;
  10074. },
  10075. createParticleWater: function(coordinates) {
  10076. let viewer2 = this.viewer;
  10077. this.viewer.clock.shouldAnimate = true;
  10078. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  10079. var entity = this.viewer.entities.add({
  10080. position: position2
  10081. });
  10082. function computeModelMatrix(entity2, time) {
  10083. return entity2.computeModelMatrix(time, new Cesium.Matrix4());
  10084. }
  10085. function computeEmitterModelMatrix() {
  10086. let hpr = Cesium.HeadingPitchRoll.fromDegrees(viewModel.heading, viewModel.pitch, viewModel.roll);
  10087. let trs = new Cesium.TranslationRotationScale();
  10088. trs.translation = Cesium.Cartesian3.fromElements(0, 0, 1);
  10089. trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
  10090. let Matrix42 = Cesium.Matrix4.fromTranslationRotationScale(trs);
  10091. return Matrix42;
  10092. }
  10093. function updateCallback(p, dt2) {
  10094. var gravityScratch = new Cesium.Cartesian3();
  10095. var position3 = p.position;
  10096. Cesium.Cartesian3.normalize(position3, gravityScratch);
  10097. Cesium.Cartesian3.multiplyByScalar(gravityScratch, viewModel.gravity * dt2, gravityScratch);
  10098. p.velocity = Cesium.Cartesian3.add(p.velocity, gravityScratch, p.velocity);
  10099. }
  10100. function update(scene, time) {
  10101. waterParticleSystem.modelMatrix = computeModelMatrix(entity, time);
  10102. waterParticleSystem.emitterModelMatrix = computeEmitterModelMatrix();
  10103. }
  10104. viewer2.scene.preUpdate.addEventListener(update);
  10105. var viewModel = {
  10106. startScale: 1,
  10107. endScale: 7,
  10108. minimumParticleLife: 6,
  10109. maximumParticleLife: 7,
  10110. minimumSpeed: 9,
  10111. maximumSpeed: 9.5,
  10112. particleSize: 1,
  10113. emissionRate: 60,
  10114. gravity: -4,
  10115. heading: 110,
  10116. pitch: 30,
  10117. roll: 0
  10118. };
  10119. var waterParticleSystem = new Cesium.ParticleSystem({
  10120. image: "jt3dSDK/imgs/particlesystem/water.png",
  10121. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  10122. startColor: new Cesium.Color(1, 1, 1, 0.6),
  10123. endColor: new Cesium.Color(0.8, 0.86, 1, 0.4),
  10124. startScale: viewModel.startScale,
  10125. endScale: viewModel.endScale,
  10126. minimumParticleLife: viewModel.minimumParticleLife,
  10127. maximumParticleLife: viewModel.maximumParticleLife,
  10128. minimumSpeed: viewModel.minimumSpeed,
  10129. maximumSpeed: viewModel.maximumSpeed,
  10130. emissionRate: viewModel.emissionRate,
  10131. sizeInMeters: true,
  10132. emitter: new Cesium.CircleEmitter(0.2),
  10133. modelMatrix: computeModelMatrix(entity),
  10134. emitterModelMatrix: computeEmitterModelMatrix(),
  10135. updateCallback
  10136. });
  10137. viewer2.scene.primitives.add(waterParticleSystem);
  10138. entity.remove = function() {
  10139. viewer2.entities.remove(entity);
  10140. viewer2.scene.primitives.remove(waterParticleSystem);
  10141. };
  10142. return entity;
  10143. }
  10144. });
  10145. let SceneEffects = {
  10146. Weather,
  10147. SkyBox,
  10148. ParticleSystem
  10149. };
  10150. class ImageLayerSplit {
  10151. constructor(viewer2) {
  10152. if (!viewer2)
  10153. throw new Cesium.DeveloperError("no viewer object!");
  10154. this._viewer = viewer2;
  10155. }
  10156. }
  10157. Object.assign(ImageLayerSplit.prototype, {
  10158. initSplit() {
  10159. let _self = this;
  10160. this.viewer = this._viewer;
  10161. let sliderDiv = document.getElementById("image_slider");
  10162. if (sliderDiv == null) {
  10163. sliderDiv = document.createElement("div");
  10164. sliderDiv.id = "image_slider";
  10165. sliderDiv.style.position = "absolute";
  10166. sliderDiv.style.left = "50%";
  10167. sliderDiv.style.top = "0px";
  10168. sliderDiv.style.backgroundColor = "#d3d3d3";
  10169. sliderDiv.style.width = "5px";
  10170. sliderDiv.style.height = "100%";
  10171. sliderDiv.style.zIndex = "9999";
  10172. sliderDiv.onmouseover = function() {
  10173. this.style.cursor = "ew-resize";
  10174. };
  10175. document.body.appendChild(sliderDiv);
  10176. }
  10177. this.slider = sliderDiv;
  10178. viewer.scene.splitPosition = this.slider.offsetLeft / this.slider.parentElement.offsetWidth;
  10179. if (this.handler) {
  10180. this.handler.destroy();
  10181. this.handler = null;
  10182. }
  10183. this.handler = new Cesium.ScreenSpaceEventHandler(this.slider);
  10184. var moveActive = false;
  10185. function move(movement) {
  10186. if (!moveActive) {
  10187. return;
  10188. }
  10189. var relativeOffset = movement.endPosition.x;
  10190. var splitPosition = (_self.slider.offsetLeft + relativeOffset) / _self.slider.parentElement.offsetWidth;
  10191. _self.slider.style.left = `${100 * splitPosition}%`;
  10192. viewer.scene.splitPosition = splitPosition;
  10193. }
  10194. this.handler.setInputAction(function() {
  10195. moveActive = true;
  10196. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  10197. this.handler.setInputAction(function() {
  10198. moveActive = true;
  10199. }, Cesium.ScreenSpaceEventType.PINCH_START);
  10200. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10201. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);
  10202. this.handler.setInputAction(function() {
  10203. moveActive = false;
  10204. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  10205. this.handler.setInputAction(function() {
  10206. moveActive = false;
  10207. }, Cesium.ScreenSpaceEventType.PINCH_END);
  10208. },
  10209. addSplitLayer(earthAtLeft, earthAtRight) {
  10210. if (this.earthAtLeft) {
  10211. this._viewer.imageryLayers.remove(this.earthAtLeft);
  10212. }
  10213. if (this.earthAtRight) {
  10214. this._viewer.imageryLayers.remove(this.earthAtRight);
  10215. }
  10216. this.earthAtLeft = earthAtLeft;
  10217. this.earthAtRight = earthAtRight;
  10218. this.earthAtLeft.splitDirection = Cesium.SplitDirection.LEFT;
  10219. this.earthAtRight.splitDirection = Cesium.SplitDirection.RIGHT;
  10220. },
  10221. removeSplitLayer() {
  10222. document.body.removeChild(this.slider);
  10223. if (this.earthAtLeft) {
  10224. this._viewer.imageryLayers.remove(this.earthAtLeft);
  10225. }
  10226. if (this.earthAtRight) {
  10227. this._viewer.imageryLayers.remove(this.earthAtRight);
  10228. }
  10229. }
  10230. });
  10231. class ViewerSplitScreen {
  10232. constructor() {
  10233. }
  10234. }
  10235. Object.assign(ViewerSplitScreen.prototype, {
  10236. initHandler(viewer1, viewer2) {
  10237. var _self = this;
  10238. if (_self.handler1 && _self.handler1.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)) {
  10239. return;
  10240. }
  10241. _self.handler1 = new Cesium.ScreenSpaceEventHandler(viewer1.scene.canvas);
  10242. _self.handler2 = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  10243. _self.handler1.setInputAction(function(movement) {
  10244. var _camerca = viewer1.camera;
  10245. viewer2.camera.setView({
  10246. destination: _camerca.position,
  10247. orientation: {
  10248. direction: _camerca._direction,
  10249. up: _camerca.up,
  10250. heading: _camerca.heading,
  10251. pitch: _camerca.pitch,
  10252. roll: _camerca.roll
  10253. }
  10254. });
  10255. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10256. _self.handler1.setInputAction(function(movement) {
  10257. var _camerca = viewer1.camera;
  10258. viewer2.camera.setView({
  10259. destination: _camerca.position,
  10260. orientation: {
  10261. direction: _camerca._direction,
  10262. up: _camerca.up,
  10263. heading: _camerca.heading,
  10264. pitch: _camerca.pitch,
  10265. roll: _camerca.roll
  10266. }
  10267. });
  10268. }, Cesium.ScreenSpaceEventType.WHEEL);
  10269. _self.handler2.setInputAction(function(movement) {
  10270. var _camerca = viewer2.camera;
  10271. viewer1.camera.setView({
  10272. destination: _camerca.position,
  10273. orientation: {
  10274. direction: _camerca._direction,
  10275. up: _camerca.up,
  10276. heading: _camerca.heading,
  10277. pitch: _camerca.pitch,
  10278. roll: _camerca.roll
  10279. }
  10280. });
  10281. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10282. _self.handler2.setInputAction(function(movement) {
  10283. var _camerca = viewer2.camera;
  10284. viewer1.camera.setView({
  10285. destination: _camerca.position,
  10286. orientation: {
  10287. direction: _camerca._direction,
  10288. up: _camerca.up,
  10289. heading: _camerca.heading,
  10290. pitch: _camerca.pitch,
  10291. roll: _camerca.roll
  10292. }
  10293. });
  10294. }, Cesium.ScreenSpaceEventType.WHEEL);
  10295. },
  10296. clearHandler() {
  10297. var _self = this;
  10298. if (_self.handler1) {
  10299. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10300. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  10301. }
  10302. if (_self.handler2) {
  10303. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10304. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  10305. }
  10306. }
  10307. });
  10308. let SceneControl = {
  10309. ImageLayerSplit,
  10310. ViewerSplitScreen
  10311. };
  10312. class TrackRoam {
  10313. constructor(viewer2) {
  10314. if (!viewer2)
  10315. throw new Cesium.DeveloperError("no viewer object!");
  10316. this._viewer = viewer2;
  10317. this._draw3DObj = null;
  10318. }
  10319. _startFly(pathsData, options2) {
  10320. var _self = this;
  10321. options2 = options2 || {};
  10322. options2.time = Cesium.defaultValue(options2.time, 360);
  10323. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  10324. options2.height = Cesium.defaultValue(options2.height, 5);
  10325. options2.role = Cesium.defaultValue(options2.role, 1);
  10326. this.url = options2.modelUrl;
  10327. this.time = options2.time;
  10328. this.isPathShow = options2.isPathShow;
  10329. this.height = options2.height;
  10330. this.role = options2.role;
  10331. _self.clearFlyPaths();
  10332. _self._viewer.camera.setView({
  10333. destination: pathsData.position,
  10334. orientation: pathsData.orientation
  10335. });
  10336. setTimeout(function() {
  10337. executeFly3D();
  10338. }, 200);
  10339. function executeFly3D() {
  10340. if (pathsData && pathsData.geometry) {
  10341. var positionA = pathsData.geometry.coordinates;
  10342. let positions = positionA.map((point2) => {
  10343. return Cesium.Cartesian3.fromDegrees(point2.lng, point2.lat, point2.height);
  10344. });
  10345. let distance2 = [];
  10346. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  10347. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  10348. distance2.push(dis);
  10349. }
  10350. let times = [Cesium.JulianDate.fromDate(new Date())];
  10351. times.push(Cesium.JulianDate.addSeconds(times[0], _self.time, new Cesium.JulianDate()));
  10352. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  10353. let s = Cesium.JulianDate.addSeconds(times[i2], _self.time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  10354. times.push(s);
  10355. }
  10356. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  10357. oriSamples.addSamples(times, positions);
  10358. let startTime = times[0];
  10359. let stopTime = times[times.length - 1];
  10360. _self._viewer.clock.startTime = startTime.clone();
  10361. _self._viewer.clock.stopTime = stopTime.clone();
  10362. _self._viewer.clock.currentTime = startTime.clone();
  10363. _self._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  10364. _self._viewer.clock.multiplier = 10;
  10365. let timeOfResolution = 6;
  10366. let samplesNum = Math.floor(
  10367. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  10368. );
  10369. let sampledPositions = [];
  10370. let sampledTimes = [];
  10371. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10372. let sampleTime = Cesium.JulianDate.addSeconds(
  10373. startTime,
  10374. i2 * timeOfResolution,
  10375. new Cesium.JulianDate()
  10376. );
  10377. let tmpPos = oriSamples.getValue(sampleTime);
  10378. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  10379. sampledTimes.push(sampleTime);
  10380. }
  10381. Cesium.sampleTerrainMostDetailed(
  10382. _self._viewer.terrainProvider,
  10383. sampledPositions
  10384. ).then(() => {
  10385. let carPositionProperty = new Cesium.SampledPositionProperty();
  10386. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  10387. sampledPositions[i2].height = sampledPositions[i2].height + _self.height;
  10388. }
  10389. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10390. carPositionProperty.addSample(
  10391. sampledTimes[i2],
  10392. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  10393. );
  10394. }
  10395. var position2 = carPositionProperty;
  10396. _self.entityFly = _self._viewer.entities.add({
  10397. availability: new Cesium.TimeIntervalCollection([
  10398. new Cesium.TimeInterval({
  10399. start: startTime,
  10400. stop: stopTime
  10401. })
  10402. ]),
  10403. position: position2,
  10404. orientation: new Cesium.VelocityOrientationProperty(position2),
  10405. point: {
  10406. color: Cesium.Color.RED,
  10407. outlineColor: Cesium.Color.WHITE,
  10408. outlineWidth: 2,
  10409. pixelSize: 10
  10410. },
  10411. path: {
  10412. show: _self.isPathShow,
  10413. resolution: 1,
  10414. material: new Cesium.PolylineGlowMaterialProperty({
  10415. glowPower: 0.1,
  10416. color: Cesium.Color.YELLOW
  10417. }),
  10418. width: 10
  10419. }
  10420. });
  10421. if (_self.role == 0)
  10422. ;
  10423. else if (_self.role == 1) {
  10424. _self._viewer.trackedEntity = _self.entityFly;
  10425. } else if (_self.role == 2) {
  10426. _self._viewer.trackedEntity = _self.entityFly;
  10427. let exection = function TimeExecution() {
  10428. if (_self._viewer.clock.shouldAnimate === true) {
  10429. let center2 = _self.entity.position.getValue(
  10430. _self._viewer.clock.currentTime
  10431. );
  10432. let orientation = _self.entity.orientation.getValue(
  10433. _self._viewer.clock.currentTime
  10434. );
  10435. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  10436. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  10437. _self._viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(-50, 0, 250));
  10438. }
  10439. };
  10440. _self._viewer.clock.onTick.addEventListener(exection);
  10441. } else if (_self.role == 3) {
  10442. _self._viewer.trackedEntity = _self.entityFly;
  10443. let exection = function TimeExecution() {
  10444. if (_self._viewer.clock.shouldAnimate === true) {
  10445. let center2 = _self.entity.position.getValue(
  10446. _self._viewer.clock.currentTime
  10447. );
  10448. _self._viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  10449. }
  10450. };
  10451. _self._viewer.clock.onTick.addEventListener(exection);
  10452. }
  10453. });
  10454. } else {
  10455. return;
  10456. }
  10457. }
  10458. }
  10459. }
  10460. Object.assign(TrackRoam.prototype, {
  10461. drawFlyPaths(coordinates, options2) {
  10462. return new Promise((resolve2, reject2) => {
  10463. let _self = this;
  10464. _self.clearFlyPaths();
  10465. let position2 = _self._viewer.camera.position;
  10466. let heading = _self._viewer.camera.heading;
  10467. let pitch = _self._viewer.camera.pitch;
  10468. let roll = _self._viewer.camera.roll;
  10469. var pathsData = {
  10470. "orientation": {
  10471. "heading": heading,
  10472. "pitch": pitch,
  10473. "roll": roll
  10474. },
  10475. "position": position2,
  10476. "clampToGround": true,
  10477. "geometry": {
  10478. "type": "LineString",
  10479. "coordinates": coordinates
  10480. }
  10481. };
  10482. _self._draw3DObj = pathsData;
  10483. resolve2(true);
  10484. });
  10485. },
  10486. clearFlyPaths() {
  10487. this._draw3DObj = null;
  10488. this._viewer.trackedEntity = void 0;
  10489. this._viewer.entities.remove(this.entityFly);
  10490. },
  10491. startFly(options2, callError) {
  10492. if (this._draw3DObj) {
  10493. this._startFly(this._draw3DObj, options2);
  10494. } else {
  10495. if (callError)
  10496. callError("\u6F2B\u6E38\u8DEF\u7EBF\u4E0D\u5B58\u5728");
  10497. }
  10498. },
  10499. pauseFly() {
  10500. var clockViewModel = this._viewer.clockViewModel;
  10501. if (clockViewModel.shouldAnimate) {
  10502. clockViewModel.shouldAnimate = false;
  10503. } else if (this._viewer.clockViewModel.canAnimate) {
  10504. clockViewModel.shouldAnimate = true;
  10505. }
  10506. },
  10507. forwardFly() {
  10508. var clockViewModel = this._viewer.clockViewModel;
  10509. var multiplier = clockViewModel.multiplier;
  10510. if (multiplier < 0) {
  10511. clockViewModel.multiplier = -multiplier;
  10512. }
  10513. clockViewModel.shouldAnimate = true;
  10514. },
  10515. backwardsFly() {
  10516. var clockViewModel = this._viewer.clockViewModel;
  10517. var multiplier = clockViewModel.multiplier;
  10518. if (multiplier > 0) {
  10519. clockViewModel.multiplier = -multiplier;
  10520. }
  10521. clockViewModel.shouldAnimate = true;
  10522. },
  10523. outFly() {
  10524. var start2 = Cesium.JulianDate.fromDate(new Date());
  10525. this._viewer.clock.startTime = start2.clone();
  10526. var stop = Cesium.JulianDate.addSeconds(start2, 3e8, new Cesium.JulianDate());
  10527. this._viewer.clock.stopTime = stop.clone();
  10528. this.clearFlyPaths();
  10529. }
  10530. });
  10531. class Roaming {
  10532. constructor(viewer2, positions, options2) {
  10533. if (!viewer2)
  10534. throw new Cesium.DeveloperError("no viewer object!");
  10535. if (!positions)
  10536. throw new Cesium.DeveloperError("no positions Array!");
  10537. this.viewer = viewer2;
  10538. this.entity = void 0;
  10539. options2 = options2 || {};
  10540. options2.time = Cesium.defaultValue(options2.time, 360);
  10541. options2.speed = Cesium.defaultValue(options2.speed, 10);
  10542. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  10543. options2.height = Cesium.defaultValue(options2.height, 5);
  10544. options2.role = Cesium.defaultValue(options2.role, 1);
  10545. options2.followedX = Cesium.defaultValue(options2.followedX, 50);
  10546. options2.followedZ = Cesium.defaultValue(options2.followedZ, 10);
  10547. this.time = options2.time;
  10548. this.speed = options2.speed;
  10549. this.isPathShow = options2.isPathShow;
  10550. this.height = options2.height;
  10551. this.role = options2.role;
  10552. this.followedX = options2.followedX;
  10553. this.followedZ = options2.followedZ;
  10554. this.model = options2.model;
  10555. this.billboard = options2.billboard;
  10556. this.point = options2.point;
  10557. this.label = options2.label;
  10558. this.property = this.ComputeRoamingLineProperty(positions, this.time);
  10559. }
  10560. ComputeRoamingLineProperty(Lines, time) {
  10561. let positions = [];
  10562. if (Lines[0] instanceof Cesium.Cartesian3) {
  10563. positions = Lines;
  10564. } else {
  10565. positions = Lines.map((point2) => {
  10566. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10567. });
  10568. }
  10569. let distance2 = [];
  10570. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  10571. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  10572. distance2.push(dis);
  10573. }
  10574. let times = [Cesium.JulianDate.fromDate(new Date())];
  10575. times.push(Cesium.JulianDate.addSeconds(times[0], time, new Cesium.JulianDate()));
  10576. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  10577. let s = Cesium.JulianDate.addSeconds(times[i2], time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  10578. times.push(s);
  10579. }
  10580. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  10581. oriSamples.addSamples(times, positions);
  10582. let startTime = times[0];
  10583. let stopTime = times[times.length - 1];
  10584. this.viewer.clock.startTime = startTime.clone();
  10585. this.viewer.clock.stopTime = stopTime.clone();
  10586. this.viewer.clock.currentTime = startTime.clone();
  10587. this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  10588. this.viewer.clock.multiplier = this.speed;
  10589. let timeOfResolution = 6;
  10590. let samplesNum = Math.floor(
  10591. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  10592. );
  10593. let sampledPositions = [];
  10594. let sampledTimes = [];
  10595. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10596. let sampleTime = Cesium.JulianDate.addSeconds(
  10597. startTime,
  10598. i2 * timeOfResolution,
  10599. new Cesium.JulianDate()
  10600. );
  10601. let tmpPos = oriSamples.getValue(sampleTime);
  10602. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  10603. sampledTimes.push(sampleTime);
  10604. }
  10605. Cesium.sampleTerrainMostDetailed(
  10606. this.viewer.terrainProvider,
  10607. sampledPositions
  10608. ).then((updatedPositions) => {
  10609. let carPositionProperty = new Cesium.SampledPositionProperty();
  10610. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  10611. sampledPositions[i2].height = sampledPositions[i2].height + this.height;
  10612. }
  10613. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10614. carPositionProperty.addSample(
  10615. sampledTimes[i2],
  10616. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  10617. );
  10618. }
  10619. var position2 = carPositionProperty;
  10620. this.InitRoaming(position2, startTime, stopTime, this.isPathShow);
  10621. });
  10622. }
  10623. InitRoaming(position2, start2, stop, isPathShow) {
  10624. this.entity = this.viewer.entities.add({
  10625. availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
  10626. start: start2,
  10627. stop
  10628. })]),
  10629. position: position2,
  10630. orientation: new Cesium.VelocityOrientationProperty(position2),
  10631. path: {
  10632. resolution: 1,
  10633. material: new Cesium.PolylineGlowMaterialProperty({
  10634. glowPower: 0.1,
  10635. color: Cesium.Color.YELLOW
  10636. }),
  10637. width: 10,
  10638. show: isPathShow
  10639. }
  10640. });
  10641. if (this.model) {
  10642. let model = this.model;
  10643. this.entity.model = {
  10644. uri: model.url,
  10645. minimumPixelSize: 64,
  10646. maximumSize: 128,
  10647. maximumScale: 200,
  10648. show: true,
  10649. silhouetteColor: Cesium.Color.WHITE,
  10650. debugWireframe: false,
  10651. debugShowBoundingVolume: false,
  10652. scale: 20,
  10653. runAnimations: true
  10654. };
  10655. } else if (this.billboard) {
  10656. let billboard = this.billboard;
  10657. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  10658. this.entity.billboard = {
  10659. image: billboard.imgUrl,
  10660. show: true,
  10661. width: 30,
  10662. scale: 1,
  10663. height: 30,
  10664. pixelOffset: new Cesium.Cartesian2(0, -14)
  10665. };
  10666. } else {
  10667. let point2 = {};
  10668. if (this.point) {
  10669. point2 = this.point;
  10670. }
  10671. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  10672. if (point2.color) {
  10673. if (point2.color instanceof Array) {
  10674. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  10675. } else if (typeof point2.color === "string") {
  10676. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  10677. } else {
  10678. point2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10679. }
  10680. }
  10681. if (point2.outlineColor) {
  10682. if (point2.outlineColor instanceof Array) {
  10683. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  10684. } else if (typeof point2.outlineColor === "string") {
  10685. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  10686. } else {
  10687. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10688. }
  10689. }
  10690. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 2);
  10691. this.entity.point = point2;
  10692. }
  10693. if (this.label) {
  10694. let label2 = this.label;
  10695. label2.text = Cesium.defaultValue(label2.text, "");
  10696. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  10697. if (label2.fillColor) {
  10698. if (label2.fillColor instanceof Array) {
  10699. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  10700. } else if (typeof label2.fillColor === "string") {
  10701. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  10702. } else {
  10703. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10704. }
  10705. }
  10706. if (label2.outlineColor) {
  10707. if (label2.outlineColor instanceof Array) {
  10708. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  10709. } else if (typeof label2.outlineColor === "string") {
  10710. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  10711. } else {
  10712. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10713. }
  10714. }
  10715. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  10716. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  10717. if (label2.backgroundColor) {
  10718. if (label2.backgroundColor instanceof Array) {
  10719. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  10720. } else if (typeof label2.backgroundColor === "string") {
  10721. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  10722. } else {
  10723. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10724. }
  10725. }
  10726. label2.pixelOffset = Cesium.defaultValue(label2.pixelOffset, 0);
  10727. label2.scale = Cesium.defaultValue(label2.scale, 1);
  10728. label2.near = Cesium.defaultValue(label2.near, 150);
  10729. label2.nearValue = Cesium.defaultValue(label2.nearValue, 1);
  10730. label2.far = Cesium.defaultValue(label2.far, 2400);
  10731. label2.farValue = Cesium.defaultValue(label2.farValue, 0);
  10732. this.entity.label = {
  10733. text: label2.text,
  10734. font: label2.font,
  10735. fillColor: label2.fillColor,
  10736. outlineColor: label2.outlineColor,
  10737. outlineWidth: label2.outlineWidth,
  10738. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  10739. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  10740. showBackground: label2.showBackground,
  10741. backgroundColor: label2.backgroundColor,
  10742. backgroundPadding: new Cesium.Cartesian2(6, 6),
  10743. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  10744. pixelOffset: new Cesium.Cartesian2(0, label2.pixelOffset),
  10745. scale: label2.scale
  10746. };
  10747. }
  10748. this.entity.position.setInterpolationOptions({
  10749. interpolationDegree: 5,
  10750. interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
  10751. });
  10752. this.initRole(this.role);
  10753. }
  10754. initRole(role) {
  10755. let _self = this;
  10756. if (role == 0) {
  10757. this.viewer.trackedEntity = void 0;
  10758. let len = _self.viewer.clock.onTick.numberOfListeners;
  10759. for (let i2 = 0; i2 < len; i2++) {
  10760. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  10761. }
  10762. } else if (role == 1) {
  10763. this.viewer.trackedEntity = this.entity;
  10764. let len = _self.viewer.clock.onTick.numberOfListeners;
  10765. for (let i2 = 0; i2 < len; i2++) {
  10766. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  10767. }
  10768. } else if (role == 2) {
  10769. this.viewer.trackedEntity = this.entity;
  10770. let exection = function TimeExecution() {
  10771. if (_self.viewer.clock.shouldAnimate === true) {
  10772. let center2 = _self.entity.position.getValue(
  10773. _self.viewer.clock.currentTime
  10774. );
  10775. let orientation = _self.entity.orientation.getValue(
  10776. _self.viewer.clock.currentTime
  10777. );
  10778. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  10779. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  10780. var transformX = _self.followedX || 50;
  10781. var transformZ = _self.followedZ || 10;
  10782. _self.viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(transformX, 0, transformZ));
  10783. }
  10784. };
  10785. this.viewer.clock.onTick.addEventListener(exection);
  10786. } else if (role == 3) {
  10787. this.viewer.trackedEntity = this.entity;
  10788. let exection = function TimeExecution() {
  10789. if (_self.viewer.clock.shouldAnimate === true) {
  10790. let center2 = _self.entity.position.getValue(
  10791. _self.viewer.clock.currentTime
  10792. );
  10793. _self.viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  10794. }
  10795. };
  10796. this.viewer.clock.onTick.addEventListener(exection);
  10797. }
  10798. }
  10799. PauseOrContinue(state) {
  10800. this.viewer.clock.shouldAnimate = state;
  10801. }
  10802. forwardFly() {
  10803. var multiplier = this.viewer.clock.multiplier;
  10804. if (multiplier < 0) {
  10805. this.viewer.clock.multiplier = -multiplier;
  10806. }
  10807. this.viewer.clock.shouldAnimate = true;
  10808. }
  10809. backwardsFly() {
  10810. var multiplier = this.viewer.clock.multiplier;
  10811. if (multiplier > 0) {
  10812. this.viewer.clock.multiplier = -multiplier;
  10813. }
  10814. this.viewer.clock.shouldAnimate = true;
  10815. }
  10816. ChangeRoamingSpeed(value) {
  10817. this.viewer.clock.multiplier = value;
  10818. }
  10819. EndRoaming() {
  10820. if (this.entity !== void 0) {
  10821. this.viewer.entities.remove(this.entity);
  10822. }
  10823. this.viewer.trackedEntity = void 0;
  10824. this.viewer.clock.shouldAnimate = false;
  10825. let len = this.viewer.clock.onTick.numberOfListeners;
  10826. for (let i2 = 0; i2 < len; i2++) {
  10827. this.viewer.clock.onTick.removeEventListener(this.viewer.clock.onTick._listeners[i2]);
  10828. }
  10829. }
  10830. }
  10831. class PolygonObject {
  10832. constructor(viewer2) {
  10833. if (!viewer2)
  10834. throw new Cesium.DeveloperError("no viewer object!");
  10835. this._viewer = viewer2;
  10836. this._drawEntities = [];
  10837. this._polygonEntity = null;
  10838. }
  10839. }
  10840. Object.assign(PolygonObject.prototype, {
  10841. drawPolygonByGeoJson(geoJsonUrl, options2) {
  10842. return new Promise((resolve2, reject2) => {
  10843. let _self = this;
  10844. if (!Cesium.defined(geoJsonUrl)) {
  10845. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10846. }
  10847. options2 = options2 || {};
  10848. options2.id = options2.id || setSessionid$1();
  10849. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  10850. options2.color = Cesium.defaultValue(options2.color, "#FF0000");
  10851. options2.outlineColor = Cesium.defaultValue(options2.outlineColor, "#FFFF00");
  10852. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10853. options2.extrudedHeight = Cesium.defaultValue(options2.extrudedHeight, 0);
  10854. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  10855. clampToGround: true,
  10856. stroke: Cesium.Color.WHITE,
  10857. strokeWidth: 3,
  10858. fill: Cesium.Color.RED.withAlpha(0.5)
  10859. });
  10860. promise.then((dataSource) => {
  10861. _self._viewer.dataSources.add(dataSource);
  10862. dataSource.name = options2.id;
  10863. let entities2 = dataSource.entities.values;
  10864. for (let index2 = 0; index2 < entities2.length; index2++) {
  10865. let entity = entities2[index2];
  10866. entity.polygon.material = new Cesium.Color.fromCssColorString(color).withAlpha(0.1);
  10867. entity.polygon.extrudedHeight = options2.extrudedHeight;
  10868. entity.polygon.fill = false;
  10869. entity.polygon.outline = false;
  10870. entity.polygon.outlineWidth = options2.outlineWidth;
  10871. entity.polygon.outlineColor = options2.outlineColor;
  10872. entity.polyline = {
  10873. positions: entity.polygon.hierarchy._value.positions,
  10874. width: entity.polygon.outlineWidth,
  10875. material: new Cesium.Color.fromCssColorString(color).withAlpha(0.1)
  10876. };
  10877. if (options2.clampToGround) {
  10878. entity.polyline.clampToGround = true;
  10879. }
  10880. }
  10881. resolve2(entities2);
  10882. });
  10883. });
  10884. },
  10885. generatePolygonByPoints(points2, options2) {
  10886. return new Promise((resolve2, reject2) => {
  10887. let _self = this;
  10888. if (!Cesium.defined(points2)) {
  10889. throw new Cesium.DeveloperError("points is required.");
  10890. }
  10891. if (points2.length < 3) {
  10892. reject2("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  10893. }
  10894. let positions = points2.map((point2) => {
  10895. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10896. });
  10897. options2 = options2 || {};
  10898. options2.id = options2.id || setSessionid$1();
  10899. options2.fill = options2.fill || true;
  10900. if (options2.color) {
  10901. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10902. } else {
  10903. options2.color = new Cesium.Color.fromCssColorString("#ff0000");
  10904. }
  10905. options2.outline = options2.outline || false;
  10906. if (options2.outlineColor) {
  10907. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  10908. } else {
  10909. options2.outlineColor = new Cesium.Color.fromCssColorString("#000");
  10910. }
  10911. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10912. let entity = new Cesium.Entity({
  10913. id: options2.id,
  10914. name: "Generate surfaces based on coordinate points",
  10915. polygon: {
  10916. hierarchy: positions,
  10917. material: options2.color,
  10918. fill: options2.fill,
  10919. outline: options2.outline,
  10920. outlineWidth: options2.outlineWidth,
  10921. outlineColor: options2.outlineColor
  10922. }
  10923. });
  10924. if (options2.outline) {
  10925. entity.polyline = {
  10926. positions: entity.polygon.hierarchy._value.positions,
  10927. width: options2.outlineWidth,
  10928. material: options2.outlineColor,
  10929. clampToGround: true
  10930. };
  10931. }
  10932. _self._viewer.entities.add(entity);
  10933. resolve2(entity);
  10934. });
  10935. }
  10936. });
  10937. class CircleMaterialProperty$1 {
  10938. constructor(options2) {
  10939. this._viewer = options2.viewer;
  10940. this._definitionChanged = new Cesium.Event();
  10941. this._color = void 0;
  10942. this.color = options2.color || Cesium.Color.BLUE;
  10943. this.count = options2.count || 1;
  10944. this.duration = options2.duration || 1e3;
  10945. this._time = new Date().getTime();
  10946. this._materialTypeName = "jtCircleMaterial";
  10947. this._param = {
  10948. color: this.color._value.toCssColorString(),
  10949. duration: this.duration,
  10950. count: this.count
  10951. };
  10952. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  10953. fabric: {
  10954. type: this._materialTypeName,
  10955. uniforms: {
  10956. time: 0,
  10957. color: new Cesium.Color(1, 0, 0, 0.5),
  10958. count: 1
  10959. },
  10960. source: this._getCircleMaterial()
  10961. },
  10962. translucent: function(material) {
  10963. return true;
  10964. }
  10965. });
  10966. }
  10967. _getCircleMaterial() {
  10968. 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";
  10969. return circleMaterial;
  10970. }
  10971. }
  10972. Object.assign(CircleMaterialProperty$1.prototype, {
  10973. getType: function(time) {
  10974. return this._materialTypeName;
  10975. },
  10976. getValue: function(time, result) {
  10977. if (!Cesium.defined(result)) {
  10978. result = {};
  10979. }
  10980. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  10981. result.count = this.count;
  10982. if (this.duration) {
  10983. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  10984. }
  10985. this._viewer.scene.requestRender();
  10986. return result;
  10987. },
  10988. equals: function(other) {
  10989. return this === other || other instanceof CircleMaterialProperty$1 && Cesium.Property.equals(this._color, other._color);
  10990. }
  10991. });
  10992. Object.defineProperties(CircleMaterialProperty$1.prototype, {
  10993. isConstant: {
  10994. get: function() {
  10995. return false;
  10996. }
  10997. },
  10998. definitionChanged: {
  10999. get: function() {
  11000. return this._definitionChanged;
  11001. }
  11002. },
  11003. color: Cesium.createPropertyDescriptor("color")
  11004. });
  11005. class CircleRippleMaterialProperty {
  11006. constructor(options2) {
  11007. this._definitionChanged = new Cesium.Event();
  11008. this._color = void 0;
  11009. this._speed = void 0;
  11010. this.color = options2.color;
  11011. this.speed = options2.speed;
  11012. this.count = options2.count;
  11013. this.gradient = options2.gradient;
  11014. }
  11015. get isConstant() {
  11016. return false;
  11017. }
  11018. get definitionChanged() {
  11019. return this._definitionChanged;
  11020. }
  11021. getType(time) {
  11022. return Cesium.Material.CircleRippleMaterialType;
  11023. }
  11024. getValue(time, result) {
  11025. if (!Cesium.defined(result)) {
  11026. result = {};
  11027. }
  11028. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  11029. result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 10, result.speed);
  11030. result.count = this.count;
  11031. result.gradient = this.gradient;
  11032. return result;
  11033. }
  11034. equals(other) {
  11035. 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);
  11036. }
  11037. }
  11038. Object.defineProperties(CircleRippleMaterialProperty.prototype, {
  11039. color: Cesium.createPropertyDescriptor("color"),
  11040. speed: Cesium.createPropertyDescriptor("speed"),
  11041. count: Cesium.createPropertyDescriptor("count"),
  11042. gradient: Cesium.createPropertyDescriptor("gradient")
  11043. });
  11044. Cesium.CircleRippleMaterialProperty = CircleRippleMaterialProperty;
  11045. Cesium.Material.CircleRippleMaterialProperty = "CircleRippleMaterialProperty";
  11046. Cesium.Material.CircleRippleMaterialType = "CircleRippleMaterialType";
  11047. Cesium.Material.CircleRippleMaterialSource = `
  11048. uniform vec4 color;
  11049. uniform float speed;
  11050. uniform float count;
  11051. uniform float gradient;
  11052. czm_material czm_getMaterial(czm_materialInput materialInput)
  11053. {
  11054. czm_material material = czm_getDefaultMaterial(materialInput);
  11055. material.diffuse = 1.5 * color.rgb;
  11056. vec2 st = materialInput.st;
  11057. float dis = distance(st, vec2(0.5, 0.5));
  11058. float per = fract(czm_frameNumber * speed / 1000.0);
  11059. if(count == 1.0){
  11060. if(dis > per * 0.5){
  11061. discard;
  11062. }else {
  11063. material.alpha = color.a * dis / per / 2.0;
  11064. }
  11065. } else {
  11066. vec3 str = materialInput.str;
  11067. if(abs(str.z) > 0.001){
  11068. discard;
  11069. }
  11070. if(dis > 0.5){
  11071. discard;
  11072. } else {
  11073. float perDis = 0.5 / count;
  11074. float disNum;
  11075. float bl = 0.0;
  11076. for(int i = 0; i <= 999; i++){
  11077. if(float(i) <= count){
  11078. disNum = perDis * float(i) - dis + per / count;
  11079. if(disNum > 0.0){
  11080. if(disNum < perDis){
  11081. bl = 1.0 - disNum / perDis;
  11082. }
  11083. else if(disNum - perDis < perDis){
  11084. bl = 1.0 - abs(1.0 - disNum / perDis);
  11085. }
  11086. material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));
  11087. }
  11088. }
  11089. }
  11090. }
  11091. }
  11092. return material;
  11093. }
  11094. `;
  11095. Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRippleMaterialType, {
  11096. fabric: {
  11097. type: Cesium.Material.CircleRippleMaterialType,
  11098. uniforms: {
  11099. color: new Cesium.Color(1, 0, 0, 1),
  11100. speed: 3,
  11101. count: 4,
  11102. gradient: 0.2
  11103. },
  11104. source: Cesium.Material.CircleRippleMaterialSource
  11105. },
  11106. translucent: function(material) {
  11107. return true;
  11108. }
  11109. });
  11110. class CircleObject {
  11111. constructor(viewer2) {
  11112. if (!viewer2)
  11113. throw new Cesium.DeveloperError("no viewer object!");
  11114. this._viewer = viewer2;
  11115. }
  11116. }
  11117. Object.assign(CircleObject.prototype, {
  11118. drawCircle: function(centerPoint, radius, options2) {
  11119. return new Promise((resolve2, reject2) => {
  11120. this._viewer;
  11121. if (!Cesium.defined(centerPoint)) {
  11122. throw new Cesium.DeveloperError("centerPoint is required.");
  11123. }
  11124. if (!Cesium.defined(radius)) {
  11125. throw new Cesium.DeveloperError("radius is required.");
  11126. }
  11127. let position2;
  11128. if (centerPoint instanceof Cesium.Cartesian3) {
  11129. position2 = centerPoint;
  11130. } else {
  11131. position2 = Cesium.Cartesian3.fromDegrees(centerPoint[0], centerPoint[1], centerPoint[2] || 0);
  11132. }
  11133. if (typeof radius === "number" && radius > 0) {
  11134. radius = radius;
  11135. } else {
  11136. radius = 100;
  11137. }
  11138. options2 = options2 || {};
  11139. options2.id = options2.id || setSessionid$1();
  11140. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  11141. options2.CircleType = Cesium.defaultValue(options2.CircleType, "ColorCircle");
  11142. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  11143. options2.count = Cesium.defaultValue(options2.count, 1);
  11144. if (options2.color) {
  11145. if (options2.color instanceof Array) {
  11146. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  11147. } else if (typeof options2.color === "string") {
  11148. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  11149. } else {
  11150. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  11151. }
  11152. }
  11153. if (options2.outlineColor) {
  11154. if (options2.outlineColor instanceof Array) {
  11155. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  11156. } else if (typeof options2.outlineColor === "string") {
  11157. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  11158. } else {
  11159. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  11160. }
  11161. }
  11162. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 0);
  11163. let polygonMaterial = options2.color;
  11164. options2.outlineColor;
  11165. if (options2.CircleType === "DynamicCircle") {
  11166. polygonMaterial = new Cesium.CircleRippleMaterialProperty({
  11167. color: options2.color,
  11168. speed: options2.duration / 1e3,
  11169. count: options2.count,
  11170. gradient: 0.2
  11171. });
  11172. }
  11173. let entity = new Cesium.Entity({
  11174. id: options2.id,
  11175. position: position2,
  11176. ellipse: {
  11177. semiMinorAxis: radius,
  11178. semiMajorAxis: radius,
  11179. material: polygonMaterial,
  11180. outline: true,
  11181. outlineColor: options2.outlineColor,
  11182. outlineWidth: options2.outlineWidth
  11183. }
  11184. });
  11185. resolve2(entity);
  11186. });
  11187. }
  11188. });
  11189. Cesium.Primitive.prototype.setUseGeometry = function(geometry2) {
  11190. this._useGeometry = geometry2;
  11191. };
  11192. Cesium.Primitive.prototype.getUseGeometry = function() {
  11193. return this._useGeometry;
  11194. };
  11195. class SketchViewModel {
  11196. constructor(viewer2, options2) {
  11197. this._viewer = viewer2;
  11198. this._init(options2);
  11199. }
  11200. _init(options2) {
  11201. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  11202. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  11203. this._entities = this._viewer.entities;
  11204. this._pointEntitys = [];
  11205. this._sketchPointImage = void 0;
  11206. 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==";
  11207. 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";
  11208. 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=";
  11209. 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";
  11210. this._sketchEntityName = "sketchEntity";
  11211. this._sketchTempPoints = [];
  11212. this._sketchPoints = [];
  11213. this._sketchOutputPoints = [];
  11214. this._sketchTempPolyline = void 0;
  11215. this._sketchPolyline = void 0;
  11216. this._sketchTempPolygon = void 0;
  11217. this._sketchPolygon = void 0;
  11218. this._sketchTempAltituePolyline = void 0;
  11219. this._sketchAltitudePolyline = void 0;
  11220. this._sketchAltitudeInitHeight = 0;
  11221. this._sketchTempSpatialPolyline = void 0;
  11222. this._sketchSpatialPolyline = void 0;
  11223. this._sketchTempCircle = void 0;
  11224. this._sketchCircle = void 0;
  11225. this._sketchTempRectangle = void 0;
  11226. this._sketchRectangle = void 0;
  11227. this._sketchTempTriangleAltitudePolyline = void 0;
  11228. this._sketchTriangleAltituePolyline = void 0;
  11229. this._sketchTempSpatialTriangle = void 0;
  11230. this._sketchSpatialTriangle = void 0;
  11231. this._lineLabel = void 0;
  11232. this._polygonLabel = void 0;
  11233. options2 = options2 || {};
  11234. if (options2.isDrawPoint) {
  11235. this._isDrawPoint = options2.isDrawPoint;
  11236. } else {
  11237. this._isDrawPoint = false;
  11238. }
  11239. if (options2.isRetainDrawPoint) {
  11240. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  11241. } else {
  11242. this._isRetainDrawPoint = false;
  11243. }
  11244. this._param = {
  11245. moveLineWidth: 2,
  11246. lineWidth: 2,
  11247. moveAltitudeLineWidth: 2,
  11248. altitudeLineWidth: 2,
  11249. spatialLineWidth: 2,
  11250. moveEllipseColor: [0, 255, 0, 0.5],
  11251. moveEllipseOutline: true,
  11252. moveEllipseOutlineColor: [255, 0, 0, 0.5],
  11253. moveEllipseOutlineWidth: 1,
  11254. spatialLineWidth: 2,
  11255. ellipseColor: [0, 0, 255, 0.5],
  11256. ellipseOutline: true,
  11257. ellipseOutlineColor: [255, 0, 0, 0.5],
  11258. ellipseOutlineWidth: 1
  11259. };
  11260. this._setMoveLineStyle(void 0);
  11261. this._setLineStyle(void 0);
  11262. this._setMovePolygonStyle(void 0);
  11263. this._setPolygonStyle(void 0);
  11264. this._setMoveAltitudeLineStyle(void 0);
  11265. this._setAltitudeLineStyle(void 0);
  11266. this._setMoveEllipseStyle(void 0);
  11267. this._setEllipseStyle(void 0);
  11268. this._setSpatialLineStyle(void 0);
  11269. if (options2 && options2.iconType) {
  11270. switch (options2.iconType) {
  11271. case SketchViewModel.SketchIconType.Normal:
  11272. this._sketchPointImage = this._iconNormal;
  11273. break;
  11274. case SketchViewModel.SketchIconType.Blue:
  11275. this._sketchPointImage = this._iconBlue;
  11276. break;
  11277. case SketchViewModel.SketchIconType.Green:
  11278. this._sketchPointImage = this._iconGreen;
  11279. break;
  11280. case SketchViewModel.SketchIconType.Violet:
  11281. this._sketchPointImage = this._iconViolet;
  11282. break;
  11283. default:
  11284. this._sketchPointImage = this._iconNormal;
  11285. break;
  11286. }
  11287. } else {
  11288. this._sketchPointImage = this._iconNormal;
  11289. }
  11290. }
  11291. _arcToDegree(arc) {
  11292. return arc / Math.PI * 180;
  11293. }
  11294. _toColor(red, green, blue, alpha) {
  11295. let normalColor = new Cesium.Color(0, 0, 0, 1);
  11296. if (typeof red != "number")
  11297. return normalColor;
  11298. if (typeof green != "number")
  11299. return normalColor;
  11300. if (typeof blue != "number")
  11301. return normalColor;
  11302. if (typeof alpha != "number")
  11303. return normalColor;
  11304. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  11305. return normalColor;
  11306. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  11307. }
  11308. _toColorFromArray(array) {
  11309. if (!array || array.length === void 0 || array.length === 0)
  11310. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  11311. let r2 = 255, g = 255, b = 255, a = 1;
  11312. if (array.length === 1) {
  11313. r2 = parseInt(array[0]);
  11314. } else if (array.length === 2) {
  11315. r2 = parseInt(array[0]);
  11316. g = parseInt(array[1]);
  11317. } else if (array.length === 3) {
  11318. r2 = parseInt(array[0]);
  11319. g = parseInt(array[1]);
  11320. b = parseInt(array[2]);
  11321. } else if (array.length >= 4) {
  11322. r2 = parseInt(array[0]);
  11323. g = parseInt(array[1]);
  11324. b = parseInt(array[2]);
  11325. a = parseFloat(array[3]);
  11326. }
  11327. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  11328. }
  11329. _updateScene() {
  11330. this._viewer.scene.requestRender();
  11331. }
  11332. _getScreenClickPosition(screenPosition) {
  11333. let resCartesian = void 0;
  11334. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  11335. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11336. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11337. if (Cesium.defined(position2)) {
  11338. resCartesian = {
  11339. x: position2.x,
  11340. y: position2.y,
  11341. z: position2.z
  11342. };
  11343. }
  11344. return resCartesian;
  11345. }
  11346. _getScreenClickPositionAndHeight(screenPoint) {
  11347. var lng = void 0, lat = void 0, height2 = void 0;
  11348. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  11349. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11350. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11351. var feature2 = this._viewer.scene.pick(screenPoint);
  11352. if (feature2 == void 0) {
  11353. lng = this._arcToDegree(cartographic.longitude);
  11354. lat = this._arcToDegree(cartographic.latitude);
  11355. height2 = cartographic.height;
  11356. } else {
  11357. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  11358. if (Cesium.defined(cartesian)) {
  11359. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  11360. lng = this._arcToDegree(cartographic.longitude);
  11361. lat = this._arcToDegree(cartographic.latitude);
  11362. height2 = cartographic.height;
  11363. }
  11364. }
  11365. return {
  11366. lng,
  11367. lat,
  11368. height: height2
  11369. };
  11370. }
  11371. _transfromFromScreenPoint(screenPosition) {
  11372. let location = this._getScreenClickPositionAndHeight(screenPosition);
  11373. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  11374. return {
  11375. gLocation: location,
  11376. sLocation: cartesian
  11377. };
  11378. }
  11379. _removeEntityByName(entityName) {
  11380. var entities2 = this._entities;
  11381. if (!entities2 || !entities2.values)
  11382. return;
  11383. var delEntitys = [];
  11384. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  11385. if (entities2.values[i2].name == entityName) {
  11386. delEntitys.push(entities2.values[i2]);
  11387. }
  11388. }
  11389. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  11390. entities2.remove(delEntitys[i2]);
  11391. }
  11392. this._updateScene();
  11393. }
  11394. _removeEntityByObject(objEntity) {
  11395. if (!Cesium.defined(objEntity))
  11396. return;
  11397. this._entities.remove(objEntity);
  11398. }
  11399. _createPoint(coord, label2) {
  11400. let _self = this;
  11401. let entity = new Cesium.Entity({
  11402. name: _self._sketchEntityName + "_Point",
  11403. position: coord,
  11404. billboard: {
  11405. image: _self._sketchPointImage,
  11406. horizontalOrigin: Cesium.HorizontalOrigin.center,
  11407. verticalOrigin: Cesium.VerticalOrigin.bottom,
  11408. scale: 0.5,
  11409. pixelOffset: new Cesium.Cartesian2(0, -11),
  11410. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11411. }
  11412. });
  11413. if (label2) {
  11414. entity.label = {
  11415. text: label2,
  11416. font: "12px sans-serif",
  11417. fillColor: this._toColor(255, 255, 255, 1),
  11418. outlineColor: this._toColor(0, 154, 94, 1),
  11419. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  11420. outlineWidth: 1,
  11421. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  11422. pixelOffset: new Cesium.Cartesian2(0, -28),
  11423. showBackground: true,
  11424. backgroundColor: this._toColor(0, 0, 0, 0.6),
  11425. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11426. };
  11427. }
  11428. this._entities.add(entity);
  11429. this._pointEntitys.push(entity);
  11430. this._updateScene();
  11431. }
  11432. _removePointEntitys() {
  11433. this._removeEntityByName(this._sketchEntityName + "_Point");
  11434. this._pointEntitys = [];
  11435. }
  11436. _createTempPolyline() {
  11437. let _self = this;
  11438. if (!Cesium.defined(this._sketchTempPolyline)) {
  11439. this._sketchTempPolyline = new Cesium.Entity({
  11440. name: _self._sketchEntityName,
  11441. polyline: {
  11442. show: true,
  11443. positions: new Cesium.CallbackProperty(function() {
  11444. return _self._sketchTempPoints;
  11445. }, false),
  11446. material: _self._tempLineMaterial,
  11447. width: _self._param.moveLineWidth,
  11448. clampToGround: true
  11449. }
  11450. });
  11451. this._entities.add(this._sketchTempPolyline);
  11452. this._updateScene();
  11453. }
  11454. }
  11455. _createPolyline() {
  11456. let _self = this;
  11457. if (!Cesium.defined(this._sketchPolyline)) {
  11458. this._sketchPolyline = new Cesium.Entity({
  11459. name: _self._sketchEntityName,
  11460. polyline: {
  11461. show: true,
  11462. positions: _self._sketchPoints,
  11463. material: _self._lineMaterial,
  11464. width: _self._param.lineWidth,
  11465. clampToGround: true
  11466. }
  11467. });
  11468. this._entities.add(this._sketchPolyline);
  11469. this._updateScene();
  11470. }
  11471. }
  11472. _createTempSpatialPolyline() {
  11473. let _self = this;
  11474. if (!Cesium.defined(this._sketchTempSpatialPolyline)) {
  11475. this._sketchTempSpatialPolyline = new Cesium.Entity({
  11476. name: _self._sketchEntityName,
  11477. polyline: {
  11478. show: true,
  11479. positions: new Cesium.CallbackProperty(function() {
  11480. return _self._sketchTempPoints;
  11481. }, false),
  11482. material: _self._tempLineMaterial,
  11483. width: _self._param.moveLineWidth,
  11484. clampToGround: false
  11485. }
  11486. });
  11487. this._entities.add(this._sketchTempSpatialPolyline);
  11488. this._updateScene();
  11489. }
  11490. }
  11491. _createSpatialPolyline() {
  11492. let _self = this;
  11493. if (!Cesium.defined(this._sketchSpatialPolyline)) {
  11494. this._sketchSpatialPolyline = new Cesium.Entity({
  11495. name: _self._sketchEntityName,
  11496. polyline: {
  11497. show: true,
  11498. positions: _self._sketchPoints,
  11499. material: _self._spatialLineMaterial,
  11500. width: _self._param.spatialLineWidth,
  11501. clampToGround: false
  11502. }
  11503. });
  11504. this._entities.add(this._sketchSpatialPolyline);
  11505. this._updateScene();
  11506. }
  11507. }
  11508. _createTempPolygon() {
  11509. let _self = this;
  11510. if (!Cesium.defined(this._sketchTempPolygon)) {
  11511. this._sketchTempPolygon = new Cesium.Entity({
  11512. name: _self._sketchEntityName,
  11513. polygon: {
  11514. show: true,
  11515. hierarchy: new Cesium.CallbackProperty(function() {
  11516. return {
  11517. positions: _self._sketchTempPoints
  11518. };
  11519. }, false),
  11520. material: _self._tempPolygonMaterial,
  11521. classificationType: Cesium.ClassificationType.BOTH
  11522. }
  11523. });
  11524. this._entities.add(this._sketchTempPolygon);
  11525. this._updateScene();
  11526. }
  11527. }
  11528. _createPolygon() {
  11529. let _self = this;
  11530. if (!Cesium.defined(this._sketchPolygon)) {
  11531. this._sketchPoints.push(this._sketchPoints[0]);
  11532. this._sketchPolygon = new Cesium.Entity({
  11533. name: _self._sketchEntityName,
  11534. polygon: {
  11535. show: true,
  11536. hierarchy: {
  11537. positions: _self._sketchPoints
  11538. },
  11539. material: _self._polygonMaterial,
  11540. classificationType: Cesium.ClassificationType.BOTH
  11541. },
  11542. polyline: {
  11543. show: true,
  11544. positions: _self._sketchPoints,
  11545. material: _self._lineMaterial,
  11546. width: _self._param.lineWidth,
  11547. clampToGround: true
  11548. }
  11549. });
  11550. this._entities.add(this._sketchPolygon);
  11551. this._updateScene();
  11552. }
  11553. }
  11554. _createPolygonBody(options2) {
  11555. let _self = this;
  11556. let appendHeight = parseFloat(100);
  11557. if (options2 && options2.height && typeof options2.height === "number")
  11558. appendHeight = parseFloat(options2.height);
  11559. let wallColor = [255, 255, 0, 1];
  11560. let polygonColor = [0, 0, 255, 0.65];
  11561. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  11562. polygonColor = this._checkColorAndAlpha(options2.color);
  11563. if (!Cesium.defined(this._sketchPolygon)) {
  11564. 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}";
  11565. let wallMaterial = new Cesium.Material({
  11566. fabric: {
  11567. type: "wallMaterial",
  11568. uniforms: {
  11569. color: _self._toColorFromArray(wallColor),
  11570. speed: 100
  11571. },
  11572. source: shaderSource
  11573. }
  11574. });
  11575. new Cesium.MaterialAppearance({
  11576. material: wallMaterial
  11577. });
  11578. let polygonAppearance = new Cesium.MaterialAppearance({
  11579. material: new Cesium.Material({
  11580. fabric: {
  11581. type: "Color",
  11582. uniforms: {
  11583. color: _self._toColorFromArray(polygonColor)
  11584. }
  11585. }
  11586. })
  11587. });
  11588. let wallMinimumHeights = [];
  11589. let wallMaximumHeights = [];
  11590. for (let i2 = 0; i2 < _self._sketchOutputPoints.length; i2++) {
  11591. let height3 = parseFloat(_self._sketchOutputPoints[i2].height);
  11592. wallMinimumHeights.push(height3);
  11593. wallMaximumHeights.push(height3 + appendHeight);
  11594. }
  11595. let height2 = parseFloat(_self._sketchOutputPoints[0].height);
  11596. wallMinimumHeights.push(height2);
  11597. wallMaximumHeights.push(height2 + appendHeight);
  11598. let tempPoints = [];
  11599. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  11600. tempPoints.push(_self._sketchPoints[i2]);
  11601. }
  11602. tempPoints.push(_self._sketchPoints[0]);
  11603. new Cesium.WallGeometry({
  11604. positions: tempPoints,
  11605. maximumHeights: wallMaximumHeights,
  11606. minimumHeights: wallMinimumHeights
  11607. });
  11608. let polygonGeometry = new Cesium.PolygonGeometry({
  11609. polygonHierarchy: new Cesium.PolygonHierarchy(tempPoints),
  11610. perPositionHeight: true,
  11611. extrudedHeight: Math.max.apply(null, wallMaximumHeights)
  11612. });
  11613. let polygonPrimitive = new Cesium.Primitive({
  11614. geometryInstances: new Cesium.GeometryInstance({
  11615. geometry: polygonGeometry
  11616. }),
  11617. appearance: polygonAppearance,
  11618. releaseGeometryInstances: false
  11619. });
  11620. polygonPrimitive.setUseGeometry({
  11621. cPoints: _self._sketchPoints,
  11622. gPoints: _self._sketchOutputPoints,
  11623. height: appendHeight,
  11624. color: polygonColor
  11625. });
  11626. this._viewer.scene.primitives.add(polygonPrimitive);
  11627. }
  11628. }
  11629. _callUpdaeEllipseCenterPosition() {
  11630. let _self = this;
  11631. return function() {
  11632. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11633. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11634. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11635. return _self._sketchEllipseCenterPosition;
  11636. };
  11637. }
  11638. _callUpdateAltitudePolylinePositions() {
  11639. let _self = this;
  11640. return function() {
  11641. _self._sketchAltitudePolylinePostions = [];
  11642. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  11643. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11644. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11645. let point_temp = Cesium.Cartesian3.fromDegrees(
  11646. Cesium.Math.toDegrees(
  11647. point1cartographic.longitude
  11648. ),
  11649. Cesium.Math.toDegrees(point1cartographic.latitude),
  11650. point2cartographic.height
  11651. );
  11652. _self._sketchAltitudePolylinePostions.push(point_temp);
  11653. return _self._sketchAltitudePolylinePostions;
  11654. };
  11655. }
  11656. _callUpdateEllipseMinorAxis() {
  11657. let _self = this;
  11658. return function() {
  11659. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11660. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11661. let geodesic = new Cesium.EllipsoidGeodesic();
  11662. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11663. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11664. if (_self._sketchEllipseRadius <= 0)
  11665. _self._sketchEllipseRadius = 1;
  11666. return _self._sketchEllipseRadius;
  11667. };
  11668. }
  11669. _callUpdateEllipseHeight() {
  11670. let _self = this;
  11671. return function() {
  11672. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11673. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11674. let height_temp = cartographic1.height - cartographic.height;
  11675. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  11676. return _self._sketchEllipseHeight;
  11677. };
  11678. }
  11679. _createTempAltitudePolyline() {
  11680. let _self = this;
  11681. if (!Cesium.defined(this._sketchTempAltituePolyline)) {
  11682. this._sketchTempAltituePolyline = new Cesium.Entity({
  11683. name: _self._sketchEntityName,
  11684. position: new Cesium.CallbackProperty(
  11685. _self._callUpdaeEllipseCenterPosition(),
  11686. false
  11687. ),
  11688. polyline: {
  11689. show: true,
  11690. positions: new Cesium.CallbackProperty(
  11691. _self._callUpdateAltitudePolylinePositions(),
  11692. false
  11693. ),
  11694. material: _self._tempAlititudeLineMaterial,
  11695. width: _self._param.moveAltitudeLineWidth,
  11696. clampToGround: false
  11697. },
  11698. ellipse: {
  11699. show: true,
  11700. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11701. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11702. height: new Cesium.CallbackProperty(_self._callUpdateEllipseHeight(), false),
  11703. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  11704. outline: _self._param.moveEllipseOutline,
  11705. outlineWidth: _self._param.moveEllipseOutlineWidth,
  11706. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  11707. }
  11708. });
  11709. _self._entities.add(_self._sketchTempAltituePolyline);
  11710. }
  11711. }
  11712. _createAltitudePolyline() {
  11713. let _self = this;
  11714. if (!Cesium.defined(this._sketchAltitudePolyline)) {
  11715. this._sketchAltitudePolyline = new Cesium.Entity({
  11716. name: _self._sketchEntityName,
  11717. position: _self._sketchEllipseCenterPosition,
  11718. polyline: {
  11719. show: true,
  11720. positions: _self._sketchAltitudePolylinePostions,
  11721. material: _self._altitudeLineMaterial,
  11722. width: _self._param.altitudeLineWidth,
  11723. clampToGround: false
  11724. },
  11725. ellipse: {
  11726. show: true,
  11727. semiMinorAxis: _self._sketchEllipseRadius,
  11728. semiMajorAxis: _self._sketchEllipseRadius,
  11729. height: _self._sketchEllipseHeight,
  11730. material: _self._toColorFromArray(_self._param.ellipseColor),
  11731. outline: _self._param.ellipseOutline,
  11732. outlineWidth: _self._param.ellipseOutlineWidth,
  11733. outlineColor: _self._toColorFromArray(_self._param.ellipseOutlineColor)
  11734. }
  11735. });
  11736. _self._entities.add(_self._sketchAltitudePolyline);
  11737. }
  11738. }
  11739. _callEllipseOutlineCoordinate() {
  11740. let _self = this;
  11741. return function() {
  11742. let positionCenter = _self._sketchEllipseCenterPosition;
  11743. let positionRotate = _self._sketchTempPoints[1];
  11744. _self._ellipseOutlineCoordinates = [];
  11745. for (let angle = 5; angle < 360; ) {
  11746. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  11747. _self._ellipseOutlineCoordinates.push(newPosition);
  11748. angle = angle + 5;
  11749. }
  11750. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  11751. return _self._ellipseOutlineCoordinates;
  11752. };
  11753. }
  11754. _createTempCircle(centerPosition) {
  11755. let _self = this;
  11756. if (!Cesium.defined(this._sketchTempCircle)) {
  11757. _self._sketchEllipseCenterPosition = centerPosition.clone();
  11758. this._sketchTempCircle = new Cesium.Entity({
  11759. name: _self._sketchEntityName,
  11760. position: centerPosition,
  11761. polyline: {
  11762. show: true,
  11763. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(), false),
  11764. material: _self._tempLineMaterial,
  11765. width: _self._param.moveLineWidth,
  11766. clampToGround: true
  11767. },
  11768. ellipse: {
  11769. show: true,
  11770. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11771. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11772. material: _self._tempPolygonMaterial,
  11773. classificationType: Cesium.ClassificationType.BOTH
  11774. }
  11775. });
  11776. _self._entities.add(_self._sketchTempCircle);
  11777. }
  11778. }
  11779. _rotatedPointByAngle(position_A, position_B, angle) {
  11780. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  11781. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  11782. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  11783. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  11784. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  11785. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  11786. var new_z = localPosition_A.z;
  11787. return Cesium.Matrix4.multiplyByPoint(
  11788. localToWorld_Matrix,
  11789. new Cesium.Cartesian3(new_x, new_y, new_z),
  11790. new Cesium.Cartesian3()
  11791. );
  11792. }
  11793. _createCircle() {
  11794. let _self = this;
  11795. if (!Cesium.defined(this._sketchCircle)) {
  11796. this._sketchCircle = new Cesium.Entity({
  11797. name: _self._sketchEntityName,
  11798. position: _self._sketchEllipseCenterPosition,
  11799. polyline: {
  11800. show: true,
  11801. positions: _self._ellipseOutlineCoordinates,
  11802. material: _self._lineMaterial,
  11803. width: _self._param.lineWidth,
  11804. clampToGround: true
  11805. },
  11806. ellipse: {
  11807. show: true,
  11808. semiMinorAxis: _self._sketchEllipseRadius,
  11809. semiMajorAxis: _self._sketchEllipseRadius,
  11810. material: _self._polygonMaterial,
  11811. classificationType: Cesium.ClassificationType.BOTH
  11812. }
  11813. });
  11814. _self._entities.add(_self._sketchCircle);
  11815. }
  11816. }
  11817. _callUpdateRectangleCoordinates() {
  11818. let _self = this;
  11819. return function() {
  11820. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  11821. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  11822. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  11823. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  11824. _self._rectangleCoordinates = [0, 0, 1, 1];
  11825. if (lng0 < lng1) {
  11826. _self._rectangleCoordinates[0] = lng0;
  11827. _self._rectangleCoordinates[2] = lng1;
  11828. } else {
  11829. _self._rectangleCoordinates[0] = lng1;
  11830. _self._rectangleCoordinates[2] = lng0;
  11831. }
  11832. if (lat0 < lat1) {
  11833. _self._rectangleCoordinates[1] = lat0;
  11834. _self._rectangleCoordinates[3] = lat1;
  11835. } else {
  11836. _self._rectangleCoordinates[1] = lat1;
  11837. _self._rectangleCoordinates[3] = lat0;
  11838. }
  11839. let rectangle = Cesium.Rectangle.fromDegrees(
  11840. _self._rectangleCoordinates[0],
  11841. _self._rectangleCoordinates[1],
  11842. _self._rectangleCoordinates[2],
  11843. _self._rectangleCoordinates[3]
  11844. );
  11845. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  11846. _self._rectangleOutlineCoordinates = res.cPoints;
  11847. _self._sketchOutputPoints = res.gPoints;
  11848. return rectangle;
  11849. };
  11850. }
  11851. _calculateRectangleOutlineCoordinates(rectangle) {
  11852. let south_east = Cesium.Rectangle.southeast(rectangle);
  11853. let se2 = Cesium.Cartographic.toCartesian(south_east);
  11854. let south_west = Cesium.Rectangle.southwest(rectangle);
  11855. let sw = Cesium.Cartographic.toCartesian(south_west);
  11856. let north_east = Cesium.Rectangle.northeast(rectangle);
  11857. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  11858. let north_west = Cesium.Rectangle.northwest(rectangle);
  11859. let nw = Cesium.Cartographic.toCartesian(north_west);
  11860. let gPoints = [];
  11861. gPoints.push({
  11862. lng: Cesium.Math.toDegrees(south_west.longitude),
  11863. lat: Cesium.Math.toDegrees(south_west.latitude),
  11864. height: south_west.height
  11865. });
  11866. gPoints.push({
  11867. lng: Cesium.Math.toDegrees(south_east.longitude),
  11868. lat: Cesium.Math.toDegrees(south_east.latitude),
  11869. height: south_east.height
  11870. });
  11871. gPoints.push({
  11872. lng: Cesium.Math.toDegrees(north_east.longitude),
  11873. lat: Cesium.Math.toDegrees(north_east.latitude),
  11874. height: north_east.height
  11875. });
  11876. gPoints.push({
  11877. lng: Cesium.Math.toDegrees(north_west.longitude),
  11878. lat: Cesium.Math.toDegrees(north_west.latitude),
  11879. height: north_west.height
  11880. });
  11881. gPoints.push({
  11882. lng: Cesium.Math.toDegrees(south_west.longitude),
  11883. lat: Cesium.Math.toDegrees(south_west.latitude),
  11884. height: south_west.height
  11885. });
  11886. return {
  11887. cPoints: [sw, se2, ne2, nw, sw],
  11888. gPoints
  11889. };
  11890. }
  11891. _callUpdateRectangleOutlineCoordinates() {
  11892. let _self = this;
  11893. return function() {
  11894. return _self._rectangleOutlineCoordinates;
  11895. };
  11896. }
  11897. _createTempRectangle() {
  11898. let _self = this;
  11899. if (!Cesium.defined(this._sketchTempRectangle)) {
  11900. this._sketchTempRectangle = new Cesium.Entity({
  11901. name: _self._sketchEntityName,
  11902. polyline: {
  11903. show: true,
  11904. positions: new Cesium.CallbackProperty(_self._callUpdateRectangleOutlineCoordinates(), false),
  11905. material: _self._tempLineMaterial,
  11906. width: _self._param.moveLineWidth,
  11907. clampToGround: true
  11908. },
  11909. rectangle: {
  11910. show: true,
  11911. coordinates: new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(), false),
  11912. material: _self._tempPolygonMaterial,
  11913. classificationType: Cesium.ClassificationType.BOTH
  11914. }
  11915. });
  11916. _self._entities.add(_self._sketchTempRectangle);
  11917. }
  11918. }
  11919. _createRectangle() {
  11920. let _self = this;
  11921. if (!Cesium.defined(this._sketchRectangle)) {
  11922. this._sketchRectangle = new Cesium.Entity({
  11923. name: _self._sketchEntityName,
  11924. polyline: {
  11925. show: true,
  11926. positions: _self._rectangleOutlineCoordinates,
  11927. material: _self._lineMaterial,
  11928. width: _self._param.lineWidth,
  11929. clampToGround: true
  11930. },
  11931. rectangle: {
  11932. show: true,
  11933. coordinates: Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]),
  11934. material: _self._polygonMaterial,
  11935. classificationType: Cesium.ClassificationType.BOTH
  11936. }
  11937. });
  11938. _self._entities.add(_self._sketchRectangle);
  11939. }
  11940. }
  11941. _callUpdaeTriangleEllipseCenterPosition() {
  11942. let _self = this;
  11943. return function() {
  11944. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11945. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11946. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11947. return _self._sketchEllipseCenterPosition;
  11948. };
  11949. }
  11950. _callUpdateTriangleAltitudePolylinePositions() {
  11951. let _self = this;
  11952. return function() {
  11953. _self._sketchAltitudePolylinePostions = [];
  11954. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[1]);
  11955. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11956. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11957. let point_temp = Cesium.Cartesian3.fromDegrees(
  11958. Cesium.Math.toDegrees(
  11959. point1cartographic.longitude
  11960. ),
  11961. Cesium.Math.toDegrees(point1cartographic.latitude),
  11962. point2cartographic.height
  11963. );
  11964. _self._sketchAltitudePolylinePostions.push(point_temp);
  11965. return _self._sketchAltitudePolylinePostions;
  11966. };
  11967. }
  11968. _callUpdateTriangleEllipseMinorAxis() {
  11969. let _self = this;
  11970. return function() {
  11971. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11972. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11973. let geodesic = new Cesium.EllipsoidGeodesic();
  11974. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11975. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11976. if (_self._sketchEllipseRadius <= 0)
  11977. _self._sketchEllipseRadius = 1;
  11978. return _self._sketchEllipseRadius;
  11979. };
  11980. }
  11981. _callUpdateTriangleEllipseHeight() {
  11982. let _self = this;
  11983. return function() {
  11984. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11985. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11986. let height_temp = cartographic1.height - cartographic.height;
  11987. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  11988. return _self._sketchEllipseHeight;
  11989. };
  11990. }
  11991. _callUpdateTriangleSpatialPolylinePositions() {
  11992. let _self = this;
  11993. return function() {
  11994. _self._sketchTriangleSpatialPolylinePositions = [];
  11995. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchTempPoints[0]);
  11996. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchEllipseCenterPosition);
  11997. return _self._sketchTriangleSpatialPolylinePositions;
  11998. };
  11999. }
  12000. _createTriangleSpatialPolyline() {
  12001. let _self = this;
  12002. this._sketchSpatialPolyline = new Cesium.Entity({
  12003. name: _self._sketchEntityName,
  12004. polyline: {
  12005. show: true,
  12006. positions: _self._sketchTriangleSpatialPolylinePositions,
  12007. material: _self._spatialLineMaterial,
  12008. width: _self._param.spatialLineWidth,
  12009. clampToGround: false
  12010. }
  12011. });
  12012. this._entities.add(this._sketchSpatialPolyline);
  12013. }
  12014. _createTempTriangleAltitudePolylineAndSpatialPolyline() {
  12015. let _self = this;
  12016. if (!Cesium.defined(this._sketchTempTriangleAltitudePolyline) && !Cesium.defined(this._sketchTempSpatialPolyline)) {
  12017. this._sketchTempTriangleAltitudePolyline = new Cesium.Entity({
  12018. name: _self._sketchEntityName,
  12019. position: new Cesium.CallbackProperty(
  12020. _self._callUpdaeTriangleEllipseCenterPosition(),
  12021. false
  12022. ),
  12023. polyline: {
  12024. show: true,
  12025. positions: new Cesium.CallbackProperty(
  12026. _self._callUpdateTriangleAltitudePolylinePositions(),
  12027. false
  12028. ),
  12029. material: _self._tempAlititudeLineMaterial,
  12030. width: _self._param.moveAltitudeLineWidth,
  12031. clampToGround: false
  12032. },
  12033. ellipse: {
  12034. show: true,
  12035. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  12036. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  12037. height: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseHeight(), false),
  12038. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  12039. outline: _self._param.moveEllipseOutline,
  12040. outlineWidth: _self._param.moveEllipseOutlineWidth,
  12041. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  12042. }
  12043. });
  12044. _self._entities.add(_self._sketchTempTriangleAltitudePolyline);
  12045. _self._sketchTempSpatialPolyline = new Cesium.Entity({
  12046. name: _self._sketchEntityName,
  12047. polyline: {
  12048. show: true,
  12049. positions: new Cesium.CallbackProperty(_self._callUpdateTriangleSpatialPolylinePositions(), false),
  12050. material: _self._tempLineMaterial,
  12051. width: _self._param.moveLineWidth,
  12052. clampToGround: false
  12053. }
  12054. });
  12055. _self._entities.add(_self._sketchTempSpatialPolyline);
  12056. }
  12057. }
  12058. _createTempSpatialTriangle() {
  12059. let _self = this;
  12060. if (!Cesium.defined(this._sketchTempSpatialTriangle)) {
  12061. this._sketchTempSpatialTriangle = new Cesium.Entity({
  12062. name: _self._sketchEntityName,
  12063. polyline: {
  12064. show: true,
  12065. positions: new Cesium.CallbackProperty(function() {
  12066. _self._sketchSpatialTrianglePositions = [];
  12067. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12068. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  12069. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12070. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12071. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12072. _self._sketchSpatialTrianglePositions.push(point_temp);
  12073. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12074. return _self._sketchSpatialTrianglePositions;
  12075. }, false),
  12076. material: _self._tempLineMaterial,
  12077. width: _self._param.moveLineWidth,
  12078. clampToGround: false
  12079. }
  12080. });
  12081. this._entities.add(this._sketchTempSpatialTriangle);
  12082. this._updateScene();
  12083. }
  12084. }
  12085. _createSpatialTriangle() {
  12086. let _self = this;
  12087. if (!Cesium.defined(this._sketchSpatialTriangle)) {
  12088. this._sketchSpatialTriangle = new Cesium.Entity({
  12089. name: _self._sketchEntityName,
  12090. polyline: {
  12091. show: true,
  12092. positions: _self._sketchSpatialTrianglePositions,
  12093. material: _self._lineMaterial,
  12094. width: _self._param.lineWidth,
  12095. clampToGround: false
  12096. }
  12097. });
  12098. this._entities.add(this._sketchSpatialTriangle);
  12099. this._updateScene();
  12100. }
  12101. }
  12102. _setMoveLineStyle(options2) {
  12103. let _self = this;
  12104. let color2 = [255, 255, 255, 1];
  12105. let lineWidth = 3;
  12106. let isOutline = false;
  12107. let power = 0.2;
  12108. let outlineColor = [255, 0, 0, 1];
  12109. let outlineWidth = 1;
  12110. if (options2 && options2.color && options2.color.length === 4)
  12111. color2 = options2.color;
  12112. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12113. isOutline = options2.outline;
  12114. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12115. outlineColor = options2.outlineColor;
  12116. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12117. outlineWidth = options2.outlineWidth;
  12118. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12119. lineWidth = options2.lineWidth;
  12120. if (options2 && options2.power)
  12121. power = options2.power;
  12122. if (isOutline) {
  12123. this._tempLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12124. color: _self._toColorFromArray(color2),
  12125. outlineColor: _self._toColorFromArray(outlineColor),
  12126. outlineWidth
  12127. });
  12128. } else {
  12129. if (power === void 0) {
  12130. this._tempLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12131. color: _self._toColorFromArray(color2)
  12132. });
  12133. } else {
  12134. this._tempLineMaterial = new Cesium.PolylineGlowMaterialProperty({
  12135. color: _self._toColorFromArray(color2),
  12136. glowPower: power
  12137. });
  12138. }
  12139. }
  12140. this._param.moveLineWidth = lineWidth;
  12141. }
  12142. _setLineStyle(options2) {
  12143. let _self = this;
  12144. let color2 = [255, 255, 255, 1];
  12145. let lineWidth = 2;
  12146. let outlineColor = [0, 255, 0, 0.6];
  12147. let outlineWidth = 1;
  12148. if (options2 && options2.color && options2.color.length === 4)
  12149. color2 = options2.color;
  12150. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12151. outlineColor = options2.outlineColor;
  12152. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12153. outlineWidth = options2.outlineWidth;
  12154. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12155. lineWidth = options2.lineWidth;
  12156. this._lineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12157. color: _self._toColorFromArray(color2),
  12158. outlineColor: _self._toColorFromArray(outlineColor),
  12159. outlineWidth
  12160. });
  12161. this._param.lineWidth = lineWidth;
  12162. }
  12163. _setSpatialLineStyle(options2) {
  12164. let _self = this;
  12165. let color2 = [255, 255, 0, 1];
  12166. let lineWidth = 2;
  12167. let outlineColor = [255, 255, 255, 1];
  12168. let outlineWidth = 1;
  12169. if (options2 && options2.color && options2.color.length === 4)
  12170. color2 = options2.color;
  12171. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12172. outlineColor = options2.outlineColor;
  12173. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12174. outlineWidth = options2.outlineWidth;
  12175. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12176. lineWidth = options2.lineWidth;
  12177. this._spatialLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12178. color: _self._toColorFromArray(color2),
  12179. outlineColor: _self._toColorFromArray(outlineColor),
  12180. outlineWidth
  12181. });
  12182. this._param.spatialLineWidth = lineWidth;
  12183. }
  12184. _setMovePolygonStyle(options2) {
  12185. let polygonColor = [255, 0, 0, 0.3];
  12186. if (options2 && options2.color && options2.color.length === 4)
  12187. polygonColor = options2.color;
  12188. this._tempPolygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12189. }
  12190. _setPolygonStyle(options2) {
  12191. let polygonColor = [0, 0, 255, 0.3];
  12192. if (options2 && options2.color && options2.color.length === 4)
  12193. polygonColor = options2.color;
  12194. this._polygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12195. }
  12196. _setMoveAltitudeLineStyle(options2) {
  12197. let _self = this;
  12198. let color2 = [255, 255, 255, 1];
  12199. let lineWidth = 2;
  12200. let isOutline = true;
  12201. let outlineColor = [255, 255, 0, 1];
  12202. let outlineWidth = 1;
  12203. if (options2 && options2.color && options2.color.length === 4)
  12204. color2 = options2.color;
  12205. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12206. isOutline = options2.outline;
  12207. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12208. outlineColor = options2.outlineColor;
  12209. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12210. outlineWidth = options2.outlineWidth;
  12211. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12212. lineWidth = options2.lineWidth;
  12213. if (isOutline) {
  12214. this._tempAlititudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12215. color: _self._toColorFromArray(color2),
  12216. outlineColor: _self._toColorFromArray(outlineColor),
  12217. outlineWidth
  12218. });
  12219. } else {
  12220. this._tempAlititudeLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12221. color: _self._toColorFromArray(color2)
  12222. });
  12223. }
  12224. this._param.moveAltitudeLineWidth = lineWidth;
  12225. }
  12226. _setAltitudeLineStyle(options2) {
  12227. let _self = this;
  12228. let color2 = [255, 255, 255, 1];
  12229. let lineWidth = 2;
  12230. let outlineColor = [0, 0, 255, 1];
  12231. let outlineWidth = 1;
  12232. if (options2 && options2.color && options2.color.length === 4)
  12233. color2 = options2.color;
  12234. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12235. outlineColor = options2.outlineColor;
  12236. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12237. outlineWidth = options2.outlineWidth;
  12238. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12239. lineWidth = options2.lineWidth;
  12240. this._altitudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12241. color: _self._toColorFromArray(color2),
  12242. outlineColor: _self._toColorFromArray(outlineColor),
  12243. outlineWidth
  12244. });
  12245. this._param.altitudeLineWidth = lineWidth;
  12246. }
  12247. _setMoveEllipseStyle(options2) {
  12248. if (options2 && options2.color && options2.color.length === 4)
  12249. this._param.moveEllipseColor = options2.color;
  12250. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12251. this._param.moveEllipseOutlineWidth = options2.outlineWidth;
  12252. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12253. this._param.moveEllipseOutline = options2.outline;
  12254. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12255. this._param.moveEllipseOutlineColor = options2.outlineColor;
  12256. }
  12257. _setEllipseStyle(options2) {
  12258. if (options2 && options2.color && options2.color.length === 4)
  12259. this._param.ellipseColor = options2.color;
  12260. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12261. this._param.ellipseOutlineWidth = options2.outlineWidth;
  12262. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12263. this._param.ellipseOutline = options2.outline;
  12264. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12265. this._param.ellipseOutlineColor = options2.outlineColor;
  12266. }
  12267. _clear(isAll) {
  12268. if (isAll != void 0 && isAll === true) {
  12269. this._removeEntityByName(this._sketchEntityName);
  12270. this._removePointEntitys();
  12271. }
  12272. this._sketchTempPoints = [];
  12273. this._sketchPoints = [];
  12274. this._sketchOutputPoints = [];
  12275. this._sketchTempPolyline = void 0;
  12276. this._sketchPolyline = void 0;
  12277. this._sketchTempPolygon = void 0;
  12278. this._sketchPolygon = void 0;
  12279. this._sketchTempAltituePolyline = void 0;
  12280. this._sketchAltitudePolyline = void 0;
  12281. this._sketchTempSpatialPolyline = void 0;
  12282. this._sketchSpatialPolyline = void 0;
  12283. this._sketchTempCircle = void 0;
  12284. this._sketchCircle = void 0;
  12285. this._sketchTempRectangle = void 0;
  12286. this._sketchRectangle = void 0;
  12287. this._sketchTempTriangleAltitudePolyline = void 0;
  12288. this._sketchTriangleAltituePolyline = void 0;
  12289. this._sketchTempSpatialTriangle = void 0;
  12290. this._sketchSpatialTriangle = void 0;
  12291. }
  12292. _checkAppOrWeb() {
  12293. if (window.navigator.userAgent.match(
  12294. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  12295. )) {
  12296. return SketchViewModel.RuntimeEnvironment.App;
  12297. } else {
  12298. return SketchViewModel.RuntimeEnvironment.Web;
  12299. }
  12300. }
  12301. _isRuntimeApp() {
  12302. if (this._checkAppOrWeb() === SketchViewModel.RuntimeEnvironment.App) {
  12303. return true;
  12304. }
  12305. return false;
  12306. }
  12307. }
  12308. Object.assign(SketchViewModel.prototype, {
  12309. setMoveLineStyle: function(options2) {
  12310. this._setMoveLineStyle(options2);
  12311. },
  12312. setLineStyle: function(options2) {
  12313. this._setLineStyle(options2);
  12314. },
  12315. setSpatialLineStyle: function() {
  12316. this._setSpatialLineStyle(options);
  12317. },
  12318. setMovePolygonStyle: function(options2) {
  12319. this._setMovePolygonStyle(options2);
  12320. },
  12321. setPolygonStyle: function(options2) {
  12322. this._setPolygonStyle(options2);
  12323. },
  12324. setMoveAltitudeLineStyle: function(options2) {
  12325. this._setMoveAltitudeLineStyle(options2);
  12326. },
  12327. setAltitudeLineStyle: function(options2) {
  12328. this._setAltitudeLineStyle(options2);
  12329. },
  12330. setMoveEllipseStyle: function(options2) {
  12331. this._setMoveEllipseStyle(options2);
  12332. },
  12333. setEllipseStyle: function(options2) {
  12334. this._setEllipseStyle(options2);
  12335. },
  12336. setLabel: function(options2) {
  12337. if (!options2) {
  12338. options2 = {
  12339. lineLabel: void 0,
  12340. polygonLabel: void 0
  12341. };
  12342. }
  12343. if (options2.lineLabel)
  12344. this._lineLabel = options2.lineLabel;
  12345. if (options2.polygonLabel)
  12346. this._lineLabel = options2.polygonLabel;
  12347. }
  12348. });
  12349. Object.assign(SketchViewModel.prototype, {
  12350. _registerLeftClickEvent: function(handler, callChange) {
  12351. let _self = this;
  12352. if (!handler)
  12353. return;
  12354. handler.setInputAction(function(event2) {
  12355. _self._lock = true;
  12356. if (_self._timer != null)
  12357. clearTimeout(_self._timer);
  12358. _self._timer = setTimeout(function() {
  12359. if (callChange)
  12360. callChange(event2);
  12361. _self._lock = false;
  12362. }, 200);
  12363. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12364. },
  12365. _registerLeftDoubleClickEvent: function(handler, callChange) {
  12366. let _self = this;
  12367. if (!handler)
  12368. return;
  12369. handler.setInputAction(function(event2) {
  12370. if (_self._timer != null)
  12371. clearTimeout(_self._timer);
  12372. _self._lock = false;
  12373. if (callChange)
  12374. callChange(event2);
  12375. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  12376. },
  12377. _registerMouseMoveEvent: function(handler, callChange) {
  12378. let _self = this;
  12379. if (!handler)
  12380. return;
  12381. handler.setInputAction(function(event2) {
  12382. if (_self._lock === void 0 || _self._lock === false) {
  12383. if (callChange)
  12384. callChange(event2);
  12385. }
  12386. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12387. },
  12388. _registerRightClickEvent: function(handler, callChange) {
  12389. if (!handler)
  12390. return;
  12391. handler.setInputAction(function(event2) {
  12392. if (callChange)
  12393. callChange(event2);
  12394. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12395. },
  12396. _clearEvent: function(handler) {
  12397. if (!handler)
  12398. return;
  12399. handler.destroy();
  12400. handler = null;
  12401. }
  12402. });
  12403. Object.assign(SketchViewModel.prototype, {
  12404. _sketchDrawPoint(handler, options2) {
  12405. let _self = this;
  12406. this._registerLeftClickEvent(handler, function(event2) {
  12407. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12408. if (!Cesium.defined(loc2.sLocation))
  12409. return;
  12410. if (_self._isDrawPoint) {
  12411. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12412. }
  12413. _self._clearEvent(handler);
  12414. if (options2.onComplete)
  12415. options2.onComplete(loc2.sLocation, loc2.gLocation);
  12416. });
  12417. },
  12418. _sketchDrawMultiplePoint(handler, options2) {
  12419. let _self = this;
  12420. this._registerLeftClickEvent(handler, function(event2) {
  12421. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12422. if (!Cesium.defined(loc2.sLocation))
  12423. return;
  12424. if (_self._isDrawPoint) {
  12425. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12426. }
  12427. _self._sketchPoints.push(loc2.sLocation);
  12428. _self._sketchOutputPoints.push(loc2.gLocation);
  12429. if (options2.onAdded)
  12430. options2.onAdded(loc2.sLocation, loc2.gLocation);
  12431. });
  12432. this._registerRightClickEvent(handler, function(event2) {
  12433. if (_self._sketchPoints.length > 0) {
  12434. _self._sketchPoints.pop();
  12435. _self._sketchOutputPoints.pop();
  12436. if (options2.onUndo)
  12437. options2.onUndo();
  12438. }
  12439. });
  12440. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12441. _self._clearEvent();
  12442. if (options2.onComplete)
  12443. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12444. });
  12445. },
  12446. _sketchDrawPolyline(handler, options2) {
  12447. let _self = this;
  12448. this._registerLeftClickEvent(handler, function(event2) {
  12449. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12450. if (!Cesium.defined(loc2.sLocation))
  12451. return;
  12452. if (_self._isDrawPoint) {
  12453. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12454. }
  12455. if (_self._sketchTempPoints.length === 0) {
  12456. _self._createTempPolyline();
  12457. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12458. }
  12459. _self._sketchTempPoints.push(loc2.sLocation);
  12460. _self._sketchPoints.push(loc2.sLocation.clone());
  12461. _self._sketchOutputPoints.push(loc2.gLocation);
  12462. if (options2.onAdded)
  12463. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12464. });
  12465. this._registerMouseMoveEvent(handler, function(event2) {
  12466. if (_self._isRuntimeApp())
  12467. return;
  12468. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12469. if (!Cesium.defined(loc2.sLocation))
  12470. return;
  12471. if (Cesium.defined(_self._sketchTempPolyline)) {
  12472. _self._sketchTempPoints.pop();
  12473. _self._sketchTempPoints.push(loc2.sLocation);
  12474. if (options2.onMoving)
  12475. options2.onMoving(loc2.sLocation);
  12476. }
  12477. });
  12478. this._registerRightClickEvent(handler, function(event2) {
  12479. if (_self._sketchTempPoints.length > 2) {
  12480. _self._sketchPoints.pop();
  12481. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12482. if (_self._isDrawPoint) {
  12483. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12484. _self._entities.remove(lastPointEntity);
  12485. _self._pointEntitys.pop();
  12486. }
  12487. if (options2.onUndo)
  12488. options2.onUndo();
  12489. }
  12490. });
  12491. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12492. if (_self._isRuntimeApp())
  12493. return;
  12494. if (_self._sketchPoints.length < 2) {
  12495. if (options2.onError)
  12496. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12497. return;
  12498. }
  12499. _self._removeEntityByObject(_self._sketchTempPolyline);
  12500. _self._createPolyline();
  12501. if (!_self._isRetainDrawPoint)
  12502. _self._removePointEntitys();
  12503. _self._clearEvent(handler);
  12504. if (options2.onComplete)
  12505. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12506. });
  12507. },
  12508. _sketchDrawSpatialPolyline(handler, options2) {
  12509. let _self = this;
  12510. this._registerLeftClickEvent(handler, function(event2) {
  12511. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12512. if (!Cesium.defined(loc2.sLocation))
  12513. return;
  12514. if (_self._isDrawPoint) {
  12515. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12516. }
  12517. if (_self._sketchTempPoints.length === 0) {
  12518. _self._createTempSpatialPolyline();
  12519. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12520. }
  12521. _self._sketchTempPoints.push(loc2.sLocation);
  12522. _self._sketchPoints.push(loc2.sLocation.clone());
  12523. _self._sketchOutputPoints.push(loc2.gLocation);
  12524. if (options2.onAdded)
  12525. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12526. });
  12527. this._registerMouseMoveEvent(handler, function(event2) {
  12528. if (_self._isRuntimeApp())
  12529. return;
  12530. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12531. if (!Cesium.defined(loc2.sLocation))
  12532. return;
  12533. if (Cesium.defined(_self._sketchTempSpatialPolyline)) {
  12534. _self._sketchTempPoints.pop();
  12535. _self._sketchTempPoints.push(loc2.sLocation);
  12536. if (options2.onMoving)
  12537. options2.onMoving(loc2.sLocation);
  12538. }
  12539. });
  12540. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12541. if (_self._isRuntimeApp())
  12542. return;
  12543. if (_self._sketchPoints.length < 2) {
  12544. if (options2.onError)
  12545. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12546. return;
  12547. }
  12548. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12549. _self._createSpatialPolyline();
  12550. _self._removePointEntitys();
  12551. _self._clearEvent(handler);
  12552. if (options2.onComplete)
  12553. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12554. });
  12555. this._registerRightClickEvent(handler, function(event2) {
  12556. if (_self._sketchTempPoints.length > 2) {
  12557. _self._sketchPoints.pop();
  12558. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12559. if (options2.onUndo)
  12560. options2.onUndo();
  12561. }
  12562. });
  12563. },
  12564. _sketchDrawPolygon(handler, options2) {
  12565. let _self = this;
  12566. this._registerLeftClickEvent(handler, function(event2) {
  12567. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12568. if (!Cesium.defined(loc2.sLocation))
  12569. return;
  12570. if (_self._isDrawPoint) {
  12571. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12572. }
  12573. if (_self._sketchTempPoints.length === 0) {
  12574. _self._createTempPolygon();
  12575. _self._createTempPolyline();
  12576. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12577. }
  12578. _self._sketchTempPoints.push(loc2.sLocation);
  12579. _self._sketchPoints.push(loc2.sLocation.clone());
  12580. _self._sketchOutputPoints.push(loc2.gLocation);
  12581. if (options2.onAdded)
  12582. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12583. });
  12584. this._registerMouseMoveEvent(handler, function(event2) {
  12585. if (_self._isRuntimeApp())
  12586. return;
  12587. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12588. if (!Cesium.defined(loc2.sLocation))
  12589. return;
  12590. if (Cesium.defined(_self._sketchTempPolygon)) {
  12591. _self._sketchTempPoints.pop();
  12592. _self._sketchTempPoints.push(loc2.sLocation);
  12593. if (options2.onMoving)
  12594. options2.onMoving(loc2.sLocation);
  12595. }
  12596. });
  12597. this._registerRightClickEvent(handler, function(event2) {
  12598. if (_self._sketchTempPoints.length > 2) {
  12599. _self._sketchPoints.pop();
  12600. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12601. if (_self._isDrawPoint) {
  12602. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12603. _self._entities.remove(lastPointEntity);
  12604. _self._pointEntitys.pop();
  12605. }
  12606. if (options2.onUndo)
  12607. options2.onUndo();
  12608. }
  12609. });
  12610. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12611. if (_self._isRuntimeApp())
  12612. return;
  12613. if (_self._sketchPoints.length < 3) {
  12614. if (options2.onError)
  12615. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12616. return;
  12617. }
  12618. _self._removeEntityByObject(_self._sketchTempPolygon);
  12619. _self._removeEntityByObject(_self._sketchTempPolyline);
  12620. _self._createPolygon();
  12621. if (!_self._isRetainDrawPoint)
  12622. _self._removePointEntitys();
  12623. _self._clearEvent(handler);
  12624. if (options2.onComplete)
  12625. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12626. });
  12627. },
  12628. _sketchDrawCircle: function(handler, options2) {
  12629. let _self = this;
  12630. this._registerLeftClickEvent(handler, function(event2) {
  12631. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12632. if (!Cesium.defined(loc2.sLocation))
  12633. return;
  12634. if (_self._sketchTempPoints.length === 0) {
  12635. if (_self._isDrawPoint) {
  12636. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12637. }
  12638. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12639. _self._sketchTempPoints.push(loc2.sLocation);
  12640. _self._sketchPoints.push(loc2.sLocation.clone());
  12641. _self._sketchOutputPoints.push(loc2.gLocation);
  12642. _self._createTempCircle(loc2.sLocation);
  12643. if (options2.onAdded)
  12644. options2.onAdded(loc2.sLocation);
  12645. } else {
  12646. if (_self._isRuntimeApp()) {
  12647. _self._sketchTempPoints.pop();
  12648. _self._sketchTempPoints.push(loc2.sLocation);
  12649. let positionCenter = _self._sketchEllipseCenterPosition;
  12650. let positionRotate = _self._sketchTempPoints[1];
  12651. _self._ellipseOutlineCoordinates = [];
  12652. for (let angle = 5; angle < 360; ) {
  12653. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  12654. _self._ellipseOutlineCoordinates.push(newPosition);
  12655. angle = angle + 5;
  12656. }
  12657. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  12658. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12659. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12660. let geodesic = new Cesium.EllipsoidGeodesic();
  12661. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12662. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12663. if (_self._sketchEllipseRadius <= 0)
  12664. _self._sketchEllipseRadius = 1;
  12665. }
  12666. _self._removePointEntitys();
  12667. _self._removeEntityByObject(_self._sketchTempCircle);
  12668. _self._createCircle();
  12669. _self._clearEvent(handler);
  12670. if (options2.onComplete)
  12671. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  12672. }
  12673. });
  12674. this._registerMouseMoveEvent(handler, function(event2) {
  12675. if (_self._isRuntimeApp())
  12676. return;
  12677. if (!Cesium.defined(_self._sketchTempCircle))
  12678. return;
  12679. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12680. if (cartesian == void 0)
  12681. return;
  12682. _self._sketchTempPoints.pop();
  12683. _self._sketchTempPoints.push(cartesian);
  12684. });
  12685. },
  12686. _sketchDrawHeightPolyline: function(handler, options2) {
  12687. let _self = this;
  12688. this._registerLeftClickEvent(handler, function(event2) {
  12689. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12690. if (!Cesium.defined(loc2.sLocation))
  12691. return;
  12692. if (_self._sketchTempPoints.length === 0) {
  12693. if (_self._isDrawPoint) {
  12694. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12695. }
  12696. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12697. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12698. _self._sketchTempPoints.push(loc2.sLocation);
  12699. _self._sketchPoints.push(loc2.sLocation.clone());
  12700. if (options2.onAdded)
  12701. options2.onAdded(loc2.sLocation);
  12702. } else {
  12703. if (_self._isRuntimeApp()) {
  12704. _self._sketchTempPoints.pop();
  12705. _self._sketchTempPoints.push(loc2.sLocation);
  12706. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12707. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12708. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12709. _self._sketchAltitudePolylinePostions = [];
  12710. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  12711. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12712. _self._sketchAltitudePolylinePostions.push(point_temp);
  12713. let geodesic = new Cesium.EllipsoidGeodesic();
  12714. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12715. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12716. if (_self._sketchEllipseRadius <= 0)
  12717. _self._sketchEllipseRadius = 1;
  12718. let height_temp = point2cartographic.height - point1cartographic.height;
  12719. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  12720. }
  12721. _self._removePointEntitys();
  12722. _self._removeEntityByObject(_self._sketchTempAltituePolyline);
  12723. _self._createAltitudePolyline();
  12724. _self._clearEvent(handler);
  12725. if (options2.onComplete) {
  12726. options2.onComplete(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12727. }
  12728. }
  12729. });
  12730. this._registerMouseMoveEvent(handler, function(event2) {
  12731. if (_self._isRuntimeApp())
  12732. return;
  12733. if (_self._sketchTempPoints == void 0 || _self._sketchTempPoints.length == 0)
  12734. return;
  12735. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12736. if (cartesian == void 0)
  12737. return;
  12738. if (_self._sketchTempPoints.length >= 2) {
  12739. if (!Cesium.defined(_self._sketchTempAltituePolyline)) {
  12740. _self._createTempAltitudePolyline();
  12741. } else {
  12742. _self._sketchTempPoints.pop();
  12743. _self._sketchTempPoints.push(cartesian);
  12744. }
  12745. if (options2.onMoving) {
  12746. options2.onMoving(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12747. }
  12748. }
  12749. });
  12750. },
  12751. _sketchDrawRectangle: function(handler, options2) {
  12752. let _self = this;
  12753. this._registerLeftClickEvent(handler, function(event2) {
  12754. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12755. if (!Cesium.defined(loc2.sLocation))
  12756. return;
  12757. if (_self._sketchTempPoints.length === 0) {
  12758. if (_self._isDrawPoint) {
  12759. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12760. }
  12761. _self._sketchTempPoints.push(loc2.gLocation);
  12762. _self._sketchTempPoints.push(loc2.gLocation);
  12763. _self._sketchPoints.push(loc2.gLocation);
  12764. _self._createTempRectangle();
  12765. if (options2.onAdded)
  12766. options2.onAdded(loc2.sLocation);
  12767. } else {
  12768. if (_self._isRuntimeApp()) {
  12769. _self._sketchTempPoints.pop();
  12770. _self._sketchTempPoints.push(loc2.gLocation);
  12771. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  12772. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  12773. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  12774. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  12775. _self._rectangleCoordinates = [0, 0, 1, 1];
  12776. if (lng0 < lng1) {
  12777. _self._rectangleCoordinates[0] = lng0;
  12778. _self._rectangleCoordinates[2] = lng1;
  12779. } else {
  12780. _self._rectangleCoordinates[0] = lng1;
  12781. _self._rectangleCoordinates[2] = lng0;
  12782. }
  12783. if (lat0 < lat1) {
  12784. _self._rectangleCoordinates[1] = lat0;
  12785. _self._rectangleCoordinates[3] = lat1;
  12786. } else {
  12787. _self._rectangleCoordinates[1] = lat1;
  12788. _self._rectangleCoordinates[3] = lat0;
  12789. }
  12790. let rectangle = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  12791. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  12792. _self._rectangleOutlineCoordinates = res.cPoints;
  12793. _self._sketchOutputPoints = res.gPoints;
  12794. }
  12795. _self._removePointEntitys();
  12796. _self._removeEntityByObject(_self._sketchTempRectangle);
  12797. _self._createRectangle();
  12798. handler.destroy();
  12799. handler = null;
  12800. if (options2.onComplete)
  12801. options2.onComplete(_self._sketchOutputPoints);
  12802. }
  12803. });
  12804. this._registerMouseMoveEvent(handler, function(event2) {
  12805. if (_self._isRuntimeApp())
  12806. return;
  12807. if (!Cesium.defined(_self._sketchTempRectangle))
  12808. return;
  12809. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12810. if (!Cesium.defined(loc2.sLocation))
  12811. return;
  12812. _self._sketchTempPoints.pop();
  12813. _self._sketchTempPoints.push(loc2.gLocation);
  12814. });
  12815. },
  12816. _sketchDrawTriangle: function(handler, options2) {
  12817. let _self = this;
  12818. handler.setInputAction(function(event2) {
  12819. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12820. return;
  12821. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12822. if (!Cesium.defined(loc2.sLocation))
  12823. return;
  12824. if (_self._sketchPoints.length == 0) {
  12825. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12826. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12827. _self._sketchTempPoints.push(loc2.sLocation);
  12828. _self._sketchPoints.push(loc2.sLocation);
  12829. _self._createTempPolyline();
  12830. } else if (_self._sketchPoints.length === 1) {
  12831. _self._createPoint(loc2.sLocation, "\u9AD8\u5EA6\u8D77\u70B9");
  12832. _self._entities.remove(_self._sketchTempPolyline);
  12833. _self._sketchPoints.push(loc2.sLocation);
  12834. _self._createPolyline();
  12835. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12836. _self._sketchPoints.push(loc2.sLocation);
  12837. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12838. _self._createTempTriangleAltitudePolylineAndSpatialPolyline();
  12839. }
  12840. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12841. handler.setInputAction(function(event2) {
  12842. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12843. return;
  12844. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12845. if (cartesian == void 0)
  12846. return;
  12847. _self._sketchTempPoints.pop();
  12848. _self._sketchTempPoints.push(cartesian);
  12849. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12850. handler.setInputAction(function(event2) {
  12851. if (_self._sketchPoints.length < 2) {
  12852. if (options2.onError)
  12853. options2.onError("\u7ED8\u5236\u56FE\u5F62\u4E0D\u5B8C\u6574\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12854. return;
  12855. }
  12856. _self._removePointEntitys();
  12857. _self._removeEntityByObject(_self._sketchTempTriangleAltitudePolyline);
  12858. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12859. _self._createAltitudePolyline();
  12860. _self._createTriangleSpatialPolyline();
  12861. handler.destroy();
  12862. handler = null;
  12863. options2.onComplete(
  12864. _self._sketchPoints,
  12865. _self._sketchTriangleSpatialPolylinePositions,
  12866. _self._sketchAltitudePolylinePostions,
  12867. _self._sketchEllipseCenterPosition
  12868. );
  12869. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12870. },
  12871. _sketchDrawPolygonBody(handler, options2) {
  12872. let _self = this;
  12873. this._registerLeftClickEvent(handler, function(event2) {
  12874. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12875. if (!Cesium.defined(loc2.sLocation))
  12876. return;
  12877. if (_self._isDrawPoint) {
  12878. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12879. }
  12880. if (_self._sketchTempPoints.length === 0) {
  12881. _self._createTempPolygon();
  12882. _self._createTempPolyline();
  12883. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12884. }
  12885. _self._sketchTempPoints.push(loc2.sLocation);
  12886. _self._sketchPoints.push(loc2.sLocation.clone());
  12887. _self._sketchOutputPoints.push(loc2.gLocation);
  12888. if (options2.onAdded)
  12889. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12890. });
  12891. this._registerMouseMoveEvent(handler, function(event2) {
  12892. if (_self._isRuntimeApp())
  12893. return;
  12894. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12895. if (!Cesium.defined(loc2.sLocation))
  12896. return;
  12897. if (Cesium.defined(_self._sketchTempPolygon)) {
  12898. _self._sketchTempPoints.pop();
  12899. _self._sketchTempPoints.push(loc2.sLocation);
  12900. if (options2.onMoving)
  12901. options2.onMoving(loc2.sLocation);
  12902. }
  12903. });
  12904. this._registerRightClickEvent(handler, function(event2) {
  12905. if (_self._sketchTempPoints.length > 2) {
  12906. _self._sketchPoints.pop();
  12907. _self._sketchOutputPoints.pop();
  12908. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12909. if (options2.onUndo)
  12910. options2.onUndo(_self._sketchPoints);
  12911. }
  12912. });
  12913. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12914. if (_self._isRuntimeApp())
  12915. return;
  12916. if (_self._sketchPoints.length < 3) {
  12917. if (options2.onError)
  12918. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12919. return;
  12920. }
  12921. _self._removeEntityByObject(_self._sketchTempPolygon);
  12922. _self._removeEntityByObject(_self._sketchTempPolyline);
  12923. _self._createPolygonBody({
  12924. height: 30,
  12925. color: [255, 255, 0, 0.9]
  12926. });
  12927. _self._removePointEntitys();
  12928. _self._clearEvent(handler);
  12929. if (options2.onComplete)
  12930. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12931. });
  12932. },
  12933. _sketchDrawTriangleA: function(handler, options2) {
  12934. let _self = this;
  12935. this._registerLeftClickEvent(handler, function(event2) {
  12936. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12937. return;
  12938. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12939. if (!Cesium.defined(loc2.sLocation))
  12940. return;
  12941. if (_self._sketchPoints.length == 0) {
  12942. if (_self._isDrawPoint) {
  12943. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12944. }
  12945. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12946. _self._sketchTempPoints.push(loc2.sLocation);
  12947. _self._sketchPoints.push(loc2.sLocation);
  12948. _self._createTempSpatialTriangle();
  12949. if (options2.onAdded)
  12950. options2.onAdded(loc2.sLocation);
  12951. } else if (_self._sketchPoints.length > 0) {
  12952. if (_self._isRuntimeApp()) {
  12953. _self._sketchTempPoints.pop();
  12954. _self._sketchTempPoints.push(loc2.sLocation);
  12955. _self._sketchSpatialTrianglePositions = [];
  12956. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12957. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  12958. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12959. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12960. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12961. _self._sketchSpatialTrianglePositions.push(point_temp);
  12962. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12963. }
  12964. _self._removePointEntitys();
  12965. _self._removeEntityByObject(_self._sketchTempSpatialTriangle);
  12966. _self._createSpatialTriangle();
  12967. _self._clearEvent(handler);
  12968. if (options2.onComplete)
  12969. options2.onComplete(_self._sketchSpatialTrianglePositions);
  12970. }
  12971. });
  12972. this._registerMouseMoveEvent(handler, function(event2) {
  12973. if (_self._isRuntimeApp())
  12974. return;
  12975. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12976. return;
  12977. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12978. if (cartesian == void 0)
  12979. return;
  12980. _self._sketchTempPoints.pop();
  12981. _self._sketchTempPoints.push(cartesian);
  12982. if (options2.onMoving)
  12983. options2.onMoving(cartesian);
  12984. });
  12985. },
  12986. sketchTools: function(toolsType, options2) {
  12987. let _self = this;
  12988. this._clear();
  12989. _self._sketchEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  12990. switch (toolsType) {
  12991. case SketchViewModel.SketchType.Point:
  12992. _self._sketchDrawPoint(_self._sketchEventHandler, options2);
  12993. break;
  12994. case SketchViewModel.SketchType.Line:
  12995. _self._sketchDrawPolyline(_self._sketchEventHandler, options2);
  12996. break;
  12997. case SketchViewModel.SketchType.Polygon:
  12998. _self._sketchDrawPolygon(_self._sketchEventHandler, options2);
  12999. break;
  13000. case SketchViewModel.SketchType.Height:
  13001. _self._sketchDrawHeightPolyline(_self._sketchEventHandler, options2);
  13002. break;
  13003. case SketchViewModel.SketchType.Spatial:
  13004. _self._sketchDrawSpatialPolyline(_self._sketchEventHandler, options2);
  13005. break;
  13006. case SketchViewModel.SketchType.Circle:
  13007. _self._sketchDrawCircle(_self._sketchEventHandler, options2);
  13008. break;
  13009. case SketchViewModel.SketchType.Rectangle:
  13010. _self._sketchDrawRectangle(_self._sketchEventHandler, options2);
  13011. break;
  13012. case SketchViewModel.SketchType.Triangle:
  13013. _self._sketchDrawTriangleA(_self._sketchEventHandler, options2);
  13014. break;
  13015. case SketchViewModel.SketchType.PolygonBody:
  13016. _self._sketchDrawPolygonBody(_self._sketchEventHandler, options2);
  13017. break;
  13018. case SketchViewModel.SketchType.MultiplePoint:
  13019. _self._sketchDrawMultiplePoint(_self._sketchEventHandler, options2);
  13020. break;
  13021. }
  13022. },
  13023. sketchDrawFeacture: function(points2, type2, options2) {
  13024. let _self = this;
  13025. if (points2 === void 0 || points2.length === void 0 || points2.length < 2) {
  13026. if (options2 && options2.onError)
  13027. options2.onError("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  13028. return;
  13029. }
  13030. this._sketchPoints = [];
  13031. for (let i2 = 0; i2 < points2.length; ) {
  13032. this._sketchPoints.push(Cesium.Cartesian3.fromDegrees(points2[i2], points2[i2 + 1], points2[i2 + 2]));
  13033. i2 = i2 + 3;
  13034. }
  13035. switch (type2) {
  13036. case SketchViewModel.SketchType.DrawPoint:
  13037. _self._createPoint(_self._sketchPoints[0], _self._lineLabel);
  13038. if (options2 && options2.onComplete)
  13039. options2.onComplete(_self._pointEntitys);
  13040. break;
  13041. case SketchViewModel.SketchType.DrawMultiplePoint:
  13042. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  13043. _self._createPoint(_self._sketchPoints[i2], _self._lineLabel);
  13044. }
  13045. if (options2 && options2.onComplete)
  13046. options2.onComplete(_self._pointEntitys);
  13047. break;
  13048. case SketchViewModel.SketchType.DrawPolyline:
  13049. if (_self._sketchPoints.length < 2) {
  13050. if (options2 && options2.onError)
  13051. options2.onError("\u70B9\u6570\u5C11\u4E8E2\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  13052. } else {
  13053. _self._createPolyline();
  13054. if (options2 && options2.onComplete)
  13055. options2.onComplete(_self._sketchPolyline);
  13056. }
  13057. break;
  13058. case SketchViewModel.SketchType.DrawPolygon:
  13059. if (_self._sketchPoints.length < 3) {
  13060. if (options2 && options2.onError)
  13061. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  13062. } else {
  13063. _self._createPolygon();
  13064. if (options2 && options2.onComplete)
  13065. options2.onComplete(_self._sketchPolygon);
  13066. }
  13067. break;
  13068. default:
  13069. if (options2 && options2.onError)
  13070. options2.onError("\u7ED8\u5236\u7C7B\u578B\u5F02\u5E38\uFF01");
  13071. break;
  13072. }
  13073. },
  13074. sketchClear: function() {
  13075. this._clear(true);
  13076. this._clearEvent(this._sketchEventHandler);
  13077. },
  13078. sketchInit: function() {
  13079. this._clear(false);
  13080. }
  13081. });
  13082. Object.assign(SketchViewModel.prototype, {
  13083. _checkColor: function(color2) {
  13084. if (color2 === void 0 || color2 === null)
  13085. return false;
  13086. if (typeof color2 != "number")
  13087. return false;
  13088. let intColor = parseInt(color2);
  13089. if (intColor < 0 || intColor > 255)
  13090. return false;
  13091. return true;
  13092. },
  13093. _checkAlpha: function(alpha) {
  13094. if (alpha === void 0 || alpha === null)
  13095. return false;
  13096. if (typeof alpha != "number")
  13097. return false;
  13098. let floatAlpha = parseFloat(alpha);
  13099. if (floatAlpha < 0 || floatAlpha > 1)
  13100. return false;
  13101. return true;
  13102. },
  13103. _checkColorAndAlpha: function(colorAndAlpah) {
  13104. let setColor = void 0;
  13105. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  13106. return void 0;
  13107. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  13108. setColor = [colorAndAlpah[0], 0, 0, 1];
  13109. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13110. colorAndAlpah[1]
  13111. )) {
  13112. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  13113. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13114. colorAndAlpah[1]
  13115. ) && this._checkColor(colorAndAlpah[2])) {
  13116. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  13117. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13118. colorAndAlpah[1]
  13119. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  13120. colorAndAlpah[3]
  13121. )) {
  13122. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  13123. }
  13124. return setColor;
  13125. },
  13126. sketchEditPickPolygonBody: function(options2) {
  13127. let _self = this;
  13128. let primitive = _self._sketchPickPolygonBody;
  13129. if (primitive === void 0) {
  13130. if (options2.onComplete)
  13131. options2.onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13132. return;
  13133. }
  13134. let color2 = primitive._useGeometry.color;
  13135. let height2 = primitive._useGeometry.height;
  13136. this._sketchPoints = primitive._useGeometry.cPoints;
  13137. this._sketchOutputPoints = primitive._useGeometry.gPoints;
  13138. if (options2 && options2.height && typeof options2.height === "number")
  13139. height2 = parseInt(options2.height);
  13140. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  13141. color2 = this._checkColorAndAlpha(options2.color);
  13142. this._viewer.scene.primitives.remove(primitive);
  13143. this._createPolygonBody({
  13144. color: color2,
  13145. height: height2
  13146. });
  13147. if (options2.onComplete)
  13148. options2.onComplete(void 0);
  13149. },
  13150. sketchRemovePickPolygonBody: function(onComplete) {
  13151. let _self = this;
  13152. let primitive = _self._sketchPickPolygonBody;
  13153. if (primitive === void 0) {
  13154. if (onComplete)
  13155. onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13156. return;
  13157. }
  13158. this._viewer.scene.primitives.remove(primitive);
  13159. if (onComplete)
  13160. onComplete(void 0);
  13161. },
  13162. sketchPick: function(onComplete) {
  13163. let _self = this;
  13164. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  13165. handler.setInputAction(function(event2) {
  13166. let pickObj = _self._viewer.scene.pick(event2.position);
  13167. if (pickObj && pickObj.primitive && pickObj.primitive._useGeometry != void 0) {
  13168. _self._sketchPickPolygonBody = pickObj.primitive;
  13169. if (onComplete)
  13170. onComplete({
  13171. color: pickObj.primitive._useGeometry.color,
  13172. height: pickObj.primitive._useGeometry.height
  13173. });
  13174. } else {
  13175. _self._sketchPickPolygonBody = void 0;
  13176. if (onComplete)
  13177. onComplete(void 0);
  13178. }
  13179. handler.destroy();
  13180. handler = null;
  13181. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  13182. }
  13183. });
  13184. SketchViewModel.SketchType = Object.freeze({
  13185. Point: "point",
  13186. MultiplePoint: "multiplePoint",
  13187. Line: "line",
  13188. Polygon: "polygon",
  13189. Height: "height",
  13190. Spatial: "spatial",
  13191. Circle: "circle",
  13192. Rectangle: "rectangle",
  13193. Triangle: "triangle",
  13194. PolygonBody: "polygonBody",
  13195. DrawPoint: "drawPoint",
  13196. DrawMultiplePoint: "drawMultiplePoint",
  13197. DrawPolyline: "drawPolyline",
  13198. DrawPolygon: "drawPolygon"
  13199. });
  13200. SketchViewModel.SketchIconType = Object.freeze({
  13201. Normal: "normal",
  13202. Blue: "blue",
  13203. Green: "green",
  13204. Violet: "violter"
  13205. });
  13206. SketchViewModel.RuntimeEnvironment = Object.freeze({
  13207. App: "app",
  13208. Web: "web"
  13209. });
  13210. class CommonTools {
  13211. constructor(viewer2, options2) {
  13212. this._viewer = viewer2;
  13213. options2 = options2 || {};
  13214. if (options2.isDrawPoint) {
  13215. this._isDrawPoint = options2.isDrawPoint;
  13216. } else {
  13217. this._isDrawPoint = false;
  13218. }
  13219. if (options2.isRetainDrawPoint) {
  13220. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  13221. } else {
  13222. this._isRetainDrawPoint = false;
  13223. }
  13224. if (options2.isClear) {
  13225. this._isClear = options2.isClear;
  13226. } else {
  13227. this._isClear = false;
  13228. }
  13229. this._sketchViewModel = new SketchViewModel(viewer2, {
  13230. iconType: SketchViewModel.SketchIconType.Blue,
  13231. isDrawPoint: this._isDrawPoint,
  13232. isRetainDrawPoint: this._isRetainDrawPoint
  13233. });
  13234. let buttonDiv = document.getElementById("drawButtonDiv");
  13235. if (buttonDiv) {
  13236. document.body.removeChild(buttonDiv);
  13237. }
  13238. this._init();
  13239. }
  13240. _init() {
  13241. this._measureEntityName = "MeasureEntity";
  13242. this._entities = this._viewer.entities;
  13243. 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==";
  13244. 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";
  13245. 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=";
  13246. 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";
  13247. this._measureTempPoints = [];
  13248. }
  13249. _updateScene() {
  13250. this._viewer.scene.requestRender();
  13251. }
  13252. _removeEntityByName(entityName) {
  13253. let entities2 = this._entities;
  13254. if (!entities2 || !entities2.values)
  13255. return;
  13256. let delEntitys = [];
  13257. for (let i2 = 0; i2 < entities2.values.length; i2++) {
  13258. if (entities2.values[i2].name == entityName) {
  13259. delEntitys.push(entities2.values[i2]);
  13260. }
  13261. }
  13262. for (let i2 = 0; i2 < delEntitys.length; i2++) {
  13263. entities2.remove(delEntitys[i2]);
  13264. }
  13265. this._updateScene();
  13266. }
  13267. _clear(isAll) {
  13268. if (isAll != void 0 && isAll === true) {
  13269. this._removeEntityByName(this._measureEntityName);
  13270. if (this._sketchViewModel != void 0) {
  13271. this._sketchViewModel.sketchClear();
  13272. }
  13273. }
  13274. this._measureTempPoints = [];
  13275. this._altitudeDynamicLabel = void 0;
  13276. this._tooltipRemove();
  13277. let buttonDiv = document.getElementById("drawButtonDiv");
  13278. if (buttonDiv) {
  13279. document.body.removeChild(buttonDiv);
  13280. }
  13281. }
  13282. _toColor(red, green, blue, alpha) {
  13283. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  13284. }
  13285. _cartesianToGeography(cartesian) {
  13286. let ellipsoid = Cesium.Ellipsoid.WGS84;
  13287. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  13288. let latitude = Cesium.Math.toDegrees(cartographic.latitude);
  13289. let longitude = Cesium.Math.toDegrees(cartographic.longitude);
  13290. let altitude = cartographic.height;
  13291. return {
  13292. lon: longitude,
  13293. lat: latitude,
  13294. hei: altitude
  13295. };
  13296. }
  13297. _createPoint(coord, label2) {
  13298. let _self = this;
  13299. let entity = new Cesium.Entity({
  13300. name: _self._measureEntityName,
  13301. position: coord,
  13302. billboard: {
  13303. image: _self._iconBlue,
  13304. horizontalOrigin: Cesium.HorizontalOrigin.center,
  13305. verticalOrigin: Cesium.VerticalOrigin.bottom,
  13306. scale: 0.5,
  13307. pixelOffset: new Cesium.Cartesian2(0, -11),
  13308. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13309. }
  13310. });
  13311. if (label2) {
  13312. entity.label = {
  13313. text: label2,
  13314. font: "30px SimHei",
  13315. scale: 0.5,
  13316. fillColor: this._toColor(255, 255, 255, 1),
  13317. outlineColor: this._toColor(14, 30, 79, 1),
  13318. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13319. outlineWidth: 2,
  13320. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13321. showBackground: true,
  13322. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13323. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13324. pixelOffset: new Cesium.Cartesian2(0, -28)
  13325. };
  13326. }
  13327. this._entities.add(entity);
  13328. this._updateScene();
  13329. return entity;
  13330. }
  13331. _createLabel(coord, label2) {
  13332. let _self = this;
  13333. let entity = new Cesium.Entity({
  13334. name: _self._measureEntityName,
  13335. position: coord,
  13336. label: {
  13337. text: label2,
  13338. font: "30px SimHei",
  13339. scale: 0.5,
  13340. fillColor: this._toColor(255, 255, 255, 1),
  13341. outlineColor: this._toColor(14, 30, 79, 1),
  13342. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13343. outlineWidth: 2,
  13344. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13345. showBackground: true,
  13346. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13347. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13348. pixelOffset: new Cesium.Cartesian2(0, -14)
  13349. }
  13350. });
  13351. this._entities.add(entity);
  13352. this._updateScene();
  13353. }
  13354. _createAltitudeDynamicLabel() {
  13355. let _self = this;
  13356. this._altitudeDynamicLabel = new Cesium.Entity({
  13357. name: _self._measureEntityName,
  13358. position: new Cesium.CallbackProperty(function() {
  13359. return _self._altitudeLabelPosition;
  13360. }, false),
  13361. label: {
  13362. text: new Cesium.CallbackProperty(function() {
  13363. return _self._altitudeLabelText;
  13364. }, false),
  13365. font: "12px sans-serif",
  13366. fillColor: this._toColor(255, 255, 255, 1),
  13367. outlineColor: this._toColor(0, 154, 94, 1),
  13368. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13369. outlineWidth: 1,
  13370. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13371. pixelOffset: new Cesium.Cartesian2(0, -28),
  13372. showBackground: true,
  13373. backgroundColor: this._toColor(0, 0, 0, 0.6),
  13374. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13375. }
  13376. });
  13377. this._entities.add(this._altitudeDynamicLabel);
  13378. this._updateScene();
  13379. }
  13380. _measureDistance(positions) {
  13381. let distance2 = 0;
  13382. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13383. let point1cartographic = Cesium.Cartographic.fromCartesian(positions[i2]);
  13384. let point2cartographic = Cesium.Cartographic.fromCartesian(positions[i2 + 1]);
  13385. let geodesic = new Cesium.EllipsoidGeodesic();
  13386. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13387. let s = geodesic.surfaceDistance;
  13388. s = Math.sqrt(Math.pow(s, 2) + Math.pow(
  13389. point2cartographic.height - point1cartographic.height,
  13390. 2
  13391. ));
  13392. distance2 = distance2 + s;
  13393. }
  13394. if (distance2 < 1e3)
  13395. return distance2.toFixed(2) + "\u7C73";
  13396. else
  13397. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13398. }
  13399. _measureSpaceDistance(positions) {
  13400. let distance2 = 0;
  13401. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13402. let point1 = positions[i2];
  13403. let point2 = positions[i2 + 1];
  13404. let sx = Math.abs(point1.x - point2.x);
  13405. let sy = Math.abs(point1.y - point2.y);
  13406. let sz = Math.abs(point1.z - point2.z);
  13407. let s = Math.sqrt(Math.pow(sx, 2) + Math.pow(sy, 2) + Math.pow(sz, 2));
  13408. distance2 = distance2 + s;
  13409. }
  13410. if (distance2 < 1e3)
  13411. return distance2.toFixed(2) + "\u7C73";
  13412. else
  13413. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13414. }
  13415. _measureAreaBearing(from3, to) {
  13416. let radiansPerDegree = Math.PI / 180;
  13417. let degreesPerRadian = 180 / Math.PI;
  13418. let lat1 = from3.lat * radiansPerDegree;
  13419. let lon1 = from3.lon * radiansPerDegree;
  13420. let lat2 = to.lat * radiansPerDegree;
  13421. let lon2 = to.lon * radiansPerDegree;
  13422. let angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(
  13423. lat2
  13424. ) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2));
  13425. if (angle < 0) {
  13426. angle += Math.PI * 2;
  13427. }
  13428. angle = angle * degreesPerRadian;
  13429. return angle;
  13430. }
  13431. _calculateAreaAngle(p1, p2, p3) {
  13432. let bearing21 = this._measureAreaBearing(p2, p1);
  13433. let bearing23 = this._measureAreaBearing(p2, p3);
  13434. let angle = bearing21 - bearing23;
  13435. if (angle < 0) {
  13436. angle += 360;
  13437. }
  13438. return angle;
  13439. }
  13440. _calculateDistance(point1, point2) {
  13441. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  13442. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  13443. let geodesic = new Cesium.EllipsoidGeodesic();
  13444. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13445. let s = geodesic.surfaceDistance;
  13446. s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
  13447. return s;
  13448. }
  13449. _measureArea(points2, cartesianPoints) {
  13450. let self2 = this;
  13451. let res = 0;
  13452. for (let i2 = 0; i2 < points2.length - 2; i2++) {
  13453. let j = (i2 + 1) % points2.length;
  13454. let k = (i2 + 2) % points2.length;
  13455. let totalAngle = self2._calculateAreaAngle(points2[i2], points2[j], points2[k]);
  13456. let dis_temp1 = self2._calculateDistance(cartesianPoints[i2], cartesianPoints[j]);
  13457. let dis_temp2 = self2._calculateDistance(cartesianPoints[j], cartesianPoints[k]);
  13458. res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
  13459. }
  13460. return res;
  13461. }
  13462. _calculatePolylineAltitudeHeight(points2) {
  13463. if (points2 === void 0 || points2.length < 2)
  13464. return -1;
  13465. let cartographic = Cesium.Cartographic.fromCartesian(points2[0]);
  13466. let cartographic1 = Cesium.Cartographic.fromCartesian(points2[1]);
  13467. let height_temp = cartographic1.height - cartographic.height;
  13468. return Math.abs(height_temp).toFixed(2) + "\u7C73";
  13469. }
  13470. _setMousePointerStyle() {
  13471. document.querySelector("body").style.cursor = "crosshair";
  13472. }
  13473. _initMousePointerStyle() {
  13474. document.querySelector("body").style.cursor = "default";
  13475. }
  13476. _checkAppOrWeb() {
  13477. if (window.navigator.userAgent.match(
  13478. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  13479. )) {
  13480. return CommonTools.RuntimeEnvironment.App;
  13481. } else {
  13482. return CommonTools.RuntimeEnvironment.Web;
  13483. }
  13484. }
  13485. _isRuntimeApp() {
  13486. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.App) {
  13487. return true;
  13488. }
  13489. return false;
  13490. }
  13491. _isRuntimeWeb() {
  13492. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.Web) {
  13493. return true;
  13494. }
  13495. return false;
  13496. }
  13497. _createOperationMainDom() {
  13498. let buttonDiv = document.createElement("div");
  13499. buttonDiv.id = "drawButtonDiv";
  13500. buttonDiv.style.width = "80px";
  13501. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  13502. buttonDiv.style.borderRadius = "5px";
  13503. buttonDiv.style.display = "flex";
  13504. buttonDiv.style.flexDirection = "column";
  13505. buttonDiv.style.padding = "8px";
  13506. buttonDiv.style.justifyContent = "center";
  13507. buttonDiv.style.position = "absolute";
  13508. buttonDiv.style.bottom = "150px";
  13509. buttonDiv.style.right = "10px";
  13510. let btnUndo = document.createElement("button");
  13511. btnUndo.id = "btnDrawBackout";
  13512. btnUndo.style.height = "30px";
  13513. btnUndo.style.marginBottom = "8px";
  13514. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  13515. btnUndo.style.color = "rgb(255, 255, 255)";
  13516. btnUndo.style.border = "0px solid red";
  13517. btnUndo.style.borderRadius = "5px";
  13518. btnUndo.innerHTML = "\u56DE\u9000";
  13519. btnUndo.style.fontSize = "13px";
  13520. btnUndo.style.cursor = "pointer";
  13521. buttonDiv.appendChild(btnUndo);
  13522. let btnCompletion = document.createElement("button");
  13523. btnCompletion.id = "btnDrawComplete";
  13524. btnCompletion.style.height = "30px";
  13525. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  13526. btnCompletion.style.color = "rgb(255, 255, 255)";
  13527. btnCompletion.style.border = "0px solid red";
  13528. btnCompletion.style.borderRadius = "5px";
  13529. btnCompletion.innerHTML = "\u5B8C\u6210";
  13530. btnCompletion.style.fontSize = "13px";
  13531. btnCompletion.style.cursor = "pointer";
  13532. buttonDiv.appendChild(btnCompletion);
  13533. document.body.appendChild(buttonDiv);
  13534. }
  13535. _showTooltipMessage(message) {
  13536. let msgMainDom = document.getElementById("messageMainDom");
  13537. if (msgMainDom !== null && msgMainDom !== void 0) {
  13538. document.body.removeChild(msgMainDom);
  13539. }
  13540. msgMainDom = document.createElement("div");
  13541. msgMainDom.style.width = "30%";
  13542. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  13543. msgMainDom.style.height = "45px";
  13544. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  13545. msgMainDom.style.borderRadius = "8px";
  13546. msgMainDom.style.display = "flex";
  13547. msgMainDom.style.alignItems = "center";
  13548. msgMainDom.style.paddingLeft = "10px";
  13549. msgMainDom.style.color = "rgb(91, 188, 48)";
  13550. msgMainDom.style.fontSize = "14px";
  13551. msgMainDom.style.fontWeight = "600";
  13552. msgMainDom.style.position = "absolute";
  13553. msgMainDom.style.left = "35%";
  13554. msgMainDom.style.transition = "transform 1s";
  13555. msgMainDom.style.transform = "translateY(-90px)";
  13556. msgMainDom.style.top = "0px";
  13557. msgMainDom.style.zIndex = 1e3;
  13558. document.body.appendChild(msgMainDom);
  13559. let strHtml = "";
  13560. strHtml += "<div style='";
  13561. strHtml += "background-color: rgb(88, 185, 45);";
  13562. strHtml += "color: rgb(255, 255, 255);";
  13563. strHtml += "height: 24px;";
  13564. strHtml += "width: 24px;";
  13565. strHtml += "border-radius: 20px;";
  13566. strHtml += "display: flex;";
  13567. strHtml += "justify-content: center;";
  13568. strHtml += "align-items: center;";
  13569. strHtml += "font-size: 14px;";
  13570. strHtml += "margin-right: 18px;";
  13571. strHtml += "'>&#10003</div>";
  13572. strHtml += "<div>" + message + "</div>";
  13573. msgMainDom.innerHTML = strHtml;
  13574. msgMainDom.addEventListener("transitionend", function() {
  13575. setTimeout(function() {
  13576. document.body.removeChild(msgMainDom);
  13577. }, 1e3);
  13578. }, false);
  13579. setTimeout(function() {
  13580. msgMainDom.style.transform = "translateY(50px)";
  13581. }, 100);
  13582. }
  13583. }
  13584. Object.assign(CommonTools.prototype, {
  13585. _tooltipInit: function(text) {
  13586. this._tooltipId = "tooltipJt";
  13587. let tooltipObj = document.getElementById(this._tooltipId);
  13588. if (tooltipObj === null) {
  13589. tooltipObj = document.createElement("div");
  13590. tooltipObj.id = this._tooltipId;
  13591. document.body.appendChild(tooltipObj);
  13592. let divStyle = "";
  13593. divStyle += "top: 30px;";
  13594. divStyle += "left: 30px;";
  13595. divStyle += "position: absolute;";
  13596. divStyle += "display: flex;";
  13597. divStyle += "align-items: center;";
  13598. divStyle += "width: 12x0px;";
  13599. divStyle += "height: auto;";
  13600. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  13601. divStyle += "border-radius: 5px;";
  13602. divStyle += "color: rgb(255, 255, 255);";
  13603. divStyle += "font-size: 12px;";
  13604. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  13605. divStyle += "padding: 8px;";
  13606. divStyle += "border:solid 1px rgb(255,0,0);";
  13607. tooltipObj.setAttribute("style", divStyle);
  13608. }
  13609. if (text != void 0)
  13610. tooltipObj.innerHTML = text;
  13611. document.onmousemove = function(event2) {
  13612. tooltipObj.style.left = event2.clientX + 10 + "px";
  13613. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  13614. };
  13615. },
  13616. _tooltipRemove: function() {
  13617. let tooltipObj = document.getElementById(this._tooltipId);
  13618. if (tooltipObj != null) {
  13619. document.body.removeChild(tooltipObj);
  13620. }
  13621. },
  13622. _tooltipSetText: function(text) {
  13623. let tooltipObj = document.getElementById(this._tooltipId);
  13624. if (tooltipObj != null) {
  13625. tooltipObj.innerHTML = text;
  13626. }
  13627. }
  13628. });
  13629. Object.assign(CommonTools.prototype, {
  13630. clear: function() {
  13631. this._clear(true);
  13632. this._initMousePointerStyle();
  13633. }
  13634. });
  13635. Object.assign(CommonTools.prototype, {
  13636. measureLength: function(callError) {
  13637. let _self = this;
  13638. this._tempEntitys = [];
  13639. this._clear(this._isClear);
  13640. this._setMousePointerStyle();
  13641. if (this._isRuntimeApp()) {
  13642. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13643. } else {
  13644. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13645. }
  13646. if (this._isRuntimeWeb()) {
  13647. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13648. onAdded: function(cPoints, gPoints) {
  13649. if (cPoints.length === 1) {
  13650. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13651. } else {
  13652. let distince = _self._measureDistance(cPoints);
  13653. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13654. distince += " +" + _self._measureDistance(tempPoints);
  13655. _self._tempEntitys.push(_self._createPoint(
  13656. cPoints[cPoints.length - 1],
  13657. distince
  13658. ));
  13659. }
  13660. },
  13661. onUndo: function() {
  13662. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13663. _self._tempEntitys.pop();
  13664. },
  13665. onMoving: function(cPoint, scPoint) {
  13666. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13667. },
  13668. onError: function(error) {
  13669. if (callError)
  13670. callError(error);
  13671. },
  13672. onComplete: function(cPoints, gPoints) {
  13673. _self._initMousePointerStyle();
  13674. _self._tooltipRemove();
  13675. }
  13676. });
  13677. } else {
  13678. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13679. onAdded: function(cPoints, gPoints) {
  13680. if (cPoints.length === 1) {
  13681. _self._tooltipRemove();
  13682. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13683. let buttonDiv = document.getElementById("drawButtonDiv");
  13684. if (buttonDiv == null) {
  13685. _self._createOperationMainDom();
  13686. document.getElementById("btnDrawBackout").onclick = () => {
  13687. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13688. _self._sketchViewModel._sketchPoints.pop();
  13689. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13690. if (_self._sketchViewModel._isDrawPoint) {
  13691. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13692. _self._sketchViewModel._entities.remove(lastPointEntity);
  13693. _self._sketchViewModel._pointEntitys.pop();
  13694. }
  13695. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13696. _self._tempEntitys.pop();
  13697. }
  13698. };
  13699. document.getElementById("btnDrawComplete").onclick = () => {
  13700. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13701. if (callError)
  13702. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13703. return;
  13704. }
  13705. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13706. _self._sketchViewModel._createPolyline();
  13707. if (!_self._sketchViewModel._isRetainDrawPoint)
  13708. _self._sketchViewModel._removePointEntitys();
  13709. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13710. _self._initMousePointerStyle();
  13711. _self._tooltipRemove();
  13712. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13713. if (buttonDiv2) {
  13714. document.body.removeChild(buttonDiv2);
  13715. }
  13716. };
  13717. }
  13718. } else {
  13719. let distince = _self._measureDistance(cPoints);
  13720. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13721. distince += " +" + _self._measureDistance(tempPoints);
  13722. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13723. }
  13724. }
  13725. });
  13726. }
  13727. },
  13728. measureSpatialLength: function(callError) {
  13729. let _self = this;
  13730. this._clear(this._isClear);
  13731. this._setMousePointerStyle();
  13732. if (this._isRuntimeApp()) {
  13733. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13734. } else {
  13735. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13736. }
  13737. this._tempEntitys = [];
  13738. if (this._isRuntimeWeb()) {
  13739. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
  13740. onAdded: function(cPoints, gPoints) {
  13741. if (cPoints.length === 1) {
  13742. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13743. } else {
  13744. let distince = _self._measureSpaceDistance(cPoints);
  13745. _self._tempEntitys.push(_self._createPoint(
  13746. cPoints[cPoints.length - 1],
  13747. distince
  13748. ));
  13749. }
  13750. },
  13751. onUndo: function() {
  13752. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13753. _self._tempEntitys.pop();
  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.Spatial, {
  13769. onAdded: function(cPoints, gPoints) {
  13770. if (cPoints.length === 1) {
  13771. _self._tooltipRemove();
  13772. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13773. let buttonDiv = document.getElementById("drawButtonDiv");
  13774. if (buttonDiv == null) {
  13775. _self._createOperationMainDom();
  13776. document.getElementById("btnDrawBackout").onclick = () => {
  13777. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13778. _self._sketchViewModel._sketchPoints.pop();
  13779. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13780. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13781. _self._tempEntitys.pop();
  13782. }
  13783. };
  13784. document.getElementById("btnDrawComplete").onclick = () => {
  13785. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13786. if (callError)
  13787. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13788. return;
  13789. }
  13790. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempSpatialPolyline);
  13791. _self._sketchViewModel._createSpatialPolyline();
  13792. _self._sketchViewModel._removePointEntitys();
  13793. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13794. _self._initMousePointerStyle();
  13795. _self._tooltipRemove();
  13796. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13797. if (buttonDiv2) {
  13798. document.body.removeChild(buttonDiv2);
  13799. }
  13800. };
  13801. }
  13802. } else {
  13803. let distince = _self._measureSpaceDistance(cPoints);
  13804. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13805. }
  13806. }
  13807. });
  13808. }
  13809. },
  13810. measureArea: function(callError) {
  13811. let _self = this;
  13812. this._clear(this._isClear);
  13813. this._setMousePointerStyle();
  13814. if (this._isRuntimeApp()) {
  13815. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13816. } else {
  13817. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13818. }
  13819. var _areaLabel = "";
  13820. if (this._isRuntimeWeb()) {
  13821. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13822. onAdded: function(cPoints, gPoints) {
  13823. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13824. if (cPoints.length === 1) {
  13825. _areaLabel = "\u8D77\u70B9";
  13826. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13827. var lable = _areaLabel;
  13828. return lable;
  13829. }, false));
  13830. } else if (cPoints.length >= 3) {
  13831. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13832. if (area > 1e5) {
  13833. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13834. } else {
  13835. _areaLabel = area.toFixed(2) + "m\xB2";
  13836. }
  13837. }
  13838. },
  13839. onUndo: function() {
  13840. _self._measureTempPoints.pop();
  13841. if (_self._measureTempPoints.length === 1)
  13842. _self._areaLabel = "\u8D77\u70B9";
  13843. },
  13844. onMoving: function(cPoint, scPoint) {
  13845. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13846. },
  13847. onError: function(error) {
  13848. if (callError)
  13849. callError(error);
  13850. },
  13851. onComplete: function(cPoints, gPoints) {
  13852. _self._initMousePointerStyle();
  13853. _self._tooltipRemove();
  13854. }
  13855. });
  13856. } else {
  13857. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13858. onAdded: function(cPoints, gPoints) {
  13859. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13860. if (cPoints.length === 1) {
  13861. _self._tooltipRemove();
  13862. _areaLabel = "\u8D77\u70B9";
  13863. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13864. var lable = _areaLabel;
  13865. return lable;
  13866. }, false));
  13867. let buttonDiv = document.getElementById("drawButtonDiv");
  13868. if (buttonDiv == null) {
  13869. _self._createOperationMainDom();
  13870. document.getElementById("btnDrawBackout").onclick = () => {
  13871. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13872. _self._sketchViewModel._sketchPoints.pop();
  13873. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13874. if (_self._sketchViewModel._isDrawPoint) {
  13875. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13876. _self._entities.remove(lastPointEntity);
  13877. _self._sketchViewModel._pointEntitys.pop();
  13878. }
  13879. _self._measureTempPoints.pop();
  13880. if (_self._measureTempPoints.length === 1)
  13881. _self._areaLabel = "\u8D77\u70B9";
  13882. }
  13883. };
  13884. document.getElementById("btnDrawComplete").onclick = () => {
  13885. if (_self._sketchViewModel._sketchPoints.length < 3) {
  13886. if (callError)
  13887. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13888. return;
  13889. }
  13890. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  13891. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13892. _self._sketchViewModel._createPolygon();
  13893. if (!_self._sketchViewModel._isRetainDrawPoint)
  13894. _self._sketchViewModel._removePointEntitys();
  13895. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13896. _self._initMousePointerStyle();
  13897. _self._tooltipRemove();
  13898. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13899. if (buttonDiv2) {
  13900. document.body.removeChild(buttonDiv2);
  13901. }
  13902. };
  13903. }
  13904. } else if (cPoints.length >= 3) {
  13905. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13906. if (area > 1e5) {
  13907. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13908. } else {
  13909. _areaLabel = area.toFixed(2) + "m\xB2";
  13910. }
  13911. }
  13912. }
  13913. });
  13914. }
  13915. },
  13916. measureHeight: function(callError) {
  13917. let _self = this;
  13918. this._clear(this._isClear);
  13919. this._setMousePointerStyle();
  13920. if (this._isRuntimeApp()) {
  13921. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13922. } else {
  13923. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13924. }
  13925. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Height, {
  13926. onAdded: function(cPoint) {
  13927. if (_self._isRuntimeApp()) {
  13928. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13929. } else {
  13930. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13931. }
  13932. },
  13933. onMoving: function(cPoints, centerPoint) {
  13934. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13935. _self._altitudeLabelPosition = centerPoint;
  13936. _self._altitudeLabelText = height2;
  13937. if (_self._altitudeDynamicLabel === void 0) {
  13938. _self._createAltitudeDynamicLabel();
  13939. }
  13940. },
  13941. onError: function(error) {
  13942. if (callError)
  13943. callError(error);
  13944. },
  13945. onComplete: function(cPoints, centerPoint) {
  13946. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13947. _self._entities.remove(_self._altitudeDynamicLabel);
  13948. _self._createLabel(centerPoint, height2);
  13949. _self._initMousePointerStyle();
  13950. _self._tooltipRemove();
  13951. }
  13952. });
  13953. },
  13954. measureTriangle: function(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. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Triangle, {
  13964. onAdded: function(cPoint) {
  13965. if (_self._isRuntimeApp()) {
  13966. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13967. } else {
  13968. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13969. }
  13970. },
  13971. onMoving: function(cPoint) {
  13972. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13973. },
  13974. onError: function(error) {
  13975. if (callError)
  13976. callError(error);
  13977. },
  13978. onComplete: function(positions) {
  13979. _self._initMousePointerStyle();
  13980. _self._tooltipRemove();
  13981. let sPoints = [positions[0], positions[1]];
  13982. let sDistince = _self._measureSpaceDistance(sPoints);
  13983. let hPoints = [positions[1], positions[2]];
  13984. let hDistince = _self._measureSpaceDistance(hPoints);
  13985. let hePoints = [positions[2], positions[0]];
  13986. let height2 = _self._calculatePolylineAltitudeHeight(hePoints);
  13987. _self._createLabel(positions[0], "\u659C\u8DDD:" + sDistince);
  13988. _self._createLabel(positions[1], "\u5E73\u8DDD:" + hDistince);
  13989. _self._createLabel(positions[2], "\u9AD8\u5EA6:" + height2);
  13990. }
  13991. });
  13992. }
  13993. });
  13994. Object.assign(CommonTools.prototype, {
  13995. queryByPoint: function(callComplete) {
  13996. let _self = this;
  13997. this._setMousePointerStyle();
  13998. this._clear(this._isClear);
  13999. if (this._isRuntimeApp()) {
  14000. this._showTooltipMessage("\u70B9\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  14001. } else {
  14002. this._tooltipInit("\u5355\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  14003. }
  14004. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Point, {
  14005. onComplete: function(cPoint, gPoint) {
  14006. _self._initMousePointerStyle();
  14007. _self._tooltipRemove();
  14008. _self._createPoint(cPoint);
  14009. let coordinates = gPoint.lng + "," + gPoint.lat;
  14010. if (callComplete)
  14011. callComplete(coordinates);
  14012. }
  14013. });
  14014. },
  14015. queryByMultiplePoint: function(callComplete) {
  14016. let _self = this;
  14017. this._setMousePointerStyle();
  14018. this._clear(this._isClear);
  14019. this._tooltipInit("\u70B9\u51FB\u4F4D\u7F6E\u7ED8\u5236<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14020. this._tempEntitys = [];
  14021. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.MultiplePoint, {
  14022. onAdded: function(cPoint, gPoint) {
  14023. let res = gPoint.lng.toFixed(6) + "," + gPoint.lat.toFixed(6);
  14024. _self._tempEntitys.push(_self._createPoint(cPoint, res));
  14025. },
  14026. onUndo: function() {
  14027. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  14028. _self._tempEntitys.pop();
  14029. },
  14030. onComplete: function(cPoints, gPoints) {
  14031. _self._initMousePointerStyle();
  14032. _self._tooltipRemove();
  14033. let res = [];
  14034. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14035. res.push(gPoints[i2].lng);
  14036. res.push(gPoints[i2].lat);
  14037. }
  14038. if (callComplete)
  14039. callComplete(res);
  14040. }
  14041. });
  14042. },
  14043. queryByLine: function(callComplete, callError) {
  14044. let _self = this;
  14045. this._clear(this._isClear);
  14046. this._setMousePointerStyle();
  14047. if (this._isRuntimeApp()) {
  14048. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  14049. } else {
  14050. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  14051. }
  14052. if (this._isRuntimeWeb()) {
  14053. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  14054. onAdded: function(cPoints, gPoints) {
  14055. },
  14056. onMoving: function(cPoint, scPoint) {
  14057. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  14058. },
  14059. onError: function(error) {
  14060. if (callError)
  14061. callError(error);
  14062. },
  14063. onComplete: function(cPoints, gPoints) {
  14064. _self._initMousePointerStyle();
  14065. _self._tooltipRemove();
  14066. let coordinates = void 0;
  14067. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14068. let point2 = gPoints[i2];
  14069. if (coordinates === void 0)
  14070. coordinates = point2.lng + "," + point2.lat;
  14071. else
  14072. coordinates += "," + point2.lng + "," + point2.lat;
  14073. }
  14074. if (callComplete)
  14075. callComplete(coordinates);
  14076. }
  14077. });
  14078. } else {
  14079. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  14080. onAdded: function(cPoints, gPoints) {
  14081. if (cPoints.length === 1) {
  14082. _self._tooltipRemove();
  14083. let buttonDiv = document.getElementById("drawButtonDiv");
  14084. if (buttonDiv == null) {
  14085. _self._createOperationMainDom();
  14086. document.getElementById("btnDrawBackout").onclick = () => {
  14087. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  14088. _self._sketchViewModel._sketchPoints.pop();
  14089. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14090. if (_self._sketchViewModel._isDrawPoint) {
  14091. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14092. _self._sketchViewModel._entities.remove(lastPointEntity);
  14093. _self._sketchViewModel._pointEntitys.pop();
  14094. }
  14095. }
  14096. };
  14097. document.getElementById("btnDrawComplete").onclick = () => {
  14098. if (_self._sketchViewModel._sketchPoints.length < 2) {
  14099. if (callError)
  14100. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14101. return;
  14102. }
  14103. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14104. _self._sketchViewModel._createPolyline();
  14105. if (!_self._sketchViewModel._isRetainDrawPoint)
  14106. _self._sketchViewModel._removePointEntitys();
  14107. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14108. _self._initMousePointerStyle();
  14109. _self._tooltipRemove();
  14110. let coordinates = void 0;
  14111. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14112. let point2 = gPoints[i2];
  14113. if (coordinates === void 0)
  14114. coordinates = point2.lng + "," + point2.lat;
  14115. else
  14116. coordinates += "," + point2.lng + "," + point2.lat;
  14117. }
  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. queryByPolygon: function(callComplete, callError) {
  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\u533A\u57DF");
  14137. } else {
  14138. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
  14139. }
  14140. if (this._isRuntimeWeb()) {
  14141. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14142. onMoving: function(cPoint, scPoint) {
  14143. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  14144. },
  14145. onError: function(error) {
  14146. if (callError)
  14147. callError(error);
  14148. },
  14149. onComplete: function(cPoints, gPoints) {
  14150. _self._initMousePointerStyle();
  14151. _self._tooltipRemove();
  14152. let coordinates = void 0;
  14153. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14154. let point2 = gPoints[i2];
  14155. if (coordinates === void 0)
  14156. coordinates = point2.lng + "," + point2.lat;
  14157. else
  14158. coordinates += "," + point2.lng + "," + point2.lat;
  14159. }
  14160. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14161. if (callComplete)
  14162. callComplete(coordinates);
  14163. }
  14164. });
  14165. } else {
  14166. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14167. onAdded: function(cPoints, gPoints) {
  14168. if (cPoints.length === 1) {
  14169. _self._tooltipRemove();
  14170. let buttonDiv = document.getElementById("drawButtonDiv");
  14171. if (buttonDiv == null) {
  14172. _self._createOperationMainDom();
  14173. document.getElementById("btnDrawBackout").onclick = () => {
  14174. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  14175. _self._sketchViewModel._sketchPoints.pop();
  14176. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14177. if (_self._sketchViewModel._isDrawPoint) {
  14178. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14179. _self._entities.remove(lastPointEntity);
  14180. _self._sketchViewModel._pointEntitys.pop();
  14181. }
  14182. }
  14183. };
  14184. document.getElementById("btnDrawComplete").onclick = () => {
  14185. if (_self._sketchViewModel._sketchPoints.length < 3) {
  14186. if (callError)
  14187. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14188. return;
  14189. }
  14190. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  14191. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14192. _self._sketchViewModel._createPolygon();
  14193. if (!_self._sketchViewModel._isRetainDrawPoint)
  14194. _self._sketchViewModel._removePointEntitys();
  14195. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14196. _self._initMousePointerStyle();
  14197. _self._tooltipRemove();
  14198. let coordinates = void 0;
  14199. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14200. let point2 = gPoints[i2];
  14201. if (coordinates === void 0)
  14202. coordinates = point2.lng + "," + point2.lat;
  14203. else
  14204. coordinates += "," + point2.lng + "," + point2.lat;
  14205. }
  14206. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14207. let buttonDiv2 = document.getElementById("drawButtonDiv");
  14208. if (buttonDiv2) {
  14209. document.body.removeChild(buttonDiv2);
  14210. }
  14211. if (callComplete)
  14212. callComplete(coordinates);
  14213. };
  14214. }
  14215. }
  14216. }
  14217. });
  14218. }
  14219. },
  14220. queryByCircle: function(callComplete) {
  14221. let _self = this;
  14222. this._clear(this._isClear);
  14223. this._setMousePointerStyle();
  14224. if (this._isRuntimeApp()) {
  14225. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14226. } else {
  14227. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14228. }
  14229. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Circle, {
  14230. onAdded: function(center2) {
  14231. if (_self._isRuntimeApp()) {
  14232. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14233. } else {
  14234. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14235. }
  14236. },
  14237. onComplete: function(center2, radius) {
  14238. _self._initMousePointerStyle();
  14239. _self._tooltipRemove();
  14240. if (callComplete)
  14241. callComplete(center2.lng + "," + center2.lat, radius);
  14242. }
  14243. });
  14244. },
  14245. queryByRectangle: function(callComplete) {
  14246. let _self = this;
  14247. this._clear(this._isClear);
  14248. this._setMousePointerStyle();
  14249. if (this._isRuntimeApp()) {
  14250. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14251. } else {
  14252. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14253. }
  14254. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Rectangle, {
  14255. onAdded: function(center2) {
  14256. if (_self._isRuntimeApp()) {
  14257. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14258. } else {
  14259. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14260. }
  14261. },
  14262. onComplete: function(gPoints) {
  14263. _self._initMousePointerStyle();
  14264. _self._tooltipRemove();
  14265. let coordinates = void 0;
  14266. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14267. let point2 = gPoints[i2];
  14268. if (coordinates === void 0)
  14269. coordinates = point2.lng + "," + point2.lat;
  14270. else
  14271. coordinates += "," + point2.lng + "," + point2.lat;
  14272. }
  14273. if (callComplete)
  14274. callComplete(coordinates);
  14275. }
  14276. });
  14277. }
  14278. });
  14279. Object.assign(CommonTools.prototype, {
  14280. drawPolygonBody: function(callComplete) {
  14281. let _self = this;
  14282. this._clear(this._isClear);
  14283. this._setMousePointerStyle();
  14284. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14285. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.PolygonBody, {
  14286. onAdded: function(cPoints, gPoints) {
  14287. if (cPoints.length === 0) {
  14288. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14289. } else if (cPoints.length < 3) {
  14290. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14291. } else {
  14292. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14293. }
  14294. },
  14295. onUndo: function(cPoints) {
  14296. if (cPoints.length === 0) {
  14297. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14298. } else if (cPoints.length < 3) {
  14299. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14300. } else {
  14301. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14302. }
  14303. },
  14304. onComplete: function(cPoints, gPoints) {
  14305. _self._initMousePointerStyle();
  14306. _self._tooltipRemove();
  14307. if (callComplete)
  14308. callComplete();
  14309. }
  14310. });
  14311. },
  14312. drawPointFeacture: function(points2, options2) {
  14313. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPoint, options2);
  14314. },
  14315. drawMultiplePointFeacture: function(points2, options2) {
  14316. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawMultiplePoint, options2);
  14317. },
  14318. drawPolylineFeacture: function(points2, options2) {
  14319. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolyline, options2);
  14320. },
  14321. drawPolygonFeacture: function(points2, options2) {
  14322. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolygon, options2);
  14323. }
  14324. });
  14325. Object.assign(CommonTools.prototype, {
  14326. tooltipInit: function(text) {
  14327. this._tooltipInit(text);
  14328. },
  14329. tooltipRemove: function() {
  14330. this._tooltipRemove();
  14331. },
  14332. tooltipSetText: function(text) {
  14333. this._tooltipSetText(text);
  14334. }
  14335. });
  14336. Object.assign(CommonTools.prototype, {
  14337. pickPolygonBody: function(callComplete) {
  14338. this._sketchViewModel.sketchPick(function(options2) {
  14339. if (options2 === void 0) {
  14340. if (callComplete)
  14341. callComplete(void 0);
  14342. } else {
  14343. if (callComplete)
  14344. callComplete({
  14345. color: options2.color,
  14346. height: options2.height
  14347. });
  14348. }
  14349. });
  14350. },
  14351. setPolygonBody: function(options2) {
  14352. this._sketchViewModel.sketchEditPickPolygonBody({
  14353. color: options2.color,
  14354. height: options2.height,
  14355. onComplete: options2.onComplete
  14356. });
  14357. },
  14358. removePolygonBody: function(onComplete) {
  14359. this._sketchViewModel.sketchRemovePickPolygonBody(onComplete);
  14360. }
  14361. });
  14362. CommonTools.RuntimeEnvironment = Object.freeze({
  14363. App: "app",
  14364. Web: "web"
  14365. });
  14366. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  14367. const handleEvent = (event2) => {
  14368. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event2);
  14369. if (checkForDefaultPrevented === false || !shouldPrevent) {
  14370. return oursHandler == null ? void 0 : oursHandler(event2);
  14371. }
  14372. };
  14373. return handleEvent;
  14374. };
  14375. var _a;
  14376. const isClient = typeof window !== "undefined";
  14377. const isString$1 = (val) => typeof val === "string";
  14378. const noop$3 = () => {
  14379. };
  14380. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  14381. function resolveUnref(r2) {
  14382. return typeof r2 === "function" ? r2() : unref(r2);
  14383. }
  14384. function identity(arg) {
  14385. return arg;
  14386. }
  14387. function tryOnScopeDispose(fn2) {
  14388. if (getCurrentScope()) {
  14389. onScopeDispose(fn2);
  14390. return true;
  14391. }
  14392. return false;
  14393. }
  14394. function tryOnMounted(fn2, sync = true) {
  14395. if (getCurrentInstance())
  14396. onMounted(fn2);
  14397. else if (sync)
  14398. fn2();
  14399. else
  14400. nextTick(fn2);
  14401. }
  14402. function useTimeoutFn(cb, interval, options2 = {}) {
  14403. const {
  14404. immediate = true
  14405. } = options2;
  14406. const isPending = ref(false);
  14407. let timer = null;
  14408. function clear() {
  14409. if (timer) {
  14410. clearTimeout(timer);
  14411. timer = null;
  14412. }
  14413. }
  14414. function stop() {
  14415. isPending.value = false;
  14416. clear();
  14417. }
  14418. function start2(...args) {
  14419. clear();
  14420. isPending.value = true;
  14421. timer = setTimeout(() => {
  14422. isPending.value = false;
  14423. timer = null;
  14424. cb(...args);
  14425. }, resolveUnref(interval));
  14426. }
  14427. if (immediate) {
  14428. isPending.value = true;
  14429. if (isClient)
  14430. start2();
  14431. }
  14432. tryOnScopeDispose(stop);
  14433. return {
  14434. isPending: readonly(isPending),
  14435. start: start2,
  14436. stop
  14437. };
  14438. }
  14439. function unrefElement(elRef) {
  14440. var _a2;
  14441. const plain = resolveUnref(elRef);
  14442. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  14443. }
  14444. const defaultWindow = isClient ? window : void 0;
  14445. function useEventListener(...args) {
  14446. let target;
  14447. let events;
  14448. let listeners;
  14449. let options2;
  14450. if (isString$1(args[0]) || Array.isArray(args[0])) {
  14451. [events, listeners, options2] = args;
  14452. target = defaultWindow;
  14453. } else {
  14454. [target, events, listeners, options2] = args;
  14455. }
  14456. if (!target)
  14457. return noop$3;
  14458. if (!Array.isArray(events))
  14459. events = [events];
  14460. if (!Array.isArray(listeners))
  14461. listeners = [listeners];
  14462. const cleanups = [];
  14463. const cleanup = () => {
  14464. cleanups.forEach((fn2) => fn2());
  14465. cleanups.length = 0;
  14466. };
  14467. const register = (el, event2, listener, options22) => {
  14468. el.addEventListener(event2, listener, options22);
  14469. return () => el.removeEventListener(event2, listener, options22);
  14470. };
  14471. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options2)], ([el, options22]) => {
  14472. cleanup();
  14473. if (!el)
  14474. return;
  14475. cleanups.push(...events.flatMap((event2) => {
  14476. return listeners.map((listener) => register(el, event2, listener, options22));
  14477. }));
  14478. }, { immediate: true, flush: "post" });
  14479. const stop = () => {
  14480. stopWatch();
  14481. cleanup();
  14482. };
  14483. tryOnScopeDispose(stop);
  14484. return stop;
  14485. }
  14486. let _iOSWorkaround = false;
  14487. function onClickOutside(target, handler, options2 = {}) {
  14488. const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options2;
  14489. if (!window2)
  14490. return;
  14491. if (isIOS && !_iOSWorkaround) {
  14492. _iOSWorkaround = true;
  14493. Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop$3));
  14494. }
  14495. let shouldListen = true;
  14496. const shouldIgnore = (event2) => {
  14497. return ignore.some((target2) => {
  14498. if (typeof target2 === "string") {
  14499. return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event2.target || event2.composedPath().includes(el));
  14500. } else {
  14501. const el = unrefElement(target2);
  14502. return el && (event2.target === el || event2.composedPath().includes(el));
  14503. }
  14504. });
  14505. };
  14506. const listener = (event2) => {
  14507. const el = unrefElement(target);
  14508. if (!el || el === event2.target || event2.composedPath().includes(el))
  14509. return;
  14510. if (event2.detail === 0)
  14511. shouldListen = !shouldIgnore(event2);
  14512. if (!shouldListen) {
  14513. shouldListen = true;
  14514. return;
  14515. }
  14516. handler(event2);
  14517. };
  14518. const cleanup = [
  14519. useEventListener(window2, "click", listener, { passive: true, capture }),
  14520. useEventListener(window2, "pointerdown", (e) => {
  14521. const el = unrefElement(target);
  14522. if (el)
  14523. shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  14524. }, { passive: true }),
  14525. detectIframe && useEventListener(window2, "blur", (event2) => {
  14526. var _a2;
  14527. const el = unrefElement(target);
  14528. if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
  14529. handler(event2);
  14530. })
  14531. ].filter(Boolean);
  14532. const stop = () => cleanup.forEach((fn2) => fn2());
  14533. return stop;
  14534. }
  14535. function useSupported(callback2, sync = false) {
  14536. const isSupported = ref();
  14537. const update = () => isSupported.value = Boolean(callback2());
  14538. update();
  14539. tryOnMounted(update, sync);
  14540. return isSupported;
  14541. }
  14542. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  14543. const globalKey = "__vueuse_ssr_handlers__";
  14544. _global[globalKey] = _global[globalKey] || {};
  14545. _global[globalKey];
  14546. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  14547. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  14548. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  14549. var __objRest$2 = (source, exclude) => {
  14550. var target = {};
  14551. for (var prop in source)
  14552. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  14553. target[prop] = source[prop];
  14554. if (source != null && __getOwnPropSymbols$g)
  14555. for (var prop of __getOwnPropSymbols$g(source)) {
  14556. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  14557. target[prop] = source[prop];
  14558. }
  14559. return target;
  14560. };
  14561. function useResizeObserver(target, callback2, options2 = {}) {
  14562. const _a2 = options2, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  14563. let observer;
  14564. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  14565. const cleanup = () => {
  14566. if (observer) {
  14567. observer.disconnect();
  14568. observer = void 0;
  14569. }
  14570. };
  14571. const stopWatch = watch(() => unrefElement(target), (el) => {
  14572. cleanup();
  14573. if (isSupported.value && window2 && el) {
  14574. observer = new ResizeObserver(callback2);
  14575. observer.observe(el, observerOptions);
  14576. }
  14577. }, { immediate: true, flush: "post" });
  14578. const stop = () => {
  14579. cleanup();
  14580. stopWatch();
  14581. };
  14582. tryOnScopeDispose(stop);
  14583. return {
  14584. isSupported,
  14585. stop
  14586. };
  14587. }
  14588. var SwipeDirection;
  14589. (function(SwipeDirection2) {
  14590. SwipeDirection2["UP"] = "UP";
  14591. SwipeDirection2["RIGHT"] = "RIGHT";
  14592. SwipeDirection2["DOWN"] = "DOWN";
  14593. SwipeDirection2["LEFT"] = "LEFT";
  14594. SwipeDirection2["NONE"] = "NONE";
  14595. })(SwipeDirection || (SwipeDirection = {}));
  14596. var __defProp2 = Object.defineProperty;
  14597. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  14598. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14599. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  14600. var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  14601. var __spreadValues = (a, b) => {
  14602. for (var prop in b || (b = {}))
  14603. if (__hasOwnProp.call(b, prop))
  14604. __defNormalProp2(a, prop, b[prop]);
  14605. if (__getOwnPropSymbols)
  14606. for (var prop of __getOwnPropSymbols(b)) {
  14607. if (__propIsEnum.call(b, prop))
  14608. __defNormalProp2(a, prop, b[prop]);
  14609. }
  14610. return a;
  14611. };
  14612. const _TransitionPresets = {
  14613. easeInSine: [0.12, 0, 0.39, 0],
  14614. easeOutSine: [0.61, 1, 0.88, 1],
  14615. easeInOutSine: [0.37, 0, 0.63, 1],
  14616. easeInQuad: [0.11, 0, 0.5, 0],
  14617. easeOutQuad: [0.5, 1, 0.89, 1],
  14618. easeInOutQuad: [0.45, 0, 0.55, 1],
  14619. easeInCubic: [0.32, 0, 0.67, 0],
  14620. easeOutCubic: [0.33, 1, 0.68, 1],
  14621. easeInOutCubic: [0.65, 0, 0.35, 1],
  14622. easeInQuart: [0.5, 0, 0.75, 0],
  14623. easeOutQuart: [0.25, 1, 0.5, 1],
  14624. easeInOutQuart: [0.76, 0, 0.24, 1],
  14625. easeInQuint: [0.64, 0, 0.78, 0],
  14626. easeOutQuint: [0.22, 1, 0.36, 1],
  14627. easeInOutQuint: [0.83, 0, 0.17, 1],
  14628. easeInExpo: [0.7, 0, 0.84, 0],
  14629. easeOutExpo: [0.16, 1, 0.3, 1],
  14630. easeInOutExpo: [0.87, 0, 0.13, 1],
  14631. easeInCirc: [0.55, 0, 1, 0.45],
  14632. easeOutCirc: [0, 0.55, 0.45, 1],
  14633. easeInOutCirc: [0.85, 0, 0.15, 1],
  14634. easeInBack: [0.36, 0, 0.66, -0.56],
  14635. easeOutBack: [0.34, 1.56, 0.64, 1],
  14636. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  14637. };
  14638. __spreadValues({
  14639. linear: identity
  14640. }, _TransitionPresets);
  14641. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  14642. const getClientXY = (event2) => {
  14643. let clientX;
  14644. let clientY;
  14645. if (event2.type === "touchend") {
  14646. clientY = event2.changedTouches[0].clientY;
  14647. clientX = event2.changedTouches[0].clientX;
  14648. } else if (event2.type.startsWith("touch")) {
  14649. clientY = event2.touches[0].clientY;
  14650. clientX = event2.touches[0].clientX;
  14651. } else {
  14652. clientY = event2.clientY;
  14653. clientX = event2.clientX;
  14654. }
  14655. return {
  14656. clientX,
  14657. clientY
  14658. };
  14659. };
  14660. const NOOP = () => {
  14661. };
  14662. const hasOwnProperty$9 = Object.prototype.hasOwnProperty;
  14663. const hasOwn = (val, key) => hasOwnProperty$9.call(val, key);
  14664. const isArray$2 = Array.isArray;
  14665. const isFunction$3 = (val) => typeof val === "function";
  14666. const isString = (val) => typeof val === "string";
  14667. const isObject$5 = (val) => val !== null && typeof val === "object";
  14668. const isPromise$2 = (val) => {
  14669. return isObject$5(val) && isFunction$3(val.then) && isFunction$3(val.catch);
  14670. };
  14671. const objectToString$1 = Object.prototype.toString;
  14672. const toTypeString = (value) => objectToString$1.call(value);
  14673. const toRawType = (value) => {
  14674. return toTypeString(value).slice(8, -1);
  14675. };
  14676. const cacheStringFunction = (fn2) => {
  14677. const cache = /* @__PURE__ */ Object.create(null);
  14678. return (str) => {
  14679. const hit = cache[str];
  14680. return hit || (cache[str] = fn2(str));
  14681. };
  14682. };
  14683. const camelizeRE = /-(\w)/g;
  14684. const camelize = cacheStringFunction((str) => {
  14685. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  14686. });
  14687. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  14688. var freeGlobal$1 = freeGlobal;
  14689. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  14690. var root = freeGlobal$1 || freeSelf || Function("return this")();
  14691. var root$1 = root;
  14692. var Symbol$1 = root$1.Symbol;
  14693. var Symbol$2 = Symbol$1;
  14694. var objectProto$b = Object.prototype;
  14695. var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
  14696. var nativeObjectToString$1 = objectProto$b.toString;
  14697. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14698. function getRawTag(value) {
  14699. var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  14700. try {
  14701. value[symToStringTag$1] = void 0;
  14702. var unmasked = true;
  14703. } catch (e) {
  14704. }
  14705. var result = nativeObjectToString$1.call(value);
  14706. if (unmasked) {
  14707. if (isOwn) {
  14708. value[symToStringTag$1] = tag;
  14709. } else {
  14710. delete value[symToStringTag$1];
  14711. }
  14712. }
  14713. return result;
  14714. }
  14715. var objectProto$a = Object.prototype;
  14716. var nativeObjectToString = objectProto$a.toString;
  14717. function objectToString(value) {
  14718. return nativeObjectToString.call(value);
  14719. }
  14720. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  14721. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14722. function baseGetTag(value) {
  14723. if (value == null) {
  14724. return value === void 0 ? undefinedTag : nullTag;
  14725. }
  14726. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  14727. }
  14728. function isObjectLike(value) {
  14729. return value != null && typeof value == "object";
  14730. }
  14731. var symbolTag$1 = "[object Symbol]";
  14732. function isSymbol(value) {
  14733. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
  14734. }
  14735. function arrayMap(array, iteratee) {
  14736. var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
  14737. while (++index2 < length) {
  14738. result[index2] = iteratee(array[index2], index2, array);
  14739. }
  14740. return result;
  14741. }
  14742. var isArray = Array.isArray;
  14743. var isArray$1 = isArray;
  14744. var INFINITY$1 = 1 / 0;
  14745. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
  14746. function baseToString(value) {
  14747. if (typeof value == "string") {
  14748. return value;
  14749. }
  14750. if (isArray$1(value)) {
  14751. return arrayMap(value, baseToString) + "";
  14752. }
  14753. if (isSymbol(value)) {
  14754. return symbolToString ? symbolToString.call(value) : "";
  14755. }
  14756. var result = value + "";
  14757. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  14758. }
  14759. var reWhitespace = /\s/;
  14760. function trimmedEndIndex(string) {
  14761. var index2 = string.length;
  14762. while (index2-- && reWhitespace.test(string.charAt(index2))) {
  14763. }
  14764. return index2;
  14765. }
  14766. var reTrimStart = /^\s+/;
  14767. function baseTrim(string) {
  14768. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  14769. }
  14770. function isObject$4(value) {
  14771. var type2 = typeof value;
  14772. return value != null && (type2 == "object" || type2 == "function");
  14773. }
  14774. var NAN = 0 / 0;
  14775. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14776. var reIsBinary = /^0b[01]+$/i;
  14777. var reIsOctal = /^0o[0-7]+$/i;
  14778. var freeParseInt = parseInt;
  14779. function toNumber(value) {
  14780. if (typeof value == "number") {
  14781. return value;
  14782. }
  14783. if (isSymbol(value)) {
  14784. return NAN;
  14785. }
  14786. if (isObject$4(value)) {
  14787. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  14788. value = isObject$4(other) ? other + "" : other;
  14789. }
  14790. if (typeof value != "string") {
  14791. return value === 0 ? value : +value;
  14792. }
  14793. value = baseTrim(value);
  14794. var isBinary = reIsBinary.test(value);
  14795. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  14796. }
  14797. var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  14798. function isFunction$2(value) {
  14799. if (!isObject$4(value)) {
  14800. return false;
  14801. }
  14802. var tag = baseGetTag(value);
  14803. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  14804. }
  14805. var coreJsData = root$1["__core-js_shared__"];
  14806. var coreJsData$1 = coreJsData;
  14807. var maskSrcKey = function() {
  14808. var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  14809. return uid ? "Symbol(src)_1." + uid : "";
  14810. }();
  14811. function isMasked(func) {
  14812. return !!maskSrcKey && maskSrcKey in func;
  14813. }
  14814. var funcProto$1 = Function.prototype;
  14815. var funcToString$1 = funcProto$1.toString;
  14816. function toSource(func) {
  14817. if (func != null) {
  14818. try {
  14819. return funcToString$1.call(func);
  14820. } catch (e) {
  14821. }
  14822. try {
  14823. return func + "";
  14824. } catch (e) {
  14825. }
  14826. }
  14827. return "";
  14828. }
  14829. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  14830. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14831. var funcProto = Function.prototype, objectProto$9 = Object.prototype;
  14832. var funcToString = funcProto.toString;
  14833. var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
  14834. var reIsNative = RegExp(
  14835. "^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  14836. );
  14837. function baseIsNative(value) {
  14838. if (!isObject$4(value) || isMasked(value)) {
  14839. return false;
  14840. }
  14841. var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
  14842. return pattern.test(toSource(value));
  14843. }
  14844. function getValue(object, key) {
  14845. return object == null ? void 0 : object[key];
  14846. }
  14847. function getNative(object, key) {
  14848. var value = getValue(object, key);
  14849. return baseIsNative(value) ? value : void 0;
  14850. }
  14851. var WeakMap$1 = getNative(root$1, "WeakMap");
  14852. var WeakMap$2 = WeakMap$1;
  14853. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  14854. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14855. function isIndex(value, length) {
  14856. var type2 = typeof value;
  14857. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  14858. return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  14859. }
  14860. function eq(value, other) {
  14861. return value === other || value !== value && other !== other;
  14862. }
  14863. var MAX_SAFE_INTEGER = 9007199254740991;
  14864. function isLength(value) {
  14865. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  14866. }
  14867. function isArrayLike(value) {
  14868. return value != null && isLength(value.length) && !isFunction$2(value);
  14869. }
  14870. var objectProto$8 = Object.prototype;
  14871. function isPrototype(value) {
  14872. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
  14873. return value === proto;
  14874. }
  14875. function baseTimes(n, iteratee) {
  14876. var index2 = -1, result = Array(n);
  14877. while (++index2 < n) {
  14878. result[index2] = iteratee(index2);
  14879. }
  14880. return result;
  14881. }
  14882. var argsTag$2 = "[object Arguments]";
  14883. function baseIsArguments(value) {
  14884. return isObjectLike(value) && baseGetTag(value) == argsTag$2;
  14885. }
  14886. var objectProto$7 = Object.prototype;
  14887. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  14888. var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
  14889. var isArguments = baseIsArguments(function() {
  14890. return arguments;
  14891. }()) ? baseIsArguments : function(value) {
  14892. return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  14893. };
  14894. var isArguments$1 = isArguments;
  14895. function stubFalse() {
  14896. return false;
  14897. }
  14898. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  14899. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  14900. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  14901. var Buffer$1 = moduleExports$1 ? root$1.Buffer : void 0;
  14902. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  14903. var isBuffer = nativeIsBuffer || stubFalse;
  14904. var isBuffer$1 = isBuffer;
  14905. 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]";
  14906. 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]";
  14907. var typedArrayTags = {};
  14908. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
  14909. 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;
  14910. function baseIsTypedArray(value) {
  14911. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  14912. }
  14913. function baseUnary(func) {
  14914. return function(value) {
  14915. return func(value);
  14916. };
  14917. }
  14918. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  14919. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  14920. var moduleExports = freeModule && freeModule.exports === freeExports;
  14921. var freeProcess = moduleExports && freeGlobal$1.process;
  14922. var nodeUtil = function() {
  14923. try {
  14924. var types = freeModule && freeModule.require && freeModule.require("util").types;
  14925. if (types) {
  14926. return types;
  14927. }
  14928. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  14929. } catch (e) {
  14930. }
  14931. }();
  14932. var nodeUtil$1 = nodeUtil;
  14933. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  14934. var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  14935. var isTypedArray$3 = isTypedArray$2;
  14936. var objectProto$6 = Object.prototype;
  14937. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  14938. function arrayLikeKeys(value, inherited) {
  14939. 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;
  14940. for (var key in value) {
  14941. 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)))) {
  14942. result.push(key);
  14943. }
  14944. }
  14945. return result;
  14946. }
  14947. function overArg(func, transform3) {
  14948. return function(arg) {
  14949. return func(transform3(arg));
  14950. };
  14951. }
  14952. var nativeKeys = overArg(Object.keys, Object);
  14953. var nativeKeys$1 = nativeKeys;
  14954. var objectProto$5 = Object.prototype;
  14955. var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
  14956. function baseKeys(object) {
  14957. if (!isPrototype(object)) {
  14958. return nativeKeys$1(object);
  14959. }
  14960. var result = [];
  14961. for (var key in Object(object)) {
  14962. if (hasOwnProperty$4.call(object, key) && key != "constructor") {
  14963. result.push(key);
  14964. }
  14965. }
  14966. return result;
  14967. }
  14968. function keys$2(object) {
  14969. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14970. }
  14971. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  14972. function isKey(value, object) {
  14973. if (isArray$1(value)) {
  14974. return false;
  14975. }
  14976. var type2 = typeof value;
  14977. if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol(value)) {
  14978. return true;
  14979. }
  14980. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  14981. }
  14982. var nativeCreate = getNative(Object, "create");
  14983. var nativeCreate$1 = nativeCreate;
  14984. function hashClear() {
  14985. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  14986. this.size = 0;
  14987. }
  14988. function hashDelete(key) {
  14989. var result = this.has(key) && delete this.__data__[key];
  14990. this.size -= result ? 1 : 0;
  14991. return result;
  14992. }
  14993. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  14994. var objectProto$4 = Object.prototype;
  14995. var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
  14996. function hashGet(key) {
  14997. var data = this.__data__;
  14998. if (nativeCreate$1) {
  14999. var result = data[key];
  15000. return result === HASH_UNDEFINED$2 ? void 0 : result;
  15001. }
  15002. return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
  15003. }
  15004. var objectProto$3 = Object.prototype;
  15005. var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
  15006. function hashHas(key) {
  15007. var data = this.__data__;
  15008. return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
  15009. }
  15010. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  15011. function hashSet(key, value) {
  15012. var data = this.__data__;
  15013. this.size += this.has(key) ? 0 : 1;
  15014. data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  15015. return this;
  15016. }
  15017. function Hash(entries) {
  15018. var index2 = -1, length = entries == null ? 0 : entries.length;
  15019. this.clear();
  15020. while (++index2 < length) {
  15021. var entry = entries[index2];
  15022. this.set(entry[0], entry[1]);
  15023. }
  15024. }
  15025. Hash.prototype.clear = hashClear;
  15026. Hash.prototype["delete"] = hashDelete;
  15027. Hash.prototype.get = hashGet;
  15028. Hash.prototype.has = hashHas;
  15029. Hash.prototype.set = hashSet;
  15030. function listCacheClear() {
  15031. this.__data__ = [];
  15032. this.size = 0;
  15033. }
  15034. function assocIndexOf(array, key) {
  15035. var length = array.length;
  15036. while (length--) {
  15037. if (eq(array[length][0], key)) {
  15038. return length;
  15039. }
  15040. }
  15041. return -1;
  15042. }
  15043. var arrayProto = Array.prototype;
  15044. var splice = arrayProto.splice;
  15045. function listCacheDelete(key) {
  15046. var data = this.__data__, index2 = assocIndexOf(data, key);
  15047. if (index2 < 0) {
  15048. return false;
  15049. }
  15050. var lastIndex = data.length - 1;
  15051. if (index2 == lastIndex) {
  15052. data.pop();
  15053. } else {
  15054. splice.call(data, index2, 1);
  15055. }
  15056. --this.size;
  15057. return true;
  15058. }
  15059. function listCacheGet(key) {
  15060. var data = this.__data__, index2 = assocIndexOf(data, key);
  15061. return index2 < 0 ? void 0 : data[index2][1];
  15062. }
  15063. function listCacheHas(key) {
  15064. return assocIndexOf(this.__data__, key) > -1;
  15065. }
  15066. function listCacheSet(key, value) {
  15067. var data = this.__data__, index2 = assocIndexOf(data, key);
  15068. if (index2 < 0) {
  15069. ++this.size;
  15070. data.push([key, value]);
  15071. } else {
  15072. data[index2][1] = value;
  15073. }
  15074. return this;
  15075. }
  15076. function ListCache(entries) {
  15077. var index2 = -1, length = entries == null ? 0 : entries.length;
  15078. this.clear();
  15079. while (++index2 < length) {
  15080. var entry = entries[index2];
  15081. this.set(entry[0], entry[1]);
  15082. }
  15083. }
  15084. ListCache.prototype.clear = listCacheClear;
  15085. ListCache.prototype["delete"] = listCacheDelete;
  15086. ListCache.prototype.get = listCacheGet;
  15087. ListCache.prototype.has = listCacheHas;
  15088. ListCache.prototype.set = listCacheSet;
  15089. var Map$2 = getNative(root$1, "Map");
  15090. var Map$3 = Map$2;
  15091. function mapCacheClear() {
  15092. this.size = 0;
  15093. this.__data__ = {
  15094. "hash": new Hash(),
  15095. "map": new (Map$3 || ListCache)(),
  15096. "string": new Hash()
  15097. };
  15098. }
  15099. function isKeyable(value) {
  15100. var type2 = typeof value;
  15101. return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
  15102. }
  15103. function getMapData(map, key) {
  15104. var data = map.__data__;
  15105. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  15106. }
  15107. function mapCacheDelete(key) {
  15108. var result = getMapData(this, key)["delete"](key);
  15109. this.size -= result ? 1 : 0;
  15110. return result;
  15111. }
  15112. function mapCacheGet(key) {
  15113. return getMapData(this, key).get(key);
  15114. }
  15115. function mapCacheHas(key) {
  15116. return getMapData(this, key).has(key);
  15117. }
  15118. function mapCacheSet(key, value) {
  15119. var data = getMapData(this, key), size = data.size;
  15120. data.set(key, value);
  15121. this.size += data.size == size ? 0 : 1;
  15122. return this;
  15123. }
  15124. function MapCache(entries) {
  15125. var index2 = -1, length = entries == null ? 0 : entries.length;
  15126. this.clear();
  15127. while (++index2 < length) {
  15128. var entry = entries[index2];
  15129. this.set(entry[0], entry[1]);
  15130. }
  15131. }
  15132. MapCache.prototype.clear = mapCacheClear;
  15133. MapCache.prototype["delete"] = mapCacheDelete;
  15134. MapCache.prototype.get = mapCacheGet;
  15135. MapCache.prototype.has = mapCacheHas;
  15136. MapCache.prototype.set = mapCacheSet;
  15137. var FUNC_ERROR_TEXT$1 = "Expected a function";
  15138. function memoize(func, resolver) {
  15139. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  15140. throw new TypeError(FUNC_ERROR_TEXT$1);
  15141. }
  15142. var memoized = function() {
  15143. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  15144. if (cache.has(key)) {
  15145. return cache.get(key);
  15146. }
  15147. var result = func.apply(this, args);
  15148. memoized.cache = cache.set(key, result) || cache;
  15149. return result;
  15150. };
  15151. memoized.cache = new (memoize.Cache || MapCache)();
  15152. return memoized;
  15153. }
  15154. memoize.Cache = MapCache;
  15155. var MAX_MEMOIZE_SIZE = 500;
  15156. function memoizeCapped(func) {
  15157. var result = memoize(func, function(key) {
  15158. if (cache.size === MAX_MEMOIZE_SIZE) {
  15159. cache.clear();
  15160. }
  15161. return key;
  15162. });
  15163. var cache = result.cache;
  15164. return result;
  15165. }
  15166. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  15167. var reEscapeChar = /\\(\\)?/g;
  15168. var stringToPath = memoizeCapped(function(string) {
  15169. var result = [];
  15170. if (string.charCodeAt(0) === 46) {
  15171. result.push("");
  15172. }
  15173. string.replace(rePropName, function(match, number, quote, subString) {
  15174. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  15175. });
  15176. return result;
  15177. });
  15178. var stringToPath$1 = stringToPath;
  15179. function toString$3(value) {
  15180. return value == null ? "" : baseToString(value);
  15181. }
  15182. function castPath(value, object) {
  15183. if (isArray$1(value)) {
  15184. return value;
  15185. }
  15186. return isKey(value, object) ? [value] : stringToPath$1(toString$3(value));
  15187. }
  15188. var INFINITY = 1 / 0;
  15189. function toKey(value) {
  15190. if (typeof value == "string" || isSymbol(value)) {
  15191. return value;
  15192. }
  15193. var result = value + "";
  15194. return result == "0" && 1 / value == -INFINITY ? "-0" : result;
  15195. }
  15196. function baseGet(object, path) {
  15197. path = castPath(path, object);
  15198. var index2 = 0, length = path.length;
  15199. while (object != null && index2 < length) {
  15200. object = object[toKey(path[index2++])];
  15201. }
  15202. return index2 && index2 == length ? object : void 0;
  15203. }
  15204. function get$2(object, path, defaultValue2) {
  15205. var result = object == null ? void 0 : baseGet(object, path);
  15206. return result === void 0 ? defaultValue2 : result;
  15207. }
  15208. function arrayPush(array, values3) {
  15209. var index2 = -1, length = values3.length, offset = array.length;
  15210. while (++index2 < length) {
  15211. array[offset + index2] = values3[index2];
  15212. }
  15213. return array;
  15214. }
  15215. function castArray() {
  15216. if (!arguments.length) {
  15217. return [];
  15218. }
  15219. var value = arguments[0];
  15220. return isArray$1(value) ? value : [value];
  15221. }
  15222. function stackClear() {
  15223. this.__data__ = new ListCache();
  15224. this.size = 0;
  15225. }
  15226. function stackDelete(key) {
  15227. var data = this.__data__, result = data["delete"](key);
  15228. this.size = data.size;
  15229. return result;
  15230. }
  15231. function stackGet(key) {
  15232. return this.__data__.get(key);
  15233. }
  15234. function stackHas(key) {
  15235. return this.__data__.has(key);
  15236. }
  15237. var LARGE_ARRAY_SIZE = 200;
  15238. function stackSet(key, value) {
  15239. var data = this.__data__;
  15240. if (data instanceof ListCache) {
  15241. var pairs = data.__data__;
  15242. if (!Map$3 || pairs.length < LARGE_ARRAY_SIZE - 1) {
  15243. pairs.push([key, value]);
  15244. this.size = ++data.size;
  15245. return this;
  15246. }
  15247. data = this.__data__ = new MapCache(pairs);
  15248. }
  15249. data.set(key, value);
  15250. this.size = data.size;
  15251. return this;
  15252. }
  15253. function Stack(entries) {
  15254. var data = this.__data__ = new ListCache(entries);
  15255. this.size = data.size;
  15256. }
  15257. Stack.prototype.clear = stackClear;
  15258. Stack.prototype["delete"] = stackDelete;
  15259. Stack.prototype.get = stackGet;
  15260. Stack.prototype.has = stackHas;
  15261. Stack.prototype.set = stackSet;
  15262. function arrayFilter(array, predicate) {
  15263. var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  15264. while (++index2 < length) {
  15265. var value = array[index2];
  15266. if (predicate(value, index2, array)) {
  15267. result[resIndex++] = value;
  15268. }
  15269. }
  15270. return result;
  15271. }
  15272. function stubArray() {
  15273. return [];
  15274. }
  15275. var objectProto$2 = Object.prototype;
  15276. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  15277. var nativeGetSymbols = Object.getOwnPropertySymbols;
  15278. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  15279. if (object == null) {
  15280. return [];
  15281. }
  15282. object = Object(object);
  15283. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  15284. return propertyIsEnumerable.call(object, symbol);
  15285. });
  15286. };
  15287. var getSymbols$1 = getSymbols;
  15288. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  15289. var result = keysFunc(object);
  15290. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  15291. }
  15292. function getAllKeys(object) {
  15293. return baseGetAllKeys(object, keys$2, getSymbols$1);
  15294. }
  15295. var DataView$1 = getNative(root$1, "DataView");
  15296. var DataView$2 = DataView$1;
  15297. var Promise$1 = getNative(root$1, "Promise");
  15298. var Promise$2 = Promise$1;
  15299. var Set$2 = getNative(root$1, "Set");
  15300. var Set$3 = Set$2;
  15301. var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
  15302. var dataViewTag$1 = "[object DataView]";
  15303. var dataViewCtorString = toSource(DataView$2), mapCtorString = toSource(Map$3), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$3), weakMapCtorString = toSource(WeakMap$2);
  15304. var getTag = baseGetTag;
  15305. 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) {
  15306. getTag = function(value) {
  15307. var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  15308. if (ctorString) {
  15309. switch (ctorString) {
  15310. case dataViewCtorString:
  15311. return dataViewTag$1;
  15312. case mapCtorString:
  15313. return mapTag$1;
  15314. case promiseCtorString:
  15315. return promiseTag;
  15316. case setCtorString:
  15317. return setTag$1;
  15318. case weakMapCtorString:
  15319. return weakMapTag;
  15320. }
  15321. }
  15322. return result;
  15323. };
  15324. }
  15325. var getTag$1 = getTag;
  15326. var Uint8Array$1 = root$1.Uint8Array;
  15327. var Uint8Array$2 = Uint8Array$1;
  15328. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  15329. function setCacheAdd(value) {
  15330. this.__data__.set(value, HASH_UNDEFINED);
  15331. return this;
  15332. }
  15333. function setCacheHas(value) {
  15334. return this.__data__.has(value);
  15335. }
  15336. function SetCache(values3) {
  15337. var index2 = -1, length = values3 == null ? 0 : values3.length;
  15338. this.__data__ = new MapCache();
  15339. while (++index2 < length) {
  15340. this.add(values3[index2]);
  15341. }
  15342. }
  15343. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15344. SetCache.prototype.has = setCacheHas;
  15345. function arraySome(array, predicate) {
  15346. var index2 = -1, length = array == null ? 0 : array.length;
  15347. while (++index2 < length) {
  15348. if (predicate(array[index2], index2, array)) {
  15349. return true;
  15350. }
  15351. }
  15352. return false;
  15353. }
  15354. function cacheHas(cache, key) {
  15355. return cache.has(key);
  15356. }
  15357. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  15358. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  15359. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
  15360. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  15361. return false;
  15362. }
  15363. var arrStacked = stack.get(array);
  15364. var othStacked = stack.get(other);
  15365. if (arrStacked && othStacked) {
  15366. return arrStacked == other && othStacked == array;
  15367. }
  15368. var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  15369. stack.set(array, other);
  15370. stack.set(other, array);
  15371. while (++index2 < arrLength) {
  15372. var arrValue = array[index2], othValue = other[index2];
  15373. if (customizer) {
  15374. var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
  15375. }
  15376. if (compared !== void 0) {
  15377. if (compared) {
  15378. continue;
  15379. }
  15380. result = false;
  15381. break;
  15382. }
  15383. if (seen) {
  15384. if (!arraySome(other, function(othValue2, othIndex) {
  15385. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  15386. return seen.push(othIndex);
  15387. }
  15388. })) {
  15389. result = false;
  15390. break;
  15391. }
  15392. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  15393. result = false;
  15394. break;
  15395. }
  15396. }
  15397. stack["delete"](array);
  15398. stack["delete"](other);
  15399. return result;
  15400. }
  15401. function mapToArray(map) {
  15402. var index2 = -1, result = Array(map.size);
  15403. map.forEach(function(value, key) {
  15404. result[++index2] = [key, value];
  15405. });
  15406. return result;
  15407. }
  15408. function setToArray(set4) {
  15409. var index2 = -1, result = Array(set4.size);
  15410. set4.forEach(function(value) {
  15411. result[++index2] = value;
  15412. });
  15413. return result;
  15414. }
  15415. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  15416. 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]";
  15417. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  15418. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  15419. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  15420. switch (tag) {
  15421. case dataViewTag:
  15422. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  15423. return false;
  15424. }
  15425. object = object.buffer;
  15426. other = other.buffer;
  15427. case arrayBufferTag:
  15428. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object), new Uint8Array$2(other))) {
  15429. return false;
  15430. }
  15431. return true;
  15432. case boolTag:
  15433. case dateTag:
  15434. case numberTag:
  15435. return eq(+object, +other);
  15436. case errorTag:
  15437. return object.name == other.name && object.message == other.message;
  15438. case regexpTag:
  15439. case stringTag:
  15440. return object == other + "";
  15441. case mapTag:
  15442. var convert = mapToArray;
  15443. case setTag:
  15444. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  15445. convert || (convert = setToArray);
  15446. if (object.size != other.size && !isPartial) {
  15447. return false;
  15448. }
  15449. var stacked = stack.get(object);
  15450. if (stacked) {
  15451. return stacked == other;
  15452. }
  15453. bitmask |= COMPARE_UNORDERED_FLAG;
  15454. stack.set(object, other);
  15455. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  15456. stack["delete"](object);
  15457. return result;
  15458. case symbolTag:
  15459. if (symbolValueOf) {
  15460. return symbolValueOf.call(object) == symbolValueOf.call(other);
  15461. }
  15462. }
  15463. return false;
  15464. }
  15465. var COMPARE_PARTIAL_FLAG$1 = 1;
  15466. var objectProto$1 = Object.prototype;
  15467. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  15468. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  15469. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  15470. if (objLength != othLength && !isPartial) {
  15471. return false;
  15472. }
  15473. var index2 = objLength;
  15474. while (index2--) {
  15475. var key = objProps[index2];
  15476. if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
  15477. return false;
  15478. }
  15479. }
  15480. var objStacked = stack.get(object);
  15481. var othStacked = stack.get(other);
  15482. if (objStacked && othStacked) {
  15483. return objStacked == other && othStacked == object;
  15484. }
  15485. var result = true;
  15486. stack.set(object, other);
  15487. stack.set(other, object);
  15488. var skipCtor = isPartial;
  15489. while (++index2 < objLength) {
  15490. key = objProps[index2];
  15491. var objValue = object[key], othValue = other[key];
  15492. if (customizer) {
  15493. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  15494. }
  15495. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  15496. result = false;
  15497. break;
  15498. }
  15499. skipCtor || (skipCtor = key == "constructor");
  15500. }
  15501. if (result && !skipCtor) {
  15502. var objCtor = object.constructor, othCtor = other.constructor;
  15503. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  15504. result = false;
  15505. }
  15506. }
  15507. stack["delete"](object);
  15508. stack["delete"](other);
  15509. return result;
  15510. }
  15511. var COMPARE_PARTIAL_FLAG = 1;
  15512. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  15513. var objectProto = Object.prototype;
  15514. var hasOwnProperty = objectProto.hasOwnProperty;
  15515. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  15516. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  15517. objTag = objTag == argsTag ? objectTag : objTag;
  15518. othTag = othTag == argsTag ? objectTag : othTag;
  15519. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  15520. if (isSameTag && isBuffer$1(object)) {
  15521. if (!isBuffer$1(other)) {
  15522. return false;
  15523. }
  15524. objIsArr = true;
  15525. objIsObj = false;
  15526. }
  15527. if (isSameTag && !objIsObj) {
  15528. stack || (stack = new Stack());
  15529. return objIsArr || isTypedArray$3(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  15530. }
  15531. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  15532. var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
  15533. if (objIsWrapped || othIsWrapped) {
  15534. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  15535. stack || (stack = new Stack());
  15536. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  15537. }
  15538. }
  15539. if (!isSameTag) {
  15540. return false;
  15541. }
  15542. stack || (stack = new Stack());
  15543. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  15544. }
  15545. function baseIsEqual(value, other, bitmask, customizer, stack) {
  15546. if (value === other) {
  15547. return true;
  15548. }
  15549. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  15550. return value !== value && other !== other;
  15551. }
  15552. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  15553. }
  15554. var now = function() {
  15555. return root$1.Date.now();
  15556. };
  15557. var now$1 = now;
  15558. var FUNC_ERROR_TEXT = "Expected a function";
  15559. var nativeMax = Math.max, nativeMin = Math.min;
  15560. function debounce$2(func, wait, options2) {
  15561. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  15562. if (typeof func != "function") {
  15563. throw new TypeError(FUNC_ERROR_TEXT);
  15564. }
  15565. wait = toNumber(wait) || 0;
  15566. if (isObject$4(options2)) {
  15567. leading = !!options2.leading;
  15568. maxing = "maxWait" in options2;
  15569. maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
  15570. trailing = "trailing" in options2 ? !!options2.trailing : trailing;
  15571. }
  15572. function invokeFunc(time) {
  15573. var args = lastArgs, thisArg = lastThis;
  15574. lastArgs = lastThis = void 0;
  15575. lastInvokeTime = time;
  15576. result = func.apply(thisArg, args);
  15577. return result;
  15578. }
  15579. function leadingEdge(time) {
  15580. lastInvokeTime = time;
  15581. timerId = setTimeout(timerExpired, wait);
  15582. return leading ? invokeFunc(time) : result;
  15583. }
  15584. function remainingWait(time) {
  15585. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  15586. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  15587. }
  15588. function shouldInvoke(time) {
  15589. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  15590. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  15591. }
  15592. function timerExpired() {
  15593. var time = now$1();
  15594. if (shouldInvoke(time)) {
  15595. return trailingEdge(time);
  15596. }
  15597. timerId = setTimeout(timerExpired, remainingWait(time));
  15598. }
  15599. function trailingEdge(time) {
  15600. timerId = void 0;
  15601. if (trailing && lastArgs) {
  15602. return invokeFunc(time);
  15603. }
  15604. lastArgs = lastThis = void 0;
  15605. return result;
  15606. }
  15607. function cancel() {
  15608. if (timerId !== void 0) {
  15609. clearTimeout(timerId);
  15610. }
  15611. lastInvokeTime = 0;
  15612. lastArgs = lastCallTime = lastThis = timerId = void 0;
  15613. }
  15614. function flush() {
  15615. return timerId === void 0 ? result : trailingEdge(now$1());
  15616. }
  15617. function debounced() {
  15618. var time = now$1(), isInvoking = shouldInvoke(time);
  15619. lastArgs = arguments;
  15620. lastThis = this;
  15621. lastCallTime = time;
  15622. if (isInvoking) {
  15623. if (timerId === void 0) {
  15624. return leadingEdge(lastCallTime);
  15625. }
  15626. if (maxing) {
  15627. clearTimeout(timerId);
  15628. timerId = setTimeout(timerExpired, wait);
  15629. return invokeFunc(lastCallTime);
  15630. }
  15631. }
  15632. if (timerId === void 0) {
  15633. timerId = setTimeout(timerExpired, wait);
  15634. }
  15635. return result;
  15636. }
  15637. debounced.cancel = cancel;
  15638. debounced.flush = flush;
  15639. return debounced;
  15640. }
  15641. function fromPairs(pairs) {
  15642. var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
  15643. while (++index2 < length) {
  15644. var pair = pairs[index2];
  15645. result[pair[0]] = pair[1];
  15646. }
  15647. return result;
  15648. }
  15649. function isEqual(value, other) {
  15650. return baseIsEqual(value, other);
  15651. }
  15652. function isNil(value) {
  15653. return value == null;
  15654. }
  15655. function isUndefined$1(value) {
  15656. return value === void 0;
  15657. }
  15658. const isUndefined = (val) => val === void 0;
  15659. const isBoolean = (val) => typeof val === "boolean";
  15660. const isNumber = (val) => typeof val === "number";
  15661. const isElement = (e) => {
  15662. if (typeof Element === "undefined")
  15663. return false;
  15664. return e instanceof Element;
  15665. };
  15666. const isStringNumber = (val) => {
  15667. if (!isString(val)) {
  15668. return false;
  15669. }
  15670. return !Number.isNaN(Number(val));
  15671. };
  15672. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  15673. const keysOf = (arr) => Object.keys(arr);
  15674. class ElementPlusError extends Error {
  15675. constructor(m) {
  15676. super(m);
  15677. this.name = "ElementPlusError";
  15678. }
  15679. }
  15680. function throwError(scope, m) {
  15681. throw new ElementPlusError(`[${scope}] ${m}`);
  15682. }
  15683. function debugWarn(scope, message) {
  15684. }
  15685. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  15686. const hasClass$2 = (el, cls) => {
  15687. if (!el || !cls)
  15688. return false;
  15689. if (cls.includes(" "))
  15690. throw new Error("className should not contain space.");
  15691. return el.classList.contains(cls);
  15692. };
  15693. const addClass$2 = (el, cls) => {
  15694. if (!el || !cls.trim())
  15695. return;
  15696. el.classList.add(...classNameToArray(cls));
  15697. };
  15698. const removeClass$2 = (el, cls) => {
  15699. if (!el || !cls.trim())
  15700. return;
  15701. el.classList.remove(...classNameToArray(cls));
  15702. };
  15703. const getStyle = (element, styleName) => {
  15704. var _a2;
  15705. if (!isClient || !element || !styleName)
  15706. return "";
  15707. let key = camelize(styleName);
  15708. if (key === "float")
  15709. key = "cssFloat";
  15710. try {
  15711. const style = element.style[key];
  15712. if (style)
  15713. return style;
  15714. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  15715. return computed2 ? computed2[key] : "";
  15716. } catch (e) {
  15717. return element.style[key];
  15718. }
  15719. };
  15720. function addUnit(value, defaultUnit = "px") {
  15721. if (!value)
  15722. return "";
  15723. if (isNumber(value) || isStringNumber(value)) {
  15724. return `${value}${defaultUnit}`;
  15725. } else if (isString(value)) {
  15726. return value;
  15727. }
  15728. }
  15729. let scrollBarWidth;
  15730. const getScrollBarWidth = (namespace) => {
  15731. var _a2;
  15732. if (!isClient)
  15733. return 0;
  15734. if (scrollBarWidth !== void 0)
  15735. return scrollBarWidth;
  15736. const outer = document.createElement("div");
  15737. outer.className = `${namespace}-scrollbar__wrap`;
  15738. outer.style.visibility = "hidden";
  15739. outer.style.width = "100px";
  15740. outer.style.position = "absolute";
  15741. outer.style.top = "-9999px";
  15742. document.body.appendChild(outer);
  15743. const widthNoScroll = outer.offsetWidth;
  15744. outer.style.overflow = "scroll";
  15745. const inner = document.createElement("div");
  15746. inner.style.width = "100%";
  15747. outer.appendChild(inner);
  15748. const widthWithScroll = inner.offsetWidth;
  15749. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  15750. scrollBarWidth = widthNoScroll - widthWithScroll;
  15751. return scrollBarWidth;
  15752. };
  15753. function scrollIntoView(container, selected) {
  15754. if (!isClient)
  15755. return;
  15756. if (!selected) {
  15757. container.scrollTop = 0;
  15758. return;
  15759. }
  15760. const offsetParents = [];
  15761. let pointer = selected.offsetParent;
  15762. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  15763. offsetParents.push(pointer);
  15764. pointer = pointer.offsetParent;
  15765. }
  15766. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  15767. const bottom = top + selected.offsetHeight;
  15768. const viewRectTop = container.scrollTop;
  15769. const viewRectBottom = viewRectTop + container.clientHeight;
  15770. if (top < viewRectTop) {
  15771. container.scrollTop = top;
  15772. } else if (bottom > viewRectBottom) {
  15773. container.scrollTop = bottom - container.clientHeight;
  15774. }
  15775. }
  15776. /*! Element Plus Icons Vue v2.1.0 */
  15777. var export_helper_default = (sfc, props) => {
  15778. let target = sfc.__vccOpts || sfc;
  15779. for (let [key, val] of props)
  15780. target[key] = val;
  15781. return target;
  15782. };
  15783. var arrow_down_vue_vue_type_script_lang_default = {
  15784. name: "ArrowDown"
  15785. };
  15786. var _hoisted_16$2 = {
  15787. xmlns: "http://www.w3.org/2000/svg",
  15788. viewBox: "0 0 1024 1024"
  15789. }, _hoisted_26$2 = /* @__PURE__ */ createElementVNode(
  15790. "path",
  15791. {
  15792. fill: "currentColor",
  15793. 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"
  15794. },
  15795. null,
  15796. -1
  15797. ), _hoisted_36$2 = [
  15798. _hoisted_26$2
  15799. ];
  15800. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  15801. return openBlock(), createElementBlock("svg", _hoisted_16$2, _hoisted_36$2);
  15802. }
  15803. var arrow_down_default = /* @__PURE__ */ export_helper_default(arrow_down_vue_vue_type_script_lang_default, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  15804. var arrow_right_vue_vue_type_script_lang_default = {
  15805. name: "ArrowRight"
  15806. };
  15807. var _hoisted_110 = {
  15808. xmlns: "http://www.w3.org/2000/svg",
  15809. viewBox: "0 0 1024 1024"
  15810. }, _hoisted_210 = /* @__PURE__ */ createElementVNode(
  15811. "path",
  15812. {
  15813. fill: "currentColor",
  15814. 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"
  15815. },
  15816. null,
  15817. -1
  15818. ), _hoisted_310 = [
  15819. _hoisted_210
  15820. ];
  15821. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  15822. return openBlock(), createElementBlock("svg", _hoisted_110, _hoisted_310);
  15823. }
  15824. var arrow_right_default = /* @__PURE__ */ export_helper_default(arrow_right_vue_vue_type_script_lang_default, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  15825. var arrow_up_vue_vue_type_script_lang_default = {
  15826. name: "ArrowUp"
  15827. };
  15828. var _hoisted_112 = {
  15829. xmlns: "http://www.w3.org/2000/svg",
  15830. viewBox: "0 0 1024 1024"
  15831. }, _hoisted_212 = /* @__PURE__ */ createElementVNode(
  15832. "path",
  15833. {
  15834. fill: "currentColor",
  15835. 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"
  15836. },
  15837. null,
  15838. -1
  15839. ), _hoisted_312 = [
  15840. _hoisted_212
  15841. ];
  15842. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  15843. return openBlock(), createElementBlock("svg", _hoisted_112, _hoisted_312);
  15844. }
  15845. var arrow_up_default = /* @__PURE__ */ export_helper_default(arrow_up_vue_vue_type_script_lang_default, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  15846. var circle_check_vue_vue_type_script_lang_default = {
  15847. name: "CircleCheck"
  15848. };
  15849. var _hoisted_149 = {
  15850. xmlns: "http://www.w3.org/2000/svg",
  15851. viewBox: "0 0 1024 1024"
  15852. }, _hoisted_249 = /* @__PURE__ */ createElementVNode(
  15853. "path",
  15854. {
  15855. fill: "currentColor",
  15856. 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"
  15857. },
  15858. null,
  15859. -1
  15860. ), _hoisted_348 = /* @__PURE__ */ createElementVNode(
  15861. "path",
  15862. {
  15863. fill: "currentColor",
  15864. 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"
  15865. },
  15866. null,
  15867. -1
  15868. ), _hoisted_415 = [
  15869. _hoisted_249,
  15870. _hoisted_348
  15871. ];
  15872. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  15873. return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
  15874. }
  15875. var circle_check_default = /* @__PURE__ */ export_helper_default(circle_check_vue_vue_type_script_lang_default, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
  15876. var circle_close_vue_vue_type_script_lang_default = {
  15877. name: "CircleClose"
  15878. };
  15879. var _hoisted_151 = {
  15880. xmlns: "http://www.w3.org/2000/svg",
  15881. viewBox: "0 0 1024 1024"
  15882. }, _hoisted_251 = /* @__PURE__ */ createElementVNode(
  15883. "path",
  15884. {
  15885. fill: "currentColor",
  15886. 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"
  15887. },
  15888. null,
  15889. -1
  15890. ), _hoisted_350 = /* @__PURE__ */ createElementVNode(
  15891. "path",
  15892. {
  15893. fill: "currentColor",
  15894. 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"
  15895. },
  15896. null,
  15897. -1
  15898. ), _hoisted_416 = [
  15899. _hoisted_251,
  15900. _hoisted_350
  15901. ];
  15902. function _sfc_render51(_ctx, _cache, $props, $setup, $data, $options) {
  15903. return openBlock(), createElementBlock("svg", _hoisted_151, _hoisted_416);
  15904. }
  15905. var circle_close_default = /* @__PURE__ */ export_helper_default(circle_close_vue_vue_type_script_lang_default, [["render", _sfc_render51], ["__file", "circle-close.vue"]]);
  15906. var close_vue_vue_type_script_lang_default = {
  15907. name: "Close"
  15908. };
  15909. var _hoisted_156 = {
  15910. xmlns: "http://www.w3.org/2000/svg",
  15911. viewBox: "0 0 1024 1024"
  15912. }, _hoisted_256 = /* @__PURE__ */ createElementVNode(
  15913. "path",
  15914. {
  15915. fill: "currentColor",
  15916. 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"
  15917. },
  15918. null,
  15919. -1
  15920. ), _hoisted_355 = [
  15921. _hoisted_256
  15922. ];
  15923. function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
  15924. return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
  15925. }
  15926. var close_default = /* @__PURE__ */ export_helper_default(close_vue_vue_type_script_lang_default, [["render", _sfc_render56], ["__file", "close.vue"]]);
  15927. var delete_vue_vue_type_script_lang_default = {
  15928. name: "Delete"
  15929. };
  15930. var _hoisted_180 = {
  15931. xmlns: "http://www.w3.org/2000/svg",
  15932. viewBox: "0 0 1024 1024"
  15933. }, _hoisted_280 = /* @__PURE__ */ createElementVNode(
  15934. "path",
  15935. {
  15936. fill: "currentColor",
  15937. 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"
  15938. },
  15939. null,
  15940. -1
  15941. ), _hoisted_379 = [
  15942. _hoisted_280
  15943. ];
  15944. function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
  15945. return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
  15946. }
  15947. var delete_default = /* @__PURE__ */ export_helper_default(delete_vue_vue_type_script_lang_default, [["render", _sfc_render80], ["__file", "delete.vue"]]);
  15948. var edit_vue_vue_type_script_lang_default = {
  15949. name: "Edit"
  15950. };
  15951. var _hoisted_194 = {
  15952. xmlns: "http://www.w3.org/2000/svg",
  15953. viewBox: "0 0 1024 1024"
  15954. }, _hoisted_294 = /* @__PURE__ */ createElementVNode(
  15955. "path",
  15956. {
  15957. fill: "currentColor",
  15958. 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"
  15959. },
  15960. null,
  15961. -1
  15962. ), _hoisted_393 = /* @__PURE__ */ createElementVNode(
  15963. "path",
  15964. {
  15965. fill: "currentColor",
  15966. 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"
  15967. },
  15968. null,
  15969. -1
  15970. ), _hoisted_431 = [
  15971. _hoisted_294,
  15972. _hoisted_393
  15973. ];
  15974. function _sfc_render94(_ctx, _cache, $props, $setup, $data, $options) {
  15975. return openBlock(), createElementBlock("svg", _hoisted_194, _hoisted_431);
  15976. }
  15977. var edit_default = /* @__PURE__ */ export_helper_default(edit_vue_vue_type_script_lang_default, [["render", _sfc_render94], ["__file", "edit.vue"]]);
  15978. var hide_vue_vue_type_script_lang_default = {
  15979. name: "Hide"
  15980. };
  15981. var _hoisted_1133 = {
  15982. xmlns: "http://www.w3.org/2000/svg",
  15983. viewBox: "0 0 1024 1024"
  15984. }, _hoisted_2133 = /* @__PURE__ */ createElementVNode(
  15985. "path",
  15986. {
  15987. fill: "currentColor",
  15988. 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"
  15989. },
  15990. null,
  15991. -1
  15992. ), _hoisted_3132 = /* @__PURE__ */ createElementVNode(
  15993. "path",
  15994. {
  15995. fill: "currentColor",
  15996. 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"
  15997. },
  15998. null,
  15999. -1
  16000. ), _hoisted_438 = [
  16001. _hoisted_2133,
  16002. _hoisted_3132
  16003. ];
  16004. function _sfc_render133(_ctx, _cache, $props, $setup, $data, $options) {
  16005. return openBlock(), createElementBlock("svg", _hoisted_1133, _hoisted_438);
  16006. }
  16007. var hide_default = /* @__PURE__ */ export_helper_default(hide_vue_vue_type_script_lang_default, [["render", _sfc_render133], ["__file", "hide.vue"]]);
  16008. var loading_vue_vue_type_script_lang_default = {
  16009. name: "Loading"
  16010. };
  16011. var _hoisted_1150 = {
  16012. xmlns: "http://www.w3.org/2000/svg",
  16013. viewBox: "0 0 1024 1024"
  16014. }, _hoisted_2150 = /* @__PURE__ */ createElementVNode(
  16015. "path",
  16016. {
  16017. fill: "currentColor",
  16018. 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"
  16019. },
  16020. null,
  16021. -1
  16022. ), _hoisted_3149 = [
  16023. _hoisted_2150
  16024. ];
  16025. function _sfc_render150(_ctx, _cache, $props, $setup, $data, $options) {
  16026. return openBlock(), createElementBlock("svg", _hoisted_1150, _hoisted_3149);
  16027. }
  16028. var loading_default = /* @__PURE__ */ export_helper_default(loading_vue_vue_type_script_lang_default, [["render", _sfc_render150], ["__file", "loading.vue"]]);
  16029. var minus_vue_vue_type_script_lang_default = {
  16030. name: "Minus"
  16031. };
  16032. var _hoisted_1169 = {
  16033. xmlns: "http://www.w3.org/2000/svg",
  16034. viewBox: "0 0 1024 1024"
  16035. }, _hoisted_2169 = /* @__PURE__ */ createElementVNode(
  16036. "path",
  16037. {
  16038. fill: "currentColor",
  16039. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  16040. },
  16041. null,
  16042. -1
  16043. ), _hoisted_3168 = [
  16044. _hoisted_2169
  16045. ];
  16046. function _sfc_render169(_ctx, _cache, $props, $setup, $data, $options) {
  16047. return openBlock(), createElementBlock("svg", _hoisted_1169, _hoisted_3168);
  16048. }
  16049. var minus_default = /* @__PURE__ */ export_helper_default(minus_vue_vue_type_script_lang_default, [["render", _sfc_render169], ["__file", "minus.vue"]]);
  16050. var plus_vue_vue_type_script_lang_default = {
  16051. name: "Plus"
  16052. };
  16053. var _hoisted_1201 = {
  16054. xmlns: "http://www.w3.org/2000/svg",
  16055. viewBox: "0 0 1024 1024"
  16056. }, _hoisted_2201 = /* @__PURE__ */ createElementVNode(
  16057. "path",
  16058. {
  16059. fill: "currentColor",
  16060. 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"
  16061. },
  16062. null,
  16063. -1
  16064. ), _hoisted_3200 = [
  16065. _hoisted_2201
  16066. ];
  16067. function _sfc_render201(_ctx, _cache, $props, $setup, $data, $options) {
  16068. return openBlock(), createElementBlock("svg", _hoisted_1201, _hoisted_3200);
  16069. }
  16070. var plus_default = /* @__PURE__ */ export_helper_default(plus_vue_vue_type_script_lang_default, [["render", _sfc_render201], ["__file", "plus.vue"]]);
  16071. var setting_vue_vue_type_script_lang_default = {
  16072. name: "Setting"
  16073. };
  16074. var _hoisted_1231 = {
  16075. xmlns: "http://www.w3.org/2000/svg",
  16076. viewBox: "0 0 1024 1024"
  16077. }, _hoisted_2231 = /* @__PURE__ */ createElementVNode(
  16078. "path",
  16079. {
  16080. fill: "currentColor",
  16081. 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"
  16082. },
  16083. null,
  16084. -1
  16085. ), _hoisted_3230 = [
  16086. _hoisted_2231
  16087. ];
  16088. function _sfc_render231(_ctx, _cache, $props, $setup, $data, $options) {
  16089. return openBlock(), createElementBlock("svg", _hoisted_1231, _hoisted_3230);
  16090. }
  16091. var setting_default = /* @__PURE__ */ export_helper_default(setting_vue_vue_type_script_lang_default, [["render", _sfc_render231], ["__file", "setting.vue"]]);
  16092. var view_vue_vue_type_script_lang_default = {
  16093. name: "View"
  16094. };
  16095. var _hoisted_1283 = {
  16096. xmlns: "http://www.w3.org/2000/svg",
  16097. viewBox: "0 0 1024 1024"
  16098. }, _hoisted_2283 = /* @__PURE__ */ createElementVNode(
  16099. "path",
  16100. {
  16101. fill: "currentColor",
  16102. 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"
  16103. },
  16104. null,
  16105. -1
  16106. ), _hoisted_3282 = [
  16107. _hoisted_2283
  16108. ];
  16109. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  16110. return openBlock(), createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  16111. }
  16112. var view_default = /* @__PURE__ */ export_helper_default(view_vue_vue_type_script_lang_default, [["render", _sfc_render283], ["__file", "view.vue"]]);
  16113. const epPropKey = "__epPropKey";
  16114. const definePropType = (val) => val;
  16115. const isEpProp = (val) => isObject$5(val) && !!val[epPropKey];
  16116. const buildProp = (prop, key) => {
  16117. if (!isObject$5(prop) || isEpProp(prop))
  16118. return prop;
  16119. const { values: values3, required, default: defaultValue2, type: type2, validator } = prop;
  16120. const _validator = values3 || validator ? (val) => {
  16121. let valid = false;
  16122. let allowedValues = [];
  16123. if (values3) {
  16124. allowedValues = Array.from(values3);
  16125. if (hasOwn(prop, "default")) {
  16126. allowedValues.push(defaultValue2);
  16127. }
  16128. valid || (valid = allowedValues.includes(val));
  16129. }
  16130. if (validator)
  16131. valid || (valid = validator(val));
  16132. if (!valid && allowedValues.length > 0) {
  16133. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  16134. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  16135. }
  16136. return valid;
  16137. } : void 0;
  16138. const epProp = {
  16139. type: type2,
  16140. required: !!required,
  16141. validator: _validator,
  16142. [epPropKey]: true
  16143. };
  16144. if (hasOwn(prop, "default"))
  16145. epProp.default = defaultValue2;
  16146. return epProp;
  16147. };
  16148. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  16149. key,
  16150. buildProp(option, key)
  16151. ]));
  16152. const iconPropType = definePropType([
  16153. String,
  16154. Object,
  16155. Function
  16156. ]);
  16157. const CloseComponents = {
  16158. Close: close_default
  16159. };
  16160. const ValidateComponentsMap = {
  16161. validating: loading_default,
  16162. success: circle_check_default,
  16163. error: circle_close_default
  16164. };
  16165. const withInstall = (main, extra) => {
  16166. main.install = (app) => {
  16167. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  16168. app.component(comp.name, comp);
  16169. }
  16170. };
  16171. if (extra) {
  16172. for (const [key, comp] of Object.entries(extra)) {
  16173. main[key] = comp;
  16174. }
  16175. }
  16176. return main;
  16177. };
  16178. const withNoopInstall = (component) => {
  16179. component.install = NOOP;
  16180. return component;
  16181. };
  16182. const composeRefs = (...refs) => {
  16183. return (el) => {
  16184. refs.forEach((ref2) => {
  16185. if (isFunction$3(ref2)) {
  16186. ref2(el);
  16187. } else {
  16188. ref2.value = el;
  16189. }
  16190. });
  16191. };
  16192. };
  16193. const EVENT_CODE = {
  16194. tab: "Tab",
  16195. enter: "Enter",
  16196. space: "Space",
  16197. left: "ArrowLeft",
  16198. up: "ArrowUp",
  16199. right: "ArrowRight",
  16200. down: "ArrowDown",
  16201. esc: "Escape",
  16202. delete: "Delete",
  16203. backspace: "Backspace",
  16204. numpadEnter: "NumpadEnter",
  16205. pageUp: "PageUp",
  16206. pageDown: "PageDown",
  16207. home: "Home",
  16208. end: "End"
  16209. };
  16210. const UPDATE_MODEL_EVENT = "update:modelValue";
  16211. const CHANGE_EVENT = "change";
  16212. const INPUT_EVENT = "input";
  16213. const componentSizes = ["", "default", "small", "large"];
  16214. const componentSizeMap = {
  16215. large: 40,
  16216. default: 32,
  16217. small: 24
  16218. };
  16219. const getComponentSize = (size) => {
  16220. return componentSizeMap[size || "default"];
  16221. };
  16222. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  16223. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  16224. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  16225. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  16226. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  16227. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  16228. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  16229. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  16230. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  16231. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  16232. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  16233. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  16234. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  16235. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  16236. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  16237. return PatchFlags2;
  16238. })(PatchFlags || {});
  16239. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  16240. const generateId = () => Math.floor(Math.random() * 1e4);
  16241. const mutable = (val) => val;
  16242. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  16243. const LISTENER_PREFIX = /^on[A-Z]/;
  16244. const useAttrs = (params = {}) => {
  16245. const { excludeListeners = false, excludeKeys } = params;
  16246. const allExcludeKeys = computed$1(() => {
  16247. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  16248. });
  16249. const instance = getCurrentInstance();
  16250. if (!instance) {
  16251. return computed$1(() => ({}));
  16252. }
  16253. return computed$1(() => {
  16254. var _a2;
  16255. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  16256. });
  16257. };
  16258. const useDeprecated = ({ from: from3, replacement, scope, version: version2, ref: ref2, type: type2 = "API" }, condition) => {
  16259. watch(() => unref(condition), (val) => {
  16260. }, {
  16261. immediate: true
  16262. });
  16263. };
  16264. const useDraggable = (targetRef, dragRef, draggable2) => {
  16265. let transform3 = {
  16266. offsetX: 0,
  16267. offsetY: 0
  16268. };
  16269. const onMousedown = (e) => {
  16270. const downX = e.clientX;
  16271. const downY = e.clientY;
  16272. const { offsetX, offsetY } = transform3;
  16273. const targetRect = targetRef.value.getBoundingClientRect();
  16274. const targetLeft = targetRect.left;
  16275. const targetTop = targetRect.top;
  16276. const targetWidth = targetRect.width;
  16277. const targetHeight = targetRect.height;
  16278. const clientWidth = document.documentElement.clientWidth;
  16279. const clientHeight = document.documentElement.clientHeight;
  16280. const minLeft = -targetLeft + offsetX;
  16281. const minTop = -targetTop + offsetY;
  16282. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  16283. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  16284. const onMousemove = (e2) => {
  16285. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  16286. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  16287. transform3 = {
  16288. offsetX: moveX,
  16289. offsetY: moveY
  16290. };
  16291. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  16292. };
  16293. const onMouseup = () => {
  16294. document.removeEventListener("mousemove", onMousemove);
  16295. document.removeEventListener("mouseup", onMouseup);
  16296. };
  16297. document.addEventListener("mousemove", onMousemove);
  16298. document.addEventListener("mouseup", onMouseup);
  16299. };
  16300. const onDraggable = () => {
  16301. if (dragRef.value && targetRef.value) {
  16302. dragRef.value.addEventListener("mousedown", onMousedown);
  16303. }
  16304. };
  16305. const offDraggable = () => {
  16306. if (dragRef.value && targetRef.value) {
  16307. dragRef.value.removeEventListener("mousedown", onMousedown);
  16308. }
  16309. };
  16310. onMounted(() => {
  16311. watchEffect(() => {
  16312. if (draggable2.value) {
  16313. onDraggable();
  16314. } else {
  16315. offDraggable();
  16316. }
  16317. });
  16318. });
  16319. onBeforeUnmount(() => {
  16320. offDraggable();
  16321. });
  16322. };
  16323. const useFocus = (el) => {
  16324. return {
  16325. focus: () => {
  16326. var _a2, _b;
  16327. (_b = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  16328. }
  16329. };
  16330. };
  16331. var English = {
  16332. name: "en",
  16333. el: {
  16334. colorpicker: {
  16335. confirm: "OK",
  16336. clear: "Clear",
  16337. defaultLabel: "color picker",
  16338. description: "current color is {color}. press enter to select a new color."
  16339. },
  16340. datepicker: {
  16341. now: "Now",
  16342. today: "Today",
  16343. cancel: "Cancel",
  16344. clear: "Clear",
  16345. confirm: "OK",
  16346. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  16347. monthTablePrompt: "Use the arrow keys and enter to select the month",
  16348. yearTablePrompt: "Use the arrow keys and enter to select the year",
  16349. selectedDate: "Selected date",
  16350. selectDate: "Select date",
  16351. selectTime: "Select time",
  16352. startDate: "Start Date",
  16353. startTime: "Start Time",
  16354. endDate: "End Date",
  16355. endTime: "End Time",
  16356. prevYear: "Previous Year",
  16357. nextYear: "Next Year",
  16358. prevMonth: "Previous Month",
  16359. nextMonth: "Next Month",
  16360. year: "",
  16361. month1: "January",
  16362. month2: "February",
  16363. month3: "March",
  16364. month4: "April",
  16365. month5: "May",
  16366. month6: "June",
  16367. month7: "July",
  16368. month8: "August",
  16369. month9: "September",
  16370. month10: "October",
  16371. month11: "November",
  16372. month12: "December",
  16373. week: "week",
  16374. weeks: {
  16375. sun: "Sun",
  16376. mon: "Mon",
  16377. tue: "Tue",
  16378. wed: "Wed",
  16379. thu: "Thu",
  16380. fri: "Fri",
  16381. sat: "Sat"
  16382. },
  16383. weeksFull: {
  16384. sun: "Sunday",
  16385. mon: "Monday",
  16386. tue: "Tuesday",
  16387. wed: "Wednesday",
  16388. thu: "Thursday",
  16389. fri: "Friday",
  16390. sat: "Saturday"
  16391. },
  16392. months: {
  16393. jan: "Jan",
  16394. feb: "Feb",
  16395. mar: "Mar",
  16396. apr: "Apr",
  16397. may: "May",
  16398. jun: "Jun",
  16399. jul: "Jul",
  16400. aug: "Aug",
  16401. sep: "Sep",
  16402. oct: "Oct",
  16403. nov: "Nov",
  16404. dec: "Dec"
  16405. }
  16406. },
  16407. inputNumber: {
  16408. decrease: "decrease number",
  16409. increase: "increase number"
  16410. },
  16411. select: {
  16412. loading: "Loading",
  16413. noMatch: "No matching data",
  16414. noData: "No data",
  16415. placeholder: "Select"
  16416. },
  16417. dropdown: {
  16418. toggleDropdown: "Toggle Dropdown"
  16419. },
  16420. cascader: {
  16421. noMatch: "No matching data",
  16422. loading: "Loading",
  16423. placeholder: "Select",
  16424. noData: "No data"
  16425. },
  16426. pagination: {
  16427. goto: "Go to",
  16428. pagesize: "/page",
  16429. total: "Total {total}",
  16430. pageClassifier: "",
  16431. page: "Page",
  16432. prev: "Go to previous page",
  16433. next: "Go to next page",
  16434. currentPage: "page {pager}",
  16435. prevPages: "Previous {pager} pages",
  16436. nextPages: "Next {pager} pages",
  16437. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  16438. },
  16439. dialog: {
  16440. close: "Close this dialog"
  16441. },
  16442. drawer: {
  16443. close: "Close this dialog"
  16444. },
  16445. messagebox: {
  16446. title: "Message",
  16447. confirm: "OK",
  16448. cancel: "Cancel",
  16449. error: "Illegal input",
  16450. close: "Close this dialog"
  16451. },
  16452. upload: {
  16453. deleteTip: "press delete to remove",
  16454. delete: "Delete",
  16455. preview: "Preview",
  16456. continue: "Continue"
  16457. },
  16458. slider: {
  16459. defaultLabel: "slider between {min} and {max}",
  16460. defaultRangeStartLabel: "pick start value",
  16461. defaultRangeEndLabel: "pick end value"
  16462. },
  16463. table: {
  16464. emptyText: "No Data",
  16465. confirmFilter: "Confirm",
  16466. resetFilter: "Reset",
  16467. clearFilter: "All",
  16468. sumText: "Sum"
  16469. },
  16470. tree: {
  16471. emptyText: "No Data"
  16472. },
  16473. transfer: {
  16474. noMatch: "No matching data",
  16475. noData: "No data",
  16476. titles: ["List 1", "List 2"],
  16477. filterPlaceholder: "Enter keyword",
  16478. noCheckedFormat: "{total} items",
  16479. hasCheckedFormat: "{checked}/{total} checked"
  16480. },
  16481. image: {
  16482. error: "FAILED"
  16483. },
  16484. pageHeader: {
  16485. title: "Back"
  16486. },
  16487. popconfirm: {
  16488. confirmButtonText: "Yes",
  16489. cancelButtonText: "No"
  16490. }
  16491. }
  16492. };
  16493. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  16494. const translate = (path, option, locale) => get$2(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  16495. var _a2;
  16496. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  16497. });
  16498. const buildLocaleContext = (locale) => {
  16499. const lang = computed$1(() => unref(locale).name);
  16500. const localeRef = isRef(locale) ? locale : ref(locale);
  16501. return {
  16502. lang,
  16503. locale: localeRef,
  16504. t: buildTranslator(locale)
  16505. };
  16506. };
  16507. const localeContextKey = Symbol("localeContextKey");
  16508. const useLocale = (localeOverrides) => {
  16509. const locale = localeOverrides || inject(localeContextKey, ref());
  16510. return buildLocaleContext(computed$1(() => locale.value || English));
  16511. };
  16512. let activeEffectScope;
  16513. function recordEffectScope(effect, scope = activeEffectScope) {
  16514. if (scope && scope.active) {
  16515. scope.effects.push(effect);
  16516. }
  16517. }
  16518. const createDep = (effects) => {
  16519. const dep = new Set(effects);
  16520. dep.w = 0;
  16521. dep.n = 0;
  16522. return dep;
  16523. };
  16524. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  16525. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  16526. const initDepMarkers = ({ deps }) => {
  16527. if (deps.length) {
  16528. for (let i2 = 0; i2 < deps.length; i2++) {
  16529. deps[i2].w |= trackOpBit;
  16530. }
  16531. }
  16532. };
  16533. const finalizeDepMarkers = (effect) => {
  16534. const { deps } = effect;
  16535. if (deps.length) {
  16536. let ptr = 0;
  16537. for (let i2 = 0; i2 < deps.length; i2++) {
  16538. const dep = deps[i2];
  16539. if (wasTracked(dep) && !newTracked(dep)) {
  16540. dep.delete(effect);
  16541. } else {
  16542. deps[ptr++] = dep;
  16543. }
  16544. dep.w &= ~trackOpBit;
  16545. dep.n &= ~trackOpBit;
  16546. }
  16547. deps.length = ptr;
  16548. }
  16549. };
  16550. let effectTrackDepth = 0;
  16551. let trackOpBit = 1;
  16552. const maxMarkerBits = 30;
  16553. let activeEffect;
  16554. class ReactiveEffect {
  16555. constructor(fn2, scheduler = null, scope) {
  16556. this.fn = fn2;
  16557. this.scheduler = scheduler;
  16558. this.active = true;
  16559. this.deps = [];
  16560. this.parent = void 0;
  16561. recordEffectScope(this, scope);
  16562. }
  16563. run() {
  16564. if (!this.active) {
  16565. return this.fn();
  16566. }
  16567. let parent = activeEffect;
  16568. let lastShouldTrack = shouldTrack;
  16569. while (parent) {
  16570. if (parent === this) {
  16571. return;
  16572. }
  16573. parent = parent.parent;
  16574. }
  16575. try {
  16576. this.parent = activeEffect;
  16577. activeEffect = this;
  16578. shouldTrack = true;
  16579. trackOpBit = 1 << ++effectTrackDepth;
  16580. if (effectTrackDepth <= maxMarkerBits) {
  16581. initDepMarkers(this);
  16582. } else {
  16583. cleanupEffect(this);
  16584. }
  16585. return this.fn();
  16586. } finally {
  16587. if (effectTrackDepth <= maxMarkerBits) {
  16588. finalizeDepMarkers(this);
  16589. }
  16590. trackOpBit = 1 << --effectTrackDepth;
  16591. activeEffect = this.parent;
  16592. shouldTrack = lastShouldTrack;
  16593. this.parent = void 0;
  16594. if (this.deferStop) {
  16595. this.stop();
  16596. }
  16597. }
  16598. }
  16599. stop() {
  16600. if (activeEffect === this) {
  16601. this.deferStop = true;
  16602. } else if (this.active) {
  16603. cleanupEffect(this);
  16604. if (this.onStop) {
  16605. this.onStop();
  16606. }
  16607. this.active = false;
  16608. }
  16609. }
  16610. }
  16611. function cleanupEffect(effect2) {
  16612. const { deps } = effect2;
  16613. if (deps.length) {
  16614. for (let i2 = 0; i2 < deps.length; i2++) {
  16615. deps[i2].delete(effect2);
  16616. }
  16617. deps.length = 0;
  16618. }
  16619. }
  16620. let shouldTrack = true;
  16621. function trackEffects(dep, debuggerEventExtraInfo) {
  16622. let shouldTrack2 = false;
  16623. if (effectTrackDepth <= maxMarkerBits) {
  16624. if (!newTracked(dep)) {
  16625. dep.n |= trackOpBit;
  16626. shouldTrack2 = !wasTracked(dep);
  16627. }
  16628. } else {
  16629. shouldTrack2 = !dep.has(activeEffect);
  16630. }
  16631. if (shouldTrack2) {
  16632. dep.add(activeEffect);
  16633. activeEffect.deps.push(dep);
  16634. }
  16635. }
  16636. function triggerEffects(dep, debuggerEventExtraInfo) {
  16637. const effects = isArray$2(dep) ? dep : [...dep];
  16638. for (const effect2 of effects) {
  16639. if (effect2.computed) {
  16640. triggerEffect(effect2);
  16641. }
  16642. }
  16643. for (const effect2 of effects) {
  16644. if (!effect2.computed) {
  16645. triggerEffect(effect2);
  16646. }
  16647. }
  16648. }
  16649. function triggerEffect(effect2, debuggerEventExtraInfo) {
  16650. if (effect2 !== activeEffect || effect2.allowRecurse) {
  16651. if (effect2.scheduler) {
  16652. effect2.scheduler();
  16653. } else {
  16654. effect2.run();
  16655. }
  16656. }
  16657. }
  16658. function toRaw(observed) {
  16659. const raw = observed && observed["__v_raw"];
  16660. return raw ? toRaw(raw) : observed;
  16661. }
  16662. function trackRefValue(ref2) {
  16663. if (shouldTrack && activeEffect) {
  16664. ref2 = toRaw(ref2);
  16665. {
  16666. trackEffects(ref2.dep || (ref2.dep = createDep()));
  16667. }
  16668. }
  16669. }
  16670. function triggerRefValue(ref2, newVal) {
  16671. ref2 = toRaw(ref2);
  16672. const dep = ref2.dep;
  16673. if (dep) {
  16674. {
  16675. triggerEffects(dep);
  16676. }
  16677. }
  16678. }
  16679. class ComputedRefImpl {
  16680. constructor(getter, _setter, isReadonly, isSSR) {
  16681. this._setter = _setter;
  16682. this.dep = void 0;
  16683. this.__v_isRef = true;
  16684. this["__v_isReadonly"] = false;
  16685. this._dirty = true;
  16686. this.effect = new ReactiveEffect(getter, () => {
  16687. if (!this._dirty) {
  16688. this._dirty = true;
  16689. triggerRefValue(this);
  16690. }
  16691. });
  16692. this.effect.computed = this;
  16693. this.effect.active = this._cacheable = !isSSR;
  16694. this["__v_isReadonly"] = isReadonly;
  16695. }
  16696. get value() {
  16697. const self2 = toRaw(this);
  16698. trackRefValue(self2);
  16699. if (self2._dirty || !self2._cacheable) {
  16700. self2._dirty = false;
  16701. self2._value = self2.effect.run();
  16702. }
  16703. return self2._value;
  16704. }
  16705. set value(newValue) {
  16706. this._setter(newValue);
  16707. }
  16708. }
  16709. function computed(getterOrOptions, debugOptions, isSSR = false) {
  16710. let getter;
  16711. let setter;
  16712. const onlyGetter = isFunction$3(getterOrOptions);
  16713. if (onlyGetter) {
  16714. getter = getterOrOptions;
  16715. setter = NOOP;
  16716. } else {
  16717. getter = getterOrOptions.get;
  16718. setter = getterOrOptions.set;
  16719. }
  16720. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  16721. return cRef;
  16722. }
  16723. const defaultNamespace = "el";
  16724. const statePrefix = "is-";
  16725. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  16726. let cls = `${namespace}-${block}`;
  16727. if (blockSuffix) {
  16728. cls += `-${blockSuffix}`;
  16729. }
  16730. if (element) {
  16731. cls += `__${element}`;
  16732. }
  16733. if (modifier) {
  16734. cls += `--${modifier}`;
  16735. }
  16736. return cls;
  16737. };
  16738. const namespaceContextKey = Symbol("namespaceContextKey");
  16739. const useGetDerivedNamespace = (namespaceOverrides) => {
  16740. const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
  16741. const namespace = computed$1(() => {
  16742. return unref(derivedNamespace) || defaultNamespace;
  16743. });
  16744. return namespace;
  16745. };
  16746. const useNamespace = (block, namespaceOverrides) => {
  16747. const namespace = useGetDerivedNamespace(namespaceOverrides);
  16748. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  16749. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  16750. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  16751. const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  16752. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  16753. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  16754. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  16755. const is = (name, ...args) => {
  16756. const state = args.length >= 1 ? args[0] : true;
  16757. return name && state ? `${statePrefix}${name}` : "";
  16758. };
  16759. const cssVar = (object) => {
  16760. const styles = {};
  16761. for (const key in object) {
  16762. if (object[key]) {
  16763. styles[`--${namespace.value}-${key}`] = object[key];
  16764. }
  16765. }
  16766. return styles;
  16767. };
  16768. const cssVarBlock = (object) => {
  16769. const styles = {};
  16770. for (const key in object) {
  16771. if (object[key]) {
  16772. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  16773. }
  16774. }
  16775. return styles;
  16776. };
  16777. const cssVarName = (name) => `--${namespace.value}-${name}`;
  16778. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  16779. return {
  16780. namespace,
  16781. b,
  16782. e,
  16783. m,
  16784. be: be2,
  16785. em,
  16786. bm,
  16787. bem,
  16788. is,
  16789. cssVar,
  16790. cssVarName,
  16791. cssVarBlock,
  16792. cssVarBlockName
  16793. };
  16794. };
  16795. const useLockscreen = (trigger2, options2 = {}) => {
  16796. if (!isRef(trigger2)) {
  16797. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  16798. }
  16799. const ns = options2.ns || useNamespace("popup");
  16800. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  16801. if (!isClient || hasClass$2(document.body, hiddenCls.value)) {
  16802. return;
  16803. }
  16804. let scrollBarWidth2 = 0;
  16805. let withoutHiddenClass = false;
  16806. let bodyWidth = "0";
  16807. const cleanup = () => {
  16808. setTimeout(() => {
  16809. removeClass$2(document == null ? void 0 : document.body, hiddenCls.value);
  16810. if (withoutHiddenClass && document) {
  16811. document.body.style.width = bodyWidth;
  16812. }
  16813. }, 200);
  16814. };
  16815. watch(trigger2, (val) => {
  16816. if (!val) {
  16817. cleanup();
  16818. return;
  16819. }
  16820. withoutHiddenClass = !hasClass$2(document.body, hiddenCls.value);
  16821. if (withoutHiddenClass) {
  16822. bodyWidth = document.body.style.width;
  16823. }
  16824. scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
  16825. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  16826. const bodyOverflowY = getStyle(document.body, "overflowY");
  16827. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  16828. document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`;
  16829. }
  16830. addClass$2(document.body, hiddenCls.value);
  16831. });
  16832. onScopeDispose(() => cleanup());
  16833. };
  16834. const _prop = buildProp({
  16835. type: definePropType(Boolean),
  16836. default: null
  16837. });
  16838. const _event = buildProp({
  16839. type: definePropType(Function)
  16840. });
  16841. const createModelToggleComposable = (name) => {
  16842. const updateEventKey = `update:${name}`;
  16843. const updateEventKeyRaw = `onUpdate:${name}`;
  16844. const useModelToggleEmits2 = [updateEventKey];
  16845. const useModelToggleProps2 = {
  16846. [name]: _prop,
  16847. [updateEventKeyRaw]: _event
  16848. };
  16849. const useModelToggle2 = ({
  16850. indicator,
  16851. toggleReason,
  16852. shouldHideWhenRouteChanges,
  16853. shouldProceed,
  16854. onShow,
  16855. onHide
  16856. }) => {
  16857. const instance = getCurrentInstance();
  16858. const { emit } = instance;
  16859. const props = instance.props;
  16860. const hasUpdateHandler = computed$1(() => isFunction$3(props[updateEventKeyRaw]));
  16861. const isModelBindingAbsent = computed$1(() => props[name] === null);
  16862. const doShow = (event2) => {
  16863. if (indicator.value === true) {
  16864. return;
  16865. }
  16866. indicator.value = true;
  16867. if (toggleReason) {
  16868. toggleReason.value = event2;
  16869. }
  16870. if (isFunction$3(onShow)) {
  16871. onShow(event2);
  16872. }
  16873. };
  16874. const doHide = (event2) => {
  16875. if (indicator.value === false) {
  16876. return;
  16877. }
  16878. indicator.value = false;
  16879. if (toggleReason) {
  16880. toggleReason.value = event2;
  16881. }
  16882. if (isFunction$3(onHide)) {
  16883. onHide(event2);
  16884. }
  16885. };
  16886. const show = (event2) => {
  16887. if (props.disabled === true || isFunction$3(shouldProceed) && !shouldProceed())
  16888. return;
  16889. const shouldEmit = hasUpdateHandler.value && isClient;
  16890. if (shouldEmit) {
  16891. emit(updateEventKey, true);
  16892. }
  16893. if (isModelBindingAbsent.value || !shouldEmit) {
  16894. doShow(event2);
  16895. }
  16896. };
  16897. const hide = (event2) => {
  16898. if (props.disabled === true || !isClient)
  16899. return;
  16900. const shouldEmit = hasUpdateHandler.value && isClient;
  16901. if (shouldEmit) {
  16902. emit(updateEventKey, false);
  16903. }
  16904. if (isModelBindingAbsent.value || !shouldEmit) {
  16905. doHide(event2);
  16906. }
  16907. };
  16908. const onChange = (val) => {
  16909. if (!isBoolean(val))
  16910. return;
  16911. if (props.disabled && val) {
  16912. if (hasUpdateHandler.value) {
  16913. emit(updateEventKey, false);
  16914. }
  16915. } else if (indicator.value !== val) {
  16916. if (val) {
  16917. doShow();
  16918. } else {
  16919. doHide();
  16920. }
  16921. }
  16922. };
  16923. const toggle = () => {
  16924. if (indicator.value) {
  16925. hide();
  16926. } else {
  16927. show();
  16928. }
  16929. };
  16930. watch(() => props[name], onChange);
  16931. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  16932. watch(() => ({
  16933. ...instance.proxy.$route
  16934. }), () => {
  16935. if (shouldHideWhenRouteChanges.value && indicator.value) {
  16936. hide();
  16937. }
  16938. });
  16939. }
  16940. onMounted(() => {
  16941. onChange(props[name]);
  16942. });
  16943. return {
  16944. hide,
  16945. show,
  16946. toggle,
  16947. hasUpdateHandler
  16948. };
  16949. };
  16950. return {
  16951. useModelToggle: useModelToggle2,
  16952. useModelToggleProps: useModelToggleProps2,
  16953. useModelToggleEmits: useModelToggleEmits2
  16954. };
  16955. };
  16956. const useProp = (name) => {
  16957. const vm = getCurrentInstance();
  16958. return computed$1(() => {
  16959. var _a2, _b;
  16960. return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
  16961. });
  16962. };
  16963. 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) {
  16964. return t2.concat([e + "-" + U, e + "-" + J]);
  16965. }, []), Ee = [].concat(G, [me]).reduce(function(t2, e) {
  16966. return t2.concat([e, e + "-" + U, e + "-" + J]);
  16967. }, []), 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];
  16968. function C(t2) {
  16969. return t2 ? (t2.nodeName || "").toLowerCase() : null;
  16970. }
  16971. function H(t2) {
  16972. if (t2 == null)
  16973. return window;
  16974. if (t2.toString() !== "[object Window]") {
  16975. var e = t2.ownerDocument;
  16976. return e && e.defaultView || window;
  16977. }
  16978. return t2;
  16979. }
  16980. function Q(t2) {
  16981. var e = H(t2).Element;
  16982. return t2 instanceof e || t2 instanceof Element;
  16983. }
  16984. function B(t2) {
  16985. var e = H(t2).HTMLElement;
  16986. return t2 instanceof e || t2 instanceof HTMLElement;
  16987. }
  16988. function Pe(t2) {
  16989. if (typeof ShadowRoot == "undefined")
  16990. return false;
  16991. var e = H(t2).ShadowRoot;
  16992. return t2 instanceof e || t2 instanceof ShadowRoot;
  16993. }
  16994. function Mt(t2) {
  16995. var e = t2.state;
  16996. Object.keys(e.elements).forEach(function(n) {
  16997. var r2 = e.styles[n] || {}, o = e.attributes[n] || {}, i2 = e.elements[n];
  16998. !B(i2) || !C(i2) || (Object.assign(i2.style, r2), Object.keys(o).forEach(function(a) {
  16999. var s = o[a];
  17000. s === false ? i2.removeAttribute(a) : i2.setAttribute(a, s === true ? "" : s);
  17001. }));
  17002. });
  17003. }
  17004. function Rt(t2) {
  17005. var e = t2.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  17006. return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
  17007. Object.keys(e.elements).forEach(function(r2) {
  17008. 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) {
  17009. return f[c] = "", f;
  17010. }, {});
  17011. !B(o) || !C(o) || (Object.assign(o.style, s), Object.keys(i2).forEach(function(f) {
  17012. o.removeAttribute(f);
  17013. }));
  17014. });
  17015. };
  17016. }
  17017. var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
  17018. function q(t2) {
  17019. return t2.split("-")[0];
  17020. }
  17021. var X = Math.max, ve = Math.min, Z = Math.round;
  17022. function ee(t2, e) {
  17023. e === void 0 && (e = false);
  17024. var n = t2.getBoundingClientRect(), r2 = 1, o = 1;
  17025. if (B(t2) && e) {
  17026. var i2 = t2.offsetHeight, a = t2.offsetWidth;
  17027. a > 0 && (r2 = Z(n.width) / a || 1), i2 > 0 && (o = Z(n.height) / i2 || 1);
  17028. }
  17029. 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 };
  17030. }
  17031. function ke(t2) {
  17032. var e = ee(t2), n = t2.offsetWidth, r2 = t2.offsetHeight;
  17033. 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 };
  17034. }
  17035. function it(t2, e) {
  17036. var n = e.getRootNode && e.getRootNode();
  17037. if (t2.contains(e))
  17038. return true;
  17039. if (n && Pe(n)) {
  17040. var r2 = e;
  17041. do {
  17042. if (r2 && t2.isSameNode(r2))
  17043. return true;
  17044. r2 = r2.parentNode || r2.host;
  17045. } while (r2);
  17046. }
  17047. return false;
  17048. }
  17049. function N(t2) {
  17050. return H(t2).getComputedStyle(t2);
  17051. }
  17052. function Wt(t2) {
  17053. return ["table", "td", "th"].indexOf(C(t2)) >= 0;
  17054. }
  17055. function I(t2) {
  17056. return ((Q(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
  17057. }
  17058. function ge(t2) {
  17059. return C(t2) === "html" ? t2 : t2.assignedSlot || t2.parentNode || (Pe(t2) ? t2.host : null) || I(t2);
  17060. }
  17061. function at(t2) {
  17062. return !B(t2) || N(t2).position === "fixed" ? null : t2.offsetParent;
  17063. }
  17064. function Bt(t2) {
  17065. var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
  17066. if (n && B(t2)) {
  17067. var r2 = N(t2);
  17068. if (r2.position === "fixed")
  17069. return null;
  17070. }
  17071. var o = ge(t2);
  17072. for (Pe(o) && (o = o.host); B(o) && ["html", "body"].indexOf(C(o)) < 0; ) {
  17073. var i2 = N(o);
  17074. 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")
  17075. return o;
  17076. o = o.parentNode;
  17077. }
  17078. return null;
  17079. }
  17080. function se(t2) {
  17081. for (var e = H(t2), n = at(t2); n && Wt(n) && N(n).position === "static"; )
  17082. n = at(n);
  17083. return n && (C(n) === "html" || C(n) === "body" && N(n).position === "static") ? e : n || Bt(t2) || e;
  17084. }
  17085. function Le(t2) {
  17086. return ["top", "bottom"].indexOf(t2) >= 0 ? "x" : "y";
  17087. }
  17088. function fe(t2, e, n) {
  17089. return X(t2, ve(e, n));
  17090. }
  17091. function St(t2, e, n) {
  17092. var r2 = fe(t2, e, n);
  17093. return r2 > n ? n : r2;
  17094. }
  17095. function st() {
  17096. return { top: 0, right: 0, bottom: 0, left: 0 };
  17097. }
  17098. function ft(t2) {
  17099. return Object.assign({}, st(), t2);
  17100. }
  17101. function ct(t2, e) {
  17102. return e.reduce(function(n, r2) {
  17103. return n[r2] = t2, n;
  17104. }, {});
  17105. }
  17106. var Tt = function(t2, e) {
  17107. return t2 = typeof t2 == "function" ? t2(Object.assign({}, e.rects, { placement: e.placement })) : t2, ft(typeof t2 != "number" ? t2 : ct(t2, G));
  17108. };
  17109. function Ht(t2) {
  17110. 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";
  17111. if (!(!i2 || !a)) {
  17112. 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;
  17113. n.modifiersData[r2] = (e = {}, e[j] = O, e.centerOffset = O - w, e);
  17114. }
  17115. }
  17116. function Ct(t2) {
  17117. var e = t2.state, n = t2.options, r2 = n.element, o = r2 === void 0 ? "[data-popper-arrow]" : r2;
  17118. o != null && (typeof o == "string" && (o = e.elements.popper.querySelector(o), !o) || !it(e.elements.popper, o) || (e.elements.arrow = o));
  17119. }
  17120. var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
  17121. function te(t2) {
  17122. return t2.split("-")[1];
  17123. }
  17124. var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
  17125. function Vt(t2) {
  17126. var e = t2.x, n = t2.y, r2 = window, o = r2.devicePixelRatio || 1;
  17127. return { x: Z(e * o) / o || 0, y: Z(n * o) / o || 0 };
  17128. }
  17129. function ut(t2) {
  17130. 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 };
  17131. l = g.x, p = g.y;
  17132. var x = a.hasOwnProperty("x"), y = a.hasOwnProperty("y"), $2 = P, d2 = E, b = window;
  17133. if (c) {
  17134. var w = se(n), O = "clientHeight", j = "clientWidth";
  17135. 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) {
  17136. d2 = R;
  17137. var A = m && w === b && b.visualViewport ? b.visualViewport.height : w[O];
  17138. p -= A - r2.height, p *= f ? 1 : -1;
  17139. }
  17140. if (o === P || (o === E || o === R) && i2 === J) {
  17141. $2 = W;
  17142. var k = m && w === b && b.visualViewport ? b.visualViewport.width : w[j];
  17143. l -= k - r2.width, l *= f ? 1 : -1;
  17144. }
  17145. }
  17146. var D = Object.assign({ position: s }, c && qt), S = u === true ? Vt({ x: l, y: p }) : { x: l, y: p };
  17147. if (l = S.x, p = S.y, f) {
  17148. var L;
  17149. 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));
  17150. }
  17151. return Object.assign({}, D, (e = {}, e[d2] = y ? p + "px" : "", e[$2] = x ? l + "px" : "", e.transform = "", e));
  17152. }
  17153. function Nt(t2) {
  17154. 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" };
  17155. 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 });
  17156. }
  17157. var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
  17158. function It(t2) {
  17159. 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);
  17160. return i2 && c.forEach(function(u) {
  17161. u.addEventListener("scroll", n.update, ye);
  17162. }), s && f.addEventListener("resize", n.update, ye), function() {
  17163. i2 && c.forEach(function(u) {
  17164. u.removeEventListener("scroll", n.update, ye);
  17165. }), s && f.removeEventListener("resize", n.update, ye);
  17166. };
  17167. }
  17168. var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
  17169. }, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
  17170. function be(t2) {
  17171. return t2.replace(/left|right|bottom|top/g, function(e) {
  17172. return _t[e];
  17173. });
  17174. }
  17175. var zt = { start: "end", end: "start" };
  17176. function lt(t2) {
  17177. return t2.replace(/start|end/g, function(e) {
  17178. return zt[e];
  17179. });
  17180. }
  17181. function We(t2) {
  17182. var e = H(t2), n = e.pageXOffset, r2 = e.pageYOffset;
  17183. return { scrollLeft: n, scrollTop: r2 };
  17184. }
  17185. function Be(t2) {
  17186. return ee(I(t2)).left + We(t2).scrollLeft;
  17187. }
  17188. function Ft(t2) {
  17189. var e = H(t2), n = I(t2), r2 = e.visualViewport, o = n.clientWidth, i2 = n.clientHeight, a = 0, s = 0;
  17190. 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 };
  17191. }
  17192. function Ut(t2) {
  17193. 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;
  17194. return N(o || n).direction === "rtl" && (s += X(n.clientWidth, o ? o.clientWidth : 0) - i2), { width: i2, height: a, x: s, y: f };
  17195. }
  17196. function Se(t2) {
  17197. var e = N(t2), n = e.overflow, r2 = e.overflowX, o = e.overflowY;
  17198. return /auto|scroll|overlay|hidden/.test(n + o + r2);
  17199. }
  17200. function dt(t2) {
  17201. return ["html", "body", "#document"].indexOf(C(t2)) >= 0 ? t2.ownerDocument.body : B(t2) && Se(t2) ? t2 : dt(ge(t2));
  17202. }
  17203. function ce(t2, e) {
  17204. var n;
  17205. e === void 0 && (e = []);
  17206. 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);
  17207. return o ? s : s.concat(ce(ge(a)));
  17208. }
  17209. function Te(t2) {
  17210. return Object.assign({}, t2, { left: t2.x, top: t2.y, right: t2.x + t2.width, bottom: t2.y + t2.height });
  17211. }
  17212. function Xt(t2) {
  17213. var e = ee(t2);
  17214. 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;
  17215. }
  17216. function ht(t2, e) {
  17217. return e === je ? Te(Ft(t2)) : Q(e) ? Xt(e) : Te(Ut(I(t2)));
  17218. }
  17219. function Yt(t2) {
  17220. var e = ce(ge(t2)), n = ["absolute", "fixed"].indexOf(N(t2).position) >= 0, r2 = n && B(t2) ? se(t2) : t2;
  17221. return Q(r2) ? e.filter(function(o) {
  17222. return Q(o) && it(o, r2) && C(o) !== "body";
  17223. }) : [];
  17224. }
  17225. function Gt(t2, e, n) {
  17226. var r2 = e === "clippingParents" ? Yt(t2) : [].concat(e), o = [].concat(r2, [n]), i2 = o[0], a = o.reduce(function(s, f) {
  17227. var c = ht(t2, f);
  17228. 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;
  17229. }, ht(t2, i2));
  17230. return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
  17231. }
  17232. function mt(t2) {
  17233. 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;
  17234. switch (o) {
  17235. case E:
  17236. f = { x: a, y: e.y - n.height };
  17237. break;
  17238. case R:
  17239. f = { x: a, y: e.y + e.height };
  17240. break;
  17241. case W:
  17242. f = { x: e.x + e.width, y: s };
  17243. break;
  17244. case P:
  17245. f = { x: e.x - n.width, y: s };
  17246. break;
  17247. default:
  17248. f = { x: e.x, y: e.y };
  17249. }
  17250. var c = o ? Le(o) : null;
  17251. if (c != null) {
  17252. var u = c === "y" ? "height" : "width";
  17253. switch (i2) {
  17254. case U:
  17255. f[c] = f[c] - (e[u] / 2 - n[u] / 2);
  17256. break;
  17257. case J:
  17258. f[c] = f[c] + (e[u] / 2 - n[u] / 2);
  17259. break;
  17260. }
  17261. }
  17262. return f;
  17263. }
  17264. function ne(t2, e) {
  17265. e === void 0 && (e = {});
  17266. 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;
  17267. if (u === K && A) {
  17268. var k = A[o];
  17269. Object.keys(j).forEach(function(D) {
  17270. var S = [W, R].indexOf(D) >= 0 ? 1 : -1, L = [E, R].indexOf(D) >= 0 ? "y" : "x";
  17271. j[D] += k[L] * S;
  17272. });
  17273. }
  17274. return j;
  17275. }
  17276. function Jt(t2, e) {
  17277. e === void 0 && (e = {});
  17278. 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) {
  17279. return te(h2) === u;
  17280. }) : G, v = m.filter(function(h2) {
  17281. return c.indexOf(h2) >= 0;
  17282. });
  17283. v.length === 0 && (v = m);
  17284. var l = v.reduce(function(h2, p) {
  17285. return h2[p] = ne(t2, { placement: p, boundary: o, rootBoundary: i2, padding: a })[q(p)], h2;
  17286. }, {});
  17287. return Object.keys(l).sort(function(h2, p) {
  17288. return l[h2] - l[p];
  17289. });
  17290. }
  17291. function Kt(t2) {
  17292. if (q(t2) === me)
  17293. return [];
  17294. var e = be(t2);
  17295. return [lt(t2), e, lt(e)];
  17296. }
  17297. function Qt(t2) {
  17298. var e = t2.state, n = t2.options, r2 = t2.name;
  17299. if (!e.modifiersData[r2]._skip) {
  17300. 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) {
  17301. return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u, rootBoundary: m, padding: c, flipVariations: h2, allowedAutoPlacements: p }) : V);
  17302. }, []), b = e.rects.reference, w = e.rects.popper, O = /* @__PURE__ */ new Map(), j = true, A = d2[0], k = 0; k < d2.length; k++) {
  17303. 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;
  17304. b[oe] > w[oe] && (T = be(T));
  17305. var pe = be(T), _ = [];
  17306. if (i2 && _.push(M[S] <= 0), s && _.push(M[T] <= 0, M[pe] <= 0), _.every(function(z) {
  17307. return z;
  17308. })) {
  17309. A = D, j = false;
  17310. break;
  17311. }
  17312. O.set(D, _);
  17313. }
  17314. if (j)
  17315. for (var ue = h2 ? 3 : 1, xe = function(z) {
  17316. var V = d2.find(function(de) {
  17317. var ae = O.get(de);
  17318. if (ae)
  17319. return ae.slice(0, z).every(function(Y) {
  17320. return Y;
  17321. });
  17322. });
  17323. if (V)
  17324. return A = V, "break";
  17325. }, ie = ue; ie > 0; ie--) {
  17326. var le = xe(ie);
  17327. if (le === "break")
  17328. break;
  17329. }
  17330. e.placement !== A && (e.modifiersData[r2]._skip = true, e.placement = A, e.reset = true);
  17331. }
  17332. }
  17333. var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
  17334. function gt(t2, e, n) {
  17335. 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 };
  17336. }
  17337. function yt(t2) {
  17338. return [E, W, R, P].some(function(e) {
  17339. return t2[e] >= 0;
  17340. });
  17341. }
  17342. function Zt(t2) {
  17343. 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);
  17344. 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 });
  17345. }
  17346. var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
  17347. function en$1(t2, e, n) {
  17348. 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];
  17349. return a = a || 0, s = (s || 0) * o, [P, W].indexOf(r2) >= 0 ? { x: s, y: a } : { x: a, y: s };
  17350. }
  17351. function tn(t2) {
  17352. 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) {
  17353. return u[m] = en$1(m, e.rects, i2), u;
  17354. }, {}), s = a[e.placement], f = s.x, c = s.y;
  17355. e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f, e.modifiersData.popperOffsets.y += c), e.modifiersData[r2] = a;
  17356. }
  17357. var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
  17358. function nn(t2) {
  17359. var e = t2.state, n = t2.name;
  17360. e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
  17361. }
  17362. var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
  17363. function rn(t2) {
  17364. return t2 === "x" ? "y" : "x";
  17365. }
  17366. function on$2(t2) {
  17367. 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 };
  17368. if (w) {
  17369. if (i2) {
  17370. 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) : _);
  17371. w[d2] = qe, S[d2] = qe - T;
  17372. }
  17373. if (s) {
  17374. 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);
  17375. w[b] = Ue, S[b] = Ue - F;
  17376. }
  17377. e.modifiersData[r2] = S;
  17378. }
  17379. }
  17380. var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on$2, requiresIfExists: ["offset"] };
  17381. function an(t2) {
  17382. return { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop };
  17383. }
  17384. function sn(t2) {
  17385. return t2 === H(t2) || !B(t2) ? We(t2) : an(t2);
  17386. }
  17387. function fn(t2) {
  17388. var e = t2.getBoundingClientRect(), n = Z(e.width) / t2.offsetWidth || 1, r2 = Z(e.height) / t2.offsetHeight || 1;
  17389. return n !== 1 || r2 !== 1;
  17390. }
  17391. function cn(t2, e, n) {
  17392. n === void 0 && (n = false);
  17393. 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 };
  17394. 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 };
  17395. }
  17396. function pn(t2) {
  17397. var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r2 = [];
  17398. t2.forEach(function(i2) {
  17399. e.set(i2.name, i2);
  17400. });
  17401. function o(i2) {
  17402. n.add(i2.name);
  17403. var a = [].concat(i2.requires || [], i2.requiresIfExists || []);
  17404. a.forEach(function(s) {
  17405. if (!n.has(s)) {
  17406. var f = e.get(s);
  17407. f && o(f);
  17408. }
  17409. }), r2.push(i2);
  17410. }
  17411. return t2.forEach(function(i2) {
  17412. n.has(i2.name) || o(i2);
  17413. }), r2;
  17414. }
  17415. function un(t2) {
  17416. var e = pn(t2);
  17417. return ot.reduce(function(n, r2) {
  17418. return n.concat(e.filter(function(o) {
  17419. return o.phase === r2;
  17420. }));
  17421. }, []);
  17422. }
  17423. function ln(t2) {
  17424. var e;
  17425. return function() {
  17426. return e || (e = new Promise(function(n) {
  17427. Promise.resolve().then(function() {
  17428. e = void 0, n(t2());
  17429. });
  17430. })), e;
  17431. };
  17432. }
  17433. function dn(t2) {
  17434. var e = t2.reduce(function(n, r2) {
  17435. var o = n[r2.name];
  17436. 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;
  17437. }, {});
  17438. return Object.keys(e).map(function(n) {
  17439. return e[n];
  17440. });
  17441. }
  17442. var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
  17443. function $t() {
  17444. for (var t2 = arguments.length, e = new Array(t2), n = 0; n < t2; n++)
  17445. e[n] = arguments[n];
  17446. return !e.some(function(r2) {
  17447. return !(r2 && typeof r2.getBoundingClientRect == "function");
  17448. });
  17449. }
  17450. function we(t2) {
  17451. t2 === void 0 && (t2 = {});
  17452. var e = t2, n = e.defaultModifiers, r2 = n === void 0 ? [] : n, o = e.defaultOptions, i2 = o === void 0 ? Ot : o;
  17453. return function(a, s, f) {
  17454. f === void 0 && (f = i2);
  17455. 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) {
  17456. var g = typeof p == "function" ? p(c.options) : p;
  17457. h2(), c.options = Object.assign({}, i2, c.options, g), c.scrollParents = { reference: Q(a) ? ce(a) : a.contextElement ? ce(a.contextElement) : [], popper: ce(s) };
  17458. var x = un(dn([].concat(r2, c.options.modifiers)));
  17459. return c.orderedModifiers = x.filter(function(y) {
  17460. return y.enabled;
  17461. }), l(), v.update();
  17462. }, forceUpdate: function() {
  17463. if (!m) {
  17464. var p = c.elements, g = p.reference, x = p.popper;
  17465. if ($t(g, x)) {
  17466. 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) {
  17467. return c.modifiersData[j.name] = Object.assign({}, j.data);
  17468. });
  17469. for (var y = 0; y < c.orderedModifiers.length; y++) {
  17470. if (c.reset === true) {
  17471. c.reset = false, y = -1;
  17472. continue;
  17473. }
  17474. var $2 = c.orderedModifiers[y], d2 = $2.fn, b = $2.options, w = b === void 0 ? {} : b, O = $2.name;
  17475. typeof d2 == "function" && (c = d2({ state: c, options: w, name: O, instance: v }) || c);
  17476. }
  17477. }
  17478. }
  17479. }, update: ln(function() {
  17480. return new Promise(function(p) {
  17481. v.forceUpdate(), p(c);
  17482. });
  17483. }), destroy: function() {
  17484. h2(), m = true;
  17485. } };
  17486. if (!$t(a, s))
  17487. return v;
  17488. v.setOptions(f).then(function(p) {
  17489. !m && f.onFirstUpdate && f.onFirstUpdate(p);
  17490. });
  17491. function l() {
  17492. c.orderedModifiers.forEach(function(p) {
  17493. var g = p.name, x = p.options, y = x === void 0 ? {} : x, $2 = p.effect;
  17494. if (typeof $2 == "function") {
  17495. var d2 = $2({ state: c, name: g, instance: v, options: y }), b = function() {
  17496. };
  17497. u.push(d2 || b);
  17498. }
  17499. });
  17500. }
  17501. function h2() {
  17502. u.forEach(function(p) {
  17503. return p();
  17504. }), u = [];
  17505. }
  17506. return v;
  17507. };
  17508. }
  17509. we();
  17510. var mn = [Re, He, Me, Ae];
  17511. we({ defaultModifiers: mn });
  17512. var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
  17513. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  17514. const stateUpdater = {
  17515. name: "updateState",
  17516. enabled: true,
  17517. phase: "write",
  17518. fn: ({ state }) => {
  17519. const derivedState = deriveState(state);
  17520. Object.assign(states.value, derivedState);
  17521. },
  17522. requires: ["computeStyles"]
  17523. };
  17524. const options2 = computed$1(() => {
  17525. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  17526. return {
  17527. onFirstUpdate,
  17528. placement: placement || "bottom",
  17529. strategy: strategy || "absolute",
  17530. modifiers: [
  17531. ...modifiers || [],
  17532. stateUpdater,
  17533. { name: "applyStyles", enabled: false }
  17534. ]
  17535. };
  17536. });
  17537. const instanceRef = shallowRef();
  17538. const states = ref({
  17539. styles: {
  17540. popper: {
  17541. position: unref(options2).strategy,
  17542. left: "0",
  17543. top: "0"
  17544. },
  17545. arrow: {
  17546. position: "absolute"
  17547. }
  17548. },
  17549. attributes: {}
  17550. });
  17551. const destroy = () => {
  17552. if (!instanceRef.value)
  17553. return;
  17554. instanceRef.value.destroy();
  17555. instanceRef.value = void 0;
  17556. };
  17557. watch(options2, (newOptions) => {
  17558. const instance = unref(instanceRef);
  17559. if (instance) {
  17560. instance.setOptions(newOptions);
  17561. }
  17562. }, {
  17563. deep: true
  17564. });
  17565. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  17566. destroy();
  17567. if (!referenceElement || !popperElement)
  17568. return;
  17569. instanceRef.value = yn(referenceElement, popperElement, unref(options2));
  17570. });
  17571. onBeforeUnmount(() => {
  17572. destroy();
  17573. });
  17574. return {
  17575. state: computed$1(() => {
  17576. var _a2;
  17577. return { ...((_a2 = unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
  17578. }),
  17579. styles: computed$1(() => unref(states).styles),
  17580. attributes: computed$1(() => unref(states).attributes),
  17581. update: () => {
  17582. var _a2;
  17583. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.update();
  17584. },
  17585. forceUpdate: () => {
  17586. var _a2;
  17587. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
  17588. },
  17589. instanceRef: computed$1(() => unref(instanceRef))
  17590. };
  17591. };
  17592. function deriveState(state) {
  17593. const elements = Object.keys(state.elements);
  17594. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  17595. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  17596. return {
  17597. styles,
  17598. attributes
  17599. };
  17600. }
  17601. const useSameTarget = (handleClick) => {
  17602. if (!handleClick) {
  17603. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  17604. }
  17605. let mousedownTarget = false;
  17606. let mouseupTarget = false;
  17607. const onClick = (e) => {
  17608. if (mousedownTarget && mouseupTarget) {
  17609. handleClick(e);
  17610. }
  17611. mousedownTarget = mouseupTarget = false;
  17612. };
  17613. const onMousedown = (e) => {
  17614. mousedownTarget = e.target === e.currentTarget;
  17615. };
  17616. const onMouseup = (e) => {
  17617. mouseupTarget = e.target === e.currentTarget;
  17618. };
  17619. return { onClick, onMousedown, onMouseup };
  17620. };
  17621. function useTimeout() {
  17622. let timeoutHandle;
  17623. const registerTimeout = (fn2, delay) => {
  17624. cancelTimeout();
  17625. timeoutHandle = window.setTimeout(fn2, delay);
  17626. };
  17627. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  17628. tryOnScopeDispose(() => cancelTimeout());
  17629. return {
  17630. registerTimeout,
  17631. cancelTimeout
  17632. };
  17633. }
  17634. const defaultIdInjection = {
  17635. prefix: Math.floor(Math.random() * 1e4),
  17636. current: 0
  17637. };
  17638. const ID_INJECTION_KEY = Symbol("elIdInjection");
  17639. const useIdInjection = () => {
  17640. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  17641. };
  17642. const useId = (deterministicId) => {
  17643. const idInjection = useIdInjection();
  17644. const namespace = useGetDerivedNamespace();
  17645. const idRef = computed$1(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  17646. return idRef;
  17647. };
  17648. let registeredEscapeHandlers = [];
  17649. const cachedHandler = (e) => {
  17650. const event2 = e;
  17651. if (event2.key === EVENT_CODE.esc) {
  17652. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event2));
  17653. }
  17654. };
  17655. const useEscapeKeydown = (handler) => {
  17656. onMounted(() => {
  17657. if (registeredEscapeHandlers.length === 0) {
  17658. document.addEventListener("keydown", cachedHandler);
  17659. }
  17660. if (isClient)
  17661. registeredEscapeHandlers.push(handler);
  17662. });
  17663. onBeforeUnmount(() => {
  17664. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  17665. if (registeredEscapeHandlers.length === 0) {
  17666. if (isClient)
  17667. document.removeEventListener("keydown", cachedHandler);
  17668. }
  17669. });
  17670. };
  17671. let cachedContainer;
  17672. const usePopperContainerId = () => {
  17673. const namespace = useGetDerivedNamespace();
  17674. const idInjection = useIdInjection();
  17675. const id = computed$1(() => {
  17676. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  17677. });
  17678. const selector = computed$1(() => `#${id.value}`);
  17679. return {
  17680. id,
  17681. selector
  17682. };
  17683. };
  17684. const createContainer = (id) => {
  17685. const container = document.createElement("div");
  17686. container.id = id;
  17687. document.body.appendChild(container);
  17688. return container;
  17689. };
  17690. const usePopperContainer = () => {
  17691. const { id, selector } = usePopperContainerId();
  17692. onBeforeMount(() => {
  17693. if (!isClient)
  17694. return;
  17695. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  17696. cachedContainer = createContainer(id.value);
  17697. }
  17698. });
  17699. return {
  17700. id,
  17701. selector
  17702. };
  17703. };
  17704. const useDelayedToggleProps = buildProps({
  17705. showAfter: {
  17706. type: Number,
  17707. default: 0
  17708. },
  17709. hideAfter: {
  17710. type: Number,
  17711. default: 200
  17712. },
  17713. autoClose: {
  17714. type: Number,
  17715. default: 0
  17716. }
  17717. });
  17718. const useDelayedToggle = ({
  17719. showAfter,
  17720. hideAfter,
  17721. autoClose,
  17722. open,
  17723. close
  17724. }) => {
  17725. const { registerTimeout } = useTimeout();
  17726. const {
  17727. registerTimeout: registerTimeoutForAutoClose,
  17728. cancelTimeout: cancelTimeoutForAutoClose
  17729. } = useTimeout();
  17730. const onOpen = (event2) => {
  17731. registerTimeout(() => {
  17732. open(event2);
  17733. const _autoClose = unref(autoClose);
  17734. if (isNumber(_autoClose) && _autoClose > 0) {
  17735. registerTimeoutForAutoClose(() => {
  17736. close(event2);
  17737. }, _autoClose);
  17738. }
  17739. }, unref(showAfter));
  17740. };
  17741. const onClose = (event2) => {
  17742. cancelTimeoutForAutoClose();
  17743. registerTimeout(() => {
  17744. close(event2);
  17745. }, unref(hideAfter));
  17746. };
  17747. return {
  17748. onOpen,
  17749. onClose
  17750. };
  17751. };
  17752. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  17753. const useForwardRef = (forwardRef) => {
  17754. const setForwardRef = (el) => {
  17755. forwardRef.value = el;
  17756. };
  17757. provide(FORWARD_REF_INJECTION_KEY, {
  17758. setForwardRef
  17759. });
  17760. };
  17761. const useForwardRefDirective = (setForwardRef) => {
  17762. return {
  17763. mounted(el) {
  17764. setForwardRef(el);
  17765. },
  17766. updated(el) {
  17767. setForwardRef(el);
  17768. },
  17769. unmounted() {
  17770. setForwardRef(null);
  17771. }
  17772. };
  17773. };
  17774. const zIndex = ref(0);
  17775. const defaultInitialZIndex = 2e3;
  17776. const zIndexContextKey = Symbol("zIndexContextKey");
  17777. const useZIndex = (zIndexOverrides) => {
  17778. const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, void 0);
  17779. const initialZIndex = computed$1(() => {
  17780. const zIndexFromInjection = unref(zIndexInjection);
  17781. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  17782. });
  17783. const currentZIndex = computed$1(() => initialZIndex.value + zIndex.value);
  17784. const nextZIndex = () => {
  17785. zIndex.value++;
  17786. return currentZIndex.value;
  17787. };
  17788. return {
  17789. initialZIndex,
  17790. currentZIndex,
  17791. nextZIndex
  17792. };
  17793. };
  17794. function useCursor(input) {
  17795. const selectionRef = ref();
  17796. function recordCursor() {
  17797. if (input.value == void 0)
  17798. return;
  17799. const { selectionStart, selectionEnd, value } = input.value;
  17800. if (selectionStart == null || selectionEnd == null)
  17801. return;
  17802. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  17803. const afterTxt = value.slice(Math.max(0, selectionEnd));
  17804. selectionRef.value = {
  17805. selectionStart,
  17806. selectionEnd,
  17807. value,
  17808. beforeTxt,
  17809. afterTxt
  17810. };
  17811. }
  17812. function setCursor() {
  17813. if (input.value == void 0 || selectionRef.value == void 0)
  17814. return;
  17815. const { value } = input.value;
  17816. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  17817. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  17818. return;
  17819. let startPos = value.length;
  17820. if (value.endsWith(afterTxt)) {
  17821. startPos = value.length - afterTxt.length;
  17822. } else if (value.startsWith(beforeTxt)) {
  17823. startPos = beforeTxt.length;
  17824. } else {
  17825. const beforeLastChar = beforeTxt[selectionStart - 1];
  17826. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  17827. if (newIndex !== -1) {
  17828. startPos = newIndex + 1;
  17829. }
  17830. }
  17831. input.value.setSelectionRange(startPos, startPos);
  17832. }
  17833. return [recordCursor, setCursor];
  17834. }
  17835. const useSizeProp = buildProp({
  17836. type: String,
  17837. values: componentSizes,
  17838. required: false
  17839. });
  17840. const SIZE_INJECTION_KEY = Symbol("size");
  17841. const useGlobalSize = () => {
  17842. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  17843. return computed$1(() => {
  17844. return unref(injectedSize.size) || "";
  17845. });
  17846. };
  17847. const configProviderContextKey = Symbol();
  17848. const globalConfig = ref();
  17849. function useGlobalConfig(key, defaultValue2 = void 0) {
  17850. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  17851. if (key) {
  17852. return computed$1(() => {
  17853. var _a2, _b;
  17854. return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue2;
  17855. });
  17856. } else {
  17857. return config;
  17858. }
  17859. }
  17860. const provideGlobalConfig = (config, app, global2 = false) => {
  17861. var _a2;
  17862. const inSetup = !!getCurrentInstance();
  17863. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  17864. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  17865. if (!provideFn) {
  17866. return;
  17867. }
  17868. const context = computed$1(() => {
  17869. const cfg = unref(config);
  17870. if (!(oldConfig == null ? void 0 : oldConfig.value))
  17871. return cfg;
  17872. return mergeConfig(oldConfig.value, cfg);
  17873. });
  17874. provideFn(configProviderContextKey, context);
  17875. provideFn(localeContextKey, computed$1(() => context.value.locale));
  17876. provideFn(namespaceContextKey, computed$1(() => context.value.namespace));
  17877. provideFn(zIndexContextKey, computed$1(() => context.value.zIndex));
  17878. provideFn(SIZE_INJECTION_KEY, {
  17879. size: computed$1(() => context.value.size || "")
  17880. });
  17881. if (global2 || !globalConfig.value) {
  17882. globalConfig.value = context.value;
  17883. }
  17884. return context;
  17885. };
  17886. const mergeConfig = (a, b) => {
  17887. var _a2;
  17888. const keys3 = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  17889. const obj = {};
  17890. for (const key of keys3) {
  17891. obj[key] = (_a2 = b[key]) != null ? _a2 : a[key];
  17892. }
  17893. return obj;
  17894. };
  17895. const configProviderProps = buildProps({
  17896. a11y: {
  17897. type: Boolean,
  17898. default: true
  17899. },
  17900. locale: {
  17901. type: definePropType(Object)
  17902. },
  17903. size: useSizeProp,
  17904. button: {
  17905. type: definePropType(Object)
  17906. },
  17907. experimentalFeatures: {
  17908. type: definePropType(Object)
  17909. },
  17910. keyboardNavigation: {
  17911. type: Boolean,
  17912. default: true
  17913. },
  17914. message: {
  17915. type: definePropType(Object)
  17916. },
  17917. zIndex: Number,
  17918. namespace: {
  17919. type: String,
  17920. default: "el"
  17921. }
  17922. });
  17923. const messageConfig = {};
  17924. const ConfigProvider = defineComponent({
  17925. name: "ElConfigProvider",
  17926. props: configProviderProps,
  17927. setup(props, { slots }) {
  17928. watch(() => props.message, (val) => {
  17929. Object.assign(messageConfig, val != null ? val : {});
  17930. }, { immediate: true, deep: true });
  17931. const config = provideGlobalConfig(props);
  17932. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  17933. }
  17934. });
  17935. const ElConfigProvider = withInstall(ConfigProvider);
  17936. var _export_sfc$1 = (sfc, props) => {
  17937. const target = sfc.__vccOpts || sfc;
  17938. for (const [key, val] of props) {
  17939. target[key] = val;
  17940. }
  17941. return target;
  17942. };
  17943. const iconProps = buildProps({
  17944. size: {
  17945. type: definePropType([Number, String])
  17946. },
  17947. color: {
  17948. type: String
  17949. }
  17950. });
  17951. const __default__$o = defineComponent({
  17952. name: "ElIcon",
  17953. inheritAttrs: false
  17954. });
  17955. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  17956. ...__default__$o,
  17957. props: iconProps,
  17958. setup(__props) {
  17959. const props = __props;
  17960. const ns = useNamespace("icon");
  17961. const style = computed$1(() => {
  17962. const { size, color: color2 } = props;
  17963. if (!size && !color2)
  17964. return {};
  17965. return {
  17966. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  17967. "--color": color2
  17968. };
  17969. });
  17970. return (_ctx, _cache) => {
  17971. return openBlock(), createElementBlock("i", mergeProps({
  17972. class: unref(ns).b(),
  17973. style: unref(style)
  17974. }, _ctx.$attrs), [
  17975. renderSlot(_ctx.$slots, "default")
  17976. ], 16);
  17977. };
  17978. }
  17979. });
  17980. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  17981. const ElIcon = withInstall(Icon);
  17982. const formContextKey = Symbol("formContextKey");
  17983. const formItemContextKey = Symbol("formItemContextKey");
  17984. const useFormSize = (fallback, ignore = {}) => {
  17985. const emptyRef = ref(void 0);
  17986. const size = ignore.prop ? emptyRef : useProp("size");
  17987. const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
  17988. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  17989. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  17990. return computed$1(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  17991. };
  17992. const useFormDisabled = (fallback) => {
  17993. const disabled = useProp("disabled");
  17994. const form = inject(formContextKey, void 0);
  17995. return computed$1(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  17996. };
  17997. const useFormItem = () => {
  17998. const form = inject(formContextKey, void 0);
  17999. const formItem = inject(formItemContextKey, void 0);
  18000. return {
  18001. form,
  18002. formItem
  18003. };
  18004. };
  18005. const useFormItemInputId = (props, {
  18006. formItemContext,
  18007. disableIdGeneration,
  18008. disableIdManagement
  18009. }) => {
  18010. if (!disableIdGeneration) {
  18011. disableIdGeneration = ref(false);
  18012. }
  18013. if (!disableIdManagement) {
  18014. disableIdManagement = ref(false);
  18015. }
  18016. const inputId = ref();
  18017. let idUnwatch = void 0;
  18018. const isLabeledByFormItem = computed$1(() => {
  18019. var _a2;
  18020. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
  18021. });
  18022. onMounted(() => {
  18023. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  18024. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  18025. if (newId !== inputId.value) {
  18026. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  18027. inputId.value && formItemContext.removeInputId(inputId.value);
  18028. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  18029. formItemContext.addInputId(newId);
  18030. }
  18031. }
  18032. inputId.value = newId;
  18033. }
  18034. }, { immediate: true });
  18035. });
  18036. onUnmounted(() => {
  18037. idUnwatch && idUnwatch();
  18038. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  18039. inputId.value && formItemContext.removeInputId(inputId.value);
  18040. }
  18041. });
  18042. return {
  18043. isLabeledByFormItem,
  18044. inputId
  18045. };
  18046. };
  18047. let hiddenTextarea = void 0;
  18048. const HIDDEN_STYLE = `
  18049. height:0 !important;
  18050. visibility:hidden !important;
  18051. ${isFirefox() ? "" : "overflow:hidden !important;"}
  18052. position:absolute !important;
  18053. z-index:-1000 !important;
  18054. top:0 !important;
  18055. right:0 !important;
  18056. `;
  18057. const CONTEXT_STYLE = [
  18058. "letter-spacing",
  18059. "line-height",
  18060. "padding-top",
  18061. "padding-bottom",
  18062. "font-family",
  18063. "font-weight",
  18064. "font-size",
  18065. "text-rendering",
  18066. "text-transform",
  18067. "width",
  18068. "text-indent",
  18069. "padding-left",
  18070. "padding-right",
  18071. "border-width",
  18072. "box-sizing"
  18073. ];
  18074. function calculateNodeStyling(targetElement) {
  18075. const style = window.getComputedStyle(targetElement);
  18076. const boxSizing = style.getPropertyValue("box-sizing");
  18077. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  18078. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  18079. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  18080. return { contextStyle, paddingSize, borderSize, boxSizing };
  18081. }
  18082. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  18083. var _a2;
  18084. if (!hiddenTextarea) {
  18085. hiddenTextarea = document.createElement("textarea");
  18086. document.body.appendChild(hiddenTextarea);
  18087. }
  18088. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  18089. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  18090. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  18091. let height2 = hiddenTextarea.scrollHeight;
  18092. const result = {};
  18093. if (boxSizing === "border-box") {
  18094. height2 = height2 + borderSize;
  18095. } else if (boxSizing === "content-box") {
  18096. height2 = height2 - paddingSize;
  18097. }
  18098. hiddenTextarea.value = "";
  18099. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  18100. if (isNumber(minRows)) {
  18101. let minHeight = singleRowHeight * minRows;
  18102. if (boxSizing === "border-box") {
  18103. minHeight = minHeight + paddingSize + borderSize;
  18104. }
  18105. height2 = Math.max(minHeight, height2);
  18106. result.minHeight = `${minHeight}px`;
  18107. }
  18108. if (isNumber(maxRows)) {
  18109. let maxHeight = singleRowHeight * maxRows;
  18110. if (boxSizing === "border-box") {
  18111. maxHeight = maxHeight + paddingSize + borderSize;
  18112. }
  18113. height2 = Math.min(maxHeight, height2);
  18114. }
  18115. result.height = `${height2}px`;
  18116. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  18117. hiddenTextarea = void 0;
  18118. return result;
  18119. }
  18120. const inputProps = buildProps({
  18121. id: {
  18122. type: String,
  18123. default: void 0
  18124. },
  18125. size: useSizeProp,
  18126. disabled: Boolean,
  18127. modelValue: {
  18128. type: definePropType([
  18129. String,
  18130. Number,
  18131. Object
  18132. ]),
  18133. default: ""
  18134. },
  18135. type: {
  18136. type: String,
  18137. default: "text"
  18138. },
  18139. resize: {
  18140. type: String,
  18141. values: ["none", "both", "horizontal", "vertical"]
  18142. },
  18143. autosize: {
  18144. type: definePropType([Boolean, Object]),
  18145. default: false
  18146. },
  18147. autocomplete: {
  18148. type: String,
  18149. default: "off"
  18150. },
  18151. formatter: {
  18152. type: Function
  18153. },
  18154. parser: {
  18155. type: Function
  18156. },
  18157. placeholder: {
  18158. type: String
  18159. },
  18160. form: {
  18161. type: String
  18162. },
  18163. readonly: {
  18164. type: Boolean,
  18165. default: false
  18166. },
  18167. clearable: {
  18168. type: Boolean,
  18169. default: false
  18170. },
  18171. showPassword: {
  18172. type: Boolean,
  18173. default: false
  18174. },
  18175. showWordLimit: {
  18176. type: Boolean,
  18177. default: false
  18178. },
  18179. suffixIcon: {
  18180. type: iconPropType
  18181. },
  18182. prefixIcon: {
  18183. type: iconPropType
  18184. },
  18185. containerRole: {
  18186. type: String,
  18187. default: void 0
  18188. },
  18189. label: {
  18190. type: String,
  18191. default: void 0
  18192. },
  18193. tabindex: {
  18194. type: [String, Number],
  18195. default: 0
  18196. },
  18197. validateEvent: {
  18198. type: Boolean,
  18199. default: true
  18200. },
  18201. inputStyle: {
  18202. type: definePropType([Object, Array, String]),
  18203. default: () => mutable({})
  18204. }
  18205. });
  18206. const inputEmits = {
  18207. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  18208. input: (value) => isString(value),
  18209. change: (value) => isString(value),
  18210. focus: (evt) => evt instanceof FocusEvent,
  18211. blur: (evt) => evt instanceof FocusEvent,
  18212. clear: () => true,
  18213. mouseleave: (evt) => evt instanceof MouseEvent,
  18214. mouseenter: (evt) => evt instanceof MouseEvent,
  18215. keydown: (evt) => evt instanceof Event,
  18216. compositionstart: (evt) => evt instanceof CompositionEvent,
  18217. compositionupdate: (evt) => evt instanceof CompositionEvent,
  18218. compositionend: (evt) => evt instanceof CompositionEvent
  18219. };
  18220. const _hoisted_1$g = ["role"];
  18221. const _hoisted_2$a = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  18222. const _hoisted_3$6 = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  18223. const __default__$n = defineComponent({
  18224. name: "ElInput",
  18225. inheritAttrs: false
  18226. });
  18227. const _sfc_main$A = /* @__PURE__ */ defineComponent({
  18228. ...__default__$n,
  18229. props: inputProps,
  18230. emits: inputEmits,
  18231. setup(__props, { expose, emit }) {
  18232. const props = __props;
  18233. const rawAttrs = useAttrs$1();
  18234. const slots = useSlots();
  18235. const containerAttrs = computed$1(() => {
  18236. const comboBoxAttrs = {};
  18237. if (props.containerRole === "combobox") {
  18238. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  18239. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  18240. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  18241. }
  18242. return comboBoxAttrs;
  18243. });
  18244. const containerKls = computed$1(() => [
  18245. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  18246. nsInput.m(inputSize.value),
  18247. nsInput.is("disabled", inputDisabled.value),
  18248. nsInput.is("exceed", inputExceed.value),
  18249. {
  18250. [nsInput.b("group")]: slots.prepend || slots.append,
  18251. [nsInput.bm("group", "append")]: slots.append,
  18252. [nsInput.bm("group", "prepend")]: slots.prepend,
  18253. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  18254. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  18255. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  18256. },
  18257. rawAttrs.class
  18258. ]);
  18259. const wrapperKls = computed$1(() => [
  18260. nsInput.e("wrapper"),
  18261. nsInput.is("focus", focused.value)
  18262. ]);
  18263. const attrs = useAttrs({
  18264. excludeKeys: computed$1(() => {
  18265. return Object.keys(containerAttrs.value);
  18266. })
  18267. });
  18268. const { form, formItem } = useFormItem();
  18269. const { inputId } = useFormItemInputId(props, {
  18270. formItemContext: formItem
  18271. });
  18272. const inputSize = useFormSize();
  18273. const inputDisabled = useFormDisabled();
  18274. const nsInput = useNamespace("input");
  18275. const nsTextarea = useNamespace("textarea");
  18276. const input = shallowRef();
  18277. const textarea = shallowRef();
  18278. const focused = ref(false);
  18279. const hovering = ref(false);
  18280. const isComposing = ref(false);
  18281. const passwordVisible = ref(false);
  18282. const countStyle = ref();
  18283. const textareaCalcStyle = shallowRef(props.inputStyle);
  18284. const _ref = computed$1(() => input.value || textarea.value);
  18285. const needStatusIcon = computed$1(() => {
  18286. var _a2;
  18287. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  18288. });
  18289. const validateState = computed$1(() => (formItem == null ? void 0 : formItem.validateState) || "");
  18290. const validateIcon = computed$1(() => validateState.value && ValidateComponentsMap[validateState.value]);
  18291. const passwordIcon = computed$1(() => passwordVisible.value ? view_default : hide_default);
  18292. const containerStyle = computed$1(() => [
  18293. rawAttrs.style,
  18294. props.inputStyle
  18295. ]);
  18296. const textareaStyle = computed$1(() => [
  18297. props.inputStyle,
  18298. textareaCalcStyle.value,
  18299. { resize: props.resize }
  18300. ]);
  18301. const nativeInputValue = computed$1(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  18302. const showClear = computed$1(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  18303. const showPwdVisible = computed$1(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  18304. const isWordLimitVisible = computed$1(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  18305. const textLength = computed$1(() => nativeInputValue.value.length);
  18306. const inputExceed = computed$1(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  18307. const suffixVisible = computed$1(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  18308. const [recordCursor, setCursor] = useCursor(input);
  18309. useResizeObserver(textarea, (entries) => {
  18310. onceInitSizeTextarea();
  18311. if (!isWordLimitVisible.value || props.resize !== "both")
  18312. return;
  18313. const entry = entries[0];
  18314. const { width: width2 } = entry.contentRect;
  18315. countStyle.value = {
  18316. right: `calc(100% - ${width2 + 15 + 6}px)`
  18317. };
  18318. });
  18319. const resizeTextarea = () => {
  18320. const { type: type2, autosize } = props;
  18321. if (!isClient || type2 !== "textarea" || !textarea.value)
  18322. return;
  18323. if (autosize) {
  18324. const minRows = isObject$5(autosize) ? autosize.minRows : void 0;
  18325. const maxRows = isObject$5(autosize) ? autosize.maxRows : void 0;
  18326. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  18327. textareaCalcStyle.value = {
  18328. overflowY: "hidden",
  18329. ...textareaStyle2
  18330. };
  18331. nextTick(() => {
  18332. textarea.value.offsetHeight;
  18333. textareaCalcStyle.value = textareaStyle2;
  18334. });
  18335. } else {
  18336. textareaCalcStyle.value = {
  18337. minHeight: calcTextareaHeight(textarea.value).minHeight
  18338. };
  18339. }
  18340. };
  18341. const createOnceInitResize = (resizeTextarea2) => {
  18342. let isInit = false;
  18343. return () => {
  18344. var _a2;
  18345. if (isInit || !props.autosize)
  18346. return;
  18347. const isElHidden = ((_a2 = textarea.value) == null ? void 0 : _a2.offsetParent) === null;
  18348. if (!isElHidden) {
  18349. resizeTextarea2();
  18350. isInit = true;
  18351. }
  18352. };
  18353. };
  18354. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  18355. const setNativeInputValue = () => {
  18356. const input2 = _ref.value;
  18357. if (!input2 || input2.value === nativeInputValue.value)
  18358. return;
  18359. input2.value = nativeInputValue.value;
  18360. };
  18361. const handleInput = async (event2) => {
  18362. recordCursor();
  18363. let { value } = event2.target;
  18364. if (props.formatter) {
  18365. value = props.parser ? props.parser(value) : value;
  18366. value = props.formatter(value);
  18367. }
  18368. if (isComposing.value)
  18369. return;
  18370. if (value === nativeInputValue.value) {
  18371. setNativeInputValue();
  18372. return;
  18373. }
  18374. emit(UPDATE_MODEL_EVENT, value);
  18375. emit("input", value);
  18376. await nextTick();
  18377. setNativeInputValue();
  18378. setCursor();
  18379. };
  18380. const handleChange = (event2) => {
  18381. emit("change", event2.target.value);
  18382. };
  18383. const handleCompositionStart = (event2) => {
  18384. emit("compositionstart", event2);
  18385. isComposing.value = true;
  18386. };
  18387. const handleCompositionUpdate = (event2) => {
  18388. var _a2;
  18389. emit("compositionupdate", event2);
  18390. const text = (_a2 = event2.target) == null ? void 0 : _a2.value;
  18391. const lastCharacter = text[text.length - 1] || "";
  18392. isComposing.value = !isKorean(lastCharacter);
  18393. };
  18394. const handleCompositionEnd = (event2) => {
  18395. emit("compositionend", event2);
  18396. if (isComposing.value) {
  18397. isComposing.value = false;
  18398. handleInput(event2);
  18399. }
  18400. };
  18401. const handlePasswordVisible = () => {
  18402. passwordVisible.value = !passwordVisible.value;
  18403. focus();
  18404. };
  18405. const focus = async () => {
  18406. var _a2;
  18407. await nextTick();
  18408. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  18409. };
  18410. const blur = () => {
  18411. var _a2;
  18412. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  18413. };
  18414. const handleFocus = (event2) => {
  18415. focused.value = true;
  18416. emit("focus", event2);
  18417. };
  18418. const handleBlur = (event2) => {
  18419. var _a2;
  18420. focused.value = false;
  18421. emit("blur", event2);
  18422. if (props.validateEvent) {
  18423. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18424. }
  18425. };
  18426. const handleMouseLeave = (evt) => {
  18427. hovering.value = false;
  18428. emit("mouseleave", evt);
  18429. };
  18430. const handleMouseEnter = (evt) => {
  18431. hovering.value = true;
  18432. emit("mouseenter", evt);
  18433. };
  18434. const handleKeydown = (evt) => {
  18435. emit("keydown", evt);
  18436. };
  18437. const select = () => {
  18438. var _a2;
  18439. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  18440. };
  18441. const clear = () => {
  18442. emit(UPDATE_MODEL_EVENT, "");
  18443. emit("change", "");
  18444. emit("clear");
  18445. emit("input", "");
  18446. };
  18447. watch(() => props.modelValue, () => {
  18448. var _a2;
  18449. nextTick(() => resizeTextarea());
  18450. if (props.validateEvent) {
  18451. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18452. }
  18453. });
  18454. watch(nativeInputValue, () => setNativeInputValue());
  18455. watch(() => props.type, async () => {
  18456. await nextTick();
  18457. setNativeInputValue();
  18458. resizeTextarea();
  18459. });
  18460. onMounted(() => {
  18461. if (!props.formatter && props.parser)
  18462. ;
  18463. setNativeInputValue();
  18464. nextTick(resizeTextarea);
  18465. });
  18466. expose({
  18467. input,
  18468. textarea,
  18469. ref: _ref,
  18470. textareaStyle,
  18471. autosize: toRef(props, "autosize"),
  18472. focus,
  18473. blur,
  18474. select,
  18475. clear,
  18476. resizeTextarea
  18477. });
  18478. return (_ctx, _cache) => {
  18479. return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(containerAttrs), {
  18480. class: unref(containerKls),
  18481. style: unref(containerStyle),
  18482. role: _ctx.containerRole,
  18483. onMouseenter: handleMouseEnter,
  18484. onMouseleave: handleMouseLeave
  18485. }), [
  18486. createCommentVNode(" input "),
  18487. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18488. createCommentVNode(" prepend slot "),
  18489. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  18490. key: 0,
  18491. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  18492. }, [
  18493. renderSlot(_ctx.$slots, "prepend")
  18494. ], 2)) : createCommentVNode("v-if", true),
  18495. createElementVNode("div", {
  18496. class: normalizeClass(unref(wrapperKls))
  18497. }, [
  18498. createCommentVNode(" prefix slot "),
  18499. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  18500. key: 0,
  18501. class: normalizeClass(unref(nsInput).e("prefix"))
  18502. }, [
  18503. createElementVNode("span", {
  18504. class: normalizeClass(unref(nsInput).e("prefix-inner")),
  18505. onClick: focus
  18506. }, [
  18507. renderSlot(_ctx.$slots, "prefix"),
  18508. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18509. key: 0,
  18510. class: normalizeClass(unref(nsInput).e("icon"))
  18511. }, {
  18512. default: withCtx(() => [
  18513. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  18514. ]),
  18515. _: 1
  18516. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18517. ], 2)
  18518. ], 2)) : createCommentVNode("v-if", true),
  18519. createElementVNode("input", mergeProps({
  18520. id: unref(inputId),
  18521. ref_key: "input",
  18522. ref: input,
  18523. class: unref(nsInput).e("inner")
  18524. }, unref(attrs), {
  18525. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  18526. disabled: unref(inputDisabled),
  18527. formatter: _ctx.formatter,
  18528. parser: _ctx.parser,
  18529. readonly: _ctx.readonly,
  18530. autocomplete: _ctx.autocomplete,
  18531. tabindex: _ctx.tabindex,
  18532. "aria-label": _ctx.label,
  18533. placeholder: _ctx.placeholder,
  18534. style: _ctx.inputStyle,
  18535. form: props.form,
  18536. onCompositionstart: handleCompositionStart,
  18537. onCompositionupdate: handleCompositionUpdate,
  18538. onCompositionend: handleCompositionEnd,
  18539. onInput: handleInput,
  18540. onFocus: handleFocus,
  18541. onBlur: handleBlur,
  18542. onChange: handleChange,
  18543. onKeydown: handleKeydown
  18544. }), null, 16, _hoisted_2$a),
  18545. createCommentVNode(" suffix slot "),
  18546. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  18547. key: 1,
  18548. class: normalizeClass(unref(nsInput).e("suffix"))
  18549. }, [
  18550. createElementVNode("span", {
  18551. class: normalizeClass(unref(nsInput).e("suffix-inner")),
  18552. onClick: focus
  18553. }, [
  18554. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18555. renderSlot(_ctx.$slots, "suffix"),
  18556. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18557. key: 0,
  18558. class: normalizeClass(unref(nsInput).e("icon"))
  18559. }, {
  18560. default: withCtx(() => [
  18561. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  18562. ]),
  18563. _: 1
  18564. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18565. ], 64)) : createCommentVNode("v-if", true),
  18566. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  18567. key: 1,
  18568. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  18569. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18570. onClick: clear
  18571. }, {
  18572. default: withCtx(() => [
  18573. createVNode(unref(circle_close_default))
  18574. ]),
  18575. _: 1
  18576. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  18577. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  18578. key: 2,
  18579. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  18580. onClick: handlePasswordVisible
  18581. }, {
  18582. default: withCtx(() => [
  18583. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  18584. ]),
  18585. _: 1
  18586. }, 8, ["class"])) : createCommentVNode("v-if", true),
  18587. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18588. key: 3,
  18589. class: normalizeClass(unref(nsInput).e("count"))
  18590. }, [
  18591. createElementVNode("span", {
  18592. class: normalizeClass(unref(nsInput).e("count-inner"))
  18593. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  18594. ], 2)) : createCommentVNode("v-if", true),
  18595. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18596. key: 4,
  18597. class: normalizeClass([
  18598. unref(nsInput).e("icon"),
  18599. unref(nsInput).e("validateIcon"),
  18600. unref(nsInput).is("loading", unref(validateState) === "validating")
  18601. ])
  18602. }, {
  18603. default: withCtx(() => [
  18604. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  18605. ]),
  18606. _: 1
  18607. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18608. ], 2)
  18609. ], 2)) : createCommentVNode("v-if", true)
  18610. ], 2),
  18611. createCommentVNode(" append slot "),
  18612. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  18613. key: 1,
  18614. class: normalizeClass(unref(nsInput).be("group", "append"))
  18615. }, [
  18616. renderSlot(_ctx.$slots, "append")
  18617. ], 2)) : createCommentVNode("v-if", true)
  18618. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  18619. createCommentVNode(" textarea "),
  18620. createElementVNode("textarea", mergeProps({
  18621. id: unref(inputId),
  18622. ref_key: "textarea",
  18623. ref: textarea,
  18624. class: unref(nsTextarea).e("inner")
  18625. }, unref(attrs), {
  18626. tabindex: _ctx.tabindex,
  18627. disabled: unref(inputDisabled),
  18628. readonly: _ctx.readonly,
  18629. autocomplete: _ctx.autocomplete,
  18630. style: unref(textareaStyle),
  18631. "aria-label": _ctx.label,
  18632. placeholder: _ctx.placeholder,
  18633. form: props.form,
  18634. onCompositionstart: handleCompositionStart,
  18635. onCompositionupdate: handleCompositionUpdate,
  18636. onCompositionend: handleCompositionEnd,
  18637. onInput: handleInput,
  18638. onFocus: handleFocus,
  18639. onBlur: handleBlur,
  18640. onChange: handleChange,
  18641. onKeydown: handleKeydown
  18642. }), null, 16, _hoisted_3$6),
  18643. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18644. key: 0,
  18645. style: normalizeStyle(countStyle.value),
  18646. class: normalizeClass(unref(nsInput).e("count"))
  18647. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 7)) : createCommentVNode("v-if", true)
  18648. ], 64))
  18649. ], 16, _hoisted_1$g)), [
  18650. [vShow, _ctx.type !== "hidden"]
  18651. ]);
  18652. };
  18653. }
  18654. });
  18655. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  18656. const ElInput = withInstall(Input);
  18657. const GAP = 4;
  18658. const BAR_MAP = {
  18659. vertical: {
  18660. offset: "offsetHeight",
  18661. scroll: "scrollTop",
  18662. scrollSize: "scrollHeight",
  18663. size: "height",
  18664. key: "vertical",
  18665. axis: "Y",
  18666. client: "clientY",
  18667. direction: "top"
  18668. },
  18669. horizontal: {
  18670. offset: "offsetWidth",
  18671. scroll: "scrollLeft",
  18672. scrollSize: "scrollWidth",
  18673. size: "width",
  18674. key: "horizontal",
  18675. axis: "X",
  18676. client: "clientX",
  18677. direction: "left"
  18678. }
  18679. };
  18680. const renderThumbStyle = ({
  18681. move,
  18682. size,
  18683. bar
  18684. }) => ({
  18685. [bar.size]: size,
  18686. transform: `translate${bar.axis}(${move}%)`
  18687. });
  18688. const scrollbarContextKey = Symbol("scrollbarContextKey");
  18689. const thumbProps = buildProps({
  18690. vertical: Boolean,
  18691. size: String,
  18692. move: Number,
  18693. ratio: {
  18694. type: Number,
  18695. required: true
  18696. },
  18697. always: Boolean
  18698. });
  18699. const COMPONENT_NAME$4 = "Thumb";
  18700. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  18701. __name: "thumb",
  18702. props: thumbProps,
  18703. setup(__props) {
  18704. const props = __props;
  18705. const scrollbar = inject(scrollbarContextKey);
  18706. const ns = useNamespace("scrollbar");
  18707. if (!scrollbar)
  18708. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  18709. const instance = ref();
  18710. const thumb = ref();
  18711. const thumbState = ref({});
  18712. const visible = ref(false);
  18713. let cursorDown = false;
  18714. let cursorLeave = false;
  18715. let originalOnSelectStart = isClient ? document.onselectstart : null;
  18716. const bar = computed$1(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  18717. const thumbStyle = computed$1(() => renderThumbStyle({
  18718. size: props.size,
  18719. move: props.move,
  18720. bar: bar.value
  18721. }));
  18722. const offsetRatio = computed$1(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  18723. const clickThumbHandler = (e) => {
  18724. var _a2;
  18725. e.stopPropagation();
  18726. if (e.ctrlKey || [1, 2].includes(e.button))
  18727. return;
  18728. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  18729. startDrag(e);
  18730. const el = e.currentTarget;
  18731. if (!el)
  18732. return;
  18733. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  18734. };
  18735. const clickTrackHandler = (e) => {
  18736. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  18737. return;
  18738. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  18739. const thumbHalf = thumb.value[bar.value.offset] / 2;
  18740. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18741. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18742. };
  18743. const startDrag = (e) => {
  18744. e.stopImmediatePropagation();
  18745. cursorDown = true;
  18746. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  18747. document.addEventListener("mouseup", mouseUpDocumentHandler);
  18748. originalOnSelectStart = document.onselectstart;
  18749. document.onselectstart = () => false;
  18750. };
  18751. const mouseMoveDocumentHandler = (e) => {
  18752. if (!instance.value || !thumb.value)
  18753. return;
  18754. if (cursorDown === false)
  18755. return;
  18756. const prevPage = thumbState.value[bar.value.axis];
  18757. if (!prevPage)
  18758. return;
  18759. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  18760. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  18761. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18762. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18763. };
  18764. const mouseUpDocumentHandler = () => {
  18765. cursorDown = false;
  18766. thumbState.value[bar.value.axis] = 0;
  18767. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  18768. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18769. restoreOnselectstart();
  18770. if (cursorLeave)
  18771. visible.value = false;
  18772. };
  18773. const mouseMoveScrollbarHandler = () => {
  18774. cursorLeave = false;
  18775. visible.value = !!props.size;
  18776. };
  18777. const mouseLeaveScrollbarHandler = () => {
  18778. cursorLeave = true;
  18779. visible.value = cursorDown;
  18780. };
  18781. onBeforeUnmount(() => {
  18782. restoreOnselectstart();
  18783. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18784. });
  18785. const restoreOnselectstart = () => {
  18786. if (document.onselectstart !== originalOnSelectStart)
  18787. document.onselectstart = originalOnSelectStart;
  18788. };
  18789. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  18790. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  18791. return (_ctx, _cache) => {
  18792. return openBlock(), createBlock(Transition, {
  18793. name: unref(ns).b("fade"),
  18794. persisted: ""
  18795. }, {
  18796. default: withCtx(() => [
  18797. withDirectives(createElementVNode("div", {
  18798. ref_key: "instance",
  18799. ref: instance,
  18800. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  18801. onMousedown: clickTrackHandler
  18802. }, [
  18803. createElementVNode("div", {
  18804. ref_key: "thumb",
  18805. ref: thumb,
  18806. class: normalizeClass(unref(ns).e("thumb")),
  18807. style: normalizeStyle(unref(thumbStyle)),
  18808. onMousedown: clickThumbHandler
  18809. }, null, 38)
  18810. ], 34), [
  18811. [vShow, _ctx.always || visible.value]
  18812. ])
  18813. ]),
  18814. _: 1
  18815. }, 8, ["name"]);
  18816. };
  18817. }
  18818. });
  18819. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  18820. const barProps = buildProps({
  18821. always: {
  18822. type: Boolean,
  18823. default: true
  18824. },
  18825. width: String,
  18826. height: String,
  18827. ratioX: {
  18828. type: Number,
  18829. default: 1
  18830. },
  18831. ratioY: {
  18832. type: Number,
  18833. default: 1
  18834. }
  18835. });
  18836. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  18837. __name: "bar",
  18838. props: barProps,
  18839. setup(__props, { expose }) {
  18840. const props = __props;
  18841. const moveX = ref(0);
  18842. const moveY = ref(0);
  18843. const handleScroll = (wrap) => {
  18844. if (wrap) {
  18845. const offsetHeight = wrap.offsetHeight - GAP;
  18846. const offsetWidth = wrap.offsetWidth - GAP;
  18847. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  18848. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  18849. }
  18850. };
  18851. expose({
  18852. handleScroll
  18853. });
  18854. return (_ctx, _cache) => {
  18855. return openBlock(), createElementBlock(Fragment, null, [
  18856. createVNode(Thumb, {
  18857. move: moveX.value,
  18858. ratio: _ctx.ratioX,
  18859. size: _ctx.width,
  18860. always: _ctx.always
  18861. }, null, 8, ["move", "ratio", "size", "always"]),
  18862. createVNode(Thumb, {
  18863. move: moveY.value,
  18864. ratio: _ctx.ratioY,
  18865. size: _ctx.height,
  18866. vertical: "",
  18867. always: _ctx.always
  18868. }, null, 8, ["move", "ratio", "size", "always"])
  18869. ], 64);
  18870. };
  18871. }
  18872. });
  18873. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  18874. const scrollbarProps = buildProps({
  18875. height: {
  18876. type: [String, Number],
  18877. default: ""
  18878. },
  18879. maxHeight: {
  18880. type: [String, Number],
  18881. default: ""
  18882. },
  18883. native: {
  18884. type: Boolean,
  18885. default: false
  18886. },
  18887. wrapStyle: {
  18888. type: definePropType([String, Object, Array]),
  18889. default: ""
  18890. },
  18891. wrapClass: {
  18892. type: [String, Array],
  18893. default: ""
  18894. },
  18895. viewClass: {
  18896. type: [String, Array],
  18897. default: ""
  18898. },
  18899. viewStyle: {
  18900. type: [String, Array, Object],
  18901. default: ""
  18902. },
  18903. noresize: Boolean,
  18904. tag: {
  18905. type: String,
  18906. default: "div"
  18907. },
  18908. always: Boolean,
  18909. minSize: {
  18910. type: Number,
  18911. default: 20
  18912. }
  18913. });
  18914. const scrollbarEmits = {
  18915. scroll: ({
  18916. scrollTop,
  18917. scrollLeft
  18918. }) => [scrollTop, scrollLeft].every(isNumber)
  18919. };
  18920. const COMPONENT_NAME$3 = "ElScrollbar";
  18921. const __default__$m = defineComponent({
  18922. name: COMPONENT_NAME$3
  18923. });
  18924. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  18925. ...__default__$m,
  18926. props: scrollbarProps,
  18927. emits: scrollbarEmits,
  18928. setup(__props, { expose, emit }) {
  18929. const props = __props;
  18930. const ns = useNamespace("scrollbar");
  18931. let stopResizeObserver = void 0;
  18932. let stopResizeListener = void 0;
  18933. const scrollbarRef = ref();
  18934. const wrapRef = ref();
  18935. const resizeRef = ref();
  18936. const sizeWidth = ref("0");
  18937. const sizeHeight = ref("0");
  18938. const barRef = ref();
  18939. const ratioY = ref(1);
  18940. const ratioX = ref(1);
  18941. const style = computed$1(() => {
  18942. const style2 = {};
  18943. if (props.height)
  18944. style2.height = addUnit(props.height);
  18945. if (props.maxHeight)
  18946. style2.maxHeight = addUnit(props.maxHeight);
  18947. return [props.wrapStyle, style2];
  18948. });
  18949. const wrapKls = computed$1(() => {
  18950. return [
  18951. props.wrapClass,
  18952. ns.e("wrap"),
  18953. { [ns.em("wrap", "hidden-default")]: !props.native }
  18954. ];
  18955. });
  18956. const resizeKls = computed$1(() => {
  18957. return [ns.e("view"), props.viewClass];
  18958. });
  18959. const handleScroll = () => {
  18960. var _a2;
  18961. if (wrapRef.value) {
  18962. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18963. emit("scroll", {
  18964. scrollTop: wrapRef.value.scrollTop,
  18965. scrollLeft: wrapRef.value.scrollLeft
  18966. });
  18967. }
  18968. };
  18969. function scrollTo(arg1, arg2) {
  18970. if (isObject$5(arg1)) {
  18971. wrapRef.value.scrollTo(arg1);
  18972. } else if (isNumber(arg1) && isNumber(arg2)) {
  18973. wrapRef.value.scrollTo(arg1, arg2);
  18974. }
  18975. }
  18976. const setScrollTop = (value) => {
  18977. if (!isNumber(value)) {
  18978. return;
  18979. }
  18980. wrapRef.value.scrollTop = value;
  18981. };
  18982. const setScrollLeft = (value) => {
  18983. if (!isNumber(value)) {
  18984. return;
  18985. }
  18986. wrapRef.value.scrollLeft = value;
  18987. };
  18988. const update = () => {
  18989. if (!wrapRef.value)
  18990. return;
  18991. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  18992. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  18993. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  18994. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  18995. const height2 = Math.max(originalHeight, props.minSize);
  18996. const width2 = Math.max(originalWidth, props.minSize);
  18997. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height2 / (offsetHeight - height2));
  18998. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width2 / (offsetWidth - width2));
  18999. sizeHeight.value = height2 + GAP < offsetHeight ? `${height2}px` : "";
  19000. sizeWidth.value = width2 + GAP < offsetWidth ? `${width2}px` : "";
  19001. };
  19002. watch(() => props.noresize, (noresize) => {
  19003. if (noresize) {
  19004. stopResizeObserver == null ? void 0 : stopResizeObserver();
  19005. stopResizeListener == null ? void 0 : stopResizeListener();
  19006. } else {
  19007. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  19008. stopResizeListener = useEventListener("resize", update);
  19009. }
  19010. }, { immediate: true });
  19011. watch(() => [props.maxHeight, props.height], () => {
  19012. if (!props.native)
  19013. nextTick(() => {
  19014. var _a2;
  19015. update();
  19016. if (wrapRef.value) {
  19017. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  19018. }
  19019. });
  19020. });
  19021. provide(scrollbarContextKey, reactive({
  19022. scrollbarElement: scrollbarRef,
  19023. wrapElement: wrapRef
  19024. }));
  19025. onMounted(() => {
  19026. if (!props.native)
  19027. nextTick(() => {
  19028. update();
  19029. });
  19030. });
  19031. onUpdated(() => update());
  19032. expose({
  19033. wrapRef,
  19034. update,
  19035. scrollTo,
  19036. setScrollTop,
  19037. setScrollLeft,
  19038. handleScroll
  19039. });
  19040. return (_ctx, _cache) => {
  19041. return openBlock(), createElementBlock("div", {
  19042. ref_key: "scrollbarRef",
  19043. ref: scrollbarRef,
  19044. class: normalizeClass(unref(ns).b())
  19045. }, [
  19046. createElementVNode("div", {
  19047. ref_key: "wrapRef",
  19048. ref: wrapRef,
  19049. class: normalizeClass(unref(wrapKls)),
  19050. style: normalizeStyle(unref(style)),
  19051. onScroll: handleScroll
  19052. }, [
  19053. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  19054. ref_key: "resizeRef",
  19055. ref: resizeRef,
  19056. class: normalizeClass(unref(resizeKls)),
  19057. style: normalizeStyle(_ctx.viewStyle)
  19058. }, {
  19059. default: withCtx(() => [
  19060. renderSlot(_ctx.$slots, "default")
  19061. ]),
  19062. _: 3
  19063. }, 8, ["class", "style"]))
  19064. ], 38),
  19065. !_ctx.native ? (openBlock(), createBlock(Bar, {
  19066. key: 0,
  19067. ref_key: "barRef",
  19068. ref: barRef,
  19069. height: sizeHeight.value,
  19070. width: sizeWidth.value,
  19071. always: _ctx.always,
  19072. "ratio-x": ratioX.value,
  19073. "ratio-y": ratioY.value
  19074. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  19075. ], 2);
  19076. };
  19077. }
  19078. });
  19079. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  19080. const ElScrollbar = withInstall(Scrollbar);
  19081. const POPPER_INJECTION_KEY = Symbol("popper");
  19082. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  19083. const roleTypes = [
  19084. "dialog",
  19085. "grid",
  19086. "group",
  19087. "listbox",
  19088. "menu",
  19089. "navigation",
  19090. "tooltip",
  19091. "tree"
  19092. ];
  19093. const popperProps = buildProps({
  19094. role: {
  19095. type: String,
  19096. values: roleTypes,
  19097. default: "tooltip"
  19098. }
  19099. });
  19100. const __default__$l = defineComponent({
  19101. name: "ElPopper",
  19102. inheritAttrs: false
  19103. });
  19104. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  19105. ...__default__$l,
  19106. props: popperProps,
  19107. setup(__props, { expose }) {
  19108. const props = __props;
  19109. const triggerRef2 = ref();
  19110. const popperInstanceRef = ref();
  19111. const contentRef = ref();
  19112. const referenceRef = ref();
  19113. const role = computed$1(() => props.role);
  19114. const popperProvides = {
  19115. triggerRef: triggerRef2,
  19116. popperInstanceRef,
  19117. contentRef,
  19118. referenceRef,
  19119. role
  19120. };
  19121. expose(popperProvides);
  19122. provide(POPPER_INJECTION_KEY, popperProvides);
  19123. return (_ctx, _cache) => {
  19124. return renderSlot(_ctx.$slots, "default");
  19125. };
  19126. }
  19127. });
  19128. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  19129. const popperArrowProps = buildProps({
  19130. arrowOffset: {
  19131. type: Number,
  19132. default: 5
  19133. }
  19134. });
  19135. const __default__$k = defineComponent({
  19136. name: "ElPopperArrow",
  19137. inheritAttrs: false
  19138. });
  19139. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  19140. ...__default__$k,
  19141. props: popperArrowProps,
  19142. setup(__props, { expose }) {
  19143. const props = __props;
  19144. const ns = useNamespace("popper");
  19145. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  19146. watch(() => props.arrowOffset, (val) => {
  19147. arrowOffset.value = val;
  19148. });
  19149. onBeforeUnmount(() => {
  19150. arrowRef.value = void 0;
  19151. });
  19152. expose({
  19153. arrowRef
  19154. });
  19155. return (_ctx, _cache) => {
  19156. return openBlock(), createElementBlock("span", {
  19157. ref_key: "arrowRef",
  19158. ref: arrowRef,
  19159. class: normalizeClass(unref(ns).e("arrow")),
  19160. style: normalizeStyle(unref(arrowStyle)),
  19161. "data-popper-arrow": ""
  19162. }, null, 6);
  19163. };
  19164. }
  19165. });
  19166. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  19167. const NAME = "ElOnlyChild";
  19168. const OnlyChild = defineComponent({
  19169. name: NAME,
  19170. setup(_, {
  19171. slots,
  19172. attrs
  19173. }) {
  19174. var _a2;
  19175. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  19176. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  19177. return () => {
  19178. var _a22;
  19179. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  19180. if (!defaultSlot)
  19181. return null;
  19182. if (defaultSlot.length > 1) {
  19183. return null;
  19184. }
  19185. const firstLegitNode = findFirstLegitChild(defaultSlot);
  19186. if (!firstLegitNode) {
  19187. return null;
  19188. }
  19189. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  19190. };
  19191. }
  19192. });
  19193. function findFirstLegitChild(node) {
  19194. if (!node)
  19195. return null;
  19196. const children = node;
  19197. for (const child of children) {
  19198. if (isObject$5(child)) {
  19199. switch (child.type) {
  19200. case Comment$1:
  19201. continue;
  19202. case Text$1:
  19203. case "svg":
  19204. return wrapTextContent(child);
  19205. case Fragment:
  19206. return findFirstLegitChild(child.children);
  19207. default:
  19208. return child;
  19209. }
  19210. }
  19211. return wrapTextContent(child);
  19212. }
  19213. return null;
  19214. }
  19215. function wrapTextContent(s) {
  19216. const ns = useNamespace("only-child");
  19217. return createVNode("span", {
  19218. "class": ns.e("content")
  19219. }, [s]);
  19220. }
  19221. const popperTriggerProps = buildProps({
  19222. virtualRef: {
  19223. type: definePropType(Object)
  19224. },
  19225. virtualTriggering: Boolean,
  19226. onMouseenter: {
  19227. type: definePropType(Function)
  19228. },
  19229. onMouseleave: {
  19230. type: definePropType(Function)
  19231. },
  19232. onClick: {
  19233. type: definePropType(Function)
  19234. },
  19235. onKeydown: {
  19236. type: definePropType(Function)
  19237. },
  19238. onFocus: {
  19239. type: definePropType(Function)
  19240. },
  19241. onBlur: {
  19242. type: definePropType(Function)
  19243. },
  19244. onContextmenu: {
  19245. type: definePropType(Function)
  19246. },
  19247. id: String,
  19248. open: Boolean
  19249. });
  19250. const __default__$j = defineComponent({
  19251. name: "ElPopperTrigger",
  19252. inheritAttrs: false
  19253. });
  19254. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  19255. ...__default__$j,
  19256. props: popperTriggerProps,
  19257. setup(__props, { expose }) {
  19258. const props = __props;
  19259. const { role, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  19260. useForwardRef(triggerRef2);
  19261. const ariaControls = computed$1(() => {
  19262. return ariaHaspopup.value ? props.id : void 0;
  19263. });
  19264. const ariaDescribedby = computed$1(() => {
  19265. if (role && role.value === "tooltip") {
  19266. return props.open && props.id ? props.id : void 0;
  19267. }
  19268. return void 0;
  19269. });
  19270. const ariaHaspopup = computed$1(() => {
  19271. if (role && role.value !== "tooltip") {
  19272. return role.value;
  19273. }
  19274. return void 0;
  19275. });
  19276. const ariaExpanded = computed$1(() => {
  19277. return ariaHaspopup.value ? `${props.open}` : void 0;
  19278. });
  19279. let virtualTriggerAriaStopWatch = void 0;
  19280. onMounted(() => {
  19281. watch(() => props.virtualRef, (virtualEl) => {
  19282. if (virtualEl) {
  19283. triggerRef2.value = unrefElement(virtualEl);
  19284. }
  19285. }, {
  19286. immediate: true
  19287. });
  19288. watch(triggerRef2, (el, prevEl) => {
  19289. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19290. virtualTriggerAriaStopWatch = void 0;
  19291. if (isElement(el)) {
  19292. [
  19293. "onMouseenter",
  19294. "onMouseleave",
  19295. "onClick",
  19296. "onKeydown",
  19297. "onFocus",
  19298. "onBlur",
  19299. "onContextmenu"
  19300. ].forEach((eventName) => {
  19301. var _a2;
  19302. const handler = props[eventName];
  19303. if (handler) {
  19304. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  19305. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  19306. }
  19307. });
  19308. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  19309. [
  19310. "aria-controls",
  19311. "aria-describedby",
  19312. "aria-haspopup",
  19313. "aria-expanded"
  19314. ].forEach((key, idx) => {
  19315. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  19316. });
  19317. }, { immediate: true });
  19318. }
  19319. if (isElement(prevEl)) {
  19320. [
  19321. "aria-controls",
  19322. "aria-describedby",
  19323. "aria-haspopup",
  19324. "aria-expanded"
  19325. ].forEach((key) => prevEl.removeAttribute(key));
  19326. }
  19327. }, {
  19328. immediate: true
  19329. });
  19330. });
  19331. onBeforeUnmount(() => {
  19332. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19333. virtualTriggerAriaStopWatch = void 0;
  19334. });
  19335. expose({
  19336. triggerRef: triggerRef2
  19337. });
  19338. return (_ctx, _cache) => {
  19339. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  19340. "aria-controls": unref(ariaControls),
  19341. "aria-describedby": unref(ariaDescribedby),
  19342. "aria-expanded": unref(ariaExpanded),
  19343. "aria-haspopup": unref(ariaHaspopup)
  19344. }), {
  19345. default: withCtx(() => [
  19346. renderSlot(_ctx.$slots, "default")
  19347. ]),
  19348. _: 3
  19349. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  19350. };
  19351. }
  19352. });
  19353. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  19354. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  19355. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  19356. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  19357. const FOCUS_AFTER_TRAPPED_OPTS = {
  19358. cancelable: true,
  19359. bubbles: false
  19360. };
  19361. const FOCUSOUT_PREVENTED_OPTS = {
  19362. cancelable: true,
  19363. bubbles: false
  19364. };
  19365. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  19366. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  19367. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  19368. const focusReason = ref();
  19369. const lastUserFocusTimestamp = ref(0);
  19370. const lastAutomatedFocusTimestamp = ref(0);
  19371. let focusReasonUserCount = 0;
  19372. const obtainAllFocusableElements = (element) => {
  19373. const nodes = [];
  19374. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  19375. acceptNode: (node) => {
  19376. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  19377. if (node.disabled || node.hidden || isHiddenInput)
  19378. return NodeFilter.FILTER_SKIP;
  19379. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  19380. }
  19381. });
  19382. while (walker.nextNode())
  19383. nodes.push(walker.currentNode);
  19384. return nodes;
  19385. };
  19386. const getVisibleElement = (elements, container) => {
  19387. for (const element of elements) {
  19388. if (!isHidden(element, container))
  19389. return element;
  19390. }
  19391. };
  19392. const isHidden = (element, container) => {
  19393. if (getComputedStyle(element).visibility === "hidden")
  19394. return true;
  19395. while (element) {
  19396. if (container && element === container)
  19397. return false;
  19398. if (getComputedStyle(element).display === "none")
  19399. return true;
  19400. element = element.parentElement;
  19401. }
  19402. return false;
  19403. };
  19404. const getEdges = (container) => {
  19405. const focusable = obtainAllFocusableElements(container);
  19406. const first = getVisibleElement(focusable, container);
  19407. const last = getVisibleElement(focusable.reverse(), container);
  19408. return [first, last];
  19409. };
  19410. const isSelectable = (element) => {
  19411. return element instanceof HTMLInputElement && "select" in element;
  19412. };
  19413. const tryFocus = (element, shouldSelect) => {
  19414. if (element && element.focus) {
  19415. const prevFocusedElement = document.activeElement;
  19416. element.focus({ preventScroll: true });
  19417. lastAutomatedFocusTimestamp.value = window.performance.now();
  19418. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  19419. element.select();
  19420. }
  19421. }
  19422. };
  19423. function removeFromStack(list, item) {
  19424. const copy2 = [...list];
  19425. const idx = list.indexOf(item);
  19426. if (idx !== -1) {
  19427. copy2.splice(idx, 1);
  19428. }
  19429. return copy2;
  19430. }
  19431. const createFocusableStack = () => {
  19432. let stack = [];
  19433. const push = (layer) => {
  19434. const currentLayer = stack[0];
  19435. if (currentLayer && layer !== currentLayer) {
  19436. currentLayer.pause();
  19437. }
  19438. stack = removeFromStack(stack, layer);
  19439. stack.unshift(layer);
  19440. };
  19441. const remove2 = (layer) => {
  19442. var _a2, _b;
  19443. stack = removeFromStack(stack, layer);
  19444. (_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
  19445. };
  19446. return {
  19447. push,
  19448. remove: remove2
  19449. };
  19450. };
  19451. const focusFirstDescendant = (elements, shouldSelect = false) => {
  19452. const prevFocusedElement = document.activeElement;
  19453. for (const element of elements) {
  19454. tryFocus(element, shouldSelect);
  19455. if (document.activeElement !== prevFocusedElement)
  19456. return;
  19457. }
  19458. };
  19459. const focusableStack = createFocusableStack();
  19460. const isFocusCausedByUserEvent = () => {
  19461. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  19462. };
  19463. const notifyFocusReasonPointer = () => {
  19464. focusReason.value = "pointer";
  19465. lastUserFocusTimestamp.value = window.performance.now();
  19466. };
  19467. const notifyFocusReasonKeydown = () => {
  19468. focusReason.value = "keyboard";
  19469. lastUserFocusTimestamp.value = window.performance.now();
  19470. };
  19471. const useFocusReason = () => {
  19472. onMounted(() => {
  19473. if (focusReasonUserCount === 0) {
  19474. document.addEventListener("mousedown", notifyFocusReasonPointer);
  19475. document.addEventListener("touchstart", notifyFocusReasonPointer);
  19476. document.addEventListener("keydown", notifyFocusReasonKeydown);
  19477. }
  19478. focusReasonUserCount++;
  19479. });
  19480. onBeforeUnmount(() => {
  19481. focusReasonUserCount--;
  19482. if (focusReasonUserCount <= 0) {
  19483. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  19484. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  19485. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  19486. }
  19487. });
  19488. return {
  19489. focusReason,
  19490. lastUserFocusTimestamp,
  19491. lastAutomatedFocusTimestamp
  19492. };
  19493. };
  19494. const createFocusOutPreventedEvent = (detail) => {
  19495. return new CustomEvent(FOCUSOUT_PREVENTED, {
  19496. ...FOCUSOUT_PREVENTED_OPTS,
  19497. detail
  19498. });
  19499. };
  19500. const _sfc_main$t = defineComponent({
  19501. name: "ElFocusTrap",
  19502. inheritAttrs: false,
  19503. props: {
  19504. loop: Boolean,
  19505. trapped: Boolean,
  19506. focusTrapEl: Object,
  19507. focusStartEl: {
  19508. type: [Object, String],
  19509. default: "first"
  19510. }
  19511. },
  19512. emits: [
  19513. ON_TRAP_FOCUS_EVT,
  19514. ON_RELEASE_FOCUS_EVT,
  19515. "focusin",
  19516. "focusout",
  19517. "focusout-prevented",
  19518. "release-requested"
  19519. ],
  19520. setup(props, { emit }) {
  19521. const forwardRef = ref();
  19522. let lastFocusBeforeTrapped;
  19523. let lastFocusAfterTrapped;
  19524. const { focusReason: focusReason2 } = useFocusReason();
  19525. useEscapeKeydown((event2) => {
  19526. if (props.trapped && !focusLayer.paused) {
  19527. emit("release-requested", event2);
  19528. }
  19529. });
  19530. const focusLayer = {
  19531. paused: false,
  19532. pause() {
  19533. this.paused = true;
  19534. },
  19535. resume() {
  19536. this.paused = false;
  19537. }
  19538. };
  19539. const onKeydown = (e) => {
  19540. if (!props.loop && !props.trapped)
  19541. return;
  19542. if (focusLayer.paused)
  19543. return;
  19544. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  19545. const { loop } = props;
  19546. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  19547. const currentFocusingEl = document.activeElement;
  19548. if (isTabbing && currentFocusingEl) {
  19549. const container = currentTarget;
  19550. const [first, last] = getEdges(container);
  19551. const isTabbable = first && last;
  19552. if (!isTabbable) {
  19553. if (currentFocusingEl === container) {
  19554. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19555. focusReason: focusReason2.value
  19556. });
  19557. emit("focusout-prevented", focusoutPreventedEvent);
  19558. if (!focusoutPreventedEvent.defaultPrevented) {
  19559. e.preventDefault();
  19560. }
  19561. }
  19562. } else {
  19563. if (!shiftKey && currentFocusingEl === last) {
  19564. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19565. focusReason: focusReason2.value
  19566. });
  19567. emit("focusout-prevented", focusoutPreventedEvent);
  19568. if (!focusoutPreventedEvent.defaultPrevented) {
  19569. e.preventDefault();
  19570. if (loop)
  19571. tryFocus(first, true);
  19572. }
  19573. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  19574. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19575. focusReason: focusReason2.value
  19576. });
  19577. emit("focusout-prevented", focusoutPreventedEvent);
  19578. if (!focusoutPreventedEvent.defaultPrevented) {
  19579. e.preventDefault();
  19580. if (loop)
  19581. tryFocus(last, true);
  19582. }
  19583. }
  19584. }
  19585. }
  19586. };
  19587. provide(FOCUS_TRAP_INJECTION_KEY, {
  19588. focusTrapRef: forwardRef,
  19589. onKeydown
  19590. });
  19591. watch(() => props.focusTrapEl, (focusTrapEl) => {
  19592. if (focusTrapEl) {
  19593. forwardRef.value = focusTrapEl;
  19594. }
  19595. }, { immediate: true });
  19596. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  19597. if (forwardRef2) {
  19598. forwardRef2.addEventListener("keydown", onKeydown);
  19599. forwardRef2.addEventListener("focusin", onFocusIn);
  19600. forwardRef2.addEventListener("focusout", onFocusOut);
  19601. }
  19602. if (oldForwardRef) {
  19603. oldForwardRef.removeEventListener("keydown", onKeydown);
  19604. oldForwardRef.removeEventListener("focusin", onFocusIn);
  19605. oldForwardRef.removeEventListener("focusout", onFocusOut);
  19606. }
  19607. });
  19608. const trapOnFocus = (e) => {
  19609. emit(ON_TRAP_FOCUS_EVT, e);
  19610. };
  19611. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  19612. const onFocusIn = (e) => {
  19613. const trapContainer = unref(forwardRef);
  19614. if (!trapContainer)
  19615. return;
  19616. const target = e.target;
  19617. const relatedTarget = e.relatedTarget;
  19618. const isFocusedInTrap = target && trapContainer.contains(target);
  19619. if (!props.trapped) {
  19620. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  19621. if (!isPrevFocusedInTrap) {
  19622. lastFocusBeforeTrapped = relatedTarget;
  19623. }
  19624. }
  19625. if (isFocusedInTrap)
  19626. emit("focusin", e);
  19627. if (focusLayer.paused)
  19628. return;
  19629. if (props.trapped) {
  19630. if (isFocusedInTrap) {
  19631. lastFocusAfterTrapped = target;
  19632. } else {
  19633. tryFocus(lastFocusAfterTrapped, true);
  19634. }
  19635. }
  19636. };
  19637. const onFocusOut = (e) => {
  19638. const trapContainer = unref(forwardRef);
  19639. if (focusLayer.paused || !trapContainer)
  19640. return;
  19641. if (props.trapped) {
  19642. const relatedTarget = e.relatedTarget;
  19643. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  19644. setTimeout(() => {
  19645. if (!focusLayer.paused && props.trapped) {
  19646. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19647. focusReason: focusReason2.value
  19648. });
  19649. emit("focusout-prevented", focusoutPreventedEvent);
  19650. if (!focusoutPreventedEvent.defaultPrevented) {
  19651. tryFocus(lastFocusAfterTrapped, true);
  19652. }
  19653. }
  19654. }, 0);
  19655. }
  19656. } else {
  19657. const target = e.target;
  19658. const isFocusedInTrap = target && trapContainer.contains(target);
  19659. if (!isFocusedInTrap)
  19660. emit("focusout", e);
  19661. }
  19662. };
  19663. async function startTrap() {
  19664. await nextTick();
  19665. const trapContainer = unref(forwardRef);
  19666. if (trapContainer) {
  19667. focusableStack.push(focusLayer);
  19668. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  19669. lastFocusBeforeTrapped = prevFocusedElement;
  19670. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  19671. if (!isPrevFocusContained) {
  19672. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  19673. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19674. trapContainer.dispatchEvent(focusEvent);
  19675. if (!focusEvent.defaultPrevented) {
  19676. nextTick(() => {
  19677. let focusStartEl = props.focusStartEl;
  19678. if (!isString(focusStartEl)) {
  19679. tryFocus(focusStartEl);
  19680. if (document.activeElement !== focusStartEl) {
  19681. focusStartEl = "first";
  19682. }
  19683. }
  19684. if (focusStartEl === "first") {
  19685. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  19686. }
  19687. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  19688. tryFocus(trapContainer);
  19689. }
  19690. });
  19691. }
  19692. }
  19693. }
  19694. }
  19695. function stopTrap() {
  19696. const trapContainer = unref(forwardRef);
  19697. if (trapContainer) {
  19698. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19699. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  19700. ...FOCUS_AFTER_TRAPPED_OPTS,
  19701. detail: {
  19702. focusReason: focusReason2.value
  19703. }
  19704. });
  19705. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  19706. trapContainer.dispatchEvent(releasedEvent);
  19707. if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  19708. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  19709. }
  19710. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  19711. focusableStack.remove(focusLayer);
  19712. }
  19713. }
  19714. onMounted(() => {
  19715. if (props.trapped) {
  19716. startTrap();
  19717. }
  19718. watch(() => props.trapped, (trapped) => {
  19719. if (trapped) {
  19720. startTrap();
  19721. } else {
  19722. stopTrap();
  19723. }
  19724. });
  19725. });
  19726. onBeforeUnmount(() => {
  19727. if (props.trapped) {
  19728. stopTrap();
  19729. }
  19730. });
  19731. return {
  19732. onKeydown
  19733. };
  19734. }
  19735. });
  19736. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  19737. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  19738. }
  19739. 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"]]);
  19740. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  19741. const popperCoreConfigProps = buildProps({
  19742. boundariesPadding: {
  19743. type: Number,
  19744. default: 0
  19745. },
  19746. fallbackPlacements: {
  19747. type: definePropType(Array),
  19748. default: void 0
  19749. },
  19750. gpuAcceleration: {
  19751. type: Boolean,
  19752. default: true
  19753. },
  19754. offset: {
  19755. type: Number,
  19756. default: 12
  19757. },
  19758. placement: {
  19759. type: String,
  19760. values: Ee,
  19761. default: "bottom"
  19762. },
  19763. popperOptions: {
  19764. type: definePropType(Object),
  19765. default: () => ({})
  19766. },
  19767. strategy: {
  19768. type: String,
  19769. values: POSITIONING_STRATEGIES,
  19770. default: "absolute"
  19771. }
  19772. });
  19773. const popperContentProps = buildProps({
  19774. ...popperCoreConfigProps,
  19775. id: String,
  19776. style: {
  19777. type: definePropType([String, Array, Object])
  19778. },
  19779. className: {
  19780. type: definePropType([String, Array, Object])
  19781. },
  19782. effect: {
  19783. type: String,
  19784. default: "dark"
  19785. },
  19786. visible: Boolean,
  19787. enterable: {
  19788. type: Boolean,
  19789. default: true
  19790. },
  19791. pure: Boolean,
  19792. focusOnShow: {
  19793. type: Boolean,
  19794. default: false
  19795. },
  19796. trapping: {
  19797. type: Boolean,
  19798. default: false
  19799. },
  19800. popperClass: {
  19801. type: definePropType([String, Array, Object])
  19802. },
  19803. popperStyle: {
  19804. type: definePropType([String, Array, Object])
  19805. },
  19806. referenceEl: {
  19807. type: definePropType(Object)
  19808. },
  19809. triggerTargetEl: {
  19810. type: definePropType(Object)
  19811. },
  19812. stopPopperMouseEvent: {
  19813. type: Boolean,
  19814. default: true
  19815. },
  19816. ariaLabel: {
  19817. type: String,
  19818. default: void 0
  19819. },
  19820. virtualTriggering: Boolean,
  19821. zIndex: Number
  19822. });
  19823. const popperContentEmits = {
  19824. mouseenter: (evt) => evt instanceof MouseEvent,
  19825. mouseleave: (evt) => evt instanceof MouseEvent,
  19826. focus: () => true,
  19827. blur: () => true,
  19828. close: () => true
  19829. };
  19830. const buildPopperOptions = (props, modifiers = []) => {
  19831. const { placement, strategy, popperOptions } = props;
  19832. const options2 = {
  19833. placement,
  19834. strategy,
  19835. ...popperOptions,
  19836. modifiers: [...genModifiers(props), ...modifiers]
  19837. };
  19838. deriveExtraModifiers(options2, popperOptions == null ? void 0 : popperOptions.modifiers);
  19839. return options2;
  19840. };
  19841. const unwrapMeasurableEl = ($el) => {
  19842. if (!isClient)
  19843. return;
  19844. return unrefElement($el);
  19845. };
  19846. function genModifiers(options2) {
  19847. const { offset, gpuAcceleration, fallbackPlacements } = options2;
  19848. return [
  19849. {
  19850. name: "offset",
  19851. options: {
  19852. offset: [0, offset != null ? offset : 12]
  19853. }
  19854. },
  19855. {
  19856. name: "preventOverflow",
  19857. options: {
  19858. padding: {
  19859. top: 2,
  19860. bottom: 2,
  19861. left: 5,
  19862. right: 5
  19863. }
  19864. }
  19865. },
  19866. {
  19867. name: "flip",
  19868. options: {
  19869. padding: 5,
  19870. fallbackPlacements
  19871. }
  19872. },
  19873. {
  19874. name: "computeStyles",
  19875. options: {
  19876. gpuAcceleration
  19877. }
  19878. }
  19879. ];
  19880. }
  19881. function deriveExtraModifiers(options2, modifiers) {
  19882. if (modifiers) {
  19883. options2.modifiers = [...options2.modifiers, ...modifiers != null ? modifiers : []];
  19884. }
  19885. }
  19886. const DEFAULT_ARROW_OFFSET = 0;
  19887. const usePopperContent = (props) => {
  19888. const { popperInstanceRef, contentRef, triggerRef: triggerRef2, role } = inject(POPPER_INJECTION_KEY, void 0);
  19889. const arrowRef = ref();
  19890. const arrowOffset = ref();
  19891. const eventListenerModifier = computed$1(() => {
  19892. return {
  19893. name: "eventListeners",
  19894. enabled: !!props.visible
  19895. };
  19896. });
  19897. const arrowModifier = computed$1(() => {
  19898. var _a2;
  19899. const arrowEl = unref(arrowRef);
  19900. const offset = (_a2 = unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
  19901. return {
  19902. name: "arrow",
  19903. enabled: !isUndefined$1(arrowEl),
  19904. options: {
  19905. element: arrowEl,
  19906. padding: offset
  19907. }
  19908. };
  19909. });
  19910. const options2 = computed$1(() => {
  19911. return {
  19912. onFirstUpdate: () => {
  19913. update();
  19914. },
  19915. ...buildPopperOptions(props, [
  19916. unref(arrowModifier),
  19917. unref(eventListenerModifier)
  19918. ])
  19919. };
  19920. });
  19921. const computedReference = computed$1(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  19922. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options2);
  19923. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  19924. onMounted(() => {
  19925. watch(() => {
  19926. var _a2;
  19927. return (_a2 = unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
  19928. }, () => {
  19929. update();
  19930. });
  19931. });
  19932. return {
  19933. attributes,
  19934. arrowRef,
  19935. contentRef,
  19936. instanceRef,
  19937. state,
  19938. styles,
  19939. role,
  19940. forceUpdate,
  19941. update
  19942. };
  19943. };
  19944. const usePopperContentDOM = (props, {
  19945. attributes,
  19946. styles,
  19947. role
  19948. }) => {
  19949. const { nextZIndex } = useZIndex();
  19950. const ns = useNamespace("popper");
  19951. const contentAttrs = computed$1(() => unref(attributes).popper);
  19952. const contentZIndex = ref(props.zIndex || nextZIndex());
  19953. const contentClass = computed$1(() => [
  19954. ns.b(),
  19955. ns.is("pure", props.pure),
  19956. ns.is(props.effect),
  19957. props.popperClass
  19958. ]);
  19959. const contentStyle = computed$1(() => {
  19960. return [
  19961. { zIndex: unref(contentZIndex) },
  19962. props.popperStyle || {},
  19963. unref(styles).popper
  19964. ];
  19965. });
  19966. const ariaModal = computed$1(() => role.value === "dialog" ? "false" : void 0);
  19967. const arrowStyle = computed$1(() => unref(styles).arrow || {});
  19968. const updateZIndex = () => {
  19969. contentZIndex.value = props.zIndex || nextZIndex();
  19970. };
  19971. return {
  19972. ariaModal,
  19973. arrowStyle,
  19974. contentAttrs,
  19975. contentClass,
  19976. contentStyle,
  19977. contentZIndex,
  19978. updateZIndex
  19979. };
  19980. };
  19981. const usePopperContentFocusTrap = (props, emit) => {
  19982. const trapped = ref(false);
  19983. const focusStartRef = ref();
  19984. const onFocusAfterTrapped = () => {
  19985. emit("focus");
  19986. };
  19987. const onFocusAfterReleased = (event2) => {
  19988. var _a2;
  19989. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
  19990. focusStartRef.value = "first";
  19991. emit("blur");
  19992. }
  19993. };
  19994. const onFocusInTrap = (event2) => {
  19995. if (props.visible && !trapped.value) {
  19996. if (event2.target) {
  19997. focusStartRef.value = event2.target;
  19998. }
  19999. trapped.value = true;
  20000. }
  20001. };
  20002. const onFocusoutPrevented = (event2) => {
  20003. if (!props.trapping) {
  20004. if (event2.detail.focusReason === "pointer") {
  20005. event2.preventDefault();
  20006. }
  20007. trapped.value = false;
  20008. }
  20009. };
  20010. const onReleaseRequested = () => {
  20011. trapped.value = false;
  20012. emit("close");
  20013. };
  20014. return {
  20015. focusStartRef,
  20016. trapped,
  20017. onFocusAfterReleased,
  20018. onFocusAfterTrapped,
  20019. onFocusInTrap,
  20020. onFocusoutPrevented,
  20021. onReleaseRequested
  20022. };
  20023. };
  20024. const __default__$i = defineComponent({
  20025. name: "ElPopperContent"
  20026. });
  20027. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  20028. ...__default__$i,
  20029. props: popperContentProps,
  20030. emits: popperContentEmits,
  20031. setup(__props, { expose, emit }) {
  20032. const props = __props;
  20033. const {
  20034. focusStartRef,
  20035. trapped,
  20036. onFocusAfterReleased,
  20037. onFocusAfterTrapped,
  20038. onFocusInTrap,
  20039. onFocusoutPrevented,
  20040. onReleaseRequested
  20041. } = usePopperContentFocusTrap(props, emit);
  20042. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  20043. const {
  20044. ariaModal,
  20045. arrowStyle,
  20046. contentAttrs,
  20047. contentClass,
  20048. contentStyle,
  20049. updateZIndex
  20050. } = usePopperContentDOM(props, {
  20051. styles,
  20052. attributes,
  20053. role
  20054. });
  20055. const formItemContext = inject(formItemContextKey, void 0);
  20056. const arrowOffset = ref();
  20057. provide(POPPER_CONTENT_INJECTION_KEY, {
  20058. arrowStyle,
  20059. arrowRef,
  20060. arrowOffset
  20061. });
  20062. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  20063. provide(formItemContextKey, {
  20064. ...formItemContext,
  20065. addInputId: NOOP,
  20066. removeInputId: NOOP
  20067. });
  20068. }
  20069. let triggerTargetAriaStopWatch = void 0;
  20070. const updatePopper = (shouldUpdateZIndex = true) => {
  20071. update();
  20072. shouldUpdateZIndex && updateZIndex();
  20073. };
  20074. const togglePopperAlive = () => {
  20075. updatePopper(false);
  20076. if (props.visible && props.focusOnShow) {
  20077. trapped.value = true;
  20078. } else if (props.visible === false) {
  20079. trapped.value = false;
  20080. }
  20081. };
  20082. onMounted(() => {
  20083. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  20084. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  20085. triggerTargetAriaStopWatch = void 0;
  20086. const el = unref(triggerTargetEl || contentRef.value);
  20087. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  20088. if (isElement(el)) {
  20089. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  20090. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  20091. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  20092. });
  20093. }, { immediate: true });
  20094. }
  20095. if (prevEl !== el && isElement(prevEl)) {
  20096. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  20097. prevEl.removeAttribute(key);
  20098. });
  20099. }
  20100. }, { immediate: true });
  20101. watch(() => props.visible, togglePopperAlive, { immediate: true });
  20102. });
  20103. onBeforeUnmount(() => {
  20104. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  20105. triggerTargetAriaStopWatch = void 0;
  20106. });
  20107. expose({
  20108. popperContentRef: contentRef,
  20109. popperInstanceRef: instanceRef,
  20110. updatePopper,
  20111. contentStyle
  20112. });
  20113. return (_ctx, _cache) => {
  20114. return openBlock(), createElementBlock("div", mergeProps({
  20115. ref_key: "contentRef",
  20116. ref: contentRef
  20117. }, unref(contentAttrs), {
  20118. style: unref(contentStyle),
  20119. class: unref(contentClass),
  20120. tabindex: "-1",
  20121. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  20122. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  20123. }), [
  20124. createVNode(unref(ElFocusTrap), {
  20125. trapped: unref(trapped),
  20126. "trap-on-focus-in": true,
  20127. "focus-trap-el": unref(contentRef),
  20128. "focus-start-el": unref(focusStartRef),
  20129. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  20130. onFocusAfterReleased: unref(onFocusAfterReleased),
  20131. onFocusin: unref(onFocusInTrap),
  20132. onFocusoutPrevented: unref(onFocusoutPrevented),
  20133. onReleaseRequested: unref(onReleaseRequested)
  20134. }, {
  20135. default: withCtx(() => [
  20136. renderSlot(_ctx.$slots, "default")
  20137. ]),
  20138. _: 3
  20139. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  20140. ], 16);
  20141. };
  20142. }
  20143. });
  20144. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  20145. const ElPopper = withInstall(Popper);
  20146. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  20147. const useTooltipContentProps = buildProps({
  20148. ...useDelayedToggleProps,
  20149. ...popperContentProps,
  20150. appendTo: {
  20151. type: definePropType([String, Object])
  20152. },
  20153. content: {
  20154. type: String,
  20155. default: ""
  20156. },
  20157. rawContent: {
  20158. type: Boolean,
  20159. default: false
  20160. },
  20161. persistent: Boolean,
  20162. ariaLabel: String,
  20163. visible: {
  20164. type: definePropType(Boolean),
  20165. default: null
  20166. },
  20167. transition: String,
  20168. teleported: {
  20169. type: Boolean,
  20170. default: true
  20171. },
  20172. disabled: Boolean
  20173. });
  20174. const useTooltipTriggerProps = buildProps({
  20175. ...popperTriggerProps,
  20176. disabled: Boolean,
  20177. trigger: {
  20178. type: definePropType([String, Array]),
  20179. default: "hover"
  20180. },
  20181. triggerKeys: {
  20182. type: definePropType(Array),
  20183. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  20184. }
  20185. });
  20186. const {
  20187. useModelToggleProps: useTooltipModelToggleProps,
  20188. useModelToggleEmits: useTooltipModelToggleEmits,
  20189. useModelToggle: useTooltipModelToggle
  20190. } = createModelToggleComposable("visible");
  20191. const useTooltipProps = buildProps({
  20192. ...popperProps,
  20193. ...useTooltipModelToggleProps,
  20194. ...useTooltipContentProps,
  20195. ...useTooltipTriggerProps,
  20196. ...popperArrowProps,
  20197. showArrow: {
  20198. type: Boolean,
  20199. default: true
  20200. }
  20201. });
  20202. const tooltipEmits = [
  20203. ...useTooltipModelToggleEmits,
  20204. "before-show",
  20205. "before-hide",
  20206. "show",
  20207. "hide",
  20208. "open",
  20209. "close"
  20210. ];
  20211. const isTriggerType = (trigger2, type2) => {
  20212. if (isArray$2(trigger2)) {
  20213. return trigger2.includes(type2);
  20214. }
  20215. return trigger2 === type2;
  20216. };
  20217. const whenTrigger = (trigger2, type2, handler) => {
  20218. return (e) => {
  20219. isTriggerType(unref(trigger2), type2) && handler(e);
  20220. };
  20221. };
  20222. const __default__$h = defineComponent({
  20223. name: "ElTooltipTrigger"
  20224. });
  20225. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  20226. ...__default__$h,
  20227. props: useTooltipTriggerProps,
  20228. setup(__props, { expose }) {
  20229. const props = __props;
  20230. const ns = useNamespace("tooltip");
  20231. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20232. const triggerRef2 = ref(null);
  20233. const stopWhenControlledOrDisabled = () => {
  20234. if (unref(controlled) || props.disabled) {
  20235. return true;
  20236. }
  20237. };
  20238. const trigger2 = toRef(props, "trigger");
  20239. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onOpen));
  20240. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onClose));
  20241. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "click", (e) => {
  20242. if (e.button === 0) {
  20243. onToggle(e);
  20244. }
  20245. }));
  20246. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onOpen));
  20247. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onClose));
  20248. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "contextmenu", (e) => {
  20249. e.preventDefault();
  20250. onToggle(e);
  20251. }));
  20252. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  20253. const { code } = e;
  20254. if (props.triggerKeys.includes(code)) {
  20255. e.preventDefault();
  20256. onToggle(e);
  20257. }
  20258. });
  20259. expose({
  20260. triggerRef: triggerRef2
  20261. });
  20262. return (_ctx, _cache) => {
  20263. return openBlock(), createBlock(unref(ElPopperTrigger), {
  20264. id: unref(id),
  20265. "virtual-ref": _ctx.virtualRef,
  20266. open: unref(open),
  20267. "virtual-triggering": _ctx.virtualTriggering,
  20268. class: normalizeClass(unref(ns).e("trigger")),
  20269. onBlur: unref(onBlur),
  20270. onClick: unref(onClick),
  20271. onContextmenu: unref(onContextMenu),
  20272. onFocus: unref(onFocus),
  20273. onMouseenter: unref(onMouseenter),
  20274. onMouseleave: unref(onMouseleave),
  20275. onKeydown: unref(onKeydown)
  20276. }, {
  20277. default: withCtx(() => [
  20278. renderSlot(_ctx.$slots, "default")
  20279. ]),
  20280. _: 3
  20281. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  20282. };
  20283. }
  20284. });
  20285. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  20286. const __default__$g = defineComponent({
  20287. name: "ElTooltipContent",
  20288. inheritAttrs: false
  20289. });
  20290. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  20291. ...__default__$g,
  20292. props: useTooltipContentProps,
  20293. setup(__props, { expose }) {
  20294. const props = __props;
  20295. const { selector } = usePopperContainerId();
  20296. const ns = useNamespace("tooltip");
  20297. const contentRef = ref(null);
  20298. const destroyed = ref(false);
  20299. const {
  20300. controlled,
  20301. id,
  20302. open,
  20303. trigger: trigger2,
  20304. onClose,
  20305. onOpen,
  20306. onShow,
  20307. onHide,
  20308. onBeforeShow,
  20309. onBeforeHide
  20310. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20311. const transitionClass = computed$1(() => {
  20312. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  20313. });
  20314. const persistentRef = computed$1(() => {
  20315. return props.persistent;
  20316. });
  20317. onBeforeUnmount(() => {
  20318. destroyed.value = true;
  20319. });
  20320. const shouldRender = computed$1(() => {
  20321. return unref(persistentRef) ? true : unref(open);
  20322. });
  20323. const shouldShow = computed$1(() => {
  20324. return props.disabled ? false : unref(open);
  20325. });
  20326. const appendTo = computed$1(() => {
  20327. return props.appendTo || selector.value;
  20328. });
  20329. const contentStyle = computed$1(() => {
  20330. var _a2;
  20331. return (_a2 = props.style) != null ? _a2 : {};
  20332. });
  20333. const ariaHidden = computed$1(() => !unref(open));
  20334. const onTransitionLeave = () => {
  20335. onHide();
  20336. };
  20337. const stopWhenControlled = () => {
  20338. if (unref(controlled))
  20339. return true;
  20340. };
  20341. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  20342. if (props.enterable && unref(trigger2) === "hover") {
  20343. onOpen();
  20344. }
  20345. });
  20346. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  20347. if (unref(trigger2) === "hover") {
  20348. onClose();
  20349. }
  20350. });
  20351. const onBeforeEnter = () => {
  20352. var _a2, _b;
  20353. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20354. onBeforeShow == null ? void 0 : onBeforeShow();
  20355. };
  20356. const onBeforeLeave = () => {
  20357. onBeforeHide == null ? void 0 : onBeforeHide();
  20358. };
  20359. const onAfterShow = () => {
  20360. onShow();
  20361. stopHandle = onClickOutside(computed$1(() => {
  20362. var _a2;
  20363. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  20364. }), () => {
  20365. if (unref(controlled))
  20366. return;
  20367. const $trigger = unref(trigger2);
  20368. if ($trigger !== "hover") {
  20369. onClose();
  20370. }
  20371. });
  20372. };
  20373. const onBlur = () => {
  20374. if (!props.virtualTriggering) {
  20375. onClose();
  20376. }
  20377. };
  20378. let stopHandle;
  20379. watch(() => unref(open), (val) => {
  20380. if (!val) {
  20381. stopHandle == null ? void 0 : stopHandle();
  20382. }
  20383. }, {
  20384. flush: "post"
  20385. });
  20386. watch(() => props.content, () => {
  20387. var _a2, _b;
  20388. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20389. });
  20390. expose({
  20391. contentRef
  20392. });
  20393. return (_ctx, _cache) => {
  20394. return openBlock(), createBlock(Teleport, {
  20395. disabled: !_ctx.teleported,
  20396. to: unref(appendTo)
  20397. }, [
  20398. createVNode(Transition, {
  20399. name: unref(transitionClass),
  20400. onAfterLeave: onTransitionLeave,
  20401. onBeforeEnter,
  20402. onAfterEnter: onAfterShow,
  20403. onBeforeLeave
  20404. }, {
  20405. default: withCtx(() => [
  20406. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  20407. key: 0,
  20408. id: unref(id),
  20409. ref_key: "contentRef",
  20410. ref: contentRef
  20411. }, _ctx.$attrs, {
  20412. "aria-label": _ctx.ariaLabel,
  20413. "aria-hidden": unref(ariaHidden),
  20414. "boundaries-padding": _ctx.boundariesPadding,
  20415. "fallback-placements": _ctx.fallbackPlacements,
  20416. "gpu-acceleration": _ctx.gpuAcceleration,
  20417. offset: _ctx.offset,
  20418. placement: _ctx.placement,
  20419. "popper-options": _ctx.popperOptions,
  20420. strategy: _ctx.strategy,
  20421. effect: _ctx.effect,
  20422. enterable: _ctx.enterable,
  20423. pure: _ctx.pure,
  20424. "popper-class": _ctx.popperClass,
  20425. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  20426. "reference-el": _ctx.referenceEl,
  20427. "trigger-target-el": _ctx.triggerTargetEl,
  20428. visible: unref(shouldShow),
  20429. "z-index": _ctx.zIndex,
  20430. onMouseenter: unref(onContentEnter),
  20431. onMouseleave: unref(onContentLeave),
  20432. onBlur,
  20433. onClose: unref(onClose)
  20434. }), {
  20435. default: withCtx(() => [
  20436. !destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20437. ]),
  20438. _: 3
  20439. }, 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"])), [
  20440. [vShow, unref(shouldShow)]
  20441. ]) : createCommentVNode("v-if", true)
  20442. ]),
  20443. _: 3
  20444. }, 8, ["name"])
  20445. ], 8, ["disabled", "to"]);
  20446. };
  20447. }
  20448. });
  20449. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  20450. const _hoisted_1$f = ["innerHTML"];
  20451. const _hoisted_2$9 = { key: 1 };
  20452. const __default__$f = defineComponent({
  20453. name: "ElTooltip"
  20454. });
  20455. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  20456. ...__default__$f,
  20457. props: useTooltipProps,
  20458. emits: tooltipEmits,
  20459. setup(__props, { expose, emit }) {
  20460. const props = __props;
  20461. usePopperContainer();
  20462. const id = useId();
  20463. const popperRef = ref();
  20464. const contentRef = ref();
  20465. const updatePopper = () => {
  20466. var _a2;
  20467. const popperComponent = unref(popperRef);
  20468. if (popperComponent) {
  20469. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  20470. }
  20471. };
  20472. const open = ref(false);
  20473. const toggleReason = ref();
  20474. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  20475. indicator: open,
  20476. toggleReason
  20477. });
  20478. const { onOpen, onClose } = useDelayedToggle({
  20479. showAfter: toRef(props, "showAfter"),
  20480. hideAfter: toRef(props, "hideAfter"),
  20481. autoClose: toRef(props, "autoClose"),
  20482. open: show,
  20483. close: hide
  20484. });
  20485. const controlled = computed$1(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  20486. provide(TOOLTIP_INJECTION_KEY, {
  20487. controlled,
  20488. id,
  20489. open: readonly(open),
  20490. trigger: toRef(props, "trigger"),
  20491. onOpen: (event2) => {
  20492. onOpen(event2);
  20493. },
  20494. onClose: (event2) => {
  20495. onClose(event2);
  20496. },
  20497. onToggle: (event2) => {
  20498. if (unref(open)) {
  20499. onClose(event2);
  20500. } else {
  20501. onOpen(event2);
  20502. }
  20503. },
  20504. onShow: () => {
  20505. emit("show", toggleReason.value);
  20506. },
  20507. onHide: () => {
  20508. emit("hide", toggleReason.value);
  20509. },
  20510. onBeforeShow: () => {
  20511. emit("before-show", toggleReason.value);
  20512. },
  20513. onBeforeHide: () => {
  20514. emit("before-hide", toggleReason.value);
  20515. },
  20516. updatePopper
  20517. });
  20518. watch(() => props.disabled, (disabled) => {
  20519. if (disabled && open.value) {
  20520. open.value = false;
  20521. }
  20522. });
  20523. const isFocusInsideContent = () => {
  20524. var _a2, _b;
  20525. const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
  20526. return popperContent && popperContent.contains(document.activeElement);
  20527. };
  20528. onDeactivated(() => open.value && hide());
  20529. expose({
  20530. popperRef,
  20531. contentRef,
  20532. isFocusInsideContent,
  20533. updatePopper,
  20534. onOpen,
  20535. onClose,
  20536. hide
  20537. });
  20538. return (_ctx, _cache) => {
  20539. return openBlock(), createBlock(unref(ElPopper), {
  20540. ref_key: "popperRef",
  20541. ref: popperRef,
  20542. role: _ctx.role
  20543. }, {
  20544. default: withCtx(() => [
  20545. createVNode(ElTooltipTrigger, {
  20546. disabled: _ctx.disabled,
  20547. trigger: _ctx.trigger,
  20548. "trigger-keys": _ctx.triggerKeys,
  20549. "virtual-ref": _ctx.virtualRef,
  20550. "virtual-triggering": _ctx.virtualTriggering
  20551. }, {
  20552. default: withCtx(() => [
  20553. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20554. ]),
  20555. _: 3
  20556. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  20557. createVNode(ElTooltipContent, {
  20558. ref_key: "contentRef",
  20559. ref: contentRef,
  20560. "aria-label": _ctx.ariaLabel,
  20561. "boundaries-padding": _ctx.boundariesPadding,
  20562. content: _ctx.content,
  20563. disabled: _ctx.disabled,
  20564. effect: _ctx.effect,
  20565. enterable: _ctx.enterable,
  20566. "fallback-placements": _ctx.fallbackPlacements,
  20567. "hide-after": _ctx.hideAfter,
  20568. "gpu-acceleration": _ctx.gpuAcceleration,
  20569. offset: _ctx.offset,
  20570. persistent: _ctx.persistent,
  20571. "popper-class": _ctx.popperClass,
  20572. "popper-style": _ctx.popperStyle,
  20573. placement: _ctx.placement,
  20574. "popper-options": _ctx.popperOptions,
  20575. pure: _ctx.pure,
  20576. "raw-content": _ctx.rawContent,
  20577. "reference-el": _ctx.referenceEl,
  20578. "trigger-target-el": _ctx.triggerTargetEl,
  20579. "show-after": _ctx.showAfter,
  20580. strategy: _ctx.strategy,
  20581. teleported: _ctx.teleported,
  20582. transition: _ctx.transition,
  20583. "virtual-triggering": _ctx.virtualTriggering,
  20584. "z-index": _ctx.zIndex,
  20585. "append-to": _ctx.appendTo
  20586. }, {
  20587. default: withCtx(() => [
  20588. renderSlot(_ctx.$slots, "content", {}, () => [
  20589. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  20590. key: 0,
  20591. innerHTML: _ctx.content
  20592. }, null, 8, _hoisted_1$f)) : (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(_ctx.content), 1))
  20593. ]),
  20594. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  20595. key: 0,
  20596. "arrow-offset": _ctx.arrowOffset
  20597. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  20598. ]),
  20599. _: 3
  20600. }, 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"])
  20601. ]),
  20602. _: 3
  20603. }, 8, ["role"]);
  20604. };
  20605. }
  20606. });
  20607. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  20608. const ElTooltip = withInstall(Tooltip);
  20609. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  20610. const useButton = (props, emit) => {
  20611. useDeprecated({
  20612. from: "type.text",
  20613. replacement: "link",
  20614. version: "3.0.0",
  20615. scope: "props",
  20616. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  20617. }, computed$1(() => props.type === "text"));
  20618. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  20619. const globalConfig2 = useGlobalConfig("button");
  20620. const { form } = useFormItem();
  20621. const _size = useFormSize(computed$1(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  20622. const _disabled = useFormDisabled();
  20623. const _ref = ref();
  20624. const slots = useSlots();
  20625. const _type = computed$1(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  20626. const autoInsertSpace = computed$1(() => {
  20627. var _a2, _b, _c;
  20628. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  20629. });
  20630. const _props = computed$1(() => {
  20631. if (props.tag === "button") {
  20632. return {
  20633. ariaDisabled: _disabled.value || props.loading,
  20634. disabled: _disabled.value || props.loading,
  20635. autofocus: props.autofocus,
  20636. type: props.nativeType
  20637. };
  20638. }
  20639. return {};
  20640. });
  20641. const shouldAddSpace = computed$1(() => {
  20642. var _a2;
  20643. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  20644. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  20645. const slot = defaultSlot[0];
  20646. if ((slot == null ? void 0 : slot.type) === Text$1) {
  20647. const text = slot.children;
  20648. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  20649. }
  20650. }
  20651. return false;
  20652. });
  20653. const handleClick = (evt) => {
  20654. if (props.nativeType === "reset") {
  20655. form == null ? void 0 : form.resetFields();
  20656. }
  20657. emit("click", evt);
  20658. };
  20659. return {
  20660. _disabled,
  20661. _size,
  20662. _type,
  20663. _ref,
  20664. _props,
  20665. shouldAddSpace,
  20666. handleClick
  20667. };
  20668. };
  20669. const buttonTypes = [
  20670. "default",
  20671. "primary",
  20672. "success",
  20673. "warning",
  20674. "info",
  20675. "danger",
  20676. "text",
  20677. ""
  20678. ];
  20679. const buttonNativeTypes = ["button", "submit", "reset"];
  20680. const buttonProps = buildProps({
  20681. size: useSizeProp,
  20682. disabled: Boolean,
  20683. type: {
  20684. type: String,
  20685. values: buttonTypes,
  20686. default: ""
  20687. },
  20688. icon: {
  20689. type: iconPropType
  20690. },
  20691. nativeType: {
  20692. type: String,
  20693. values: buttonNativeTypes,
  20694. default: "button"
  20695. },
  20696. loading: Boolean,
  20697. loadingIcon: {
  20698. type: iconPropType,
  20699. default: () => loading_default
  20700. },
  20701. plain: Boolean,
  20702. text: Boolean,
  20703. link: Boolean,
  20704. bg: Boolean,
  20705. autofocus: Boolean,
  20706. round: Boolean,
  20707. circle: Boolean,
  20708. color: String,
  20709. dark: Boolean,
  20710. autoInsertSpace: {
  20711. type: Boolean,
  20712. default: void 0
  20713. },
  20714. tag: {
  20715. type: definePropType([String, Object]),
  20716. default: "button"
  20717. }
  20718. });
  20719. const buttonEmits = {
  20720. click: (evt) => evt instanceof MouseEvent
  20721. };
  20722. function bound01$1(n, max2) {
  20723. if (isOnePointZero$1(n)) {
  20724. n = "100%";
  20725. }
  20726. var isPercent = isPercentage$1(n);
  20727. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  20728. if (isPercent) {
  20729. n = parseInt(String(n * max2), 10) / 100;
  20730. }
  20731. if (Math.abs(n - max2) < 1e-6) {
  20732. return 1;
  20733. }
  20734. if (max2 === 360) {
  20735. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  20736. } else {
  20737. n = n % max2 / parseFloat(String(max2));
  20738. }
  20739. return n;
  20740. }
  20741. function clamp01(val) {
  20742. return Math.min(1, Math.max(0, val));
  20743. }
  20744. function isOnePointZero$1(n) {
  20745. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  20746. }
  20747. function isPercentage$1(n) {
  20748. return typeof n === "string" && n.indexOf("%") !== -1;
  20749. }
  20750. function boundAlpha(a) {
  20751. a = parseFloat(a);
  20752. if (isNaN(a) || a < 0 || a > 1) {
  20753. a = 1;
  20754. }
  20755. return a;
  20756. }
  20757. function convertToPercentage(n) {
  20758. if (n <= 1) {
  20759. return "".concat(Number(n) * 100, "%");
  20760. }
  20761. return n;
  20762. }
  20763. function pad2(c) {
  20764. return c.length === 1 ? "0" + c : String(c);
  20765. }
  20766. function rgbToRgb(r2, g, b) {
  20767. return {
  20768. r: bound01$1(r2, 255) * 255,
  20769. g: bound01$1(g, 255) * 255,
  20770. b: bound01$1(b, 255) * 255
  20771. };
  20772. }
  20773. function rgbToHsl(r2, g, b) {
  20774. r2 = bound01$1(r2, 255);
  20775. g = bound01$1(g, 255);
  20776. b = bound01$1(b, 255);
  20777. var max2 = Math.max(r2, g, b);
  20778. var min2 = Math.min(r2, g, b);
  20779. var h2 = 0;
  20780. var s = 0;
  20781. var l = (max2 + min2) / 2;
  20782. if (max2 === min2) {
  20783. s = 0;
  20784. h2 = 0;
  20785. } else {
  20786. var d2 = max2 - min2;
  20787. s = l > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  20788. switch (max2) {
  20789. case r2:
  20790. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20791. break;
  20792. case g:
  20793. h2 = (b - r2) / d2 + 2;
  20794. break;
  20795. case b:
  20796. h2 = (r2 - g) / d2 + 4;
  20797. break;
  20798. }
  20799. h2 /= 6;
  20800. }
  20801. return { h: h2, s, l };
  20802. }
  20803. function hue2rgb(p, q2, t2) {
  20804. if (t2 < 0) {
  20805. t2 += 1;
  20806. }
  20807. if (t2 > 1) {
  20808. t2 -= 1;
  20809. }
  20810. if (t2 < 1 / 6) {
  20811. return p + (q2 - p) * (6 * t2);
  20812. }
  20813. if (t2 < 1 / 2) {
  20814. return q2;
  20815. }
  20816. if (t2 < 2 / 3) {
  20817. return p + (q2 - p) * (2 / 3 - t2) * 6;
  20818. }
  20819. return p;
  20820. }
  20821. function hslToRgb(h2, s, l) {
  20822. var r2;
  20823. var g;
  20824. var b;
  20825. h2 = bound01$1(h2, 360);
  20826. s = bound01$1(s, 100);
  20827. l = bound01$1(l, 100);
  20828. if (s === 0) {
  20829. g = l;
  20830. b = l;
  20831. r2 = l;
  20832. } else {
  20833. var q2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
  20834. var p = 2 * l - q2;
  20835. r2 = hue2rgb(p, q2, h2 + 1 / 3);
  20836. g = hue2rgb(p, q2, h2);
  20837. b = hue2rgb(p, q2, h2 - 1 / 3);
  20838. }
  20839. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20840. }
  20841. function rgbToHsv(r2, g, b) {
  20842. r2 = bound01$1(r2, 255);
  20843. g = bound01$1(g, 255);
  20844. b = bound01$1(b, 255);
  20845. var max2 = Math.max(r2, g, b);
  20846. var min2 = Math.min(r2, g, b);
  20847. var h2 = 0;
  20848. var v = max2;
  20849. var d2 = max2 - min2;
  20850. var s = max2 === 0 ? 0 : d2 / max2;
  20851. if (max2 === min2) {
  20852. h2 = 0;
  20853. } else {
  20854. switch (max2) {
  20855. case r2:
  20856. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20857. break;
  20858. case g:
  20859. h2 = (b - r2) / d2 + 2;
  20860. break;
  20861. case b:
  20862. h2 = (r2 - g) / d2 + 4;
  20863. break;
  20864. }
  20865. h2 /= 6;
  20866. }
  20867. return { h: h2, s, v };
  20868. }
  20869. function hsvToRgb(h2, s, v) {
  20870. h2 = bound01$1(h2, 360) * 6;
  20871. s = bound01$1(s, 100);
  20872. v = bound01$1(v, 100);
  20873. var i2 = Math.floor(h2);
  20874. var f = h2 - i2;
  20875. var p = v * (1 - s);
  20876. var q2 = v * (1 - f * s);
  20877. var t2 = v * (1 - (1 - f) * s);
  20878. var mod = i2 % 6;
  20879. var r2 = [v, q2, p, p, t2, v][mod];
  20880. var g = [t2, v, v, q2, p, p][mod];
  20881. var b = [p, p, t2, v, v, q2][mod];
  20882. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20883. }
  20884. function rgbToHex(r2, g, b, allow3Char) {
  20885. var hex = [
  20886. pad2(Math.round(r2).toString(16)),
  20887. pad2(Math.round(g).toString(16)),
  20888. pad2(Math.round(b).toString(16))
  20889. ];
  20890. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  20891. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  20892. }
  20893. return hex.join("");
  20894. }
  20895. function rgbaToHex(r2, g, b, a, allow4Char) {
  20896. var hex = [
  20897. pad2(Math.round(r2).toString(16)),
  20898. pad2(Math.round(g).toString(16)),
  20899. pad2(Math.round(b).toString(16)),
  20900. pad2(convertDecimalToHex(a))
  20901. ];
  20902. 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))) {
  20903. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  20904. }
  20905. return hex.join("");
  20906. }
  20907. function convertDecimalToHex(d2) {
  20908. return Math.round(parseFloat(d2) * 255).toString(16);
  20909. }
  20910. function convertHexToDecimal(h2) {
  20911. return parseIntFromHex(h2) / 255;
  20912. }
  20913. function parseIntFromHex(val) {
  20914. return parseInt(val, 16);
  20915. }
  20916. function numberInputToObject(color2) {
  20917. return {
  20918. r: color2 >> 16,
  20919. g: (color2 & 65280) >> 8,
  20920. b: color2 & 255
  20921. };
  20922. }
  20923. var names = {
  20924. aliceblue: "#f0f8ff",
  20925. antiquewhite: "#faebd7",
  20926. aqua: "#00ffff",
  20927. aquamarine: "#7fffd4",
  20928. azure: "#f0ffff",
  20929. beige: "#f5f5dc",
  20930. bisque: "#ffe4c4",
  20931. black: "#000000",
  20932. blanchedalmond: "#ffebcd",
  20933. blue: "#0000ff",
  20934. blueviolet: "#8a2be2",
  20935. brown: "#a52a2a",
  20936. burlywood: "#deb887",
  20937. cadetblue: "#5f9ea0",
  20938. chartreuse: "#7fff00",
  20939. chocolate: "#d2691e",
  20940. coral: "#ff7f50",
  20941. cornflowerblue: "#6495ed",
  20942. cornsilk: "#fff8dc",
  20943. crimson: "#dc143c",
  20944. cyan: "#00ffff",
  20945. darkblue: "#00008b",
  20946. darkcyan: "#008b8b",
  20947. darkgoldenrod: "#b8860b",
  20948. darkgray: "#a9a9a9",
  20949. darkgreen: "#006400",
  20950. darkgrey: "#a9a9a9",
  20951. darkkhaki: "#bdb76b",
  20952. darkmagenta: "#8b008b",
  20953. darkolivegreen: "#556b2f",
  20954. darkorange: "#ff8c00",
  20955. darkorchid: "#9932cc",
  20956. darkred: "#8b0000",
  20957. darksalmon: "#e9967a",
  20958. darkseagreen: "#8fbc8f",
  20959. darkslateblue: "#483d8b",
  20960. darkslategray: "#2f4f4f",
  20961. darkslategrey: "#2f4f4f",
  20962. darkturquoise: "#00ced1",
  20963. darkviolet: "#9400d3",
  20964. deeppink: "#ff1493",
  20965. deepskyblue: "#00bfff",
  20966. dimgray: "#696969",
  20967. dimgrey: "#696969",
  20968. dodgerblue: "#1e90ff",
  20969. firebrick: "#b22222",
  20970. floralwhite: "#fffaf0",
  20971. forestgreen: "#228b22",
  20972. fuchsia: "#ff00ff",
  20973. gainsboro: "#dcdcdc",
  20974. ghostwhite: "#f8f8ff",
  20975. goldenrod: "#daa520",
  20976. gold: "#ffd700",
  20977. gray: "#808080",
  20978. green: "#008000",
  20979. greenyellow: "#adff2f",
  20980. grey: "#808080",
  20981. honeydew: "#f0fff0",
  20982. hotpink: "#ff69b4",
  20983. indianred: "#cd5c5c",
  20984. indigo: "#4b0082",
  20985. ivory: "#fffff0",
  20986. khaki: "#f0e68c",
  20987. lavenderblush: "#fff0f5",
  20988. lavender: "#e6e6fa",
  20989. lawngreen: "#7cfc00",
  20990. lemonchiffon: "#fffacd",
  20991. lightblue: "#add8e6",
  20992. lightcoral: "#f08080",
  20993. lightcyan: "#e0ffff",
  20994. lightgoldenrodyellow: "#fafad2",
  20995. lightgray: "#d3d3d3",
  20996. lightgreen: "#90ee90",
  20997. lightgrey: "#d3d3d3",
  20998. lightpink: "#ffb6c1",
  20999. lightsalmon: "#ffa07a",
  21000. lightseagreen: "#20b2aa",
  21001. lightskyblue: "#87cefa",
  21002. lightslategray: "#778899",
  21003. lightslategrey: "#778899",
  21004. lightsteelblue: "#b0c4de",
  21005. lightyellow: "#ffffe0",
  21006. lime: "#00ff00",
  21007. limegreen: "#32cd32",
  21008. linen: "#faf0e6",
  21009. magenta: "#ff00ff",
  21010. maroon: "#800000",
  21011. mediumaquamarine: "#66cdaa",
  21012. mediumblue: "#0000cd",
  21013. mediumorchid: "#ba55d3",
  21014. mediumpurple: "#9370db",
  21015. mediumseagreen: "#3cb371",
  21016. mediumslateblue: "#7b68ee",
  21017. mediumspringgreen: "#00fa9a",
  21018. mediumturquoise: "#48d1cc",
  21019. mediumvioletred: "#c71585",
  21020. midnightblue: "#191970",
  21021. mintcream: "#f5fffa",
  21022. mistyrose: "#ffe4e1",
  21023. moccasin: "#ffe4b5",
  21024. navajowhite: "#ffdead",
  21025. navy: "#000080",
  21026. oldlace: "#fdf5e6",
  21027. olive: "#808000",
  21028. olivedrab: "#6b8e23",
  21029. orange: "#ffa500",
  21030. orangered: "#ff4500",
  21031. orchid: "#da70d6",
  21032. palegoldenrod: "#eee8aa",
  21033. palegreen: "#98fb98",
  21034. paleturquoise: "#afeeee",
  21035. palevioletred: "#db7093",
  21036. papayawhip: "#ffefd5",
  21037. peachpuff: "#ffdab9",
  21038. peru: "#cd853f",
  21039. pink: "#ffc0cb",
  21040. plum: "#dda0dd",
  21041. powderblue: "#b0e0e6",
  21042. purple: "#800080",
  21043. rebeccapurple: "#663399",
  21044. red: "#ff0000",
  21045. rosybrown: "#bc8f8f",
  21046. royalblue: "#4169e1",
  21047. saddlebrown: "#8b4513",
  21048. salmon: "#fa8072",
  21049. sandybrown: "#f4a460",
  21050. seagreen: "#2e8b57",
  21051. seashell: "#fff5ee",
  21052. sienna: "#a0522d",
  21053. silver: "#c0c0c0",
  21054. skyblue: "#87ceeb",
  21055. slateblue: "#6a5acd",
  21056. slategray: "#708090",
  21057. slategrey: "#708090",
  21058. snow: "#fffafa",
  21059. springgreen: "#00ff7f",
  21060. steelblue: "#4682b4",
  21061. tan: "#d2b48c",
  21062. teal: "#008080",
  21063. thistle: "#d8bfd8",
  21064. tomato: "#ff6347",
  21065. turquoise: "#40e0d0",
  21066. violet: "#ee82ee",
  21067. wheat: "#f5deb3",
  21068. white: "#ffffff",
  21069. whitesmoke: "#f5f5f5",
  21070. yellow: "#ffff00",
  21071. yellowgreen: "#9acd32"
  21072. };
  21073. function inputToRGB(color2) {
  21074. var rgb = { r: 0, g: 0, b: 0 };
  21075. var a = 1;
  21076. var s = null;
  21077. var v = null;
  21078. var l = null;
  21079. var ok = false;
  21080. var format = false;
  21081. if (typeof color2 === "string") {
  21082. color2 = stringInputToObject(color2);
  21083. }
  21084. if (typeof color2 === "object") {
  21085. if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
  21086. rgb = rgbToRgb(color2.r, color2.g, color2.b);
  21087. ok = true;
  21088. format = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
  21089. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
  21090. s = convertToPercentage(color2.s);
  21091. v = convertToPercentage(color2.v);
  21092. rgb = hsvToRgb(color2.h, s, v);
  21093. ok = true;
  21094. format = "hsv";
  21095. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
  21096. s = convertToPercentage(color2.s);
  21097. l = convertToPercentage(color2.l);
  21098. rgb = hslToRgb(color2.h, s, l);
  21099. ok = true;
  21100. format = "hsl";
  21101. }
  21102. if (Object.prototype.hasOwnProperty.call(color2, "a")) {
  21103. a = color2.a;
  21104. }
  21105. }
  21106. a = boundAlpha(a);
  21107. return {
  21108. ok,
  21109. format: color2.format || format,
  21110. r: Math.min(255, Math.max(rgb.r, 0)),
  21111. g: Math.min(255, Math.max(rgb.g, 0)),
  21112. b: Math.min(255, Math.max(rgb.b, 0)),
  21113. a
  21114. };
  21115. }
  21116. var CSS_INTEGER = "[-\\+]?\\d+%?";
  21117. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  21118. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  21119. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21120. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21121. var matchers = {
  21122. CSS_UNIT: new RegExp(CSS_UNIT),
  21123. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  21124. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  21125. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  21126. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  21127. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  21128. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  21129. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21130. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  21131. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21132. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  21133. };
  21134. function stringInputToObject(color2) {
  21135. color2 = color2.trim().toLowerCase();
  21136. if (color2.length === 0) {
  21137. return false;
  21138. }
  21139. var named = false;
  21140. if (names[color2]) {
  21141. color2 = names[color2];
  21142. named = true;
  21143. } else if (color2 === "transparent") {
  21144. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  21145. }
  21146. var match = matchers.rgb.exec(color2);
  21147. if (match) {
  21148. return { r: match[1], g: match[2], b: match[3] };
  21149. }
  21150. match = matchers.rgba.exec(color2);
  21151. if (match) {
  21152. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  21153. }
  21154. match = matchers.hsl.exec(color2);
  21155. if (match) {
  21156. return { h: match[1], s: match[2], l: match[3] };
  21157. }
  21158. match = matchers.hsla.exec(color2);
  21159. if (match) {
  21160. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  21161. }
  21162. match = matchers.hsv.exec(color2);
  21163. if (match) {
  21164. return { h: match[1], s: match[2], v: match[3] };
  21165. }
  21166. match = matchers.hsva.exec(color2);
  21167. if (match) {
  21168. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  21169. }
  21170. match = matchers.hex8.exec(color2);
  21171. if (match) {
  21172. return {
  21173. r: parseIntFromHex(match[1]),
  21174. g: parseIntFromHex(match[2]),
  21175. b: parseIntFromHex(match[3]),
  21176. a: convertHexToDecimal(match[4]),
  21177. format: named ? "name" : "hex8"
  21178. };
  21179. }
  21180. match = matchers.hex6.exec(color2);
  21181. if (match) {
  21182. return {
  21183. r: parseIntFromHex(match[1]),
  21184. g: parseIntFromHex(match[2]),
  21185. b: parseIntFromHex(match[3]),
  21186. format: named ? "name" : "hex"
  21187. };
  21188. }
  21189. match = matchers.hex4.exec(color2);
  21190. if (match) {
  21191. return {
  21192. r: parseIntFromHex(match[1] + match[1]),
  21193. g: parseIntFromHex(match[2] + match[2]),
  21194. b: parseIntFromHex(match[3] + match[3]),
  21195. a: convertHexToDecimal(match[4] + match[4]),
  21196. format: named ? "name" : "hex8"
  21197. };
  21198. }
  21199. match = matchers.hex3.exec(color2);
  21200. if (match) {
  21201. return {
  21202. r: parseIntFromHex(match[1] + match[1]),
  21203. g: parseIntFromHex(match[2] + match[2]),
  21204. b: parseIntFromHex(match[3] + match[3]),
  21205. format: named ? "name" : "hex"
  21206. };
  21207. }
  21208. return false;
  21209. }
  21210. function isValidCSSUnit(color2) {
  21211. return Boolean(matchers.CSS_UNIT.exec(String(color2)));
  21212. }
  21213. var TinyColor = function() {
  21214. function TinyColor2(color2, opts) {
  21215. if (color2 === void 0) {
  21216. color2 = "";
  21217. }
  21218. if (opts === void 0) {
  21219. opts = {};
  21220. }
  21221. var _a2;
  21222. if (color2 instanceof TinyColor2) {
  21223. return color2;
  21224. }
  21225. if (typeof color2 === "number") {
  21226. color2 = numberInputToObject(color2);
  21227. }
  21228. this.originalInput = color2;
  21229. var rgb = inputToRGB(color2);
  21230. this.originalInput = color2;
  21231. this.r = rgb.r;
  21232. this.g = rgb.g;
  21233. this.b = rgb.b;
  21234. this.a = rgb.a;
  21235. this.roundA = Math.round(100 * this.a) / 100;
  21236. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  21237. this.gradientType = opts.gradientType;
  21238. if (this.r < 1) {
  21239. this.r = Math.round(this.r);
  21240. }
  21241. if (this.g < 1) {
  21242. this.g = Math.round(this.g);
  21243. }
  21244. if (this.b < 1) {
  21245. this.b = Math.round(this.b);
  21246. }
  21247. this.isValid = rgb.ok;
  21248. }
  21249. TinyColor2.prototype.isDark = function() {
  21250. return this.getBrightness() < 128;
  21251. };
  21252. TinyColor2.prototype.isLight = function() {
  21253. return !this.isDark();
  21254. };
  21255. TinyColor2.prototype.getBrightness = function() {
  21256. var rgb = this.toRgb();
  21257. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  21258. };
  21259. TinyColor2.prototype.getLuminance = function() {
  21260. var rgb = this.toRgb();
  21261. var R2;
  21262. var G2;
  21263. var B2;
  21264. var RsRGB = rgb.r / 255;
  21265. var GsRGB = rgb.g / 255;
  21266. var BsRGB = rgb.b / 255;
  21267. if (RsRGB <= 0.03928) {
  21268. R2 = RsRGB / 12.92;
  21269. } else {
  21270. R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  21271. }
  21272. if (GsRGB <= 0.03928) {
  21273. G2 = GsRGB / 12.92;
  21274. } else {
  21275. G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  21276. }
  21277. if (BsRGB <= 0.03928) {
  21278. B2 = BsRGB / 12.92;
  21279. } else {
  21280. B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  21281. }
  21282. return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  21283. };
  21284. TinyColor2.prototype.getAlpha = function() {
  21285. return this.a;
  21286. };
  21287. TinyColor2.prototype.setAlpha = function(alpha) {
  21288. this.a = boundAlpha(alpha);
  21289. this.roundA = Math.round(100 * this.a) / 100;
  21290. return this;
  21291. };
  21292. TinyColor2.prototype.isMonochrome = function() {
  21293. var s = this.toHsl().s;
  21294. return s === 0;
  21295. };
  21296. TinyColor2.prototype.toHsv = function() {
  21297. var hsv = rgbToHsv(this.r, this.g, this.b);
  21298. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  21299. };
  21300. TinyColor2.prototype.toHsvString = function() {
  21301. var hsv = rgbToHsv(this.r, this.g, this.b);
  21302. var h2 = Math.round(hsv.h * 360);
  21303. var s = Math.round(hsv.s * 100);
  21304. var v = Math.round(hsv.v * 100);
  21305. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h2, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  21306. };
  21307. TinyColor2.prototype.toHsl = function() {
  21308. var hsl = rgbToHsl(this.r, this.g, this.b);
  21309. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  21310. };
  21311. TinyColor2.prototype.toHslString = function() {
  21312. var hsl = rgbToHsl(this.r, this.g, this.b);
  21313. var h2 = Math.round(hsl.h * 360);
  21314. var s = Math.round(hsl.s * 100);
  21315. var l = Math.round(hsl.l * 100);
  21316. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h2, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  21317. };
  21318. TinyColor2.prototype.toHex = function(allow3Char) {
  21319. if (allow3Char === void 0) {
  21320. allow3Char = false;
  21321. }
  21322. return rgbToHex(this.r, this.g, this.b, allow3Char);
  21323. };
  21324. TinyColor2.prototype.toHexString = function(allow3Char) {
  21325. if (allow3Char === void 0) {
  21326. allow3Char = false;
  21327. }
  21328. return "#" + this.toHex(allow3Char);
  21329. };
  21330. TinyColor2.prototype.toHex8 = function(allow4Char) {
  21331. if (allow4Char === void 0) {
  21332. allow4Char = false;
  21333. }
  21334. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  21335. };
  21336. TinyColor2.prototype.toHex8String = function(allow4Char) {
  21337. if (allow4Char === void 0) {
  21338. allow4Char = false;
  21339. }
  21340. return "#" + this.toHex8(allow4Char);
  21341. };
  21342. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  21343. if (allowShortChar === void 0) {
  21344. allowShortChar = false;
  21345. }
  21346. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  21347. };
  21348. TinyColor2.prototype.toRgb = function() {
  21349. return {
  21350. r: Math.round(this.r),
  21351. g: Math.round(this.g),
  21352. b: Math.round(this.b),
  21353. a: this.a
  21354. };
  21355. };
  21356. TinyColor2.prototype.toRgbString = function() {
  21357. var r2 = Math.round(this.r);
  21358. var g = Math.round(this.g);
  21359. var b = Math.round(this.b);
  21360. return this.a === 1 ? "rgb(".concat(r2, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r2, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  21361. };
  21362. TinyColor2.prototype.toPercentageRgb = function() {
  21363. var fmt = function(x) {
  21364. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  21365. };
  21366. return {
  21367. r: fmt(this.r),
  21368. g: fmt(this.g),
  21369. b: fmt(this.b),
  21370. a: this.a
  21371. };
  21372. };
  21373. TinyColor2.prototype.toPercentageRgbString = function() {
  21374. var rnd = function(x) {
  21375. return Math.round(bound01$1(x, 255) * 100);
  21376. };
  21377. 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, ")");
  21378. };
  21379. TinyColor2.prototype.toName = function() {
  21380. if (this.a === 0) {
  21381. return "transparent";
  21382. }
  21383. if (this.a < 1) {
  21384. return false;
  21385. }
  21386. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  21387. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  21388. var _b = _a2[_i], key = _b[0], value = _b[1];
  21389. if (hex === value) {
  21390. return key;
  21391. }
  21392. }
  21393. return false;
  21394. };
  21395. TinyColor2.prototype.toString = function(format) {
  21396. var formatSet = Boolean(format);
  21397. format = format !== null && format !== void 0 ? format : this.format;
  21398. var formattedString = false;
  21399. var hasAlpha = this.a < 1 && this.a >= 0;
  21400. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  21401. if (needsAlphaFormat) {
  21402. if (format === "name" && this.a === 0) {
  21403. return this.toName();
  21404. }
  21405. return this.toRgbString();
  21406. }
  21407. if (format === "rgb") {
  21408. formattedString = this.toRgbString();
  21409. }
  21410. if (format === "prgb") {
  21411. formattedString = this.toPercentageRgbString();
  21412. }
  21413. if (format === "hex" || format === "hex6") {
  21414. formattedString = this.toHexString();
  21415. }
  21416. if (format === "hex3") {
  21417. formattedString = this.toHexString(true);
  21418. }
  21419. if (format === "hex4") {
  21420. formattedString = this.toHex8String(true);
  21421. }
  21422. if (format === "hex8") {
  21423. formattedString = this.toHex8String();
  21424. }
  21425. if (format === "name") {
  21426. formattedString = this.toName();
  21427. }
  21428. if (format === "hsl") {
  21429. formattedString = this.toHslString();
  21430. }
  21431. if (format === "hsv") {
  21432. formattedString = this.toHsvString();
  21433. }
  21434. return formattedString || this.toHexString();
  21435. };
  21436. TinyColor2.prototype.toNumber = function() {
  21437. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  21438. };
  21439. TinyColor2.prototype.clone = function() {
  21440. return new TinyColor2(this.toString());
  21441. };
  21442. TinyColor2.prototype.lighten = function(amount) {
  21443. if (amount === void 0) {
  21444. amount = 10;
  21445. }
  21446. var hsl = this.toHsl();
  21447. hsl.l += amount / 100;
  21448. hsl.l = clamp01(hsl.l);
  21449. return new TinyColor2(hsl);
  21450. };
  21451. TinyColor2.prototype.brighten = function(amount) {
  21452. if (amount === void 0) {
  21453. amount = 10;
  21454. }
  21455. var rgb = this.toRgb();
  21456. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  21457. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  21458. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  21459. return new TinyColor2(rgb);
  21460. };
  21461. TinyColor2.prototype.darken = function(amount) {
  21462. if (amount === void 0) {
  21463. amount = 10;
  21464. }
  21465. var hsl = this.toHsl();
  21466. hsl.l -= amount / 100;
  21467. hsl.l = clamp01(hsl.l);
  21468. return new TinyColor2(hsl);
  21469. };
  21470. TinyColor2.prototype.tint = function(amount) {
  21471. if (amount === void 0) {
  21472. amount = 10;
  21473. }
  21474. return this.mix("white", amount);
  21475. };
  21476. TinyColor2.prototype.shade = function(amount) {
  21477. if (amount === void 0) {
  21478. amount = 10;
  21479. }
  21480. return this.mix("black", amount);
  21481. };
  21482. TinyColor2.prototype.desaturate = function(amount) {
  21483. if (amount === void 0) {
  21484. amount = 10;
  21485. }
  21486. var hsl = this.toHsl();
  21487. hsl.s -= amount / 100;
  21488. hsl.s = clamp01(hsl.s);
  21489. return new TinyColor2(hsl);
  21490. };
  21491. TinyColor2.prototype.saturate = function(amount) {
  21492. if (amount === void 0) {
  21493. amount = 10;
  21494. }
  21495. var hsl = this.toHsl();
  21496. hsl.s += amount / 100;
  21497. hsl.s = clamp01(hsl.s);
  21498. return new TinyColor2(hsl);
  21499. };
  21500. TinyColor2.prototype.greyscale = function() {
  21501. return this.desaturate(100);
  21502. };
  21503. TinyColor2.prototype.spin = function(amount) {
  21504. var hsl = this.toHsl();
  21505. var hue = (hsl.h + amount) % 360;
  21506. hsl.h = hue < 0 ? 360 + hue : hue;
  21507. return new TinyColor2(hsl);
  21508. };
  21509. TinyColor2.prototype.mix = function(color2, amount) {
  21510. if (amount === void 0) {
  21511. amount = 50;
  21512. }
  21513. var rgb1 = this.toRgb();
  21514. var rgb2 = new TinyColor2(color2).toRgb();
  21515. var p = amount / 100;
  21516. var rgba = {
  21517. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  21518. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  21519. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  21520. a: (rgb2.a - rgb1.a) * p + rgb1.a
  21521. };
  21522. return new TinyColor2(rgba);
  21523. };
  21524. TinyColor2.prototype.analogous = function(results, slices) {
  21525. if (results === void 0) {
  21526. results = 6;
  21527. }
  21528. if (slices === void 0) {
  21529. slices = 30;
  21530. }
  21531. var hsl = this.toHsl();
  21532. var part = 360 / slices;
  21533. var ret = [this];
  21534. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  21535. hsl.h = (hsl.h + part) % 360;
  21536. ret.push(new TinyColor2(hsl));
  21537. }
  21538. return ret;
  21539. };
  21540. TinyColor2.prototype.complement = function() {
  21541. var hsl = this.toHsl();
  21542. hsl.h = (hsl.h + 180) % 360;
  21543. return new TinyColor2(hsl);
  21544. };
  21545. TinyColor2.prototype.monochromatic = function(results) {
  21546. if (results === void 0) {
  21547. results = 6;
  21548. }
  21549. var hsv = this.toHsv();
  21550. var h2 = hsv.h;
  21551. var s = hsv.s;
  21552. var v = hsv.v;
  21553. var res = [];
  21554. var modification = 1 / results;
  21555. while (results--) {
  21556. res.push(new TinyColor2({ h: h2, s, v }));
  21557. v = (v + modification) % 1;
  21558. }
  21559. return res;
  21560. };
  21561. TinyColor2.prototype.splitcomplement = function() {
  21562. var hsl = this.toHsl();
  21563. var h2 = hsl.h;
  21564. return [
  21565. this,
  21566. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  21567. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  21568. ];
  21569. };
  21570. TinyColor2.prototype.onBackground = function(background) {
  21571. var fg = this.toRgb();
  21572. var bg = new TinyColor2(background).toRgb();
  21573. var alpha = fg.a + bg.a * (1 - fg.a);
  21574. return new TinyColor2({
  21575. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  21576. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  21577. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  21578. a: alpha
  21579. });
  21580. };
  21581. TinyColor2.prototype.triad = function() {
  21582. return this.polyad(3);
  21583. };
  21584. TinyColor2.prototype.tetrad = function() {
  21585. return this.polyad(4);
  21586. };
  21587. TinyColor2.prototype.polyad = function(n) {
  21588. var hsl = this.toHsl();
  21589. var h2 = hsl.h;
  21590. var result = [this];
  21591. var increment = 360 / n;
  21592. for (var i2 = 1; i2 < n; i2++) {
  21593. result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l }));
  21594. }
  21595. return result;
  21596. };
  21597. TinyColor2.prototype.equals = function(color2) {
  21598. return this.toRgbString() === new TinyColor2(color2).toRgbString();
  21599. };
  21600. return TinyColor2;
  21601. }();
  21602. function darken(color2, amount = 20) {
  21603. return color2.mix("#141414", amount).toString();
  21604. }
  21605. function useButtonCustomStyle(props) {
  21606. const _disabled = useFormDisabled();
  21607. const ns = useNamespace("button");
  21608. return computed$1(() => {
  21609. let styles = {};
  21610. const buttonColor = props.color;
  21611. if (buttonColor) {
  21612. const color2 = new TinyColor(buttonColor);
  21613. const activeBgColor = props.dark ? color2.tint(20).toString() : darken(color2, 20);
  21614. if (props.plain) {
  21615. styles = ns.cssVarBlock({
  21616. "bg-color": props.dark ? darken(color2, 90) : color2.tint(90).toString(),
  21617. "text-color": buttonColor,
  21618. "border-color": props.dark ? darken(color2, 50) : color2.tint(50).toString(),
  21619. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  21620. "hover-bg-color": buttonColor,
  21621. "hover-border-color": buttonColor,
  21622. "active-bg-color": activeBgColor,
  21623. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  21624. "active-border-color": activeBgColor
  21625. });
  21626. if (_disabled.value) {
  21627. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color2, 90) : color2.tint(90).toString();
  21628. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21629. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color2, 80) : color2.tint(80).toString();
  21630. }
  21631. } else {
  21632. const hoverBgColor = props.dark ? darken(color2, 30) : color2.tint(30).toString();
  21633. const textColor = color2.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  21634. styles = ns.cssVarBlock({
  21635. "bg-color": buttonColor,
  21636. "text-color": textColor,
  21637. "border-color": buttonColor,
  21638. "hover-bg-color": hoverBgColor,
  21639. "hover-text-color": textColor,
  21640. "hover-border-color": hoverBgColor,
  21641. "active-bg-color": activeBgColor,
  21642. "active-border-color": activeBgColor
  21643. });
  21644. if (_disabled.value) {
  21645. const disabledButtonColor = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21646. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  21647. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  21648. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  21649. }
  21650. }
  21651. }
  21652. return styles;
  21653. });
  21654. }
  21655. const __default__$e = defineComponent({
  21656. name: "ElButton"
  21657. });
  21658. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  21659. ...__default__$e,
  21660. props: buttonProps,
  21661. emits: buttonEmits,
  21662. setup(__props, { expose, emit }) {
  21663. const props = __props;
  21664. const buttonStyle = useButtonCustomStyle(props);
  21665. const ns = useNamespace("button");
  21666. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  21667. expose({
  21668. ref: _ref,
  21669. size: _size,
  21670. type: _type,
  21671. disabled: _disabled,
  21672. shouldAddSpace
  21673. });
  21674. return (_ctx, _cache) => {
  21675. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  21676. ref_key: "_ref",
  21677. ref: _ref
  21678. }, unref(_props), {
  21679. class: [
  21680. unref(ns).b(),
  21681. unref(ns).m(unref(_type)),
  21682. unref(ns).m(unref(_size)),
  21683. unref(ns).is("disabled", unref(_disabled)),
  21684. unref(ns).is("loading", _ctx.loading),
  21685. unref(ns).is("plain", _ctx.plain),
  21686. unref(ns).is("round", _ctx.round),
  21687. unref(ns).is("circle", _ctx.circle),
  21688. unref(ns).is("text", _ctx.text),
  21689. unref(ns).is("link", _ctx.link),
  21690. unref(ns).is("has-bg", _ctx.bg)
  21691. ],
  21692. style: unref(buttonStyle),
  21693. onClick: unref(handleClick)
  21694. }), {
  21695. default: withCtx(() => [
  21696. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21697. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  21698. key: 1,
  21699. class: normalizeClass(unref(ns).is("loading"))
  21700. }, {
  21701. default: withCtx(() => [
  21702. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  21703. ]),
  21704. _: 1
  21705. }, 8, ["class"]))
  21706. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  21707. default: withCtx(() => [
  21708. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  21709. ]),
  21710. _: 3
  21711. })) : createCommentVNode("v-if", true),
  21712. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  21713. key: 2,
  21714. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  21715. }, [
  21716. renderSlot(_ctx.$slots, "default")
  21717. ], 2)) : createCommentVNode("v-if", true)
  21718. ]),
  21719. _: 3
  21720. }, 16, ["class", "style", "onClick"]);
  21721. };
  21722. }
  21723. });
  21724. var Button$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  21725. const buttonGroupProps = {
  21726. size: buttonProps.size,
  21727. type: buttonProps.type
  21728. };
  21729. const __default__$d = defineComponent({
  21730. name: "ElButtonGroup"
  21731. });
  21732. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  21733. ...__default__$d,
  21734. props: buttonGroupProps,
  21735. setup(__props) {
  21736. const props = __props;
  21737. provide(buttonGroupContextKey, reactive({
  21738. size: toRef(props, "size"),
  21739. type: toRef(props, "type")
  21740. }));
  21741. const ns = useNamespace("button");
  21742. return (_ctx, _cache) => {
  21743. return openBlock(), createElementBlock("div", {
  21744. class: normalizeClass(`${unref(ns).b("group")}`)
  21745. }, [
  21746. renderSlot(_ctx.$slots, "default")
  21747. ], 2);
  21748. };
  21749. }
  21750. });
  21751. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  21752. const ElButton = withInstall(Button$2, {
  21753. ButtonGroup
  21754. });
  21755. const ElButtonGroup = withNoopInstall(ButtonGroup);
  21756. const nodeList = /* @__PURE__ */ new Map();
  21757. let startClick;
  21758. if (isClient) {
  21759. document.addEventListener("mousedown", (e) => startClick = e);
  21760. document.addEventListener("mouseup", (e) => {
  21761. for (const handlers of nodeList.values()) {
  21762. for (const { documentHandler } of handlers) {
  21763. documentHandler(e, startClick);
  21764. }
  21765. }
  21766. });
  21767. }
  21768. function createDocumentHandler(el, binding) {
  21769. let excludes = [];
  21770. if (Array.isArray(binding.arg)) {
  21771. excludes = binding.arg;
  21772. } else if (isElement(binding.arg)) {
  21773. excludes.push(binding.arg);
  21774. }
  21775. return function(mouseup, mousedown) {
  21776. const popperRef = binding.instance.popperRef;
  21777. const mouseUpTarget = mouseup.target;
  21778. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  21779. const isBound = !binding || !binding.instance;
  21780. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  21781. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  21782. const isSelf = el === mouseUpTarget;
  21783. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  21784. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  21785. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  21786. return;
  21787. }
  21788. binding.value(mouseup, mousedown);
  21789. };
  21790. }
  21791. const ClickOutside = {
  21792. beforeMount(el, binding) {
  21793. if (!nodeList.has(el)) {
  21794. nodeList.set(el, []);
  21795. }
  21796. nodeList.get(el).push({
  21797. documentHandler: createDocumentHandler(el, binding),
  21798. bindingFn: binding.value
  21799. });
  21800. },
  21801. updated(el, binding) {
  21802. if (!nodeList.has(el)) {
  21803. nodeList.set(el, []);
  21804. }
  21805. const handlers = nodeList.get(el);
  21806. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  21807. const newHandler = {
  21808. documentHandler: createDocumentHandler(el, binding),
  21809. bindingFn: binding.value
  21810. };
  21811. if (oldHandlerIndex >= 0) {
  21812. handlers.splice(oldHandlerIndex, 1, newHandler);
  21813. } else {
  21814. handlers.push(newHandler);
  21815. }
  21816. },
  21817. unmounted(el) {
  21818. nodeList.delete(el);
  21819. }
  21820. };
  21821. const REPEAT_INTERVAL = 100;
  21822. const REPEAT_DELAY = 600;
  21823. const vRepeatClick = {
  21824. beforeMount(el, binding) {
  21825. const value = binding.value;
  21826. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$3(value) ? {} : value;
  21827. let intervalId;
  21828. let delayId;
  21829. const handler = () => isFunction$3(value) ? value() : value.handler();
  21830. const clear = () => {
  21831. if (delayId) {
  21832. clearTimeout(delayId);
  21833. delayId = void 0;
  21834. }
  21835. if (intervalId) {
  21836. clearInterval(intervalId);
  21837. intervalId = void 0;
  21838. }
  21839. };
  21840. el.addEventListener("mousedown", (evt) => {
  21841. if (evt.button !== 0)
  21842. return;
  21843. clear();
  21844. handler();
  21845. document.addEventListener("mouseup", () => clear(), {
  21846. once: true
  21847. });
  21848. delayId = setTimeout(() => {
  21849. intervalId = setInterval(() => {
  21850. handler();
  21851. }, interval);
  21852. }, delay);
  21853. });
  21854. }
  21855. };
  21856. const radioPropsBase = buildProps({
  21857. size: useSizeProp,
  21858. disabled: Boolean,
  21859. label: {
  21860. type: [String, Number, Boolean],
  21861. default: ""
  21862. }
  21863. });
  21864. const radioProps = buildProps({
  21865. ...radioPropsBase,
  21866. modelValue: {
  21867. type: [String, Number, Boolean],
  21868. default: ""
  21869. },
  21870. name: {
  21871. type: String,
  21872. default: ""
  21873. },
  21874. border: Boolean
  21875. });
  21876. const radioEmits = {
  21877. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  21878. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  21879. };
  21880. const radioGroupKey = Symbol("radioGroupKey");
  21881. const useRadio = (props, emit) => {
  21882. const radioRef = ref();
  21883. const radioGroup = inject(radioGroupKey, void 0);
  21884. const isGroup = computed$1(() => !!radioGroup);
  21885. const modelValue = computed$1({
  21886. get() {
  21887. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21888. },
  21889. set(val) {
  21890. if (isGroup.value) {
  21891. radioGroup.changeEvent(val);
  21892. } else {
  21893. emit && emit(UPDATE_MODEL_EVENT, val);
  21894. }
  21895. radioRef.value.checked = props.modelValue === props.label;
  21896. }
  21897. });
  21898. const size = useFormSize(computed$1(() => radioGroup == null ? void 0 : radioGroup.size));
  21899. const disabled = useFormDisabled(computed$1(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21900. const focus = ref(false);
  21901. const tabIndex = computed$1(() => {
  21902. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  21903. });
  21904. return {
  21905. radioRef,
  21906. isGroup,
  21907. radioGroup,
  21908. focus,
  21909. size,
  21910. disabled,
  21911. tabIndex,
  21912. modelValue
  21913. };
  21914. };
  21915. const _hoisted_1$e = ["value", "name", "disabled"];
  21916. const __default__$c = defineComponent({
  21917. name: "ElRadio"
  21918. });
  21919. const _sfc_main$m = /* @__PURE__ */ defineComponent({
  21920. ...__default__$c,
  21921. props: radioProps,
  21922. emits: radioEmits,
  21923. setup(__props, { emit }) {
  21924. const props = __props;
  21925. const ns = useNamespace("radio");
  21926. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  21927. function handleChange() {
  21928. nextTick(() => emit("change", modelValue.value));
  21929. }
  21930. return (_ctx, _cache) => {
  21931. var _a2;
  21932. return openBlock(), createElementBlock("label", {
  21933. class: normalizeClass([
  21934. unref(ns).b(),
  21935. unref(ns).is("disabled", unref(disabled)),
  21936. unref(ns).is("focus", unref(focus)),
  21937. unref(ns).is("bordered", _ctx.border),
  21938. unref(ns).is("checked", unref(modelValue) === _ctx.label),
  21939. unref(ns).m(unref(size))
  21940. ])
  21941. }, [
  21942. createElementVNode("span", {
  21943. class: normalizeClass([
  21944. unref(ns).e("input"),
  21945. unref(ns).is("disabled", unref(disabled)),
  21946. unref(ns).is("checked", unref(modelValue) === _ctx.label)
  21947. ])
  21948. }, [
  21949. withDirectives(createElementVNode("input", {
  21950. ref_key: "radioRef",
  21951. ref: radioRef,
  21952. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  21953. class: normalizeClass(unref(ns).e("original")),
  21954. value: _ctx.label,
  21955. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  21956. disabled: unref(disabled),
  21957. type: "radio",
  21958. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21959. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21960. onChange: handleChange
  21961. }, null, 42, _hoisted_1$e), [
  21962. [vModelRadio, unref(modelValue)]
  21963. ]),
  21964. createElementVNode("span", {
  21965. class: normalizeClass(unref(ns).e("inner"))
  21966. }, null, 2)
  21967. ], 2),
  21968. createElementVNode("span", {
  21969. class: normalizeClass(unref(ns).e("label")),
  21970. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  21971. }, ["stop"]))
  21972. }, [
  21973. renderSlot(_ctx.$slots, "default", {}, () => [
  21974. createTextVNode(toDisplayString(_ctx.label), 1)
  21975. ])
  21976. ], 34)
  21977. ], 2);
  21978. };
  21979. }
  21980. });
  21981. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  21982. const radioButtonProps = buildProps({
  21983. ...radioPropsBase,
  21984. name: {
  21985. type: String,
  21986. default: ""
  21987. }
  21988. });
  21989. const _hoisted_1$d = ["value", "name", "disabled"];
  21990. const __default__$b = defineComponent({
  21991. name: "ElRadioButton"
  21992. });
  21993. const _sfc_main$l = /* @__PURE__ */ defineComponent({
  21994. ...__default__$b,
  21995. props: radioButtonProps,
  21996. setup(__props) {
  21997. const props = __props;
  21998. const ns = useNamespace("radio");
  21999. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  22000. const activeStyle = computed$1(() => {
  22001. return {
  22002. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  22003. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  22004. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  22005. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  22006. };
  22007. });
  22008. return (_ctx, _cache) => {
  22009. var _a2;
  22010. return openBlock(), createElementBlock("label", {
  22011. class: normalizeClass([
  22012. unref(ns).b("button"),
  22013. unref(ns).is("active", unref(modelValue) === _ctx.label),
  22014. unref(ns).is("disabled", unref(disabled)),
  22015. unref(ns).is("focus", unref(focus)),
  22016. unref(ns).bm("button", unref(size))
  22017. ])
  22018. }, [
  22019. withDirectives(createElementVNode("input", {
  22020. ref_key: "radioRef",
  22021. ref: radioRef,
  22022. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  22023. class: normalizeClass(unref(ns).be("button", "original-radio")),
  22024. value: _ctx.label,
  22025. type: "radio",
  22026. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  22027. disabled: unref(disabled),
  22028. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  22029. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  22030. }, null, 42, _hoisted_1$d), [
  22031. [vModelRadio, unref(modelValue)]
  22032. ]),
  22033. createElementVNode("span", {
  22034. class: normalizeClass(unref(ns).be("button", "inner")),
  22035. style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
  22036. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  22037. }, ["stop"]))
  22038. }, [
  22039. renderSlot(_ctx.$slots, "default", {}, () => [
  22040. createTextVNode(toDisplayString(_ctx.label), 1)
  22041. ])
  22042. ], 38)
  22043. ], 2);
  22044. };
  22045. }
  22046. });
  22047. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  22048. const radioGroupProps = buildProps({
  22049. id: {
  22050. type: String,
  22051. default: void 0
  22052. },
  22053. size: useSizeProp,
  22054. disabled: Boolean,
  22055. modelValue: {
  22056. type: [String, Number, Boolean],
  22057. default: ""
  22058. },
  22059. fill: {
  22060. type: String,
  22061. default: ""
  22062. },
  22063. label: {
  22064. type: String,
  22065. default: void 0
  22066. },
  22067. textColor: {
  22068. type: String,
  22069. default: ""
  22070. },
  22071. name: {
  22072. type: String,
  22073. default: void 0
  22074. },
  22075. validateEvent: {
  22076. type: Boolean,
  22077. default: true
  22078. }
  22079. });
  22080. const radioGroupEmits = radioEmits;
  22081. const _hoisted_1$c = ["id", "aria-label", "aria-labelledby"];
  22082. const __default__$a = defineComponent({
  22083. name: "ElRadioGroup"
  22084. });
  22085. const _sfc_main$k = /* @__PURE__ */ defineComponent({
  22086. ...__default__$a,
  22087. props: radioGroupProps,
  22088. emits: radioGroupEmits,
  22089. setup(__props, { emit }) {
  22090. const props = __props;
  22091. const ns = useNamespace("radio");
  22092. const radioId = useId();
  22093. const radioGroupRef = ref();
  22094. const { formItem } = useFormItem();
  22095. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  22096. formItemContext: formItem
  22097. });
  22098. const changeEvent = (value) => {
  22099. emit(UPDATE_MODEL_EVENT, value);
  22100. nextTick(() => emit("change", value));
  22101. };
  22102. onMounted(() => {
  22103. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  22104. const firstLabel = radios[0];
  22105. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  22106. firstLabel.tabIndex = 0;
  22107. }
  22108. });
  22109. const name = computed$1(() => {
  22110. return props.name || radioId.value;
  22111. });
  22112. provide(radioGroupKey, reactive({
  22113. ...toRefs(props),
  22114. changeEvent,
  22115. name
  22116. }));
  22117. watch(() => props.modelValue, () => {
  22118. if (props.validateEvent) {
  22119. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22120. }
  22121. });
  22122. return (_ctx, _cache) => {
  22123. return openBlock(), createElementBlock("div", {
  22124. id: unref(groupId),
  22125. ref_key: "radioGroupRef",
  22126. ref: radioGroupRef,
  22127. class: normalizeClass(unref(ns).b("group")),
  22128. role: "radiogroup",
  22129. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  22130. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  22131. }, [
  22132. renderSlot(_ctx.$slots, "default")
  22133. ], 10, _hoisted_1$c);
  22134. };
  22135. }
  22136. });
  22137. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  22138. withInstall(Radio, {
  22139. RadioButton,
  22140. RadioGroup
  22141. });
  22142. const ElRadioGroup = withNoopInstall(RadioGroup);
  22143. const ElRadioButton = withNoopInstall(RadioButton);
  22144. const tagProps = buildProps({
  22145. closable: Boolean,
  22146. type: {
  22147. type: String,
  22148. values: ["success", "info", "warning", "danger", ""],
  22149. default: ""
  22150. },
  22151. hit: Boolean,
  22152. disableTransitions: Boolean,
  22153. color: {
  22154. type: String,
  22155. default: ""
  22156. },
  22157. size: {
  22158. type: String,
  22159. values: componentSizes,
  22160. default: ""
  22161. },
  22162. effect: {
  22163. type: String,
  22164. values: ["dark", "light", "plain"],
  22165. default: "light"
  22166. },
  22167. round: Boolean
  22168. });
  22169. const tagEmits = {
  22170. close: (evt) => evt instanceof MouseEvent,
  22171. click: (evt) => evt instanceof MouseEvent
  22172. };
  22173. const __default__$9 = defineComponent({
  22174. name: "ElTag"
  22175. });
  22176. const _sfc_main$j = /* @__PURE__ */ defineComponent({
  22177. ...__default__$9,
  22178. props: tagProps,
  22179. emits: tagEmits,
  22180. setup(__props, { emit }) {
  22181. const props = __props;
  22182. const tagSize = useFormSize();
  22183. const ns = useNamespace("tag");
  22184. const classes = computed$1(() => {
  22185. const { type: type2, hit, effect, closable, round: round2 } = props;
  22186. return [
  22187. ns.b(),
  22188. ns.is("closable", closable),
  22189. ns.m(type2),
  22190. ns.m(tagSize.value),
  22191. ns.m(effect),
  22192. ns.is("hit", hit),
  22193. ns.is("round", round2)
  22194. ];
  22195. });
  22196. const handleClose = (event2) => {
  22197. emit("close", event2);
  22198. };
  22199. const handleClick = (event2) => {
  22200. emit("click", event2);
  22201. };
  22202. return (_ctx, _cache) => {
  22203. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  22204. key: 0,
  22205. class: normalizeClass(unref(classes)),
  22206. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22207. onClick: handleClick
  22208. }, [
  22209. createElementVNode("span", {
  22210. class: normalizeClass(unref(ns).e("content"))
  22211. }, [
  22212. renderSlot(_ctx.$slots, "default")
  22213. ], 2),
  22214. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22215. key: 0,
  22216. class: normalizeClass(unref(ns).e("close")),
  22217. onClick: withModifiers(handleClose, ["stop"])
  22218. }, {
  22219. default: withCtx(() => [
  22220. createVNode(unref(close_default))
  22221. ]),
  22222. _: 1
  22223. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22224. ], 6)) : (openBlock(), createBlock(Transition, {
  22225. key: 1,
  22226. name: `${unref(ns).namespace.value}-zoom-in-center`,
  22227. appear: ""
  22228. }, {
  22229. default: withCtx(() => [
  22230. createElementVNode("span", {
  22231. class: normalizeClass(unref(classes)),
  22232. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22233. onClick: handleClick
  22234. }, [
  22235. createElementVNode("span", {
  22236. class: normalizeClass(unref(ns).e("content"))
  22237. }, [
  22238. renderSlot(_ctx.$slots, "default")
  22239. ], 2),
  22240. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22241. key: 0,
  22242. class: normalizeClass(unref(ns).e("close")),
  22243. onClick: withModifiers(handleClose, ["stop"])
  22244. }, {
  22245. default: withCtx(() => [
  22246. createVNode(unref(close_default))
  22247. ]),
  22248. _: 1
  22249. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22250. ], 6)
  22251. ]),
  22252. _: 3
  22253. }, 8, ["name"]));
  22254. };
  22255. }
  22256. });
  22257. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  22258. const ElTag = withInstall(Tag);
  22259. const emitChangeFn = (value) => typeof isNumber(value);
  22260. const collapseProps = buildProps({
  22261. accordion: Boolean,
  22262. modelValue: {
  22263. type: definePropType([Array, String, Number]),
  22264. default: () => mutable([])
  22265. }
  22266. });
  22267. const collapseEmits = {
  22268. [UPDATE_MODEL_EVENT]: emitChangeFn,
  22269. [CHANGE_EVENT]: emitChangeFn
  22270. };
  22271. const collapseContextKey = Symbol("collapseContextKey");
  22272. const useCollapse = (props, emit) => {
  22273. const activeNames = ref(castArray(props.modelValue));
  22274. const setActiveNames = (_activeNames) => {
  22275. activeNames.value = _activeNames;
  22276. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  22277. emit(UPDATE_MODEL_EVENT, value);
  22278. emit(CHANGE_EVENT, value);
  22279. };
  22280. const handleItemClick = (name) => {
  22281. if (props.accordion) {
  22282. setActiveNames([activeNames.value[0] === name ? "" : name]);
  22283. } else {
  22284. const _activeNames = [...activeNames.value];
  22285. const index2 = _activeNames.indexOf(name);
  22286. if (index2 > -1) {
  22287. _activeNames.splice(index2, 1);
  22288. } else {
  22289. _activeNames.push(name);
  22290. }
  22291. setActiveNames(_activeNames);
  22292. }
  22293. };
  22294. watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
  22295. provide(collapseContextKey, {
  22296. activeNames,
  22297. handleItemClick
  22298. });
  22299. return {
  22300. activeNames,
  22301. setActiveNames
  22302. };
  22303. };
  22304. const useCollapseDOM = () => {
  22305. const ns = useNamespace("collapse");
  22306. const rootKls = computed$1(() => ns.b());
  22307. return {
  22308. rootKls
  22309. };
  22310. };
  22311. const __default__$8 = defineComponent({
  22312. name: "ElCollapse"
  22313. });
  22314. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  22315. ...__default__$8,
  22316. props: collapseProps,
  22317. emits: collapseEmits,
  22318. setup(__props, { expose, emit }) {
  22319. const props = __props;
  22320. const { activeNames, setActiveNames } = useCollapse(props, emit);
  22321. const { rootKls } = useCollapseDOM();
  22322. expose({
  22323. activeNames,
  22324. setActiveNames
  22325. });
  22326. return (_ctx, _cache) => {
  22327. return openBlock(), createElementBlock("div", {
  22328. class: normalizeClass(unref(rootKls)),
  22329. role: "tablist",
  22330. "aria-multiselectable": "true"
  22331. }, [
  22332. renderSlot(_ctx.$slots, "default")
  22333. ], 2);
  22334. };
  22335. }
  22336. });
  22337. var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);
  22338. const __default__$7 = defineComponent({
  22339. name: "ElCollapseTransition"
  22340. });
  22341. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  22342. ...__default__$7,
  22343. setup(__props) {
  22344. const ns = useNamespace("collapse-transition");
  22345. const on3 = {
  22346. beforeEnter(el) {
  22347. if (!el.dataset)
  22348. el.dataset = {};
  22349. el.dataset.oldPaddingTop = el.style.paddingTop;
  22350. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22351. el.style.maxHeight = 0;
  22352. el.style.paddingTop = 0;
  22353. el.style.paddingBottom = 0;
  22354. },
  22355. enter(el) {
  22356. el.dataset.oldOverflow = el.style.overflow;
  22357. if (el.scrollHeight !== 0) {
  22358. el.style.maxHeight = `${el.scrollHeight}px`;
  22359. el.style.paddingTop = el.dataset.oldPaddingTop;
  22360. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22361. } else {
  22362. el.style.maxHeight = 0;
  22363. el.style.paddingTop = el.dataset.oldPaddingTop;
  22364. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22365. }
  22366. el.style.overflow = "hidden";
  22367. },
  22368. afterEnter(el) {
  22369. el.style.maxHeight = "";
  22370. el.style.overflow = el.dataset.oldOverflow;
  22371. },
  22372. beforeLeave(el) {
  22373. if (!el.dataset)
  22374. el.dataset = {};
  22375. el.dataset.oldPaddingTop = el.style.paddingTop;
  22376. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22377. el.dataset.oldOverflow = el.style.overflow;
  22378. el.style.maxHeight = `${el.scrollHeight}px`;
  22379. el.style.overflow = "hidden";
  22380. },
  22381. leave(el) {
  22382. if (el.scrollHeight !== 0) {
  22383. el.style.maxHeight = 0;
  22384. el.style.paddingTop = 0;
  22385. el.style.paddingBottom = 0;
  22386. }
  22387. },
  22388. afterLeave(el) {
  22389. el.style.maxHeight = "";
  22390. el.style.overflow = el.dataset.oldOverflow;
  22391. el.style.paddingTop = el.dataset.oldPaddingTop;
  22392. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22393. }
  22394. };
  22395. return (_ctx, _cache) => {
  22396. return openBlock(), createBlock(Transition, mergeProps({
  22397. name: unref(ns).b()
  22398. }, toHandlers(on3)), {
  22399. default: withCtx(() => [
  22400. renderSlot(_ctx.$slots, "default")
  22401. ]),
  22402. _: 3
  22403. }, 16, ["name"]);
  22404. };
  22405. }
  22406. });
  22407. 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"]]);
  22408. CollapseTransition.install = (app) => {
  22409. app.component(CollapseTransition.name, CollapseTransition);
  22410. };
  22411. const _CollapseTransition = CollapseTransition;
  22412. const collapseItemProps = buildProps({
  22413. title: {
  22414. type: String,
  22415. default: ""
  22416. },
  22417. name: {
  22418. type: definePropType([String, Number]),
  22419. default: () => generateId()
  22420. },
  22421. disabled: Boolean
  22422. });
  22423. const useCollapseItem = (props) => {
  22424. const collapse = inject(collapseContextKey);
  22425. const focusing = ref(false);
  22426. const isClick = ref(false);
  22427. const id = ref(generateId());
  22428. const isActive = computed$1(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  22429. const handleFocus = () => {
  22430. setTimeout(() => {
  22431. if (!isClick.value) {
  22432. focusing.value = true;
  22433. } else {
  22434. isClick.value = false;
  22435. }
  22436. }, 50);
  22437. };
  22438. const handleHeaderClick = () => {
  22439. if (props.disabled)
  22440. return;
  22441. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22442. focusing.value = false;
  22443. isClick.value = true;
  22444. };
  22445. const handleEnterClick = () => {
  22446. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22447. };
  22448. return {
  22449. focusing,
  22450. id,
  22451. isActive,
  22452. handleFocus,
  22453. handleHeaderClick,
  22454. handleEnterClick
  22455. };
  22456. };
  22457. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  22458. const ns = useNamespace("collapse");
  22459. const rootKls = computed$1(() => [
  22460. ns.b("item"),
  22461. ns.is("active", unref(isActive)),
  22462. ns.is("disabled", props.disabled)
  22463. ]);
  22464. const headKls = computed$1(() => [
  22465. ns.be("item", "header"),
  22466. ns.is("active", unref(isActive)),
  22467. { focusing: unref(focusing) && !props.disabled }
  22468. ]);
  22469. const arrowKls = computed$1(() => [
  22470. ns.be("item", "arrow"),
  22471. ns.is("active", unref(isActive))
  22472. ]);
  22473. const itemWrapperKls = computed$1(() => ns.be("item", "wrap"));
  22474. const itemContentKls = computed$1(() => ns.be("item", "content"));
  22475. const scopedContentId = computed$1(() => ns.b(`content-${unref(id)}`));
  22476. const scopedHeadId = computed$1(() => ns.b(`head-${unref(id)}`));
  22477. return {
  22478. arrowKls,
  22479. headKls,
  22480. rootKls,
  22481. itemWrapperKls,
  22482. itemContentKls,
  22483. scopedContentId,
  22484. scopedHeadId
  22485. };
  22486. };
  22487. const _hoisted_1$b = ["aria-expanded", "aria-controls", "aria-describedby"];
  22488. const _hoisted_2$8 = ["id", "tabindex"];
  22489. const _hoisted_3$5 = ["id", "aria-hidden", "aria-labelledby"];
  22490. const __default__$6 = defineComponent({
  22491. name: "ElCollapseItem"
  22492. });
  22493. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  22494. ...__default__$6,
  22495. props: collapseItemProps,
  22496. setup(__props, { expose }) {
  22497. const props = __props;
  22498. const {
  22499. focusing,
  22500. id,
  22501. isActive,
  22502. handleFocus,
  22503. handleHeaderClick,
  22504. handleEnterClick
  22505. } = useCollapseItem(props);
  22506. const {
  22507. arrowKls,
  22508. headKls,
  22509. rootKls,
  22510. itemWrapperKls,
  22511. itemContentKls,
  22512. scopedContentId,
  22513. scopedHeadId
  22514. } = useCollapseItemDOM(props, { focusing, isActive, id });
  22515. expose({
  22516. isActive
  22517. });
  22518. return (_ctx, _cache) => {
  22519. return openBlock(), createElementBlock("div", {
  22520. class: normalizeClass(unref(rootKls))
  22521. }, [
  22522. createElementVNode("div", {
  22523. role: "tab",
  22524. "aria-expanded": unref(isActive),
  22525. "aria-controls": unref(scopedContentId),
  22526. "aria-describedby": unref(scopedContentId)
  22527. }, [
  22528. createElementVNode("div", {
  22529. id: unref(scopedHeadId),
  22530. class: normalizeClass(unref(headKls)),
  22531. role: "button",
  22532. tabindex: _ctx.disabled ? -1 : 0,
  22533. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  22534. onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  22535. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  22536. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  22537. }, [
  22538. renderSlot(_ctx.$slots, "title", {}, () => [
  22539. createTextVNode(toDisplayString(_ctx.title), 1)
  22540. ]),
  22541. createVNode(unref(ElIcon), {
  22542. class: normalizeClass(unref(arrowKls))
  22543. }, {
  22544. default: withCtx(() => [
  22545. createVNode(unref(arrow_right_default))
  22546. ]),
  22547. _: 1
  22548. }, 8, ["class"])
  22549. ], 42, _hoisted_2$8)
  22550. ], 8, _hoisted_1$b),
  22551. createVNode(unref(_CollapseTransition), null, {
  22552. default: withCtx(() => [
  22553. withDirectives(createElementVNode("div", {
  22554. id: unref(scopedContentId),
  22555. class: normalizeClass(unref(itemWrapperKls)),
  22556. role: "tabpanel",
  22557. "aria-hidden": !unref(isActive),
  22558. "aria-labelledby": unref(scopedHeadId)
  22559. }, [
  22560. createElementVNode("div", {
  22561. class: normalizeClass(unref(itemContentKls))
  22562. }, [
  22563. renderSlot(_ctx.$slots, "default")
  22564. ], 2)
  22565. ], 10, _hoisted_3$5), [
  22566. [vShow, unref(isActive)]
  22567. ])
  22568. ]),
  22569. _: 3
  22570. })
  22571. ], 2);
  22572. };
  22573. }
  22574. });
  22575. var CollapseItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);
  22576. const ElCollapse = withInstall(Collapse, {
  22577. CollapseItem
  22578. });
  22579. const ElCollapseItem = withNoopInstall(CollapseItem);
  22580. const alphaSliderProps = buildProps({
  22581. color: {
  22582. type: definePropType(Object),
  22583. required: true
  22584. },
  22585. vertical: {
  22586. type: Boolean,
  22587. default: false
  22588. }
  22589. });
  22590. let isDragging = false;
  22591. function draggable(element, options2) {
  22592. if (!isClient)
  22593. return;
  22594. const moveFn = function(event2) {
  22595. var _a2;
  22596. (_a2 = options2.drag) == null ? void 0 : _a2.call(options2, event2);
  22597. };
  22598. const upFn = function(event2) {
  22599. var _a2;
  22600. document.removeEventListener("mousemove", moveFn);
  22601. document.removeEventListener("mouseup", upFn);
  22602. document.removeEventListener("touchmove", moveFn);
  22603. document.removeEventListener("touchend", upFn);
  22604. document.onselectstart = null;
  22605. document.ondragstart = null;
  22606. isDragging = false;
  22607. (_a2 = options2.end) == null ? void 0 : _a2.call(options2, event2);
  22608. };
  22609. const downFn = function(event2) {
  22610. var _a2;
  22611. if (isDragging)
  22612. return;
  22613. event2.preventDefault();
  22614. document.onselectstart = () => false;
  22615. document.ondragstart = () => false;
  22616. document.addEventListener("mousemove", moveFn);
  22617. document.addEventListener("mouseup", upFn);
  22618. document.addEventListener("touchmove", moveFn);
  22619. document.addEventListener("touchend", upFn);
  22620. isDragging = true;
  22621. (_a2 = options2.start) == null ? void 0 : _a2.call(options2, event2);
  22622. };
  22623. element.addEventListener("mousedown", downFn);
  22624. element.addEventListener("touchstart", downFn);
  22625. }
  22626. const useAlphaSlider = (props) => {
  22627. const instance = getCurrentInstance();
  22628. const thumb = shallowRef();
  22629. const bar = shallowRef();
  22630. function handleClick(event2) {
  22631. const target = event2.target;
  22632. if (target !== thumb.value) {
  22633. handleDrag(event2);
  22634. }
  22635. }
  22636. function handleDrag(event2) {
  22637. if (!bar.value || !thumb.value)
  22638. return;
  22639. const el = instance.vnode.el;
  22640. const rect = el.getBoundingClientRect();
  22641. const { clientX, clientY } = getClientXY(event2);
  22642. if (!props.vertical) {
  22643. let left = clientX - rect.left;
  22644. left = Math.max(thumb.value.offsetWidth / 2, left);
  22645. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22646. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  22647. } else {
  22648. let top = clientY - rect.top;
  22649. top = Math.max(thumb.value.offsetHeight / 2, top);
  22650. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22651. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  22652. }
  22653. }
  22654. return {
  22655. thumb,
  22656. bar,
  22657. handleDrag,
  22658. handleClick
  22659. };
  22660. };
  22661. const useAlphaSliderDOM = (props, {
  22662. bar,
  22663. thumb,
  22664. handleDrag
  22665. }) => {
  22666. const instance = getCurrentInstance();
  22667. const ns = useNamespace("color-alpha-slider");
  22668. const thumbLeft = ref(0);
  22669. const thumbTop = ref(0);
  22670. const background = ref();
  22671. function getThumbLeft() {
  22672. if (!thumb.value)
  22673. return 0;
  22674. if (props.vertical)
  22675. return 0;
  22676. const el = instance.vnode.el;
  22677. const alpha = props.color.get("alpha");
  22678. if (!el)
  22679. return 0;
  22680. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  22681. }
  22682. function getThumbTop() {
  22683. if (!thumb.value)
  22684. return 0;
  22685. const el = instance.vnode.el;
  22686. if (!props.vertical)
  22687. return 0;
  22688. const alpha = props.color.get("alpha");
  22689. if (!el)
  22690. return 0;
  22691. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  22692. }
  22693. function getBackground() {
  22694. if (props.color && props.color.value) {
  22695. const { r: r2, g, b } = props.color.toRgb();
  22696. return `linear-gradient(to right, rgba(${r2}, ${g}, ${b}, 0) 0%, rgba(${r2}, ${g}, ${b}, 1) 100%)`;
  22697. }
  22698. return "";
  22699. }
  22700. function update() {
  22701. thumbLeft.value = getThumbLeft();
  22702. thumbTop.value = getThumbTop();
  22703. background.value = getBackground();
  22704. }
  22705. onMounted(() => {
  22706. if (!bar.value || !thumb.value)
  22707. return;
  22708. const dragConfig = {
  22709. drag: (event2) => {
  22710. handleDrag(event2);
  22711. },
  22712. end: (event2) => {
  22713. handleDrag(event2);
  22714. }
  22715. };
  22716. draggable(bar.value, dragConfig);
  22717. draggable(thumb.value, dragConfig);
  22718. update();
  22719. });
  22720. watch(() => props.color.get("alpha"), () => update());
  22721. watch(() => props.color.value, () => update());
  22722. const rootKls = computed$1(() => [ns.b(), ns.is("vertical", props.vertical)]);
  22723. const barKls = computed$1(() => ns.e("bar"));
  22724. const thumbKls = computed$1(() => ns.e("thumb"));
  22725. const barStyle = computed$1(() => ({ background: background.value }));
  22726. const thumbStyle = computed$1(() => ({
  22727. left: addUnit(thumbLeft.value),
  22728. top: addUnit(thumbTop.value)
  22729. }));
  22730. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  22731. };
  22732. const COMPONENT_NAME$2 = "ElColorAlphaSlider";
  22733. const __default__$5 = defineComponent({
  22734. name: COMPONENT_NAME$2
  22735. });
  22736. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  22737. ...__default__$5,
  22738. props: alphaSliderProps,
  22739. setup(__props, { expose }) {
  22740. const props = __props;
  22741. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  22742. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  22743. bar,
  22744. thumb,
  22745. handleDrag
  22746. });
  22747. expose({
  22748. update,
  22749. bar,
  22750. thumb
  22751. });
  22752. return (_ctx, _cache) => {
  22753. return openBlock(), createElementBlock("div", {
  22754. class: normalizeClass(unref(rootKls))
  22755. }, [
  22756. createElementVNode("div", {
  22757. ref_key: "bar",
  22758. ref: bar,
  22759. class: normalizeClass(unref(barKls)),
  22760. style: normalizeStyle(unref(barStyle)),
  22761. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  22762. }, null, 6),
  22763. createElementVNode("div", {
  22764. ref_key: "thumb",
  22765. ref: thumb,
  22766. class: normalizeClass(unref(thumbKls)),
  22767. style: normalizeStyle(unref(thumbStyle))
  22768. }, null, 6)
  22769. ], 2);
  22770. };
  22771. }
  22772. });
  22773. 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"]]);
  22774. const _sfc_main$e = defineComponent({
  22775. name: "ElColorHueSlider",
  22776. props: {
  22777. color: {
  22778. type: Object,
  22779. required: true
  22780. },
  22781. vertical: Boolean
  22782. },
  22783. setup(props) {
  22784. const ns = useNamespace("color-hue-slider");
  22785. const instance = getCurrentInstance();
  22786. const thumb = ref();
  22787. const bar = ref();
  22788. const thumbLeft = ref(0);
  22789. const thumbTop = ref(0);
  22790. const hueValue = computed$1(() => {
  22791. return props.color.get("hue");
  22792. });
  22793. watch(() => hueValue.value, () => {
  22794. update();
  22795. });
  22796. function handleClick(event2) {
  22797. const target = event2.target;
  22798. if (target !== thumb.value) {
  22799. handleDrag(event2);
  22800. }
  22801. }
  22802. function handleDrag(event2) {
  22803. if (!bar.value || !thumb.value)
  22804. return;
  22805. const el = instance.vnode.el;
  22806. const rect = el.getBoundingClientRect();
  22807. const { clientX, clientY } = getClientXY(event2);
  22808. let hue;
  22809. if (!props.vertical) {
  22810. let left = clientX - rect.left;
  22811. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22812. left = Math.max(thumb.value.offsetWidth / 2, left);
  22813. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  22814. } else {
  22815. let top = clientY - rect.top;
  22816. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22817. top = Math.max(thumb.value.offsetHeight / 2, top);
  22818. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  22819. }
  22820. props.color.set("hue", hue);
  22821. }
  22822. function getThumbLeft() {
  22823. if (!thumb.value)
  22824. return 0;
  22825. const el = instance.vnode.el;
  22826. if (props.vertical)
  22827. return 0;
  22828. const hue = props.color.get("hue");
  22829. if (!el)
  22830. return 0;
  22831. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  22832. }
  22833. function getThumbTop() {
  22834. if (!thumb.value)
  22835. return 0;
  22836. const el = instance.vnode.el;
  22837. if (!props.vertical)
  22838. return 0;
  22839. const hue = props.color.get("hue");
  22840. if (!el)
  22841. return 0;
  22842. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  22843. }
  22844. function update() {
  22845. thumbLeft.value = getThumbLeft();
  22846. thumbTop.value = getThumbTop();
  22847. }
  22848. onMounted(() => {
  22849. if (!bar.value || !thumb.value)
  22850. return;
  22851. const dragConfig = {
  22852. drag: (event2) => {
  22853. handleDrag(event2);
  22854. },
  22855. end: (event2) => {
  22856. handleDrag(event2);
  22857. }
  22858. };
  22859. draggable(bar.value, dragConfig);
  22860. draggable(thumb.value, dragConfig);
  22861. update();
  22862. });
  22863. return {
  22864. bar,
  22865. thumb,
  22866. thumbLeft,
  22867. thumbTop,
  22868. hueValue,
  22869. handleClick,
  22870. update,
  22871. ns
  22872. };
  22873. }
  22874. });
  22875. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  22876. return openBlock(), createElementBlock("div", {
  22877. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  22878. }, [
  22879. createElementVNode("div", {
  22880. ref: "bar",
  22881. class: normalizeClass(_ctx.ns.e("bar")),
  22882. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  22883. }, null, 2),
  22884. createElementVNode("div", {
  22885. ref: "thumb",
  22886. class: normalizeClass(_ctx.ns.e("thumb")),
  22887. style: normalizeStyle({
  22888. left: _ctx.thumbLeft + "px",
  22889. top: _ctx.thumbTop + "px"
  22890. })
  22891. }, null, 6)
  22892. ], 2);
  22893. }
  22894. 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"]]);
  22895. const colorPickerProps = buildProps({
  22896. modelValue: String,
  22897. id: String,
  22898. showAlpha: Boolean,
  22899. colorFormat: String,
  22900. disabled: Boolean,
  22901. size: useSizeProp,
  22902. popperClass: {
  22903. type: String,
  22904. default: ""
  22905. },
  22906. label: {
  22907. type: String,
  22908. default: void 0
  22909. },
  22910. tabindex: {
  22911. type: [String, Number],
  22912. default: 0
  22913. },
  22914. predefine: {
  22915. type: definePropType(Array)
  22916. },
  22917. validateEvent: {
  22918. type: Boolean,
  22919. default: true
  22920. }
  22921. });
  22922. const colorPickerEmits = {
  22923. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  22924. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  22925. activeChange: (val) => isString(val) || isNil(val)
  22926. };
  22927. const colorPickerContextKey = Symbol("colorPickerContextKey");
  22928. const hsv2hsl = function(hue, sat, val) {
  22929. return [
  22930. hue,
  22931. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  22932. hue / 2
  22933. ];
  22934. };
  22935. const isOnePointZero = function(n) {
  22936. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  22937. };
  22938. const isPercentage = function(n) {
  22939. return typeof n === "string" && n.includes("%");
  22940. };
  22941. const bound01 = function(value, max2) {
  22942. if (isOnePointZero(value))
  22943. value = "100%";
  22944. const processPercent = isPercentage(value);
  22945. value = Math.min(max2, Math.max(0, Number.parseFloat(`${value}`)));
  22946. if (processPercent) {
  22947. value = Number.parseInt(`${value * max2}`, 10) / 100;
  22948. }
  22949. if (Math.abs(value - max2) < 1e-6) {
  22950. return 1;
  22951. }
  22952. return value % max2 / Number.parseFloat(max2);
  22953. };
  22954. const INT_HEX_MAP = {
  22955. 10: "A",
  22956. 11: "B",
  22957. 12: "C",
  22958. 13: "D",
  22959. 14: "E",
  22960. 15: "F"
  22961. };
  22962. const hexOne = (value) => {
  22963. value = Math.min(Math.round(value), 255);
  22964. const high = Math.floor(value / 16);
  22965. const low = value % 16;
  22966. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  22967. };
  22968. const toHex = function({ r: r2, g, b }) {
  22969. if (Number.isNaN(+r2) || Number.isNaN(+g) || Number.isNaN(+b))
  22970. return "";
  22971. return `#${hexOne(r2)}${hexOne(g)}${hexOne(b)}`;
  22972. };
  22973. const HEX_INT_MAP = {
  22974. A: 10,
  22975. B: 11,
  22976. C: 12,
  22977. D: 13,
  22978. E: 14,
  22979. F: 15
  22980. };
  22981. const parseHexChannel = function(hex) {
  22982. if (hex.length === 2) {
  22983. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  22984. }
  22985. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  22986. };
  22987. const hsl2hsv = function(hue, sat, light) {
  22988. sat = sat / 100;
  22989. light = light / 100;
  22990. let smin = sat;
  22991. const lmin = Math.max(light, 0.01);
  22992. light *= 2;
  22993. sat *= light <= 1 ? light : 2 - light;
  22994. smin *= lmin <= 1 ? lmin : 2 - lmin;
  22995. const v = (light + sat) / 2;
  22996. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  22997. return {
  22998. h: hue,
  22999. s: sv * 100,
  23000. v: v * 100
  23001. };
  23002. };
  23003. const rgb2hsv = (r2, g, b) => {
  23004. r2 = bound01(r2, 255);
  23005. g = bound01(g, 255);
  23006. b = bound01(b, 255);
  23007. const max2 = Math.max(r2, g, b);
  23008. const min2 = Math.min(r2, g, b);
  23009. let h2;
  23010. const v = max2;
  23011. const d2 = max2 - min2;
  23012. const s = max2 === 0 ? 0 : d2 / max2;
  23013. if (max2 === min2) {
  23014. h2 = 0;
  23015. } else {
  23016. switch (max2) {
  23017. case r2: {
  23018. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  23019. break;
  23020. }
  23021. case g: {
  23022. h2 = (b - r2) / d2 + 2;
  23023. break;
  23024. }
  23025. case b: {
  23026. h2 = (r2 - g) / d2 + 4;
  23027. break;
  23028. }
  23029. }
  23030. h2 /= 6;
  23031. }
  23032. return { h: h2 * 360, s: s * 100, v: v * 100 };
  23033. };
  23034. const hsv2rgb = function(h2, s, v) {
  23035. h2 = bound01(h2, 360) * 6;
  23036. s = bound01(s, 100);
  23037. v = bound01(v, 100);
  23038. const i2 = Math.floor(h2);
  23039. const f = h2 - i2;
  23040. const p = v * (1 - s);
  23041. const q2 = v * (1 - f * s);
  23042. const t2 = v * (1 - (1 - f) * s);
  23043. const mod = i2 % 6;
  23044. const r2 = [v, q2, p, p, t2, v][mod];
  23045. const g = [t2, v, v, q2, p, p][mod];
  23046. const b = [p, p, t2, v, v, q2][mod];
  23047. return {
  23048. r: Math.round(r2 * 255),
  23049. g: Math.round(g * 255),
  23050. b: Math.round(b * 255)
  23051. };
  23052. };
  23053. class Color$1 {
  23054. constructor(options2 = {}) {
  23055. this._hue = 0;
  23056. this._saturation = 100;
  23057. this._value = 100;
  23058. this._alpha = 100;
  23059. this.enableAlpha = false;
  23060. this.format = "hex";
  23061. this.value = "";
  23062. for (const option in options2) {
  23063. if (hasOwn(options2, option)) {
  23064. this[option] = options2[option];
  23065. }
  23066. }
  23067. if (options2.value) {
  23068. this.fromString(options2.value);
  23069. } else {
  23070. this.doOnChange();
  23071. }
  23072. }
  23073. set(prop, value) {
  23074. if (arguments.length === 1 && typeof prop === "object") {
  23075. for (const p in prop) {
  23076. if (hasOwn(prop, p)) {
  23077. this.set(p, prop[p]);
  23078. }
  23079. }
  23080. return;
  23081. }
  23082. this[`_${prop}`] = value;
  23083. this.doOnChange();
  23084. }
  23085. get(prop) {
  23086. if (prop === "alpha") {
  23087. return Math.floor(this[`_${prop}`]);
  23088. }
  23089. return this[`_${prop}`];
  23090. }
  23091. toRgb() {
  23092. return hsv2rgb(this._hue, this._saturation, this._value);
  23093. }
  23094. fromString(value) {
  23095. if (!value) {
  23096. this._hue = 0;
  23097. this._saturation = 100;
  23098. this._value = 100;
  23099. this.doOnChange();
  23100. return;
  23101. }
  23102. const fromHSV = (h2, s, v) => {
  23103. this._hue = Math.max(0, Math.min(360, h2));
  23104. this._saturation = Math.max(0, Math.min(100, s));
  23105. this._value = Math.max(0, Math.min(100, v));
  23106. this.doOnChange();
  23107. };
  23108. if (value.includes("hsl")) {
  23109. 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));
  23110. if (parts.length === 4) {
  23111. this._alpha = Number.parseFloat(parts[3]) * 100;
  23112. } else if (parts.length === 3) {
  23113. this._alpha = 100;
  23114. }
  23115. if (parts.length >= 3) {
  23116. const { h: h2, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  23117. fromHSV(h2, s, v);
  23118. }
  23119. } else if (value.includes("hsv")) {
  23120. 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));
  23121. if (parts.length === 4) {
  23122. this._alpha = Number.parseFloat(parts[3]) * 100;
  23123. } else if (parts.length === 3) {
  23124. this._alpha = 100;
  23125. }
  23126. if (parts.length >= 3) {
  23127. fromHSV(parts[0], parts[1], parts[2]);
  23128. }
  23129. } else if (value.includes("rgb")) {
  23130. 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));
  23131. if (parts.length === 4) {
  23132. this._alpha = Number.parseFloat(parts[3]) * 100;
  23133. } else if (parts.length === 3) {
  23134. this._alpha = 100;
  23135. }
  23136. if (parts.length >= 3) {
  23137. const { h: h2, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  23138. fromHSV(h2, s, v);
  23139. }
  23140. } else if (value.includes("#")) {
  23141. const hex = value.replace("#", "").trim();
  23142. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  23143. return;
  23144. let r2, g, b;
  23145. if (hex.length === 3) {
  23146. r2 = parseHexChannel(hex[0] + hex[0]);
  23147. g = parseHexChannel(hex[1] + hex[1]);
  23148. b = parseHexChannel(hex[2] + hex[2]);
  23149. } else if (hex.length === 6 || hex.length === 8) {
  23150. r2 = parseHexChannel(hex.slice(0, 2));
  23151. g = parseHexChannel(hex.slice(2, 4));
  23152. b = parseHexChannel(hex.slice(4, 6));
  23153. }
  23154. if (hex.length === 8) {
  23155. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  23156. } else if (hex.length === 3 || hex.length === 6) {
  23157. this._alpha = 100;
  23158. }
  23159. const { h: h2, s, v } = rgb2hsv(r2, g, b);
  23160. fromHSV(h2, s, v);
  23161. }
  23162. }
  23163. compare(color2) {
  23164. 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;
  23165. }
  23166. doOnChange() {
  23167. const { _hue, _saturation, _value, _alpha, format } = this;
  23168. if (this.enableAlpha) {
  23169. switch (format) {
  23170. case "hsl": {
  23171. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23172. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  23173. break;
  23174. }
  23175. case "hsv": {
  23176. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  23177. break;
  23178. }
  23179. case "hex": {
  23180. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  23181. break;
  23182. }
  23183. default: {
  23184. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23185. this.value = `rgba(${r2}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  23186. }
  23187. }
  23188. } else {
  23189. switch (format) {
  23190. case "hsl": {
  23191. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23192. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  23193. break;
  23194. }
  23195. case "hsv": {
  23196. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  23197. break;
  23198. }
  23199. case "rgb": {
  23200. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23201. this.value = `rgb(${r2}, ${g}, ${b})`;
  23202. break;
  23203. }
  23204. default: {
  23205. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  23206. }
  23207. }
  23208. }
  23209. }
  23210. }
  23211. const _sfc_main$d = defineComponent({
  23212. props: {
  23213. colors: {
  23214. type: Array,
  23215. required: true
  23216. },
  23217. color: {
  23218. type: Object,
  23219. required: true
  23220. }
  23221. },
  23222. setup(props) {
  23223. const ns = useNamespace("color-predefine");
  23224. const { currentColor } = inject(colorPickerContextKey);
  23225. const rgbaColors = ref(parseColors(props.colors, props.color));
  23226. watch(() => currentColor.value, (val) => {
  23227. const color2 = new Color$1();
  23228. color2.fromString(val);
  23229. rgbaColors.value.forEach((item) => {
  23230. item.selected = color2.compare(item);
  23231. });
  23232. });
  23233. watchEffect(() => {
  23234. rgbaColors.value = parseColors(props.colors, props.color);
  23235. });
  23236. function handleSelect(index2) {
  23237. props.color.fromString(props.colors[index2]);
  23238. }
  23239. function parseColors(colors, color2) {
  23240. return colors.map((value) => {
  23241. const c = new Color$1();
  23242. c.enableAlpha = true;
  23243. c.format = "rgba";
  23244. c.fromString(value);
  23245. c.selected = c.value === color2.value;
  23246. return c;
  23247. });
  23248. }
  23249. return {
  23250. rgbaColors,
  23251. handleSelect,
  23252. ns
  23253. };
  23254. }
  23255. });
  23256. const _hoisted_1$a = ["onClick"];
  23257. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  23258. return openBlock(), createElementBlock("div", {
  23259. class: normalizeClass(_ctx.ns.b())
  23260. }, [
  23261. createElementVNode("div", {
  23262. class: normalizeClass(_ctx.ns.e("colors"))
  23263. }, [
  23264. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
  23265. return openBlock(), createElementBlock("div", {
  23266. key: _ctx.colors[index2],
  23267. class: normalizeClass([
  23268. _ctx.ns.e("color-selector"),
  23269. _ctx.ns.is("alpha", item._alpha < 100),
  23270. { selected: item.selected }
  23271. ]),
  23272. onClick: ($event) => _ctx.handleSelect(index2)
  23273. }, [
  23274. createElementVNode("div", {
  23275. style: normalizeStyle({ backgroundColor: item.value })
  23276. }, null, 4)
  23277. ], 10, _hoisted_1$a);
  23278. }), 128))
  23279. ], 2)
  23280. ], 2);
  23281. }
  23282. 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"]]);
  23283. const _sfc_main$c = defineComponent({
  23284. name: "ElSlPanel",
  23285. props: {
  23286. color: {
  23287. type: Object,
  23288. required: true
  23289. }
  23290. },
  23291. setup(props) {
  23292. const ns = useNamespace("color-svpanel");
  23293. const instance = getCurrentInstance();
  23294. const cursorTop = ref(0);
  23295. const cursorLeft = ref(0);
  23296. const background = ref("hsl(0, 100%, 50%)");
  23297. const colorValue = computed$1(() => {
  23298. const hue = props.color.get("hue");
  23299. const value = props.color.get("value");
  23300. return { hue, value };
  23301. });
  23302. function update() {
  23303. const saturation = props.color.get("saturation");
  23304. const value = props.color.get("value");
  23305. const el = instance.vnode.el;
  23306. const { clientWidth: width2, clientHeight: height2 } = el;
  23307. cursorLeft.value = saturation * width2 / 100;
  23308. cursorTop.value = (100 - value) * height2 / 100;
  23309. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  23310. }
  23311. function handleDrag(event2) {
  23312. const el = instance.vnode.el;
  23313. const rect = el.getBoundingClientRect();
  23314. const { clientX, clientY } = getClientXY(event2);
  23315. let left = clientX - rect.left;
  23316. let top = clientY - rect.top;
  23317. left = Math.max(0, left);
  23318. left = Math.min(left, rect.width);
  23319. top = Math.max(0, top);
  23320. top = Math.min(top, rect.height);
  23321. cursorLeft.value = left;
  23322. cursorTop.value = top;
  23323. props.color.set({
  23324. saturation: left / rect.width * 100,
  23325. value: 100 - top / rect.height * 100
  23326. });
  23327. }
  23328. watch(() => colorValue.value, () => {
  23329. update();
  23330. });
  23331. onMounted(() => {
  23332. draggable(instance.vnode.el, {
  23333. drag: (event2) => {
  23334. handleDrag(event2);
  23335. },
  23336. end: (event2) => {
  23337. handleDrag(event2);
  23338. }
  23339. });
  23340. update();
  23341. });
  23342. return {
  23343. cursorTop,
  23344. cursorLeft,
  23345. background,
  23346. colorValue,
  23347. handleDrag,
  23348. update,
  23349. ns
  23350. };
  23351. }
  23352. });
  23353. const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("div", null, null, -1);
  23354. const _hoisted_2$7 = [
  23355. _hoisted_1$9
  23356. ];
  23357. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  23358. return openBlock(), createElementBlock("div", {
  23359. class: normalizeClass(_ctx.ns.b()),
  23360. style: normalizeStyle({
  23361. backgroundColor: _ctx.background
  23362. })
  23363. }, [
  23364. createElementVNode("div", {
  23365. class: normalizeClass(_ctx.ns.e("white"))
  23366. }, null, 2),
  23367. createElementVNode("div", {
  23368. class: normalizeClass(_ctx.ns.e("black"))
  23369. }, null, 2),
  23370. createElementVNode("div", {
  23371. class: normalizeClass(_ctx.ns.e("cursor")),
  23372. style: normalizeStyle({
  23373. top: _ctx.cursorTop + "px",
  23374. left: _ctx.cursorLeft + "px"
  23375. })
  23376. }, _hoisted_2$7, 6)
  23377. ], 6);
  23378. }
  23379. 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"]]);
  23380. const _hoisted_1$8 = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  23381. const __default__$4 = defineComponent({
  23382. name: "ElColorPicker"
  23383. });
  23384. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  23385. ...__default__$4,
  23386. props: colorPickerProps,
  23387. emits: colorPickerEmits,
  23388. setup(__props, { expose, emit }) {
  23389. const props = __props;
  23390. const { t: t2 } = useLocale();
  23391. const ns = useNamespace("color");
  23392. const { formItem } = useFormItem();
  23393. const colorSize = useFormSize();
  23394. const colorDisabled = useFormDisabled();
  23395. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  23396. formItemContext: formItem
  23397. });
  23398. const hue = ref();
  23399. const sv = ref();
  23400. const alpha = ref();
  23401. const popper = ref();
  23402. let shouldActiveChange = true;
  23403. const color2 = reactive(new Color$1({
  23404. enableAlpha: props.showAlpha,
  23405. format: props.colorFormat || "",
  23406. value: props.modelValue
  23407. }));
  23408. const showPicker = ref(false);
  23409. const showPanelColor = ref(false);
  23410. const customInput = ref("");
  23411. const displayedColor = computed$1(() => {
  23412. if (!props.modelValue && !showPanelColor.value) {
  23413. return "transparent";
  23414. }
  23415. return displayedRgb(color2, props.showAlpha);
  23416. });
  23417. const currentColor = computed$1(() => {
  23418. return !props.modelValue && !showPanelColor.value ? "" : color2.value;
  23419. });
  23420. const buttonAriaLabel = computed$1(() => {
  23421. return !isLabeledByFormItem.value ? props.label || t2("el.colorpicker.defaultLabel") : void 0;
  23422. });
  23423. const buttonAriaLabelledby = computed$1(() => {
  23424. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  23425. });
  23426. const btnKls = computed$1(() => {
  23427. return [
  23428. ns.b("picker"),
  23429. ns.is("disabled", colorDisabled.value),
  23430. ns.bm("picker", colorSize.value)
  23431. ];
  23432. });
  23433. function displayedRgb(color22, showAlpha) {
  23434. if (!(color22 instanceof Color$1)) {
  23435. throw new TypeError("color should be instance of _color Class");
  23436. }
  23437. const { r: r2, g, b } = color22.toRgb();
  23438. return showAlpha ? `rgba(${r2}, ${g}, ${b}, ${color22.get("alpha") / 100})` : `rgb(${r2}, ${g}, ${b})`;
  23439. }
  23440. function setShowPicker(value) {
  23441. showPicker.value = value;
  23442. }
  23443. const debounceSetShowPicker = debounce$2(setShowPicker, 100);
  23444. function show() {
  23445. if (colorDisabled.value)
  23446. return;
  23447. setShowPicker(true);
  23448. }
  23449. function hide() {
  23450. debounceSetShowPicker(false);
  23451. resetColor();
  23452. }
  23453. function resetColor() {
  23454. nextTick(() => {
  23455. if (props.modelValue) {
  23456. color2.fromString(props.modelValue);
  23457. } else {
  23458. color2.value = "";
  23459. nextTick(() => {
  23460. showPanelColor.value = false;
  23461. });
  23462. }
  23463. });
  23464. }
  23465. function handleTrigger() {
  23466. if (colorDisabled.value)
  23467. return;
  23468. debounceSetShowPicker(!showPicker.value);
  23469. }
  23470. function handleConfirm() {
  23471. color2.fromString(customInput.value);
  23472. }
  23473. function confirmValue() {
  23474. const value = color2.value;
  23475. emit(UPDATE_MODEL_EVENT, value);
  23476. emit("change", value);
  23477. if (props.validateEvent) {
  23478. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23479. }
  23480. debounceSetShowPicker(false);
  23481. nextTick(() => {
  23482. const newColor = new Color$1({
  23483. enableAlpha: props.showAlpha,
  23484. format: props.colorFormat || "",
  23485. value: props.modelValue
  23486. });
  23487. if (!color2.compare(newColor)) {
  23488. resetColor();
  23489. }
  23490. });
  23491. }
  23492. function clear() {
  23493. debounceSetShowPicker(false);
  23494. emit(UPDATE_MODEL_EVENT, null);
  23495. emit("change", null);
  23496. if (props.modelValue !== null && props.validateEvent) {
  23497. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23498. }
  23499. resetColor();
  23500. }
  23501. onMounted(() => {
  23502. if (props.modelValue) {
  23503. customInput.value = currentColor.value;
  23504. }
  23505. });
  23506. watch(() => props.modelValue, (newVal) => {
  23507. if (!newVal) {
  23508. showPanelColor.value = false;
  23509. } else if (newVal && newVal !== color2.value) {
  23510. shouldActiveChange = false;
  23511. color2.fromString(newVal);
  23512. }
  23513. });
  23514. watch(() => currentColor.value, (val) => {
  23515. customInput.value = val;
  23516. shouldActiveChange && emit("activeChange", val);
  23517. shouldActiveChange = true;
  23518. });
  23519. watch(() => color2.value, () => {
  23520. if (!props.modelValue && !showPanelColor.value) {
  23521. showPanelColor.value = true;
  23522. }
  23523. });
  23524. watch(() => showPicker.value, () => {
  23525. nextTick(() => {
  23526. var _a2, _b, _c;
  23527. (_a2 = hue.value) == null ? void 0 : _a2.update();
  23528. (_b = sv.value) == null ? void 0 : _b.update();
  23529. (_c = alpha.value) == null ? void 0 : _c.update();
  23530. });
  23531. });
  23532. provide(colorPickerContextKey, {
  23533. currentColor
  23534. });
  23535. expose({
  23536. color: color2,
  23537. show,
  23538. hide
  23539. });
  23540. return (_ctx, _cache) => {
  23541. return openBlock(), createBlock(unref(ElTooltip), {
  23542. ref_key: "popper",
  23543. ref: popper,
  23544. visible: showPicker.value,
  23545. "show-arrow": false,
  23546. "fallback-placements": ["bottom", "top", "right", "left"],
  23547. offset: 0,
  23548. "gpu-acceleration": false,
  23549. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  23550. "stop-popper-mouse-event": false,
  23551. effect: "light",
  23552. trigger: "click",
  23553. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  23554. persistent: ""
  23555. }, {
  23556. content: withCtx(() => [
  23557. withDirectives((openBlock(), createElementBlock("div", null, [
  23558. createElementVNode("div", {
  23559. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  23560. }, [
  23561. createVNode(HueSlider, {
  23562. ref_key: "hue",
  23563. ref: hue,
  23564. class: "hue-slider",
  23565. color: unref(color2),
  23566. vertical: ""
  23567. }, null, 8, ["color"]),
  23568. createVNode(SvPanel, {
  23569. ref: "svPanel",
  23570. color: unref(color2)
  23571. }, null, 8, ["color"])
  23572. ], 2),
  23573. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  23574. key: 0,
  23575. ref_key: "alpha",
  23576. ref: alpha,
  23577. color: unref(color2)
  23578. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  23579. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  23580. key: 1,
  23581. ref: "predefine",
  23582. color: unref(color2),
  23583. colors: _ctx.predefine
  23584. }, null, 8, ["color", "colors"])) : createCommentVNode("v-if", true),
  23585. createElementVNode("div", {
  23586. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  23587. }, [
  23588. createElementVNode("span", {
  23589. class: normalizeClass(unref(ns).be("dropdown", "value"))
  23590. }, [
  23591. createVNode(unref(ElInput), {
  23592. modelValue: customInput.value,
  23593. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  23594. "validate-event": false,
  23595. size: "small",
  23596. onKeyup: withKeys(handleConfirm, ["enter"]),
  23597. onBlur: handleConfirm
  23598. }, null, 8, ["modelValue", "onKeyup"])
  23599. ], 2),
  23600. createVNode(unref(ElButton), {
  23601. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  23602. text: "",
  23603. size: "small",
  23604. onClick: clear
  23605. }, {
  23606. default: withCtx(() => [
  23607. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.clear")), 1)
  23608. ]),
  23609. _: 1
  23610. }, 8, ["class"]),
  23611. createVNode(unref(ElButton), {
  23612. plain: "",
  23613. size: "small",
  23614. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  23615. onClick: confirmValue
  23616. }, {
  23617. default: withCtx(() => [
  23618. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.confirm")), 1)
  23619. ]),
  23620. _: 1
  23621. }, 8, ["class"])
  23622. ], 2)
  23623. ])), [
  23624. [unref(ClickOutside), hide]
  23625. ])
  23626. ]),
  23627. default: withCtx(() => [
  23628. createElementVNode("div", {
  23629. id: unref(buttonId),
  23630. class: normalizeClass(unref(btnKls)),
  23631. role: "button",
  23632. "aria-label": unref(buttonAriaLabel),
  23633. "aria-labelledby": unref(buttonAriaLabelledby),
  23634. "aria-description": unref(t2)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  23635. tabindex: _ctx.tabindex,
  23636. onKeydown: withKeys(handleTrigger, ["enter"])
  23637. }, [
  23638. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  23639. key: 0,
  23640. class: normalizeClass(unref(ns).be("picker", "mask"))
  23641. }, null, 2)) : createCommentVNode("v-if", true),
  23642. createElementVNode("div", {
  23643. class: normalizeClass(unref(ns).be("picker", "trigger")),
  23644. onClick: handleTrigger
  23645. }, [
  23646. createElementVNode("span", {
  23647. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  23648. }, [
  23649. createElementVNode("span", {
  23650. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  23651. style: normalizeStyle({
  23652. backgroundColor: unref(displayedColor)
  23653. })
  23654. }, [
  23655. withDirectives(createVNode(unref(ElIcon), {
  23656. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  23657. }, {
  23658. default: withCtx(() => [
  23659. createVNode(unref(arrow_down_default))
  23660. ]),
  23661. _: 1
  23662. }, 8, ["class"]), [
  23663. [vShow, _ctx.modelValue || showPanelColor.value]
  23664. ]),
  23665. !_ctx.modelValue && !showPanelColor.value ? (openBlock(), createBlock(unref(ElIcon), {
  23666. key: 0,
  23667. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  23668. }, {
  23669. default: withCtx(() => [
  23670. createVNode(unref(close_default))
  23671. ]),
  23672. _: 1
  23673. }, 8, ["class"])) : createCommentVNode("v-if", true)
  23674. ], 6)
  23675. ], 2)
  23676. ], 2)
  23677. ], 42, _hoisted_1$8)
  23678. ]),
  23679. _: 1
  23680. }, 8, ["visible", "popper-class", "transition"]);
  23681. };
  23682. }
  23683. });
  23684. 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"]]);
  23685. const ElColorPicker = withInstall(ColorPicker);
  23686. const overlayProps = buildProps({
  23687. mask: {
  23688. type: Boolean,
  23689. default: true
  23690. },
  23691. customMaskEvent: {
  23692. type: Boolean,
  23693. default: false
  23694. },
  23695. overlayClass: {
  23696. type: definePropType([
  23697. String,
  23698. Array,
  23699. Object
  23700. ])
  23701. },
  23702. zIndex: {
  23703. type: definePropType([String, Number])
  23704. }
  23705. });
  23706. const overlayEmits = {
  23707. click: (evt) => evt instanceof MouseEvent
  23708. };
  23709. const BLOCK = "overlay";
  23710. var Overlay = defineComponent({
  23711. name: "ElOverlay",
  23712. props: overlayProps,
  23713. emits: overlayEmits,
  23714. setup(props, { slots, emit }) {
  23715. const ns = useNamespace(BLOCK);
  23716. const onMaskClick = (e) => {
  23717. emit("click", e);
  23718. };
  23719. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  23720. return () => {
  23721. return props.mask ? createVNode("div", {
  23722. class: [ns.b(), props.overlayClass],
  23723. style: {
  23724. zIndex: props.zIndex
  23725. },
  23726. onClick,
  23727. onMousedown,
  23728. onMouseup
  23729. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", {
  23730. class: props.overlayClass,
  23731. style: {
  23732. zIndex: props.zIndex,
  23733. position: "fixed",
  23734. top: "0px",
  23735. right: "0px",
  23736. bottom: "0px",
  23737. left: "0px"
  23738. }
  23739. }, [renderSlot(slots, "default")]);
  23740. };
  23741. }
  23742. });
  23743. const ElOverlay = Overlay;
  23744. const dialogInjectionKey = Symbol("dialogInjectionKey");
  23745. const dialogContentProps = buildProps({
  23746. center: {
  23747. type: Boolean,
  23748. default: false
  23749. },
  23750. alignCenter: {
  23751. type: Boolean,
  23752. default: false
  23753. },
  23754. closeIcon: {
  23755. type: iconPropType
  23756. },
  23757. customClass: {
  23758. type: String,
  23759. default: ""
  23760. },
  23761. draggable: {
  23762. type: Boolean,
  23763. default: false
  23764. },
  23765. fullscreen: {
  23766. type: Boolean,
  23767. default: false
  23768. },
  23769. showClose: {
  23770. type: Boolean,
  23771. default: true
  23772. },
  23773. title: {
  23774. type: String,
  23775. default: ""
  23776. }
  23777. });
  23778. const dialogContentEmits = {
  23779. close: () => true
  23780. };
  23781. const _hoisted_1$7 = ["aria-label"];
  23782. const _hoisted_2$6 = ["id"];
  23783. const __default__$3 = defineComponent({ name: "ElDialogContent" });
  23784. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  23785. ...__default__$3,
  23786. props: dialogContentProps,
  23787. emits: dialogContentEmits,
  23788. setup(__props) {
  23789. const props = __props;
  23790. const { t: t2 } = useLocale();
  23791. const { Close } = CloseComponents;
  23792. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  23793. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  23794. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  23795. const draggable2 = computed$1(() => props.draggable);
  23796. useDraggable(dialogRef, headerRef, draggable2);
  23797. return (_ctx, _cache) => {
  23798. return openBlock(), createElementBlock("div", {
  23799. ref: unref(composedDialogRef),
  23800. class: normalizeClass([
  23801. unref(ns).b(),
  23802. unref(ns).is("fullscreen", _ctx.fullscreen),
  23803. unref(ns).is("draggable", unref(draggable2)),
  23804. unref(ns).is("align-center", _ctx.alignCenter),
  23805. { [unref(ns).m("center")]: _ctx.center },
  23806. _ctx.customClass
  23807. ]),
  23808. style: normalizeStyle(unref(style)),
  23809. tabindex: "-1"
  23810. }, [
  23811. createElementVNode("header", {
  23812. ref_key: "headerRef",
  23813. ref: headerRef,
  23814. class: normalizeClass(unref(ns).e("header"))
  23815. }, [
  23816. renderSlot(_ctx.$slots, "header", {}, () => [
  23817. createElementVNode("span", {
  23818. role: "heading",
  23819. class: normalizeClass(unref(ns).e("title"))
  23820. }, toDisplayString(_ctx.title), 3)
  23821. ]),
  23822. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  23823. key: 0,
  23824. "aria-label": unref(t2)("el.dialog.close"),
  23825. class: normalizeClass(unref(ns).e("headerbtn")),
  23826. type: "button",
  23827. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  23828. }, [
  23829. createVNode(unref(ElIcon), {
  23830. class: normalizeClass(unref(ns).e("close"))
  23831. }, {
  23832. default: withCtx(() => [
  23833. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  23834. ]),
  23835. _: 1
  23836. }, 8, ["class"])
  23837. ], 10, _hoisted_1$7)) : createCommentVNode("v-if", true)
  23838. ], 2),
  23839. createElementVNode("div", {
  23840. id: unref(bodyId),
  23841. class: normalizeClass(unref(ns).e("body"))
  23842. }, [
  23843. renderSlot(_ctx.$slots, "default")
  23844. ], 10, _hoisted_2$6),
  23845. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  23846. key: 0,
  23847. class: normalizeClass(unref(ns).e("footer"))
  23848. }, [
  23849. renderSlot(_ctx.$slots, "footer")
  23850. ], 2)) : createCommentVNode("v-if", true)
  23851. ], 6);
  23852. };
  23853. }
  23854. });
  23855. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  23856. const dialogProps = buildProps({
  23857. ...dialogContentProps,
  23858. appendToBody: {
  23859. type: Boolean,
  23860. default: false
  23861. },
  23862. beforeClose: {
  23863. type: definePropType(Function)
  23864. },
  23865. destroyOnClose: {
  23866. type: Boolean,
  23867. default: false
  23868. },
  23869. closeOnClickModal: {
  23870. type: Boolean,
  23871. default: true
  23872. },
  23873. closeOnPressEscape: {
  23874. type: Boolean,
  23875. default: true
  23876. },
  23877. lockScroll: {
  23878. type: Boolean,
  23879. default: true
  23880. },
  23881. modal: {
  23882. type: Boolean,
  23883. default: true
  23884. },
  23885. openDelay: {
  23886. type: Number,
  23887. default: 0
  23888. },
  23889. closeDelay: {
  23890. type: Number,
  23891. default: 0
  23892. },
  23893. top: {
  23894. type: String
  23895. },
  23896. modelValue: {
  23897. type: Boolean,
  23898. default: false
  23899. },
  23900. modalClass: String,
  23901. width: {
  23902. type: [String, Number]
  23903. },
  23904. zIndex: {
  23905. type: Number
  23906. },
  23907. trapFocus: {
  23908. type: Boolean,
  23909. default: false
  23910. }
  23911. });
  23912. const dialogEmits = {
  23913. open: () => true,
  23914. opened: () => true,
  23915. close: () => true,
  23916. closed: () => true,
  23917. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  23918. openAutoFocus: () => true,
  23919. closeAutoFocus: () => true
  23920. };
  23921. const useDialog = (props, targetRef) => {
  23922. const instance = getCurrentInstance();
  23923. const emit = instance.emit;
  23924. const { nextZIndex } = useZIndex();
  23925. let lastPosition = "";
  23926. const titleId = useId();
  23927. const bodyId = useId();
  23928. const visible = ref(false);
  23929. const closed = ref(false);
  23930. const rendered = ref(false);
  23931. const zIndex2 = ref(props.zIndex || nextZIndex());
  23932. let openTimer = void 0;
  23933. let closeTimer = void 0;
  23934. const namespace = useGlobalConfig("namespace", defaultNamespace);
  23935. const style = computed$1(() => {
  23936. const style2 = {};
  23937. const varPrefix = `--${namespace.value}-dialog`;
  23938. if (!props.fullscreen) {
  23939. if (props.top) {
  23940. style2[`${varPrefix}-margin-top`] = props.top;
  23941. }
  23942. if (props.width) {
  23943. style2[`${varPrefix}-width`] = addUnit(props.width);
  23944. }
  23945. }
  23946. return style2;
  23947. });
  23948. const overlayDialogStyle = computed$1(() => {
  23949. if (props.alignCenter) {
  23950. return { display: "flex" };
  23951. }
  23952. return {};
  23953. });
  23954. function afterEnter() {
  23955. emit("opened");
  23956. }
  23957. function afterLeave() {
  23958. emit("closed");
  23959. emit(UPDATE_MODEL_EVENT, false);
  23960. if (props.destroyOnClose) {
  23961. rendered.value = false;
  23962. }
  23963. }
  23964. function beforeLeave() {
  23965. emit("close");
  23966. }
  23967. function open() {
  23968. closeTimer == null ? void 0 : closeTimer();
  23969. openTimer == null ? void 0 : openTimer();
  23970. if (props.openDelay && props.openDelay > 0) {
  23971. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  23972. } else {
  23973. doOpen();
  23974. }
  23975. }
  23976. function close() {
  23977. openTimer == null ? void 0 : openTimer();
  23978. closeTimer == null ? void 0 : closeTimer();
  23979. if (props.closeDelay && props.closeDelay > 0) {
  23980. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  23981. } else {
  23982. doClose();
  23983. }
  23984. }
  23985. function handleClose() {
  23986. function hide(shouldCancel) {
  23987. if (shouldCancel)
  23988. return;
  23989. closed.value = true;
  23990. visible.value = false;
  23991. }
  23992. if (props.beforeClose) {
  23993. props.beforeClose(hide);
  23994. } else {
  23995. close();
  23996. }
  23997. }
  23998. function onModalClick() {
  23999. if (props.closeOnClickModal) {
  24000. handleClose();
  24001. }
  24002. }
  24003. function doOpen() {
  24004. if (!isClient)
  24005. return;
  24006. visible.value = true;
  24007. }
  24008. function doClose() {
  24009. visible.value = false;
  24010. }
  24011. function onOpenAutoFocus() {
  24012. emit("openAutoFocus");
  24013. }
  24014. function onCloseAutoFocus() {
  24015. emit("closeAutoFocus");
  24016. }
  24017. function onFocusoutPrevented(event2) {
  24018. var _a2;
  24019. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  24020. event2.preventDefault();
  24021. }
  24022. }
  24023. if (props.lockScroll) {
  24024. useLockscreen(visible);
  24025. }
  24026. function onCloseRequested() {
  24027. if (props.closeOnPressEscape) {
  24028. handleClose();
  24029. }
  24030. }
  24031. watch(() => props.modelValue, (val) => {
  24032. if (val) {
  24033. closed.value = false;
  24034. open();
  24035. rendered.value = true;
  24036. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  24037. nextTick(() => {
  24038. emit("open");
  24039. if (targetRef.value) {
  24040. targetRef.value.scrollTop = 0;
  24041. }
  24042. });
  24043. } else {
  24044. if (visible.value) {
  24045. close();
  24046. }
  24047. }
  24048. });
  24049. watch(() => props.fullscreen, (val) => {
  24050. if (!targetRef.value)
  24051. return;
  24052. if (val) {
  24053. lastPosition = targetRef.value.style.transform;
  24054. targetRef.value.style.transform = "";
  24055. } else {
  24056. targetRef.value.style.transform = lastPosition;
  24057. }
  24058. });
  24059. onMounted(() => {
  24060. if (props.modelValue) {
  24061. visible.value = true;
  24062. rendered.value = true;
  24063. open();
  24064. }
  24065. });
  24066. return {
  24067. afterEnter,
  24068. afterLeave,
  24069. beforeLeave,
  24070. handleClose,
  24071. onModalClick,
  24072. close,
  24073. doClose,
  24074. onOpenAutoFocus,
  24075. onCloseAutoFocus,
  24076. onCloseRequested,
  24077. onFocusoutPrevented,
  24078. titleId,
  24079. bodyId,
  24080. closed,
  24081. style,
  24082. overlayDialogStyle,
  24083. rendered,
  24084. visible,
  24085. zIndex: zIndex2
  24086. };
  24087. };
  24088. const _hoisted_1$6 = ["aria-label", "aria-labelledby", "aria-describedby"];
  24089. const __default__$2 = defineComponent({
  24090. name: "ElDialog",
  24091. inheritAttrs: false
  24092. });
  24093. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  24094. ...__default__$2,
  24095. props: dialogProps,
  24096. emits: dialogEmits,
  24097. setup(__props, { expose }) {
  24098. const props = __props;
  24099. const slots = useSlots();
  24100. useDeprecated({
  24101. scope: "el-dialog",
  24102. from: "the title slot",
  24103. replacement: "the header slot",
  24104. version: "3.0.0",
  24105. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  24106. }, computed$1(() => !!slots.title));
  24107. useDeprecated({
  24108. scope: "el-dialog",
  24109. from: "custom-class",
  24110. replacement: "class",
  24111. version: "2.3.0",
  24112. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  24113. type: "Attribute"
  24114. }, computed$1(() => !!props.customClass));
  24115. const ns = useNamespace("dialog");
  24116. const dialogRef = ref();
  24117. const headerRef = ref();
  24118. const dialogContentRef = ref();
  24119. const {
  24120. visible,
  24121. titleId,
  24122. bodyId,
  24123. style,
  24124. overlayDialogStyle,
  24125. rendered,
  24126. zIndex: zIndex2,
  24127. afterEnter,
  24128. afterLeave,
  24129. beforeLeave,
  24130. handleClose,
  24131. onModalClick,
  24132. onOpenAutoFocus,
  24133. onCloseAutoFocus,
  24134. onCloseRequested,
  24135. onFocusoutPrevented
  24136. } = useDialog(props, dialogRef);
  24137. provide(dialogInjectionKey, {
  24138. dialogRef,
  24139. headerRef,
  24140. bodyId,
  24141. ns,
  24142. rendered,
  24143. style
  24144. });
  24145. const overlayEvent = useSameTarget(onModalClick);
  24146. const draggable2 = computed$1(() => props.draggable && !props.fullscreen);
  24147. expose({
  24148. visible,
  24149. dialogContentRef
  24150. });
  24151. return (_ctx, _cache) => {
  24152. return openBlock(), createBlock(Teleport, {
  24153. to: "body",
  24154. disabled: !_ctx.appendToBody
  24155. }, [
  24156. createVNode(Transition, {
  24157. name: "dialog-fade",
  24158. onAfterEnter: unref(afterEnter),
  24159. onAfterLeave: unref(afterLeave),
  24160. onBeforeLeave: unref(beforeLeave),
  24161. persisted: ""
  24162. }, {
  24163. default: withCtx(() => [
  24164. withDirectives(createVNode(unref(ElOverlay), {
  24165. "custom-mask-event": "",
  24166. mask: _ctx.modal,
  24167. "overlay-class": _ctx.modalClass,
  24168. "z-index": unref(zIndex2)
  24169. }, {
  24170. default: withCtx(() => [
  24171. createElementVNode("div", {
  24172. role: "dialog",
  24173. "aria-modal": "true",
  24174. "aria-label": _ctx.title || void 0,
  24175. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  24176. "aria-describedby": unref(bodyId),
  24177. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  24178. style: normalizeStyle(unref(overlayDialogStyle)),
  24179. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  24180. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  24181. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  24182. }, [
  24183. createVNode(unref(ElFocusTrap), {
  24184. loop: "",
  24185. trapped: unref(visible),
  24186. "focus-start-el": "container",
  24187. onFocusAfterTrapped: unref(onOpenAutoFocus),
  24188. onFocusAfterReleased: unref(onCloseAutoFocus),
  24189. onFocusoutPrevented: unref(onFocusoutPrevented),
  24190. onReleaseRequested: unref(onCloseRequested)
  24191. }, {
  24192. default: withCtx(() => [
  24193. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  24194. key: 0,
  24195. ref_key: "dialogContentRef",
  24196. ref: dialogContentRef
  24197. }, _ctx.$attrs, {
  24198. "custom-class": _ctx.customClass,
  24199. center: _ctx.center,
  24200. "align-center": _ctx.alignCenter,
  24201. "close-icon": _ctx.closeIcon,
  24202. draggable: unref(draggable2),
  24203. fullscreen: _ctx.fullscreen,
  24204. "show-close": _ctx.showClose,
  24205. title: _ctx.title,
  24206. onClose: unref(handleClose)
  24207. }), createSlots({
  24208. header: withCtx(() => [
  24209. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  24210. key: 0,
  24211. close: unref(handleClose),
  24212. titleId: unref(titleId),
  24213. titleClass: unref(ns).e("title")
  24214. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  24215. ]),
  24216. default: withCtx(() => [
  24217. renderSlot(_ctx.$slots, "default")
  24218. ]),
  24219. _: 2
  24220. }, [
  24221. _ctx.$slots.footer ? {
  24222. name: "footer",
  24223. fn: withCtx(() => [
  24224. renderSlot(_ctx.$slots, "footer")
  24225. ])
  24226. } : void 0
  24227. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : createCommentVNode("v-if", true)
  24228. ]),
  24229. _: 3
  24230. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  24231. ], 46, _hoisted_1$6)
  24232. ]),
  24233. _: 3
  24234. }, 8, ["mask", "overlay-class", "z-index"]), [
  24235. [vShow, unref(visible)]
  24236. ])
  24237. ]),
  24238. _: 3
  24239. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  24240. ], 8, ["disabled"]);
  24241. };
  24242. }
  24243. });
  24244. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  24245. const ElDialog = withInstall(Dialog);
  24246. const inputNumberProps = buildProps({
  24247. id: {
  24248. type: String,
  24249. default: void 0
  24250. },
  24251. step: {
  24252. type: Number,
  24253. default: 1
  24254. },
  24255. stepStrictly: Boolean,
  24256. max: {
  24257. type: Number,
  24258. default: Number.POSITIVE_INFINITY
  24259. },
  24260. min: {
  24261. type: Number,
  24262. default: Number.NEGATIVE_INFINITY
  24263. },
  24264. modelValue: Number,
  24265. readonly: Boolean,
  24266. disabled: Boolean,
  24267. size: useSizeProp,
  24268. controls: {
  24269. type: Boolean,
  24270. default: true
  24271. },
  24272. controlsPosition: {
  24273. type: String,
  24274. default: "",
  24275. values: ["", "right"]
  24276. },
  24277. valueOnClear: {
  24278. type: [String, Number, null],
  24279. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  24280. default: null
  24281. },
  24282. name: String,
  24283. label: String,
  24284. placeholder: String,
  24285. precision: {
  24286. type: Number,
  24287. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  24288. },
  24289. validateEvent: {
  24290. type: Boolean,
  24291. default: true
  24292. }
  24293. });
  24294. const inputNumberEmits = {
  24295. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  24296. blur: (e) => e instanceof FocusEvent,
  24297. focus: (e) => e instanceof FocusEvent,
  24298. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  24299. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  24300. };
  24301. const _hoisted_1$5 = ["aria-label", "onKeydown"];
  24302. const _hoisted_2$5 = ["aria-label", "onKeydown"];
  24303. const __default__$1 = defineComponent({
  24304. name: "ElInputNumber"
  24305. });
  24306. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  24307. ...__default__$1,
  24308. props: inputNumberProps,
  24309. emits: inputNumberEmits,
  24310. setup(__props, { expose, emit }) {
  24311. const props = __props;
  24312. const { t: t2 } = useLocale();
  24313. const ns = useNamespace("input-number");
  24314. const input = ref();
  24315. const data = reactive({
  24316. currentValue: props.modelValue,
  24317. userInput: null
  24318. });
  24319. const { formItem } = useFormItem();
  24320. const minDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  24321. const maxDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  24322. const numPrecision = computed$1(() => {
  24323. const stepPrecision = getPrecision(props.step);
  24324. if (!isUndefined(props.precision)) {
  24325. if (stepPrecision > props.precision)
  24326. ;
  24327. return props.precision;
  24328. } else {
  24329. return Math.max(getPrecision(props.modelValue), stepPrecision);
  24330. }
  24331. });
  24332. const controlsAtRight = computed$1(() => {
  24333. return props.controls && props.controlsPosition === "right";
  24334. });
  24335. const inputNumberSize = useFormSize();
  24336. const inputNumberDisabled = useFormDisabled();
  24337. const displayValue = computed$1(() => {
  24338. if (data.userInput !== null) {
  24339. return data.userInput;
  24340. }
  24341. let currentValue = data.currentValue;
  24342. if (isNil(currentValue))
  24343. return "";
  24344. if (isNumber(currentValue)) {
  24345. if (Number.isNaN(currentValue))
  24346. return "";
  24347. if (!isUndefined(props.precision)) {
  24348. currentValue = currentValue.toFixed(props.precision);
  24349. }
  24350. }
  24351. return currentValue;
  24352. });
  24353. const toPrecision = (num, pre) => {
  24354. if (isUndefined(pre))
  24355. pre = numPrecision.value;
  24356. if (pre === 0)
  24357. return Math.round(num);
  24358. let snum = String(num);
  24359. const pointPos = snum.indexOf(".");
  24360. if (pointPos === -1)
  24361. return num;
  24362. const nums = snum.replace(".", "").split("");
  24363. const datum = nums[pointPos + pre];
  24364. if (!datum)
  24365. return num;
  24366. const length = snum.length;
  24367. if (snum.charAt(length - 1) === "5") {
  24368. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  24369. }
  24370. return Number.parseFloat(Number(snum).toFixed(pre));
  24371. };
  24372. const getPrecision = (value) => {
  24373. if (isNil(value))
  24374. return 0;
  24375. const valueString = value.toString();
  24376. const dotPosition = valueString.indexOf(".");
  24377. let precision = 0;
  24378. if (dotPosition !== -1) {
  24379. precision = valueString.length - dotPosition - 1;
  24380. }
  24381. return precision;
  24382. };
  24383. const ensurePrecision = (val, coefficient = 1) => {
  24384. if (!isNumber(val))
  24385. return data.currentValue;
  24386. return toPrecision(val + props.step * coefficient);
  24387. };
  24388. const increase = () => {
  24389. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  24390. return;
  24391. const value = Number(displayValue.value) || 0;
  24392. const newVal = ensurePrecision(value);
  24393. setCurrentValue(newVal);
  24394. emit(INPUT_EVENT, data.currentValue);
  24395. };
  24396. const decrease = () => {
  24397. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  24398. return;
  24399. const value = Number(displayValue.value) || 0;
  24400. const newVal = ensurePrecision(value, -1);
  24401. setCurrentValue(newVal);
  24402. emit(INPUT_EVENT, data.currentValue);
  24403. };
  24404. const verifyValue = (value, update) => {
  24405. const { max: max2, min: min2, step, precision, stepStrictly, valueOnClear } = props;
  24406. let newVal = Number(value);
  24407. if (isNil(value) || Number.isNaN(newVal)) {
  24408. return null;
  24409. }
  24410. if (value === "") {
  24411. if (valueOnClear === null) {
  24412. return null;
  24413. }
  24414. newVal = isString(valueOnClear) ? { min: min2, max: max2 }[valueOnClear] : valueOnClear;
  24415. }
  24416. if (stepStrictly) {
  24417. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  24418. }
  24419. if (!isUndefined(precision)) {
  24420. newVal = toPrecision(newVal, precision);
  24421. }
  24422. if (newVal > max2 || newVal < min2) {
  24423. newVal = newVal > max2 ? max2 : min2;
  24424. update && emit(UPDATE_MODEL_EVENT, newVal);
  24425. }
  24426. return newVal;
  24427. };
  24428. const setCurrentValue = (value, emitChange = true) => {
  24429. var _a2;
  24430. const oldVal = data.currentValue;
  24431. const newVal = verifyValue(value);
  24432. if (!emitChange) {
  24433. emit(UPDATE_MODEL_EVENT, newVal);
  24434. return;
  24435. }
  24436. if (oldVal === newVal)
  24437. return;
  24438. data.userInput = null;
  24439. emit(UPDATE_MODEL_EVENT, newVal);
  24440. emit(CHANGE_EVENT, newVal, oldVal);
  24441. if (props.validateEvent) {
  24442. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  24443. }
  24444. data.currentValue = newVal;
  24445. };
  24446. const handleInput = (value) => {
  24447. data.userInput = value;
  24448. const newVal = value === "" ? null : Number(value);
  24449. emit(INPUT_EVENT, newVal);
  24450. setCurrentValue(newVal, false);
  24451. };
  24452. const handleInputChange = (value) => {
  24453. const newVal = value !== "" ? Number(value) : "";
  24454. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  24455. setCurrentValue(newVal);
  24456. }
  24457. data.userInput = null;
  24458. };
  24459. const focus = () => {
  24460. var _a2, _b;
  24461. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  24462. };
  24463. const blur = () => {
  24464. var _a2, _b;
  24465. (_b = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  24466. };
  24467. const handleFocus = (event2) => {
  24468. emit("focus", event2);
  24469. };
  24470. const handleBlur = (event2) => {
  24471. var _a2;
  24472. emit("blur", event2);
  24473. if (props.validateEvent) {
  24474. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  24475. }
  24476. };
  24477. watch(() => props.modelValue, (value) => {
  24478. const userInput = verifyValue(data.userInput);
  24479. const newValue = verifyValue(value, true);
  24480. if (!isNumber(userInput) && (!userInput || userInput !== newValue)) {
  24481. data.currentValue = newValue;
  24482. data.userInput = null;
  24483. }
  24484. }, { immediate: true });
  24485. onMounted(() => {
  24486. var _a2;
  24487. const { min: min2, max: max2, modelValue } = props;
  24488. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24489. innerInput.setAttribute("role", "spinbutton");
  24490. if (Number.isFinite(max2)) {
  24491. innerInput.setAttribute("aria-valuemax", String(max2));
  24492. } else {
  24493. innerInput.removeAttribute("aria-valuemax");
  24494. }
  24495. if (Number.isFinite(min2)) {
  24496. innerInput.setAttribute("aria-valuemin", String(min2));
  24497. } else {
  24498. innerInput.removeAttribute("aria-valuemin");
  24499. }
  24500. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  24501. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  24502. if (!isNumber(modelValue) && modelValue != null) {
  24503. let val = Number(modelValue);
  24504. if (Number.isNaN(val)) {
  24505. val = null;
  24506. }
  24507. emit(UPDATE_MODEL_EVENT, val);
  24508. }
  24509. });
  24510. onUpdated(() => {
  24511. var _a2;
  24512. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24513. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  24514. });
  24515. expose({
  24516. focus,
  24517. blur
  24518. });
  24519. return (_ctx, _cache) => {
  24520. return openBlock(), createElementBlock("div", {
  24521. class: normalizeClass([
  24522. unref(ns).b(),
  24523. unref(ns).m(unref(inputNumberSize)),
  24524. unref(ns).is("disabled", unref(inputNumberDisabled)),
  24525. unref(ns).is("without-controls", !_ctx.controls),
  24526. unref(ns).is("controls-right", unref(controlsAtRight))
  24527. ]),
  24528. onDragstart: _cache[1] || (_cache[1] = withModifiers(() => {
  24529. }, ["prevent"]))
  24530. }, [
  24531. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24532. key: 0,
  24533. role: "button",
  24534. "aria-label": unref(t2)("el.inputNumber.decrease"),
  24535. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  24536. onKeydown: withKeys(decrease, ["enter"])
  24537. }, [
  24538. createVNode(unref(ElIcon), null, {
  24539. default: withCtx(() => [
  24540. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  24541. ]),
  24542. _: 1
  24543. })
  24544. ], 42, _hoisted_1$5)), [
  24545. [unref(vRepeatClick), decrease]
  24546. ]) : createCommentVNode("v-if", true),
  24547. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24548. key: 1,
  24549. role: "button",
  24550. "aria-label": unref(t2)("el.inputNumber.increase"),
  24551. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  24552. onKeydown: withKeys(increase, ["enter"])
  24553. }, [
  24554. createVNode(unref(ElIcon), null, {
  24555. default: withCtx(() => [
  24556. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  24557. ]),
  24558. _: 1
  24559. })
  24560. ], 42, _hoisted_2$5)), [
  24561. [unref(vRepeatClick), increase]
  24562. ]) : createCommentVNode("v-if", true),
  24563. createVNode(unref(ElInput), {
  24564. id: _ctx.id,
  24565. ref_key: "input",
  24566. ref: input,
  24567. type: "number",
  24568. step: _ctx.step,
  24569. "model-value": unref(displayValue),
  24570. placeholder: _ctx.placeholder,
  24571. readonly: _ctx.readonly,
  24572. disabled: unref(inputNumberDisabled),
  24573. size: unref(inputNumberSize),
  24574. max: _ctx.max,
  24575. min: _ctx.min,
  24576. name: _ctx.name,
  24577. label: _ctx.label,
  24578. "validate-event": false,
  24579. onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
  24580. }, ["prevent"])),
  24581. onKeydown: [
  24582. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  24583. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  24584. ],
  24585. onBlur: handleBlur,
  24586. onFocus: handleFocus,
  24587. onInput: handleInput,
  24588. onChange: handleInputChange
  24589. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  24590. ], 34);
  24591. };
  24592. }
  24593. });
  24594. 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"]]);
  24595. const ElInputNumber = withInstall(InputNumber);
  24596. const selectGroupKey = Symbol("ElSelectGroup");
  24597. const selectKey = Symbol("ElSelect");
  24598. function useOption(props, states) {
  24599. const select = inject(selectKey);
  24600. const selectGroup = inject(selectGroupKey, { disabled: false });
  24601. const isObject3 = computed$1(() => {
  24602. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  24603. });
  24604. const itemSelected = computed$1(() => {
  24605. if (!select.props.multiple) {
  24606. return isEqual2(props.value, select.props.modelValue);
  24607. } else {
  24608. return contains(select.props.modelValue, props.value);
  24609. }
  24610. });
  24611. const limitReached = computed$1(() => {
  24612. if (select.props.multiple) {
  24613. const modelValue = select.props.modelValue || [];
  24614. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  24615. } else {
  24616. return false;
  24617. }
  24618. });
  24619. const currentLabel = computed$1(() => {
  24620. return props.label || (isObject3.value ? "" : props.value);
  24621. });
  24622. const currentValue = computed$1(() => {
  24623. return props.value || props.label || "";
  24624. });
  24625. const isDisabled3 = computed$1(() => {
  24626. return props.disabled || states.groupDisabled || limitReached.value;
  24627. });
  24628. const instance = getCurrentInstance();
  24629. const contains = (arr = [], target) => {
  24630. if (!isObject3.value) {
  24631. return arr && arr.includes(target);
  24632. } else {
  24633. const valueKey = select.props.valueKey;
  24634. return arr && arr.some((item) => {
  24635. return toRaw$1(get$2(item, valueKey)) === get$2(target, valueKey);
  24636. });
  24637. }
  24638. };
  24639. const isEqual2 = (a, b) => {
  24640. if (!isObject3.value) {
  24641. return a === b;
  24642. } else {
  24643. const { valueKey } = select.props;
  24644. return get$2(a, valueKey) === get$2(b, valueKey);
  24645. }
  24646. };
  24647. const hoverItem = () => {
  24648. if (!props.disabled && !selectGroup.disabled) {
  24649. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  24650. }
  24651. };
  24652. watch(() => currentLabel.value, () => {
  24653. if (!props.created && !select.props.remote)
  24654. select.setSelected();
  24655. });
  24656. watch(() => props.value, (val, oldVal) => {
  24657. const { remote, valueKey } = select.props;
  24658. if (!Object.is(val, oldVal)) {
  24659. select.onOptionDestroy(oldVal, instance.proxy);
  24660. select.onOptionCreate(instance.proxy);
  24661. }
  24662. if (!props.created && !remote) {
  24663. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  24664. return;
  24665. }
  24666. select.setSelected();
  24667. }
  24668. });
  24669. watch(() => selectGroup.disabled, () => {
  24670. states.groupDisabled = selectGroup.disabled;
  24671. }, { immediate: true });
  24672. const { queryChange } = toRaw$1(select);
  24673. watch(queryChange, (changes) => {
  24674. const { query } = unref(changes);
  24675. const regexp = new RegExp(escapeStringRegexp(query), "i");
  24676. states.visible = regexp.test(currentLabel.value) || props.created;
  24677. if (!states.visible) {
  24678. select.filteredOptionsCount--;
  24679. }
  24680. }, { immediate: true });
  24681. return {
  24682. select,
  24683. currentLabel,
  24684. currentValue,
  24685. itemSelected,
  24686. isDisabled: isDisabled3,
  24687. hoverItem
  24688. };
  24689. }
  24690. const _sfc_main$7 = defineComponent({
  24691. name: "ElOption",
  24692. componentName: "ElOption",
  24693. props: {
  24694. value: {
  24695. required: true,
  24696. type: [String, Number, Boolean, Object]
  24697. },
  24698. label: [String, Number],
  24699. created: Boolean,
  24700. disabled: {
  24701. type: Boolean,
  24702. default: false
  24703. }
  24704. },
  24705. setup(props) {
  24706. const ns = useNamespace("select");
  24707. const states = reactive({
  24708. index: -1,
  24709. groupDisabled: false,
  24710. visible: true,
  24711. hitState: false,
  24712. hover: false
  24713. });
  24714. const { currentLabel, itemSelected, isDisabled: isDisabled3, select, hoverItem } = useOption(props, states);
  24715. const { visible, hover } = toRefs(states);
  24716. const vm = getCurrentInstance().proxy;
  24717. select.onOptionCreate(vm);
  24718. onBeforeUnmount(() => {
  24719. const key = vm.value;
  24720. const { selected } = select;
  24721. const selectedOptions = select.props.multiple ? selected : [selected];
  24722. const doesSelected = selectedOptions.some((item) => {
  24723. return item.value === vm.value;
  24724. });
  24725. nextTick(() => {
  24726. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  24727. select.cachedOptions.delete(key);
  24728. }
  24729. });
  24730. select.onOptionDestroy(key, vm);
  24731. });
  24732. function selectOptionClick() {
  24733. if (props.disabled !== true && states.groupDisabled !== true) {
  24734. select.handleOptionSelect(vm, true);
  24735. }
  24736. }
  24737. return {
  24738. ns,
  24739. currentLabel,
  24740. itemSelected,
  24741. isDisabled: isDisabled3,
  24742. select,
  24743. hoverItem,
  24744. visible,
  24745. hover,
  24746. selectOptionClick,
  24747. states
  24748. };
  24749. }
  24750. });
  24751. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  24752. return withDirectives((openBlock(), createElementBlock("li", {
  24753. class: normalizeClass([
  24754. _ctx.ns.be("dropdown", "item"),
  24755. _ctx.ns.is("disabled", _ctx.isDisabled),
  24756. {
  24757. selected: _ctx.itemSelected,
  24758. hover: _ctx.hover
  24759. }
  24760. ]),
  24761. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  24762. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  24763. }, [
  24764. renderSlot(_ctx.$slots, "default", {}, () => [
  24765. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  24766. ])
  24767. ], 34)), [
  24768. [vShow, _ctx.visible]
  24769. ]);
  24770. }
  24771. 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"]]);
  24772. const _sfc_main$6 = defineComponent({
  24773. name: "ElSelectDropdown",
  24774. componentName: "ElSelectDropdown",
  24775. setup() {
  24776. const select = inject(selectKey);
  24777. const ns = useNamespace("select");
  24778. const popperClass = computed$1(() => select.props.popperClass);
  24779. const isMultiple = computed$1(() => select.props.multiple);
  24780. const isFitInputWidth = computed$1(() => select.props.fitInputWidth);
  24781. const minWidth = ref("");
  24782. function updateMinWidth() {
  24783. var _a2;
  24784. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.offsetWidth}px`;
  24785. }
  24786. onMounted(() => {
  24787. updateMinWidth();
  24788. useResizeObserver(select.selectWrapper, updateMinWidth);
  24789. });
  24790. return {
  24791. ns,
  24792. minWidth,
  24793. popperClass,
  24794. isMultiple,
  24795. isFitInputWidth
  24796. };
  24797. }
  24798. });
  24799. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  24800. return openBlock(), createElementBlock("div", {
  24801. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  24802. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  24803. }, [
  24804. renderSlot(_ctx.$slots, "default")
  24805. ], 6);
  24806. }
  24807. 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"]]);
  24808. function useSelectStates(props) {
  24809. const { t: t2 } = useLocale();
  24810. return reactive({
  24811. options: /* @__PURE__ */ new Map(),
  24812. cachedOptions: /* @__PURE__ */ new Map(),
  24813. createdLabel: null,
  24814. createdSelected: false,
  24815. selected: props.multiple ? [] : {},
  24816. inputLength: 20,
  24817. inputWidth: 0,
  24818. optionsCount: 0,
  24819. filteredOptionsCount: 0,
  24820. visible: false,
  24821. softFocus: false,
  24822. selectedLabel: "",
  24823. hoverIndex: -1,
  24824. query: "",
  24825. previousQuery: null,
  24826. inputHovering: false,
  24827. cachedPlaceHolder: "",
  24828. currentPlaceholder: t2("el.select.placeholder"),
  24829. menuVisibleOnFocus: false,
  24830. isOnComposition: false,
  24831. isSilentBlur: false,
  24832. prefixWidth: 11,
  24833. tagInMultiLine: false,
  24834. mouseEnter: false
  24835. });
  24836. }
  24837. const useSelect = (props, states, ctx) => {
  24838. const { t: t2 } = useLocale();
  24839. const ns = useNamespace("select");
  24840. useDeprecated({
  24841. from: "suffixTransition",
  24842. replacement: "override style scheme",
  24843. version: "2.3.0",
  24844. scope: "props",
  24845. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  24846. }, computed$1(() => props.suffixTransition === false));
  24847. const reference = ref(null);
  24848. const input = ref(null);
  24849. const iOSInput = ref(null);
  24850. const tooltipRef = ref(null);
  24851. const tags = ref(null);
  24852. const selectWrapper = ref(null);
  24853. const scrollbar = ref(null);
  24854. const hoverOption = ref(-1);
  24855. const queryChange = shallowRef({ query: "" });
  24856. const groupQueryChange = shallowRef("");
  24857. const optionList = ref([]);
  24858. let originClientHeight = 0;
  24859. const { form, formItem } = useFormItem();
  24860. const readonly2 = computed$1(() => !props.filterable || props.multiple || !states.visible);
  24861. const selectDisabled = computed$1(() => props.disabled || (form == null ? void 0 : form.disabled));
  24862. const showClose = computed$1(() => {
  24863. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  24864. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  24865. return criteria;
  24866. });
  24867. const iconComponent = computed$1(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  24868. const iconReverse = computed$1(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  24869. const debounce$12 = computed$1(() => props.remote ? 300 : 0);
  24870. const emptyText = computed$1(() => {
  24871. if (props.loading) {
  24872. return props.loadingText || t2("el.select.loading");
  24873. } else {
  24874. if (props.remote && states.query === "" && states.options.size === 0)
  24875. return false;
  24876. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  24877. return props.noMatchText || t2("el.select.noMatch");
  24878. }
  24879. if (states.options.size === 0) {
  24880. return props.noDataText || t2("el.select.noData");
  24881. }
  24882. }
  24883. return null;
  24884. });
  24885. const optionsArray = computed$1(() => {
  24886. const list = Array.from(states.options.values());
  24887. const newList = [];
  24888. optionList.value.forEach((item) => {
  24889. const index2 = list.findIndex((i2) => i2.currentLabel === item);
  24890. if (index2 > -1) {
  24891. newList.push(list[index2]);
  24892. }
  24893. });
  24894. return newList.length ? newList : list;
  24895. });
  24896. const cachedOptionsArray = computed$1(() => Array.from(states.cachedOptions.values()));
  24897. const showNewOption = computed$1(() => {
  24898. const hasExistingOption = optionsArray.value.filter((option) => {
  24899. return !option.created;
  24900. }).some((option) => {
  24901. return option.currentLabel === states.query;
  24902. });
  24903. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  24904. });
  24905. const selectSize = useFormSize();
  24906. const collapseTagSize = computed$1(() => ["small"].includes(selectSize.value) ? "small" : "default");
  24907. const dropMenuVisible = computed$1({
  24908. get() {
  24909. return states.visible && emptyText.value !== false;
  24910. },
  24911. set(val) {
  24912. states.visible = val;
  24913. }
  24914. });
  24915. watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  24916. nextTick(() => {
  24917. resetInputHeight();
  24918. });
  24919. });
  24920. watch(() => props.placeholder, (val) => {
  24921. states.cachedPlaceHolder = states.currentPlaceholder = val;
  24922. });
  24923. watch(() => props.modelValue, (val, oldVal) => {
  24924. if (props.multiple) {
  24925. resetInputHeight();
  24926. if (val && val.length > 0 || input.value && states.query !== "") {
  24927. states.currentPlaceholder = "";
  24928. } else {
  24929. states.currentPlaceholder = states.cachedPlaceHolder;
  24930. }
  24931. if (props.filterable && !props.reserveKeyword) {
  24932. states.query = "";
  24933. handleQueryChange(states.query);
  24934. }
  24935. }
  24936. setSelected();
  24937. if (props.filterable && !props.multiple) {
  24938. states.inputLength = 20;
  24939. }
  24940. if (!isEqual(val, oldVal) && props.validateEvent) {
  24941. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24942. }
  24943. }, {
  24944. flush: "post",
  24945. deep: true
  24946. });
  24947. watch(() => states.visible, (val) => {
  24948. var _a2, _b, _c, _d, _e;
  24949. if (!val) {
  24950. if (props.filterable) {
  24951. if (isFunction$3(props.filterMethod)) {
  24952. props.filterMethod("");
  24953. }
  24954. if (isFunction$3(props.remoteMethod)) {
  24955. props.remoteMethod("");
  24956. }
  24957. }
  24958. input.value && input.value.blur();
  24959. states.query = "";
  24960. states.previousQuery = null;
  24961. states.selectedLabel = "";
  24962. states.inputLength = 20;
  24963. states.menuVisibleOnFocus = false;
  24964. resetHoverIndex();
  24965. nextTick(() => {
  24966. if (input.value && input.value.value === "" && states.selected.length === 0) {
  24967. states.currentPlaceholder = states.cachedPlaceHolder;
  24968. }
  24969. });
  24970. if (!props.multiple) {
  24971. if (states.selected) {
  24972. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  24973. states.selectedLabel = states.createdLabel;
  24974. } else {
  24975. states.selectedLabel = states.selected.currentLabel;
  24976. }
  24977. if (props.filterable)
  24978. states.query = states.selectedLabel;
  24979. }
  24980. if (props.filterable) {
  24981. states.currentPlaceholder = states.cachedPlaceHolder;
  24982. }
  24983. }
  24984. } else {
  24985. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  24986. if (props.filterable) {
  24987. states.filteredOptionsCount = states.optionsCount;
  24988. states.query = props.remote ? "" : states.selectedLabel;
  24989. (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
  24990. if (props.multiple) {
  24991. (_e = input.value) == null ? void 0 : _e.focus();
  24992. } else {
  24993. if (states.selectedLabel) {
  24994. states.currentPlaceholder = `${states.selectedLabel}`;
  24995. states.selectedLabel = "";
  24996. }
  24997. }
  24998. handleQueryChange(states.query);
  24999. if (!props.multiple && !props.remote) {
  25000. queryChange.value.query = "";
  25001. triggerRef(queryChange);
  25002. triggerRef(groupQueryChange);
  25003. }
  25004. }
  25005. }
  25006. ctx.emit("visible-change", val);
  25007. });
  25008. watch(() => states.options.entries(), () => {
  25009. var _a2, _b, _c;
  25010. if (!isClient)
  25011. return;
  25012. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25013. if (props.multiple) {
  25014. resetInputHeight();
  25015. }
  25016. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  25017. if (!Array.from(inputs).includes(document.activeElement)) {
  25018. setSelected();
  25019. }
  25020. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  25021. checkDefaultFirstOption();
  25022. }
  25023. }, {
  25024. flush: "post"
  25025. });
  25026. watch(() => states.hoverIndex, (val) => {
  25027. if (isNumber(val) && val > -1) {
  25028. hoverOption.value = optionsArray.value[val] || {};
  25029. } else {
  25030. hoverOption.value = {};
  25031. }
  25032. optionsArray.value.forEach((option) => {
  25033. option.hover = hoverOption.value === option;
  25034. });
  25035. });
  25036. const resetInputHeight = () => {
  25037. nextTick(() => {
  25038. var _a2, _b;
  25039. if (!reference.value)
  25040. return;
  25041. const input2 = reference.value.$el.querySelector("input");
  25042. originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
  25043. const _tags = tags.value;
  25044. const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  25045. const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
  25046. const isElHidden = input2.offsetParent === null;
  25047. !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
  25048. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  25049. if (states.visible && emptyText.value !== false) {
  25050. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25051. }
  25052. });
  25053. };
  25054. const handleQueryChange = async (val) => {
  25055. if (states.previousQuery === val || states.isOnComposition)
  25056. return;
  25057. if (states.previousQuery === null && (isFunction$3(props.filterMethod) || isFunction$3(props.remoteMethod))) {
  25058. states.previousQuery = val;
  25059. return;
  25060. }
  25061. states.previousQuery = val;
  25062. nextTick(() => {
  25063. var _a2, _b;
  25064. if (states.visible)
  25065. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25066. });
  25067. states.hoverIndex = -1;
  25068. if (props.multiple && props.filterable) {
  25069. nextTick(() => {
  25070. const length = input.value.value.length * 15 + 20;
  25071. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  25072. managePlaceholder();
  25073. resetInputHeight();
  25074. });
  25075. }
  25076. if (props.remote && isFunction$3(props.remoteMethod)) {
  25077. states.hoverIndex = -1;
  25078. props.remoteMethod(val);
  25079. } else if (isFunction$3(props.filterMethod)) {
  25080. props.filterMethod(val);
  25081. triggerRef(groupQueryChange);
  25082. } else {
  25083. states.filteredOptionsCount = states.optionsCount;
  25084. queryChange.value.query = val;
  25085. triggerRef(queryChange);
  25086. triggerRef(groupQueryChange);
  25087. }
  25088. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  25089. await nextTick();
  25090. checkDefaultFirstOption();
  25091. }
  25092. };
  25093. const managePlaceholder = () => {
  25094. if (states.currentPlaceholder !== "") {
  25095. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  25096. }
  25097. };
  25098. const checkDefaultFirstOption = () => {
  25099. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  25100. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  25101. const firstOriginOption = optionsInDropdown[0];
  25102. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  25103. };
  25104. const setSelected = () => {
  25105. var _a2;
  25106. if (!props.multiple) {
  25107. const option = getOption(props.modelValue);
  25108. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  25109. states.createdLabel = option.props.value;
  25110. states.createdSelected = true;
  25111. } else {
  25112. states.createdSelected = false;
  25113. }
  25114. states.selectedLabel = option.currentLabel;
  25115. states.selected = option;
  25116. if (props.filterable)
  25117. states.query = states.selectedLabel;
  25118. return;
  25119. } else {
  25120. states.selectedLabel = "";
  25121. }
  25122. const result = [];
  25123. if (Array.isArray(props.modelValue)) {
  25124. props.modelValue.forEach((value) => {
  25125. result.push(getOption(value));
  25126. });
  25127. }
  25128. states.selected = result;
  25129. nextTick(() => {
  25130. resetInputHeight();
  25131. });
  25132. };
  25133. const getOption = (value) => {
  25134. let option;
  25135. const isObjectValue = toRawType(value).toLowerCase() === "object";
  25136. const isNull = toRawType(value).toLowerCase() === "null";
  25137. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  25138. for (let i2 = states.cachedOptions.size - 1; i2 >= 0; i2--) {
  25139. const cachedOption = cachedOptionsArray.value[i2];
  25140. const isEqualValue = isObjectValue ? get$2(cachedOption.value, props.valueKey) === get$2(value, props.valueKey) : cachedOption.value === value;
  25141. if (isEqualValue) {
  25142. option = {
  25143. value,
  25144. currentLabel: cachedOption.currentLabel,
  25145. isDisabled: cachedOption.isDisabled
  25146. };
  25147. break;
  25148. }
  25149. }
  25150. if (option)
  25151. return option;
  25152. const label2 = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  25153. const newOption = {
  25154. value,
  25155. currentLabel: label2
  25156. };
  25157. if (props.multiple) {
  25158. newOption.hitState = false;
  25159. }
  25160. return newOption;
  25161. };
  25162. const resetHoverIndex = () => {
  25163. setTimeout(() => {
  25164. const valueKey = props.valueKey;
  25165. if (!props.multiple) {
  25166. states.hoverIndex = optionsArray.value.findIndex((item) => {
  25167. return getValueKey(item) === getValueKey(states.selected);
  25168. });
  25169. } else {
  25170. if (states.selected.length > 0) {
  25171. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  25172. return optionsArray.value.findIndex((item) => {
  25173. return get$2(item, valueKey) === get$2(selected, valueKey);
  25174. });
  25175. }));
  25176. } else {
  25177. states.hoverIndex = -1;
  25178. }
  25179. }
  25180. }, 300);
  25181. };
  25182. const handleResize = () => {
  25183. var _a2, _b;
  25184. resetInputWidth();
  25185. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25186. if (props.multiple)
  25187. resetInputHeight();
  25188. };
  25189. const resetInputWidth = () => {
  25190. var _a2;
  25191. states.inputWidth = (_a2 = reference.value) == null ? void 0 : _a2.$el.offsetWidth;
  25192. };
  25193. const onInputChange = () => {
  25194. if (props.filterable && states.query !== states.selectedLabel) {
  25195. states.query = states.selectedLabel;
  25196. handleQueryChange(states.query);
  25197. }
  25198. };
  25199. const debouncedOnInputChange = debounce$2(() => {
  25200. onInputChange();
  25201. }, debounce$12.value);
  25202. const debouncedQueryChange = debounce$2((e) => {
  25203. handleQueryChange(e.target.value);
  25204. }, debounce$12.value);
  25205. const emitChange = (val) => {
  25206. if (!isEqual(props.modelValue, val)) {
  25207. ctx.emit(CHANGE_EVENT, val);
  25208. }
  25209. };
  25210. const deletePrevTag = (e) => {
  25211. if (e.code === EVENT_CODE.delete)
  25212. return;
  25213. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  25214. const value = props.modelValue.slice();
  25215. value.pop();
  25216. ctx.emit(UPDATE_MODEL_EVENT, value);
  25217. emitChange(value);
  25218. }
  25219. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  25220. states.currentPlaceholder = states.cachedPlaceHolder;
  25221. }
  25222. };
  25223. const deleteTag = (event2, tag) => {
  25224. const index2 = states.selected.indexOf(tag);
  25225. if (index2 > -1 && !selectDisabled.value) {
  25226. const value = props.modelValue.slice();
  25227. value.splice(index2, 1);
  25228. ctx.emit(UPDATE_MODEL_EVENT, value);
  25229. emitChange(value);
  25230. ctx.emit("remove-tag", tag.value);
  25231. }
  25232. event2.stopPropagation();
  25233. };
  25234. const deleteSelected = (event2) => {
  25235. event2.stopPropagation();
  25236. const value = props.multiple ? [] : "";
  25237. if (!isString(value)) {
  25238. for (const item of states.selected) {
  25239. if (item.isDisabled)
  25240. value.push(item.value);
  25241. }
  25242. }
  25243. ctx.emit(UPDATE_MODEL_EVENT, value);
  25244. emitChange(value);
  25245. states.hoverIndex = -1;
  25246. states.visible = false;
  25247. ctx.emit("clear");
  25248. };
  25249. const handleOptionSelect = (option, byClick) => {
  25250. var _a2;
  25251. if (props.multiple) {
  25252. const value = (props.modelValue || []).slice();
  25253. const optionIndex = getValueIndex(value, option.value);
  25254. if (optionIndex > -1) {
  25255. value.splice(optionIndex, 1);
  25256. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  25257. value.push(option.value);
  25258. }
  25259. ctx.emit(UPDATE_MODEL_EVENT, value);
  25260. emitChange(value);
  25261. if (option.created) {
  25262. states.query = "";
  25263. handleQueryChange("");
  25264. states.inputLength = 20;
  25265. }
  25266. if (props.filterable)
  25267. (_a2 = input.value) == null ? void 0 : _a2.focus();
  25268. } else {
  25269. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  25270. emitChange(option.value);
  25271. states.visible = false;
  25272. }
  25273. states.isSilentBlur = byClick;
  25274. setSoftFocus();
  25275. if (states.visible)
  25276. return;
  25277. nextTick(() => {
  25278. scrollToOption(option);
  25279. });
  25280. };
  25281. const getValueIndex = (arr = [], value) => {
  25282. if (!isObject$5(value))
  25283. return arr.indexOf(value);
  25284. const valueKey = props.valueKey;
  25285. let index2 = -1;
  25286. arr.some((item, i2) => {
  25287. if (toRaw$1(get$2(item, valueKey)) === get$2(value, valueKey)) {
  25288. index2 = i2;
  25289. return true;
  25290. }
  25291. return false;
  25292. });
  25293. return index2;
  25294. };
  25295. const setSoftFocus = () => {
  25296. states.softFocus = true;
  25297. const _input = input.value || reference.value;
  25298. if (_input) {
  25299. _input == null ? void 0 : _input.focus();
  25300. }
  25301. };
  25302. const scrollToOption = (option) => {
  25303. var _a2, _b, _c, _d, _e;
  25304. const targetOption = Array.isArray(option) ? option[0] : option;
  25305. let target = null;
  25306. if (targetOption == null ? void 0 : targetOption.value) {
  25307. const options2 = optionsArray.value.filter((item) => item.value === targetOption.value);
  25308. if (options2.length > 0) {
  25309. target = options2[0].$el;
  25310. }
  25311. }
  25312. if (tooltipRef.value && target) {
  25313. 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")}`);
  25314. if (menu) {
  25315. scrollIntoView(menu, target);
  25316. }
  25317. }
  25318. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  25319. };
  25320. const onOptionCreate = (vm) => {
  25321. states.optionsCount++;
  25322. states.filteredOptionsCount++;
  25323. states.options.set(vm.value, vm);
  25324. states.cachedOptions.set(vm.value, vm);
  25325. };
  25326. const onOptionDestroy = (key, vm) => {
  25327. if (states.options.get(key) === vm) {
  25328. states.optionsCount--;
  25329. states.filteredOptionsCount--;
  25330. states.options.delete(key);
  25331. }
  25332. };
  25333. const resetInputState = (e) => {
  25334. if (e.code !== EVENT_CODE.backspace)
  25335. toggleLastOptionHitState(false);
  25336. states.inputLength = input.value.value.length * 15 + 20;
  25337. resetInputHeight();
  25338. };
  25339. const toggleLastOptionHitState = (hit) => {
  25340. if (!Array.isArray(states.selected))
  25341. return;
  25342. const option = states.selected[states.selected.length - 1];
  25343. if (!option)
  25344. return;
  25345. if (hit === true || hit === false) {
  25346. option.hitState = hit;
  25347. return hit;
  25348. }
  25349. option.hitState = !option.hitState;
  25350. return option.hitState;
  25351. };
  25352. const handleComposition = (event2) => {
  25353. const text = event2.target.value;
  25354. if (event2.type === "compositionend") {
  25355. states.isOnComposition = false;
  25356. nextTick(() => handleQueryChange(text));
  25357. } else {
  25358. const lastCharacter = text[text.length - 1] || "";
  25359. states.isOnComposition = !isKorean(lastCharacter);
  25360. }
  25361. };
  25362. const handleMenuEnter = () => {
  25363. nextTick(() => scrollToOption(states.selected));
  25364. };
  25365. const handleFocus = (event2) => {
  25366. if (!states.softFocus) {
  25367. if (props.automaticDropdown || props.filterable) {
  25368. if (props.filterable && !states.visible) {
  25369. states.menuVisibleOnFocus = true;
  25370. }
  25371. states.visible = true;
  25372. }
  25373. ctx.emit("focus", event2);
  25374. } else {
  25375. states.softFocus = false;
  25376. }
  25377. };
  25378. const blur = () => {
  25379. var _a2, _b, _c;
  25380. states.visible = false;
  25381. (_a2 = reference.value) == null ? void 0 : _a2.blur();
  25382. (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
  25383. };
  25384. const handleBlur = (event2) => {
  25385. nextTick(() => {
  25386. if (states.isSilentBlur) {
  25387. states.isSilentBlur = false;
  25388. } else {
  25389. ctx.emit("blur", event2);
  25390. }
  25391. });
  25392. states.softFocus = false;
  25393. };
  25394. const handleClearClick = (event2) => {
  25395. deleteSelected(event2);
  25396. };
  25397. const handleClose = () => {
  25398. states.visible = false;
  25399. };
  25400. const handleKeydownEscape = (event2) => {
  25401. if (states.visible) {
  25402. event2.preventDefault();
  25403. event2.stopPropagation();
  25404. states.visible = false;
  25405. }
  25406. };
  25407. const toggleMenu = (e) => {
  25408. var _a2;
  25409. if (e && !states.mouseEnter) {
  25410. return;
  25411. }
  25412. if (!selectDisabled.value) {
  25413. if (states.menuVisibleOnFocus) {
  25414. states.menuVisibleOnFocus = false;
  25415. } else {
  25416. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  25417. states.visible = !states.visible;
  25418. }
  25419. }
  25420. if (states.visible) {
  25421. (_a2 = input.value || reference.value) == null ? void 0 : _a2.focus();
  25422. }
  25423. }
  25424. };
  25425. const selectOption = () => {
  25426. if (!states.visible) {
  25427. toggleMenu();
  25428. } else {
  25429. if (optionsArray.value[states.hoverIndex]) {
  25430. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  25431. }
  25432. }
  25433. };
  25434. const getValueKey = (item) => {
  25435. return isObject$5(item.value) ? get$2(item.value, props.valueKey) : item.value;
  25436. };
  25437. const optionsAllDisabled = computed$1(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  25438. const showTagList = computed$1(() => states.selected.slice(0, props.maxCollapseTags));
  25439. const collapseTagList = computed$1(() => states.selected.slice(props.maxCollapseTags));
  25440. const navigateOptions = (direction) => {
  25441. if (!states.visible) {
  25442. states.visible = true;
  25443. return;
  25444. }
  25445. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  25446. return;
  25447. if (states.isOnComposition)
  25448. return;
  25449. if (!optionsAllDisabled.value) {
  25450. if (direction === "next") {
  25451. states.hoverIndex++;
  25452. if (states.hoverIndex === states.options.size) {
  25453. states.hoverIndex = 0;
  25454. }
  25455. } else if (direction === "prev") {
  25456. states.hoverIndex--;
  25457. if (states.hoverIndex < 0) {
  25458. states.hoverIndex = states.options.size - 1;
  25459. }
  25460. }
  25461. const option = optionsArray.value[states.hoverIndex];
  25462. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  25463. navigateOptions(direction);
  25464. }
  25465. nextTick(() => scrollToOption(hoverOption.value));
  25466. }
  25467. };
  25468. const handleMouseEnter = () => {
  25469. states.mouseEnter = true;
  25470. };
  25471. const handleMouseLeave = () => {
  25472. states.mouseEnter = false;
  25473. };
  25474. return {
  25475. optionList,
  25476. optionsArray,
  25477. selectSize,
  25478. handleResize,
  25479. debouncedOnInputChange,
  25480. debouncedQueryChange,
  25481. deletePrevTag,
  25482. deleteTag,
  25483. deleteSelected,
  25484. handleOptionSelect,
  25485. scrollToOption,
  25486. readonly: readonly2,
  25487. resetInputHeight,
  25488. showClose,
  25489. iconComponent,
  25490. iconReverse,
  25491. showNewOption,
  25492. collapseTagSize,
  25493. setSelected,
  25494. managePlaceholder,
  25495. selectDisabled,
  25496. emptyText,
  25497. toggleLastOptionHitState,
  25498. resetInputState,
  25499. handleComposition,
  25500. onOptionCreate,
  25501. onOptionDestroy,
  25502. handleMenuEnter,
  25503. handleFocus,
  25504. blur,
  25505. handleBlur,
  25506. handleClearClick,
  25507. handleClose,
  25508. handleKeydownEscape,
  25509. toggleMenu,
  25510. selectOption,
  25511. getValueKey,
  25512. navigateOptions,
  25513. dropMenuVisible,
  25514. queryChange,
  25515. groupQueryChange,
  25516. showTagList,
  25517. collapseTagList,
  25518. reference,
  25519. input,
  25520. iOSInput,
  25521. tooltipRef,
  25522. tags,
  25523. selectWrapper,
  25524. scrollbar,
  25525. handleMouseEnter,
  25526. handleMouseLeave
  25527. };
  25528. };
  25529. var ElOptions = defineComponent({
  25530. name: "ElOptions",
  25531. emits: ["update-options"],
  25532. setup(_, { slots, emit }) {
  25533. let cachedOptions = [];
  25534. function isSameOptions(a, b) {
  25535. if (a.length !== b.length)
  25536. return false;
  25537. for (const [index2] of a.entries()) {
  25538. if (a[index2] != b[index2]) {
  25539. return false;
  25540. }
  25541. }
  25542. return true;
  25543. }
  25544. return () => {
  25545. var _a2, _b;
  25546. const children = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  25547. const filteredOptions = [];
  25548. function filterOptions(children2) {
  25549. if (!Array.isArray(children2))
  25550. return;
  25551. children2.forEach((item) => {
  25552. var _a22, _b2, _c, _d;
  25553. const name = (_a22 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a22.name;
  25554. if (name === "ElOptionGroup") {
  25555. 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);
  25556. } else if (name === "ElOption") {
  25557. filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
  25558. } else if (Array.isArray(item.children)) {
  25559. filterOptions(item.children);
  25560. }
  25561. });
  25562. }
  25563. if (children.length) {
  25564. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  25565. }
  25566. if (!isSameOptions(filteredOptions, cachedOptions)) {
  25567. cachedOptions = filteredOptions;
  25568. emit("update-options", filteredOptions);
  25569. }
  25570. return children;
  25571. };
  25572. }
  25573. });
  25574. const COMPONENT_NAME$1 = "ElSelect";
  25575. const _sfc_main$5 = defineComponent({
  25576. name: COMPONENT_NAME$1,
  25577. componentName: COMPONENT_NAME$1,
  25578. components: {
  25579. ElInput,
  25580. ElSelectMenu,
  25581. ElOption: Option,
  25582. ElOptions,
  25583. ElTag,
  25584. ElScrollbar,
  25585. ElTooltip,
  25586. ElIcon
  25587. },
  25588. directives: { ClickOutside },
  25589. props: {
  25590. name: String,
  25591. id: String,
  25592. modelValue: {
  25593. type: [Array, String, Number, Boolean, Object],
  25594. default: void 0
  25595. },
  25596. autocomplete: {
  25597. type: String,
  25598. default: "off"
  25599. },
  25600. automaticDropdown: Boolean,
  25601. size: {
  25602. type: String,
  25603. validator: isValidComponentSize
  25604. },
  25605. effect: {
  25606. type: String,
  25607. default: "light"
  25608. },
  25609. disabled: Boolean,
  25610. clearable: Boolean,
  25611. filterable: Boolean,
  25612. allowCreate: Boolean,
  25613. loading: Boolean,
  25614. popperClass: {
  25615. type: String,
  25616. default: ""
  25617. },
  25618. popperOptions: {
  25619. type: Object,
  25620. default: () => ({})
  25621. },
  25622. remote: Boolean,
  25623. loadingText: String,
  25624. noMatchText: String,
  25625. noDataText: String,
  25626. remoteMethod: Function,
  25627. filterMethod: Function,
  25628. multiple: Boolean,
  25629. multipleLimit: {
  25630. type: Number,
  25631. default: 0
  25632. },
  25633. placeholder: {
  25634. type: String
  25635. },
  25636. defaultFirstOption: Boolean,
  25637. reserveKeyword: {
  25638. type: Boolean,
  25639. default: true
  25640. },
  25641. valueKey: {
  25642. type: String,
  25643. default: "value"
  25644. },
  25645. collapseTags: Boolean,
  25646. collapseTagsTooltip: {
  25647. type: Boolean,
  25648. default: false
  25649. },
  25650. maxCollapseTags: {
  25651. type: Number,
  25652. default: 1
  25653. },
  25654. teleported: useTooltipContentProps.teleported,
  25655. persistent: {
  25656. type: Boolean,
  25657. default: true
  25658. },
  25659. clearIcon: {
  25660. type: iconPropType,
  25661. default: circle_close_default
  25662. },
  25663. fitInputWidth: {
  25664. type: Boolean,
  25665. default: false
  25666. },
  25667. suffixIcon: {
  25668. type: iconPropType,
  25669. default: arrow_down_default
  25670. },
  25671. tagType: { ...tagProps.type, default: "info" },
  25672. validateEvent: {
  25673. type: Boolean,
  25674. default: true
  25675. },
  25676. remoteShowSuffix: {
  25677. type: Boolean,
  25678. default: false
  25679. },
  25680. suffixTransition: {
  25681. type: Boolean,
  25682. default: true
  25683. },
  25684. placement: {
  25685. type: String,
  25686. values: Ee,
  25687. default: "bottom-start"
  25688. }
  25689. },
  25690. emits: [
  25691. UPDATE_MODEL_EVENT,
  25692. CHANGE_EVENT,
  25693. "remove-tag",
  25694. "clear",
  25695. "visible-change",
  25696. "focus",
  25697. "blur"
  25698. ],
  25699. setup(props, ctx) {
  25700. const nsSelect = useNamespace("select");
  25701. const nsInput = useNamespace("input");
  25702. const { t: t2 } = useLocale();
  25703. const states = useSelectStates(props);
  25704. const {
  25705. optionList,
  25706. optionsArray,
  25707. selectSize,
  25708. readonly: readonly2,
  25709. handleResize,
  25710. collapseTagSize,
  25711. debouncedOnInputChange,
  25712. debouncedQueryChange,
  25713. deletePrevTag,
  25714. deleteTag,
  25715. deleteSelected,
  25716. handleOptionSelect,
  25717. scrollToOption,
  25718. setSelected,
  25719. resetInputHeight,
  25720. managePlaceholder,
  25721. showClose,
  25722. selectDisabled,
  25723. iconComponent,
  25724. iconReverse,
  25725. showNewOption,
  25726. emptyText,
  25727. toggleLastOptionHitState,
  25728. resetInputState,
  25729. handleComposition,
  25730. onOptionCreate,
  25731. onOptionDestroy,
  25732. handleMenuEnter,
  25733. handleFocus,
  25734. blur,
  25735. handleBlur,
  25736. handleClearClick,
  25737. handleClose,
  25738. handleKeydownEscape,
  25739. toggleMenu,
  25740. selectOption,
  25741. getValueKey,
  25742. navigateOptions,
  25743. dropMenuVisible,
  25744. reference,
  25745. input,
  25746. iOSInput,
  25747. tooltipRef,
  25748. tags,
  25749. selectWrapper,
  25750. scrollbar,
  25751. queryChange,
  25752. groupQueryChange,
  25753. handleMouseEnter,
  25754. handleMouseLeave,
  25755. showTagList,
  25756. collapseTagList
  25757. } = useSelect(props, states, ctx);
  25758. const { focus } = useFocus(reference);
  25759. const {
  25760. inputWidth,
  25761. selected,
  25762. inputLength,
  25763. filteredOptionsCount,
  25764. visible,
  25765. softFocus,
  25766. selectedLabel,
  25767. hoverIndex,
  25768. query,
  25769. inputHovering,
  25770. currentPlaceholder,
  25771. menuVisibleOnFocus,
  25772. isOnComposition,
  25773. isSilentBlur,
  25774. options: options2,
  25775. cachedOptions,
  25776. optionsCount,
  25777. prefixWidth,
  25778. tagInMultiLine
  25779. } = toRefs(states);
  25780. const wrapperKls = computed$1(() => {
  25781. const classList = [nsSelect.b()];
  25782. const _selectSize = unref(selectSize);
  25783. if (_selectSize) {
  25784. classList.push(nsSelect.m(_selectSize));
  25785. }
  25786. if (props.disabled) {
  25787. classList.push(nsSelect.m("disabled"));
  25788. }
  25789. return classList;
  25790. });
  25791. const selectTagsStyle = computed$1(() => ({
  25792. maxWidth: `${unref(inputWidth) - 32}px`,
  25793. width: "100%"
  25794. }));
  25795. const tagTextStyle = computed$1(() => {
  25796. const maxWidth = unref(inputWidth) > 123 ? unref(inputWidth) - 123 : unref(inputWidth) - 75;
  25797. return { maxWidth: `${maxWidth}px` };
  25798. });
  25799. provide(selectKey, reactive({
  25800. props,
  25801. options: options2,
  25802. optionsArray,
  25803. cachedOptions,
  25804. optionsCount,
  25805. filteredOptionsCount,
  25806. hoverIndex,
  25807. handleOptionSelect,
  25808. onOptionCreate,
  25809. onOptionDestroy,
  25810. selectWrapper,
  25811. selected,
  25812. setSelected,
  25813. queryChange,
  25814. groupQueryChange
  25815. }));
  25816. onMounted(() => {
  25817. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t2("el.select.placeholder"));
  25818. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  25819. currentPlaceholder.value = "";
  25820. }
  25821. useResizeObserver(selectWrapper, handleResize);
  25822. if (props.remote && props.multiple) {
  25823. resetInputHeight();
  25824. }
  25825. nextTick(() => {
  25826. const refEl = reference.value && reference.value.$el;
  25827. if (!refEl)
  25828. return;
  25829. inputWidth.value = refEl.getBoundingClientRect().width;
  25830. if (ctx.slots.prefix) {
  25831. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  25832. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  25833. }
  25834. });
  25835. setSelected();
  25836. });
  25837. if (props.multiple && !Array.isArray(props.modelValue)) {
  25838. ctx.emit(UPDATE_MODEL_EVENT, []);
  25839. }
  25840. if (!props.multiple && Array.isArray(props.modelValue)) {
  25841. ctx.emit(UPDATE_MODEL_EVENT, "");
  25842. }
  25843. const popperPaneRef = computed$1(() => {
  25844. var _a2, _b;
  25845. return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  25846. });
  25847. const onOptionsRendered = (v) => {
  25848. optionList.value = v;
  25849. };
  25850. return {
  25851. isIOS,
  25852. onOptionsRendered,
  25853. tagInMultiLine,
  25854. prefixWidth,
  25855. selectSize,
  25856. readonly: readonly2,
  25857. handleResize,
  25858. collapseTagSize,
  25859. debouncedOnInputChange,
  25860. debouncedQueryChange,
  25861. deletePrevTag,
  25862. deleteTag,
  25863. deleteSelected,
  25864. handleOptionSelect,
  25865. scrollToOption,
  25866. inputWidth,
  25867. selected,
  25868. inputLength,
  25869. filteredOptionsCount,
  25870. visible,
  25871. softFocus,
  25872. selectedLabel,
  25873. hoverIndex,
  25874. query,
  25875. inputHovering,
  25876. currentPlaceholder,
  25877. menuVisibleOnFocus,
  25878. isOnComposition,
  25879. isSilentBlur,
  25880. options: options2,
  25881. resetInputHeight,
  25882. managePlaceholder,
  25883. showClose,
  25884. selectDisabled,
  25885. iconComponent,
  25886. iconReverse,
  25887. showNewOption,
  25888. emptyText,
  25889. toggleLastOptionHitState,
  25890. resetInputState,
  25891. handleComposition,
  25892. handleMenuEnter,
  25893. handleFocus,
  25894. blur,
  25895. handleBlur,
  25896. handleClearClick,
  25897. handleClose,
  25898. handleKeydownEscape,
  25899. toggleMenu,
  25900. selectOption,
  25901. getValueKey,
  25902. navigateOptions,
  25903. dropMenuVisible,
  25904. focus,
  25905. reference,
  25906. input,
  25907. iOSInput,
  25908. tooltipRef,
  25909. popperPaneRef,
  25910. tags,
  25911. selectWrapper,
  25912. scrollbar,
  25913. wrapperKls,
  25914. selectTagsStyle,
  25915. nsSelect,
  25916. tagTextStyle,
  25917. handleMouseEnter,
  25918. handleMouseLeave,
  25919. showTagList,
  25920. collapseTagList
  25921. };
  25922. }
  25923. });
  25924. const _hoisted_1$4 = ["disabled", "autocomplete"];
  25925. const _hoisted_2$4 = ["disabled"];
  25926. const _hoisted_3$4 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  25927. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  25928. const _component_el_tag = resolveComponent("el-tag");
  25929. const _component_el_tooltip = resolveComponent("el-tooltip");
  25930. const _component_el_icon = resolveComponent("el-icon");
  25931. const _component_el_input = resolveComponent("el-input");
  25932. const _component_el_option = resolveComponent("el-option");
  25933. const _component_el_options = resolveComponent("el-options");
  25934. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25935. const _component_el_select_menu = resolveComponent("el-select-menu");
  25936. const _directive_click_outside = resolveDirective("click-outside");
  25937. return withDirectives((openBlock(), createElementBlock("div", {
  25938. ref: "selectWrapper",
  25939. class: normalizeClass(_ctx.wrapperKls),
  25940. onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  25941. onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  25942. onClick: _cache[23] || (_cache[23] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  25943. }, [
  25944. createVNode(_component_el_tooltip, {
  25945. ref: "tooltipRef",
  25946. visible: _ctx.dropMenuVisible,
  25947. placement: _ctx.placement,
  25948. teleported: _ctx.teleported,
  25949. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  25950. "popper-options": _ctx.popperOptions,
  25951. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  25952. effect: _ctx.effect,
  25953. pure: "",
  25954. trigger: "click",
  25955. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  25956. "stop-popper-mouse-event": false,
  25957. "gpu-acceleration": false,
  25958. persistent: _ctx.persistent,
  25959. onShow: _ctx.handleMenuEnter
  25960. }, {
  25961. default: withCtx(() => [
  25962. createElementVNode("div", {
  25963. class: "select-trigger",
  25964. onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true),
  25965. onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false)
  25966. }, [
  25967. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  25968. key: 0,
  25969. ref: "tags",
  25970. class: normalizeClass([
  25971. _ctx.nsSelect.e("tags"),
  25972. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  25973. ]),
  25974. style: normalizeStyle(_ctx.selectTagsStyle)
  25975. }, [
  25976. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createBlock(Transition, {
  25977. key: 0,
  25978. onAfterLeave: _ctx.resetInputHeight
  25979. }, {
  25980. default: withCtx(() => [
  25981. createElementVNode("span", {
  25982. class: normalizeClass([
  25983. _ctx.nsSelect.b("tags-wrapper"),
  25984. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  25985. ])
  25986. }, [
  25987. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  25988. return openBlock(), createBlock(_component_el_tag, {
  25989. key: _ctx.getValueKey(item),
  25990. closable: !_ctx.selectDisabled && !item.isDisabled,
  25991. size: _ctx.collapseTagSize,
  25992. hit: item.hitState,
  25993. type: _ctx.tagType,
  25994. "disable-transitions": "",
  25995. onClose: ($event) => _ctx.deleteTag($event, item)
  25996. }, {
  25997. default: withCtx(() => [
  25998. createElementVNode("span", {
  25999. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26000. style: normalizeStyle(_ctx.tagTextStyle)
  26001. }, toDisplayString(item.currentLabel), 7)
  26002. ]),
  26003. _: 2
  26004. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  26005. }), 128)),
  26006. _ctx.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
  26007. key: 0,
  26008. closable: false,
  26009. size: _ctx.collapseTagSize,
  26010. type: _ctx.tagType,
  26011. "disable-transitions": ""
  26012. }, {
  26013. default: withCtx(() => [
  26014. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  26015. key: 0,
  26016. disabled: _ctx.dropMenuVisible,
  26017. "fallback-placements": ["bottom", "top", "right", "left"],
  26018. effect: _ctx.effect,
  26019. placement: "bottom",
  26020. teleported: _ctx.teleported
  26021. }, {
  26022. default: withCtx(() => [
  26023. createElementVNode("span", {
  26024. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  26025. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
  26026. ]),
  26027. content: withCtx(() => [
  26028. createElementVNode("div", {
  26029. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  26030. }, [
  26031. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  26032. return openBlock(), createElementBlock("div", {
  26033. key: _ctx.getValueKey(item),
  26034. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  26035. }, [
  26036. createVNode(_component_el_tag, {
  26037. class: "in-tooltip",
  26038. closable: !_ctx.selectDisabled && !item.isDisabled,
  26039. size: _ctx.collapseTagSize,
  26040. hit: item.hitState,
  26041. type: _ctx.tagType,
  26042. "disable-transitions": "",
  26043. style: { margin: "2px" },
  26044. onClose: ($event) => _ctx.deleteTag($event, item)
  26045. }, {
  26046. default: withCtx(() => [
  26047. createElementVNode("span", {
  26048. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26049. style: normalizeStyle({
  26050. maxWidth: _ctx.inputWidth - 75 + "px"
  26051. })
  26052. }, toDisplayString(item.currentLabel), 7)
  26053. ]),
  26054. _: 2
  26055. }, 1032, ["closable", "size", "hit", "type", "onClose"])
  26056. ], 2);
  26057. }), 128))
  26058. ], 2)
  26059. ]),
  26060. _: 1
  26061. }, 8, ["disabled", "effect", "teleported"])) : (openBlock(), createElementBlock("span", {
  26062. key: 1,
  26063. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  26064. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
  26065. ]),
  26066. _: 1
  26067. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  26068. ], 2)
  26069. ]),
  26070. _: 1
  26071. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  26072. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  26073. key: 1,
  26074. onAfterLeave: _ctx.resetInputHeight
  26075. }, {
  26076. default: withCtx(() => [
  26077. createElementVNode("span", {
  26078. class: normalizeClass([
  26079. _ctx.nsSelect.b("tags-wrapper"),
  26080. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  26081. ])
  26082. }, [
  26083. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  26084. return openBlock(), createBlock(_component_el_tag, {
  26085. key: _ctx.getValueKey(item),
  26086. closable: !_ctx.selectDisabled && !item.isDisabled,
  26087. size: _ctx.collapseTagSize,
  26088. hit: item.hitState,
  26089. type: _ctx.tagType,
  26090. "disable-transitions": "",
  26091. onClose: ($event) => _ctx.deleteTag($event, item)
  26092. }, {
  26093. default: withCtx(() => [
  26094. createElementVNode("span", {
  26095. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26096. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  26097. }, toDisplayString(item.currentLabel), 7)
  26098. ]),
  26099. _: 2
  26100. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  26101. }), 128))
  26102. ], 2)
  26103. ]),
  26104. _: 1
  26105. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  26106. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  26107. key: 2,
  26108. ref: "input",
  26109. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
  26110. type: "text",
  26111. class: normalizeClass([
  26112. _ctx.nsSelect.e("input"),
  26113. _ctx.nsSelect.is(_ctx.selectSize),
  26114. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  26115. ]),
  26116. disabled: _ctx.selectDisabled,
  26117. autocomplete: _ctx.autocomplete,
  26118. style: normalizeStyle({
  26119. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  26120. flexGrow: 1,
  26121. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  26122. maxWidth: `${_ctx.inputWidth - 42}px`
  26123. }),
  26124. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  26125. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  26126. onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  26127. onKeydown: [
  26128. _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  26129. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  26130. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  26131. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  26132. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  26133. _cache[9] || (_cache[9] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  26134. _cache[10] || (_cache[10] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26135. ],
  26136. onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26137. onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26138. onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26139. onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  26140. }, null, 46, _hoisted_1$4)), [
  26141. [vModelText, _ctx.query]
  26142. ]) : createCommentVNode("v-if", true)
  26143. ], 6)) : createCommentVNode("v-if", true),
  26144. createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),
  26145. _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (openBlock(), createElementBlock("input", {
  26146. key: 1,
  26147. ref: "iOSInput",
  26148. class: normalizeClass([
  26149. _ctx.nsSelect.e("input"),
  26150. _ctx.nsSelect.is(_ctx.selectSize),
  26151. _ctx.nsSelect.em("input", "iOS")
  26152. ]),
  26153. disabled: _ctx.selectDisabled,
  26154. type: "text"
  26155. }, null, 10, _hoisted_2$4)) : createCommentVNode("v-if", true),
  26156. createVNode(_component_el_input, {
  26157. id: _ctx.id,
  26158. ref: "reference",
  26159. modelValue: _ctx.selectedLabel,
  26160. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event),
  26161. type: "text",
  26162. placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
  26163. name: _ctx.name,
  26164. autocomplete: _ctx.autocomplete,
  26165. size: _ctx.selectSize,
  26166. disabled: _ctx.selectDisabled,
  26167. readonly: _ctx.readonly,
  26168. "validate-event": false,
  26169. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  26170. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  26171. onFocus: _ctx.handleFocus,
  26172. onBlur: _ctx.handleBlur,
  26173. onInput: _ctx.debouncedOnInputChange,
  26174. onPaste: _ctx.debouncedOnInputChange,
  26175. onCompositionstart: _ctx.handleComposition,
  26176. onCompositionupdate: _ctx.handleComposition,
  26177. onCompositionend: _ctx.handleComposition,
  26178. onKeydown: [
  26179. _cache[16] || (_cache[16] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  26180. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  26181. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  26182. withKeys(_ctx.handleKeydownEscape, ["esc"]),
  26183. _cache[18] || (_cache[18] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26184. ]
  26185. }, createSlots({
  26186. suffix: withCtx(() => [
  26187. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  26188. key: 0,
  26189. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  26190. }, {
  26191. default: withCtx(() => [
  26192. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  26193. ]),
  26194. _: 1
  26195. }, 8, ["class"])) : createCommentVNode("v-if", true),
  26196. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  26197. key: 1,
  26198. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  26199. onClick: _ctx.handleClearClick
  26200. }, {
  26201. default: withCtx(() => [
  26202. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  26203. ]),
  26204. _: 1
  26205. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  26206. ]),
  26207. _: 2
  26208. }, [
  26209. _ctx.$slots.prefix ? {
  26210. name: "prefix",
  26211. fn: withCtx(() => [
  26212. createElementVNode("div", _hoisted_3$4, [
  26213. renderSlot(_ctx.$slots, "prefix")
  26214. ])
  26215. ])
  26216. } : void 0
  26217. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  26218. ], 32)
  26219. ]),
  26220. content: withCtx(() => [
  26221. createVNode(_component_el_select_menu, null, {
  26222. default: withCtx(() => [
  26223. withDirectives(createVNode(_component_el_scrollbar, {
  26224. ref: "scrollbar",
  26225. tag: "ul",
  26226. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  26227. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  26228. class: normalizeClass([
  26229. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  26230. ])
  26231. }, {
  26232. default: withCtx(() => [
  26233. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  26234. key: 0,
  26235. value: _ctx.query,
  26236. created: true
  26237. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  26238. createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
  26239. default: withCtx(() => [
  26240. renderSlot(_ctx.$slots, "default")
  26241. ]),
  26242. _: 3
  26243. }, 8, ["onUpdateOptions"])
  26244. ]),
  26245. _: 3
  26246. }, 8, ["wrap-class", "view-class", "class"]), [
  26247. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  26248. ]),
  26249. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  26250. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  26251. key: 1,
  26252. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  26253. }, toDisplayString(_ctx.emptyText), 3))
  26254. ], 64)) : createCommentVNode("v-if", true)
  26255. ]),
  26256. _: 3
  26257. })
  26258. ]),
  26259. _: 3
  26260. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
  26261. ], 34)), [
  26262. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  26263. ]);
  26264. }
  26265. 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"]]);
  26266. const _sfc_main$4 = defineComponent({
  26267. name: "ElOptionGroup",
  26268. componentName: "ElOptionGroup",
  26269. props: {
  26270. label: String,
  26271. disabled: {
  26272. type: Boolean,
  26273. default: false
  26274. }
  26275. },
  26276. setup(props) {
  26277. const ns = useNamespace("select");
  26278. const visible = ref(true);
  26279. const instance = getCurrentInstance();
  26280. const children = ref([]);
  26281. provide(selectGroupKey, reactive({
  26282. ...toRefs(props)
  26283. }));
  26284. const select = inject(selectKey);
  26285. onMounted(() => {
  26286. children.value = flattedChildren(instance.subTree);
  26287. });
  26288. const flattedChildren = (node) => {
  26289. const children2 = [];
  26290. if (Array.isArray(node.children)) {
  26291. node.children.forEach((child) => {
  26292. var _a2;
  26293. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  26294. children2.push(child.component.proxy);
  26295. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  26296. children2.push(...flattedChildren(child));
  26297. }
  26298. });
  26299. }
  26300. return children2;
  26301. };
  26302. const { groupQueryChange } = toRaw$1(select);
  26303. watch(groupQueryChange, () => {
  26304. visible.value = children.value.some((option) => option.visible === true);
  26305. }, { flush: "post" });
  26306. return {
  26307. visible,
  26308. ns
  26309. };
  26310. }
  26311. });
  26312. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  26313. return withDirectives((openBlock(), createElementBlock("ul", {
  26314. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  26315. }, [
  26316. createElementVNode("li", {
  26317. class: normalizeClass(_ctx.ns.be("group", "title"))
  26318. }, toDisplayString(_ctx.label), 3),
  26319. createElementVNode("li", null, [
  26320. createElementVNode("ul", {
  26321. class: normalizeClass(_ctx.ns.b("group"))
  26322. }, [
  26323. renderSlot(_ctx.$slots, "default")
  26324. ], 2)
  26325. ])
  26326. ], 2)), [
  26327. [vShow, _ctx.visible]
  26328. ]);
  26329. }
  26330. 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"]]);
  26331. const ElSelect = withInstall(Select, {
  26332. Option,
  26333. OptionGroup
  26334. });
  26335. const ElOption = withNoopInstall(Option);
  26336. withNoopInstall(OptionGroup);
  26337. const switchProps = buildProps({
  26338. modelValue: {
  26339. type: [Boolean, String, Number],
  26340. default: false
  26341. },
  26342. value: {
  26343. type: [Boolean, String, Number],
  26344. default: false
  26345. },
  26346. disabled: {
  26347. type: Boolean,
  26348. default: false
  26349. },
  26350. width: {
  26351. type: [String, Number],
  26352. default: ""
  26353. },
  26354. inlinePrompt: {
  26355. type: Boolean,
  26356. default: false
  26357. },
  26358. activeIcon: {
  26359. type: iconPropType
  26360. },
  26361. inactiveIcon: {
  26362. type: iconPropType
  26363. },
  26364. activeText: {
  26365. type: String,
  26366. default: ""
  26367. },
  26368. inactiveText: {
  26369. type: String,
  26370. default: ""
  26371. },
  26372. activeColor: {
  26373. type: String,
  26374. default: ""
  26375. },
  26376. inactiveColor: {
  26377. type: String,
  26378. default: ""
  26379. },
  26380. borderColor: {
  26381. type: String,
  26382. default: ""
  26383. },
  26384. activeValue: {
  26385. type: [Boolean, String, Number],
  26386. default: true
  26387. },
  26388. inactiveValue: {
  26389. type: [Boolean, String, Number],
  26390. default: false
  26391. },
  26392. name: {
  26393. type: String,
  26394. default: ""
  26395. },
  26396. validateEvent: {
  26397. type: Boolean,
  26398. default: true
  26399. },
  26400. id: String,
  26401. loading: {
  26402. type: Boolean,
  26403. default: false
  26404. },
  26405. beforeChange: {
  26406. type: definePropType(Function)
  26407. },
  26408. size: {
  26409. type: String,
  26410. validator: isValidComponentSize
  26411. },
  26412. tabindex: {
  26413. type: [String, Number]
  26414. }
  26415. });
  26416. const switchEmits = {
  26417. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26418. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26419. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  26420. };
  26421. const _hoisted_1$3 = ["onClick"];
  26422. const _hoisted_2$3 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  26423. const _hoisted_3$3 = ["aria-hidden"];
  26424. const _hoisted_4$3 = ["aria-hidden"];
  26425. const _hoisted_5$3 = ["aria-hidden"];
  26426. const COMPONENT_NAME = "ElSwitch";
  26427. const __default__ = defineComponent({
  26428. name: COMPONENT_NAME
  26429. });
  26430. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  26431. ...__default__,
  26432. props: switchProps,
  26433. emits: switchEmits,
  26434. setup(__props, { expose, emit }) {
  26435. const props = __props;
  26436. const vm = getCurrentInstance();
  26437. const { formItem } = useFormItem();
  26438. const switchSize = useFormSize();
  26439. const ns = useNamespace("switch");
  26440. useDeprecated({
  26441. from: '"value"',
  26442. replacement: '"model-value" or "v-model"',
  26443. scope: COMPONENT_NAME,
  26444. version: "2.3.0",
  26445. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  26446. type: "Attribute"
  26447. }, computed$1(() => {
  26448. var _a2;
  26449. return !!((_a2 = vm.vnode.props) == null ? void 0 : _a2.value);
  26450. }));
  26451. const { inputId } = useFormItemInputId(props, {
  26452. formItemContext: formItem
  26453. });
  26454. const switchDisabled = useFormDisabled(computed$1(() => props.loading));
  26455. const isControlled = ref(props.modelValue !== false);
  26456. const input = ref();
  26457. const core = ref();
  26458. const switchKls = computed$1(() => [
  26459. ns.b(),
  26460. ns.m(switchSize.value),
  26461. ns.is("disabled", switchDisabled.value),
  26462. ns.is("checked", checked.value)
  26463. ]);
  26464. const coreStyle = computed$1(() => ({
  26465. width: addUnit(props.width)
  26466. }));
  26467. watch(() => props.modelValue, () => {
  26468. isControlled.value = true;
  26469. });
  26470. watch(() => props.value, () => {
  26471. isControlled.value = false;
  26472. });
  26473. const actualValue = computed$1(() => {
  26474. return isControlled.value ? props.modelValue : props.value;
  26475. });
  26476. const checked = computed$1(() => actualValue.value === props.activeValue);
  26477. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  26478. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  26479. emit(CHANGE_EVENT, props.inactiveValue);
  26480. emit(INPUT_EVENT, props.inactiveValue);
  26481. }
  26482. watch(checked, (val) => {
  26483. var _a2;
  26484. input.value.checked = val;
  26485. if (props.validateEvent) {
  26486. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  26487. }
  26488. });
  26489. const handleChange = () => {
  26490. const val = checked.value ? props.inactiveValue : props.activeValue;
  26491. emit(UPDATE_MODEL_EVENT, val);
  26492. emit(CHANGE_EVENT, val);
  26493. emit(INPUT_EVENT, val);
  26494. nextTick(() => {
  26495. input.value.checked = checked.value;
  26496. });
  26497. };
  26498. const switchValue = () => {
  26499. if (switchDisabled.value)
  26500. return;
  26501. const { beforeChange } = props;
  26502. if (!beforeChange) {
  26503. handleChange();
  26504. return;
  26505. }
  26506. const shouldChange = beforeChange();
  26507. const isPromiseOrBool = [
  26508. isPromise$2(shouldChange),
  26509. isBoolean(shouldChange)
  26510. ].includes(true);
  26511. if (!isPromiseOrBool) {
  26512. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  26513. }
  26514. if (isPromise$2(shouldChange)) {
  26515. shouldChange.then((result) => {
  26516. if (result) {
  26517. handleChange();
  26518. }
  26519. }).catch((e) => {
  26520. });
  26521. } else if (shouldChange) {
  26522. handleChange();
  26523. }
  26524. };
  26525. const styles = computed$1(() => {
  26526. return ns.cssVarBlock({
  26527. ...props.activeColor ? { "on-color": props.activeColor } : null,
  26528. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  26529. ...props.borderColor ? { "border-color": props.borderColor } : null
  26530. });
  26531. });
  26532. const focus = () => {
  26533. var _a2, _b;
  26534. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  26535. };
  26536. onMounted(() => {
  26537. input.value.checked = checked.value;
  26538. });
  26539. expose({
  26540. focus,
  26541. checked
  26542. });
  26543. return (_ctx, _cache) => {
  26544. return openBlock(), createElementBlock("div", {
  26545. class: normalizeClass(unref(switchKls)),
  26546. style: normalizeStyle(unref(styles)),
  26547. onClick: withModifiers(switchValue, ["prevent"])
  26548. }, [
  26549. createElementVNode("input", {
  26550. id: unref(inputId),
  26551. ref_key: "input",
  26552. ref: input,
  26553. class: normalizeClass(unref(ns).e("input")),
  26554. type: "checkbox",
  26555. role: "switch",
  26556. "aria-checked": unref(checked),
  26557. "aria-disabled": unref(switchDisabled),
  26558. name: _ctx.name,
  26559. "true-value": _ctx.activeValue,
  26560. "false-value": _ctx.inactiveValue,
  26561. disabled: unref(switchDisabled),
  26562. tabindex: _ctx.tabindex,
  26563. onChange: handleChange,
  26564. onKeydown: withKeys(switchValue, ["enter"])
  26565. }, null, 42, _hoisted_2$3),
  26566. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  26567. key: 0,
  26568. class: normalizeClass([
  26569. unref(ns).e("label"),
  26570. unref(ns).em("label", "left"),
  26571. unref(ns).is("active", !unref(checked))
  26572. ])
  26573. }, [
  26574. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26575. default: withCtx(() => [
  26576. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  26577. ]),
  26578. _: 1
  26579. })) : createCommentVNode("v-if", true),
  26580. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26581. key: 1,
  26582. "aria-hidden": unref(checked)
  26583. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$3)) : createCommentVNode("v-if", true)
  26584. ], 2)) : createCommentVNode("v-if", true),
  26585. createElementVNode("span", {
  26586. ref_key: "core",
  26587. ref: core,
  26588. class: normalizeClass(unref(ns).e("core")),
  26589. style: normalizeStyle(unref(coreStyle))
  26590. }, [
  26591. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  26592. key: 0,
  26593. class: normalizeClass(unref(ns).e("inner"))
  26594. }, [
  26595. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  26596. key: 0,
  26597. class: normalizeClass(unref(ns).is("icon"))
  26598. }, {
  26599. default: withCtx(() => [
  26600. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  26601. ]),
  26602. _: 1
  26603. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26604. key: 1,
  26605. class: normalizeClass(unref(ns).is("text")),
  26606. "aria-hidden": !unref(checked)
  26607. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$3)) : createCommentVNode("v-if", true)
  26608. ], 2)) : createCommentVNode("v-if", true),
  26609. createElementVNode("div", {
  26610. class: normalizeClass(unref(ns).e("action"))
  26611. }, [
  26612. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  26613. key: 0,
  26614. class: normalizeClass(unref(ns).is("loading"))
  26615. }, {
  26616. default: withCtx(() => [
  26617. createVNode(unref(loading_default))
  26618. ]),
  26619. _: 1
  26620. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26621. ], 2)
  26622. ], 6),
  26623. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  26624. key: 1,
  26625. class: normalizeClass([
  26626. unref(ns).e("label"),
  26627. unref(ns).em("label", "right"),
  26628. unref(ns).is("active", unref(checked))
  26629. ])
  26630. }, [
  26631. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26632. default: withCtx(() => [
  26633. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  26634. ]),
  26635. _: 1
  26636. })) : createCommentVNode("v-if", true),
  26637. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  26638. key: 1,
  26639. "aria-hidden": !unref(checked)
  26640. }, toDisplayString(_ctx.activeText), 9, _hoisted_5$3)) : createCommentVNode("v-if", true)
  26641. ], 2)) : createCommentVNode("v-if", true)
  26642. ], 14, _hoisted_1$3);
  26643. };
  26644. }
  26645. });
  26646. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  26647. const ElSwitch = withInstall(Switch);
  26648. /*! Element Plus v2.3.4 */
  26649. var zhCn = {
  26650. name: "zh-cn",
  26651. el: {
  26652. colorpicker: {
  26653. confirm: "\u786E\u5B9A",
  26654. clear: "\u6E05\u7A7A"
  26655. },
  26656. datepicker: {
  26657. now: "\u6B64\u523B",
  26658. today: "\u4ECA\u5929",
  26659. cancel: "\u53D6\u6D88",
  26660. clear: "\u6E05\u7A7A",
  26661. confirm: "\u786E\u5B9A",
  26662. selectDate: "\u9009\u62E9\u65E5\u671F",
  26663. selectTime: "\u9009\u62E9\u65F6\u95F4",
  26664. startDate: "\u5F00\u59CB\u65E5\u671F",
  26665. startTime: "\u5F00\u59CB\u65F6\u95F4",
  26666. endDate: "\u7ED3\u675F\u65E5\u671F",
  26667. endTime: "\u7ED3\u675F\u65F6\u95F4",
  26668. prevYear: "\u524D\u4E00\u5E74",
  26669. nextYear: "\u540E\u4E00\u5E74",
  26670. prevMonth: "\u4E0A\u4E2A\u6708",
  26671. nextMonth: "\u4E0B\u4E2A\u6708",
  26672. year: "\u5E74",
  26673. month1: "1 \u6708",
  26674. month2: "2 \u6708",
  26675. month3: "3 \u6708",
  26676. month4: "4 \u6708",
  26677. month5: "5 \u6708",
  26678. month6: "6 \u6708",
  26679. month7: "7 \u6708",
  26680. month8: "8 \u6708",
  26681. month9: "9 \u6708",
  26682. month10: "10 \u6708",
  26683. month11: "11 \u6708",
  26684. month12: "12 \u6708",
  26685. weeks: {
  26686. sun: "\u65E5",
  26687. mon: "\u4E00",
  26688. tue: "\u4E8C",
  26689. wed: "\u4E09",
  26690. thu: "\u56DB",
  26691. fri: "\u4E94",
  26692. sat: "\u516D"
  26693. },
  26694. months: {
  26695. jan: "\u4E00\u6708",
  26696. feb: "\u4E8C\u6708",
  26697. mar: "\u4E09\u6708",
  26698. apr: "\u56DB\u6708",
  26699. may: "\u4E94\u6708",
  26700. jun: "\u516D\u6708",
  26701. jul: "\u4E03\u6708",
  26702. aug: "\u516B\u6708",
  26703. sep: "\u4E5D\u6708",
  26704. oct: "\u5341\u6708",
  26705. nov: "\u5341\u4E00\u6708",
  26706. dec: "\u5341\u4E8C\u6708"
  26707. }
  26708. },
  26709. select: {
  26710. loading: "\u52A0\u8F7D\u4E2D",
  26711. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26712. noData: "\u65E0\u6570\u636E",
  26713. placeholder: "\u8BF7\u9009\u62E9"
  26714. },
  26715. cascader: {
  26716. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26717. loading: "\u52A0\u8F7D\u4E2D",
  26718. placeholder: "\u8BF7\u9009\u62E9",
  26719. noData: "\u6682\u65E0\u6570\u636E"
  26720. },
  26721. pagination: {
  26722. goto: "\u524D\u5F80",
  26723. pagesize: "\u6761/\u9875",
  26724. total: "\u5171 {total} \u6761",
  26725. pageClassifier: "\u9875",
  26726. page: "\u9875",
  26727. prev: "\u4E0A\u4E00\u9875",
  26728. next: "\u4E0B\u4E00\u9875",
  26729. currentPage: "\u7B2C {pager} \u9875",
  26730. prevPages: "\u5411\u524D {pager} \u9875",
  26731. nextPages: "\u5411\u540E {pager} \u9875",
  26732. 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"
  26733. },
  26734. messagebox: {
  26735. title: "\u63D0\u793A",
  26736. confirm: "\u786E\u5B9A",
  26737. cancel: "\u53D6\u6D88",
  26738. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  26739. },
  26740. upload: {
  26741. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  26742. delete: "\u5220\u9664",
  26743. preview: "\u67E5\u770B\u56FE\u7247",
  26744. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  26745. },
  26746. table: {
  26747. emptyText: "\u6682\u65E0\u6570\u636E",
  26748. confirmFilter: "\u7B5B\u9009",
  26749. resetFilter: "\u91CD\u7F6E",
  26750. clearFilter: "\u5168\u90E8",
  26751. sumText: "\u5408\u8BA1"
  26752. },
  26753. tree: {
  26754. emptyText: "\u6682\u65E0\u6570\u636E"
  26755. },
  26756. transfer: {
  26757. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26758. noData: "\u65E0\u6570\u636E",
  26759. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  26760. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  26761. noCheckedFormat: "\u5171 {total} \u9879",
  26762. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  26763. },
  26764. image: {
  26765. error: "\u52A0\u8F7D\u5931\u8D25"
  26766. },
  26767. pageHeader: {
  26768. title: "\u8FD4\u56DE"
  26769. },
  26770. popconfirm: {
  26771. confirmButtonText: "\u786E\u5B9A",
  26772. cancelButtonText: "\u53D6\u6D88"
  26773. }
  26774. }
  26775. };
  26776. /*! Element Plus v2.3.4 */
  26777. var en = {
  26778. name: "en",
  26779. el: {
  26780. colorpicker: {
  26781. confirm: "OK",
  26782. clear: "Clear",
  26783. defaultLabel: "color picker",
  26784. description: "current color is {color}. press enter to select a new color."
  26785. },
  26786. datepicker: {
  26787. now: "Now",
  26788. today: "Today",
  26789. cancel: "Cancel",
  26790. clear: "Clear",
  26791. confirm: "OK",
  26792. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  26793. monthTablePrompt: "Use the arrow keys and enter to select the month",
  26794. yearTablePrompt: "Use the arrow keys and enter to select the year",
  26795. selectedDate: "Selected date",
  26796. selectDate: "Select date",
  26797. selectTime: "Select time",
  26798. startDate: "Start Date",
  26799. startTime: "Start Time",
  26800. endDate: "End Date",
  26801. endTime: "End Time",
  26802. prevYear: "Previous Year",
  26803. nextYear: "Next Year",
  26804. prevMonth: "Previous Month",
  26805. nextMonth: "Next Month",
  26806. year: "",
  26807. month1: "January",
  26808. month2: "February",
  26809. month3: "March",
  26810. month4: "April",
  26811. month5: "May",
  26812. month6: "June",
  26813. month7: "July",
  26814. month8: "August",
  26815. month9: "September",
  26816. month10: "October",
  26817. month11: "November",
  26818. month12: "December",
  26819. week: "week",
  26820. weeks: {
  26821. sun: "Sun",
  26822. mon: "Mon",
  26823. tue: "Tue",
  26824. wed: "Wed",
  26825. thu: "Thu",
  26826. fri: "Fri",
  26827. sat: "Sat"
  26828. },
  26829. weeksFull: {
  26830. sun: "Sunday",
  26831. mon: "Monday",
  26832. tue: "Tuesday",
  26833. wed: "Wednesday",
  26834. thu: "Thursday",
  26835. fri: "Friday",
  26836. sat: "Saturday"
  26837. },
  26838. months: {
  26839. jan: "Jan",
  26840. feb: "Feb",
  26841. mar: "Mar",
  26842. apr: "Apr",
  26843. may: "May",
  26844. jun: "Jun",
  26845. jul: "Jul",
  26846. aug: "Aug",
  26847. sep: "Sep",
  26848. oct: "Oct",
  26849. nov: "Nov",
  26850. dec: "Dec"
  26851. }
  26852. },
  26853. inputNumber: {
  26854. decrease: "decrease number",
  26855. increase: "increase number"
  26856. },
  26857. select: {
  26858. loading: "Loading",
  26859. noMatch: "No matching data",
  26860. noData: "No data",
  26861. placeholder: "Select"
  26862. },
  26863. dropdown: {
  26864. toggleDropdown: "Toggle Dropdown"
  26865. },
  26866. cascader: {
  26867. noMatch: "No matching data",
  26868. loading: "Loading",
  26869. placeholder: "Select",
  26870. noData: "No data"
  26871. },
  26872. pagination: {
  26873. goto: "Go to",
  26874. pagesize: "/page",
  26875. total: "Total {total}",
  26876. pageClassifier: "",
  26877. page: "Page",
  26878. prev: "Go to previous page",
  26879. next: "Go to next page",
  26880. currentPage: "page {pager}",
  26881. prevPages: "Previous {pager} pages",
  26882. nextPages: "Next {pager} pages",
  26883. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  26884. },
  26885. dialog: {
  26886. close: "Close this dialog"
  26887. },
  26888. drawer: {
  26889. close: "Close this dialog"
  26890. },
  26891. messagebox: {
  26892. title: "Message",
  26893. confirm: "OK",
  26894. cancel: "Cancel",
  26895. error: "Illegal input",
  26896. close: "Close this dialog"
  26897. },
  26898. upload: {
  26899. deleteTip: "press delete to remove",
  26900. delete: "Delete",
  26901. preview: "Preview",
  26902. continue: "Continue"
  26903. },
  26904. slider: {
  26905. defaultLabel: "slider between {min} and {max}",
  26906. defaultRangeStartLabel: "pick start value",
  26907. defaultRangeEndLabel: "pick end value"
  26908. },
  26909. table: {
  26910. emptyText: "No Data",
  26911. confirmFilter: "Confirm",
  26912. resetFilter: "Reset",
  26913. clearFilter: "All",
  26914. sumText: "Sum"
  26915. },
  26916. tree: {
  26917. emptyText: "No Data"
  26918. },
  26919. transfer: {
  26920. noMatch: "No matching data",
  26921. noData: "No data",
  26922. titles: ["List 1", "List 2"],
  26923. filterPlaceholder: "Enter keyword",
  26924. noCheckedFormat: "{total} items",
  26925. hasCheckedFormat: "{checked}/{total} checked"
  26926. },
  26927. image: {
  26928. error: "FAILED"
  26929. },
  26930. pageHeader: {
  26931. title: "Back"
  26932. },
  26933. popconfirm: {
  26934. confirmButtonText: "Yes",
  26935. cancelButtonText: "No"
  26936. }
  26937. }
  26938. };
  26939. var jquery = { exports: {} };
  26940. /*!
  26941. * jQuery JavaScript Library v3.7.0
  26942. * https://jquery.com/
  26943. *
  26944. * Copyright OpenJS Foundation and other contributors
  26945. * Released under the MIT license
  26946. * https://jquery.org/license
  26947. *
  26948. * Date: 2023-05-11T18:29Z
  26949. */
  26950. (function(module2) {
  26951. (function(global2, factory3) {
  26952. {
  26953. module2.exports = global2.document ? factory3(global2, true) : function(w) {
  26954. if (!w.document) {
  26955. throw new Error("jQuery requires a window with a document");
  26956. }
  26957. return factory3(w);
  26958. };
  26959. }
  26960. })(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) {
  26961. var arr = [];
  26962. var getProto = Object.getPrototypeOf;
  26963. var slice = arr.slice;
  26964. var flat2 = arr.flat ? function(array) {
  26965. return arr.flat.call(array);
  26966. } : function(array) {
  26967. return arr.concat.apply([], array);
  26968. };
  26969. var push = arr.push;
  26970. var indexOf = arr.indexOf;
  26971. var class2type = {};
  26972. var toString2 = class2type.toString;
  26973. var hasOwn2 = class2type.hasOwnProperty;
  26974. var fnToString = hasOwn2.toString;
  26975. var ObjectFunctionString = fnToString.call(Object);
  26976. var support = {};
  26977. var isFunction2 = function isFunction3(obj) {
  26978. return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
  26979. };
  26980. var isWindow = function isWindow2(obj) {
  26981. return obj != null && obj === obj.window;
  26982. };
  26983. var document2 = window2.document;
  26984. var preservedScriptAttributes = {
  26985. type: true,
  26986. src: true,
  26987. nonce: true,
  26988. noModule: true
  26989. };
  26990. function DOMEval(code, node, doc) {
  26991. doc = doc || document2;
  26992. var i2, val, script = doc.createElement("script");
  26993. script.text = code;
  26994. if (node) {
  26995. for (i2 in preservedScriptAttributes) {
  26996. val = node[i2] || node.getAttribute && node.getAttribute(i2);
  26997. if (val) {
  26998. script.setAttribute(i2, val);
  26999. }
  27000. }
  27001. }
  27002. doc.head.appendChild(script).parentNode.removeChild(script);
  27003. }
  27004. function toType(obj) {
  27005. if (obj == null) {
  27006. return obj + "";
  27007. }
  27008. return typeof obj === "object" || typeof obj === "function" ? class2type[toString2.call(obj)] || "object" : typeof obj;
  27009. }
  27010. var version2 = "3.7.0", rhtmlSuffix = /HTML$/i, jQuery = function(selector, context) {
  27011. return new jQuery.fn.init(selector, context);
  27012. };
  27013. jQuery.fn = jQuery.prototype = {
  27014. jquery: version2,
  27015. constructor: jQuery,
  27016. length: 0,
  27017. toArray: function() {
  27018. return slice.call(this);
  27019. },
  27020. get: function(num) {
  27021. if (num == null) {
  27022. return slice.call(this);
  27023. }
  27024. return num < 0 ? this[num + this.length] : this[num];
  27025. },
  27026. pushStack: function(elems) {
  27027. var ret = jQuery.merge(this.constructor(), elems);
  27028. ret.prevObject = this;
  27029. return ret;
  27030. },
  27031. each: function(callback2) {
  27032. return jQuery.each(this, callback2);
  27033. },
  27034. map: function(callback2) {
  27035. return this.pushStack(jQuery.map(this, function(elem, i2) {
  27036. return callback2.call(elem, i2, elem);
  27037. }));
  27038. },
  27039. slice: function() {
  27040. return this.pushStack(slice.apply(this, arguments));
  27041. },
  27042. first: function() {
  27043. return this.eq(0);
  27044. },
  27045. last: function() {
  27046. return this.eq(-1);
  27047. },
  27048. even: function() {
  27049. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  27050. return (i2 + 1) % 2;
  27051. }));
  27052. },
  27053. odd: function() {
  27054. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  27055. return i2 % 2;
  27056. }));
  27057. },
  27058. eq: function(i2) {
  27059. var len = this.length, j = +i2 + (i2 < 0 ? len : 0);
  27060. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  27061. },
  27062. end: function() {
  27063. return this.prevObject || this.constructor();
  27064. },
  27065. push,
  27066. sort: arr.sort,
  27067. splice: arr.splice
  27068. };
  27069. jQuery.extend = jQuery.fn.extend = function() {
  27070. var options2, name, src, copy2, copyIsArray, clone, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false;
  27071. if (typeof target === "boolean") {
  27072. deep = target;
  27073. target = arguments[i2] || {};
  27074. i2++;
  27075. }
  27076. if (typeof target !== "object" && !isFunction2(target)) {
  27077. target = {};
  27078. }
  27079. if (i2 === length) {
  27080. target = this;
  27081. i2--;
  27082. }
  27083. for (; i2 < length; i2++) {
  27084. if ((options2 = arguments[i2]) != null) {
  27085. for (name in options2) {
  27086. copy2 = options2[name];
  27087. if (name === "__proto__" || target === copy2) {
  27088. continue;
  27089. }
  27090. if (deep && copy2 && (jQuery.isPlainObject(copy2) || (copyIsArray = Array.isArray(copy2)))) {
  27091. src = target[name];
  27092. if (copyIsArray && !Array.isArray(src)) {
  27093. clone = [];
  27094. } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
  27095. clone = {};
  27096. } else {
  27097. clone = src;
  27098. }
  27099. copyIsArray = false;
  27100. target[name] = jQuery.extend(deep, clone, copy2);
  27101. } else if (copy2 !== void 0) {
  27102. target[name] = copy2;
  27103. }
  27104. }
  27105. }
  27106. }
  27107. return target;
  27108. };
  27109. jQuery.extend({
  27110. expando: "jQuery" + (version2 + Math.random()).replace(/\D/g, ""),
  27111. isReady: true,
  27112. error: function(msg) {
  27113. throw new Error(msg);
  27114. },
  27115. noop: function() {
  27116. },
  27117. isPlainObject: function(obj) {
  27118. var proto, Ctor;
  27119. if (!obj || toString2.call(obj) !== "[object Object]") {
  27120. return false;
  27121. }
  27122. proto = getProto(obj);
  27123. if (!proto) {
  27124. return true;
  27125. }
  27126. Ctor = hasOwn2.call(proto, "constructor") && proto.constructor;
  27127. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  27128. },
  27129. isEmptyObject: function(obj) {
  27130. var name;
  27131. for (name in obj) {
  27132. return false;
  27133. }
  27134. return true;
  27135. },
  27136. globalEval: function(code, options2, doc) {
  27137. DOMEval(code, { nonce: options2 && options2.nonce }, doc);
  27138. },
  27139. each: function(obj, callback2) {
  27140. var length, i2 = 0;
  27141. if (isArrayLike2(obj)) {
  27142. length = obj.length;
  27143. for (; i2 < length; i2++) {
  27144. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27145. break;
  27146. }
  27147. }
  27148. } else {
  27149. for (i2 in obj) {
  27150. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27151. break;
  27152. }
  27153. }
  27154. }
  27155. return obj;
  27156. },
  27157. text: function(elem) {
  27158. var node, ret = "", i2 = 0, nodeType = elem.nodeType;
  27159. if (!nodeType) {
  27160. while (node = elem[i2++]) {
  27161. ret += jQuery.text(node);
  27162. }
  27163. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  27164. return elem.textContent;
  27165. } else if (nodeType === 3 || nodeType === 4) {
  27166. return elem.nodeValue;
  27167. }
  27168. return ret;
  27169. },
  27170. makeArray: function(arr2, results) {
  27171. var ret = results || [];
  27172. if (arr2 != null) {
  27173. if (isArrayLike2(Object(arr2))) {
  27174. jQuery.merge(
  27175. ret,
  27176. typeof arr2 === "string" ? [arr2] : arr2
  27177. );
  27178. } else {
  27179. push.call(ret, arr2);
  27180. }
  27181. }
  27182. return ret;
  27183. },
  27184. inArray: function(elem, arr2, i2) {
  27185. return arr2 == null ? -1 : indexOf.call(arr2, elem, i2);
  27186. },
  27187. isXMLDoc: function(elem) {
  27188. var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
  27189. return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
  27190. },
  27191. merge: function(first, second) {
  27192. var len = +second.length, j = 0, i2 = first.length;
  27193. for (; j < len; j++) {
  27194. first[i2++] = second[j];
  27195. }
  27196. first.length = i2;
  27197. return first;
  27198. },
  27199. grep: function(elems, callback2, invert) {
  27200. var callbackInverse, matches = [], i2 = 0, length = elems.length, callbackExpect = !invert;
  27201. for (; i2 < length; i2++) {
  27202. callbackInverse = !callback2(elems[i2], i2);
  27203. if (callbackInverse !== callbackExpect) {
  27204. matches.push(elems[i2]);
  27205. }
  27206. }
  27207. return matches;
  27208. },
  27209. map: function(elems, callback2, arg) {
  27210. var length, value, i2 = 0, ret = [];
  27211. if (isArrayLike2(elems)) {
  27212. length = elems.length;
  27213. for (; i2 < length; i2++) {
  27214. value = callback2(elems[i2], i2, arg);
  27215. if (value != null) {
  27216. ret.push(value);
  27217. }
  27218. }
  27219. } else {
  27220. for (i2 in elems) {
  27221. value = callback2(elems[i2], i2, arg);
  27222. if (value != null) {
  27223. ret.push(value);
  27224. }
  27225. }
  27226. }
  27227. return flat2(ret);
  27228. },
  27229. guid: 1,
  27230. support
  27231. });
  27232. if (typeof Symbol === "function") {
  27233. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  27234. }
  27235. jQuery.each(
  27236. "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
  27237. function(_i, name) {
  27238. class2type["[object " + name + "]"] = name.toLowerCase();
  27239. }
  27240. );
  27241. function isArrayLike2(obj) {
  27242. var length = !!obj && "length" in obj && obj.length, type2 = toType(obj);
  27243. if (isFunction2(obj) || isWindow(obj)) {
  27244. return false;
  27245. }
  27246. return type2 === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  27247. }
  27248. function nodeName(elem, name) {
  27249. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  27250. }
  27251. var pop = arr.pop;
  27252. var sort = arr.sort;
  27253. var splice2 = arr.splice;
  27254. var whitespace = "[\\x20\\t\\r\\n\\f]";
  27255. var rtrimCSS = new RegExp(
  27256. "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
  27257. "g"
  27258. );
  27259. jQuery.contains = function(a, b) {
  27260. var bup = b && b.parentNode;
  27261. return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  27262. };
  27263. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  27264. function fcssescape(ch, asCodePoint) {
  27265. if (asCodePoint) {
  27266. if (ch === "\0") {
  27267. return "\uFFFD";
  27268. }
  27269. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  27270. }
  27271. return "\\" + ch;
  27272. }
  27273. jQuery.escapeSelector = function(sel) {
  27274. return (sel + "").replace(rcssescape, fcssescape);
  27275. };
  27276. var preferredDoc = document2, pushNative = push;
  27277. (function() {
  27278. 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) {
  27279. if (a === b) {
  27280. hasDuplicate = true;
  27281. }
  27282. return 0;
  27283. }, 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 = {
  27284. ID: new RegExp("^#(" + identifier + ")"),
  27285. CLASS: new RegExp("^\\.(" + identifier + ")"),
  27286. TAG: new RegExp("^(" + identifier + "|[*])"),
  27287. ATTR: new RegExp("^" + attributes),
  27288. PSEUDO: new RegExp("^" + pseudos),
  27289. CHILD: new RegExp(
  27290. "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
  27291. "i"
  27292. ),
  27293. bool: new RegExp("^(?:" + booleans + ")$", "i"),
  27294. needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  27295. }, 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) {
  27296. var high = "0x" + escape2.slice(1) - 65536;
  27297. if (nonHex) {
  27298. return nonHex;
  27299. }
  27300. return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
  27301. }, unloadHandler = function() {
  27302. setDocument();
  27303. }, inDisabledFieldset = addCombinator(
  27304. function(elem) {
  27305. return elem.disabled === true && nodeName(elem, "fieldset");
  27306. },
  27307. { dir: "parentNode", next: "legend" }
  27308. );
  27309. function safeActiveElement() {
  27310. try {
  27311. return document3.activeElement;
  27312. } catch (err) {
  27313. }
  27314. }
  27315. try {
  27316. push2.apply(
  27317. arr = slice.call(preferredDoc.childNodes),
  27318. preferredDoc.childNodes
  27319. );
  27320. arr[preferredDoc.childNodes.length].nodeType;
  27321. } catch (e) {
  27322. push2 = {
  27323. apply: function(target, els) {
  27324. pushNative.apply(target, slice.call(els));
  27325. },
  27326. call: function(target) {
  27327. pushNative.apply(target, slice.call(arguments, 1));
  27328. }
  27329. };
  27330. }
  27331. function find2(selector, context, results, seed) {
  27332. var m, i3, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
  27333. results = results || [];
  27334. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  27335. return results;
  27336. }
  27337. if (!seed) {
  27338. setDocument(context);
  27339. context = context || document3;
  27340. if (documentIsHTML) {
  27341. if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) {
  27342. if (m = match[1]) {
  27343. if (nodeType === 9) {
  27344. if (elem = context.getElementById(m)) {
  27345. if (elem.id === m) {
  27346. push2.call(results, elem);
  27347. return results;
  27348. }
  27349. } else {
  27350. return results;
  27351. }
  27352. } else {
  27353. if (newContext && (elem = newContext.getElementById(m)) && find2.contains(context, elem) && elem.id === m) {
  27354. push2.call(results, elem);
  27355. return results;
  27356. }
  27357. }
  27358. } else if (match[2]) {
  27359. push2.apply(results, context.getElementsByTagName(selector));
  27360. return results;
  27361. } else if ((m = match[3]) && context.getElementsByClassName) {
  27362. push2.apply(results, context.getElementsByClassName(m));
  27363. return results;
  27364. }
  27365. }
  27366. if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  27367. newSelector = selector;
  27368. newContext = context;
  27369. if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
  27370. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  27371. if (newContext != context || !support.scope) {
  27372. if (nid = context.getAttribute("id")) {
  27373. nid = jQuery.escapeSelector(nid);
  27374. } else {
  27375. context.setAttribute("id", nid = expando);
  27376. }
  27377. }
  27378. groups = tokenize(selector);
  27379. i3 = groups.length;
  27380. while (i3--) {
  27381. groups[i3] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i3]);
  27382. }
  27383. newSelector = groups.join(",");
  27384. }
  27385. try {
  27386. push2.apply(
  27387. results,
  27388. newContext.querySelectorAll(newSelector)
  27389. );
  27390. return results;
  27391. } catch (qsaError) {
  27392. nonnativeSelectorCache(selector, true);
  27393. } finally {
  27394. if (nid === expando) {
  27395. context.removeAttribute("id");
  27396. }
  27397. }
  27398. }
  27399. }
  27400. }
  27401. return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
  27402. }
  27403. function createCache() {
  27404. var keys3 = [];
  27405. function cache(key, value) {
  27406. if (keys3.push(key + " ") > Expr.cacheLength) {
  27407. delete cache[keys3.shift()];
  27408. }
  27409. return cache[key + " "] = value;
  27410. }
  27411. return cache;
  27412. }
  27413. function markFunction(fn2) {
  27414. fn2[expando] = true;
  27415. return fn2;
  27416. }
  27417. function assert(fn2) {
  27418. var el = document3.createElement("fieldset");
  27419. try {
  27420. return !!fn2(el);
  27421. } catch (e) {
  27422. return false;
  27423. } finally {
  27424. if (el.parentNode) {
  27425. el.parentNode.removeChild(el);
  27426. }
  27427. el = null;
  27428. }
  27429. }
  27430. function createInputPseudo(type2) {
  27431. return function(elem) {
  27432. return nodeName(elem, "input") && elem.type === type2;
  27433. };
  27434. }
  27435. function createButtonPseudo(type2) {
  27436. return function(elem) {
  27437. return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type2;
  27438. };
  27439. }
  27440. function createDisabledPseudo(disabled) {
  27441. return function(elem) {
  27442. if ("form" in elem) {
  27443. if (elem.parentNode && elem.disabled === false) {
  27444. if ("label" in elem) {
  27445. if ("label" in elem.parentNode) {
  27446. return elem.parentNode.disabled === disabled;
  27447. } else {
  27448. return elem.disabled === disabled;
  27449. }
  27450. }
  27451. return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
  27452. }
  27453. return elem.disabled === disabled;
  27454. } else if ("label" in elem) {
  27455. return elem.disabled === disabled;
  27456. }
  27457. return false;
  27458. };
  27459. }
  27460. function createPositionalPseudo(fn2) {
  27461. return markFunction(function(argument) {
  27462. argument = +argument;
  27463. return markFunction(function(seed, matches2) {
  27464. var j, matchIndexes = fn2([], seed.length, argument), i3 = matchIndexes.length;
  27465. while (i3--) {
  27466. if (seed[j = matchIndexes[i3]]) {
  27467. seed[j] = !(matches2[j] = seed[j]);
  27468. }
  27469. }
  27470. });
  27471. });
  27472. }
  27473. function testContext(context) {
  27474. return context && typeof context.getElementsByTagName !== "undefined" && context;
  27475. }
  27476. function setDocument(node) {
  27477. var subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
  27478. if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) {
  27479. return document3;
  27480. }
  27481. document3 = doc;
  27482. documentElement2 = document3.documentElement;
  27483. documentIsHTML = !jQuery.isXMLDoc(document3);
  27484. matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector;
  27485. if (preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) {
  27486. subWindow.addEventListener("unload", unloadHandler);
  27487. }
  27488. support.getById = assert(function(el) {
  27489. documentElement2.appendChild(el).id = jQuery.expando;
  27490. return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length;
  27491. });
  27492. support.disconnectedMatch = assert(function(el) {
  27493. return matches.call(el, "*");
  27494. });
  27495. support.scope = assert(function() {
  27496. return document3.querySelectorAll(":scope");
  27497. });
  27498. support.cssHas = assert(function() {
  27499. try {
  27500. document3.querySelector(":has(*,:jqfake)");
  27501. return false;
  27502. } catch (e) {
  27503. return true;
  27504. }
  27505. });
  27506. if (support.getById) {
  27507. Expr.filter.ID = function(id) {
  27508. var attrId = id.replace(runescape, funescape);
  27509. return function(elem) {
  27510. return elem.getAttribute("id") === attrId;
  27511. };
  27512. };
  27513. Expr.find.ID = function(id, context) {
  27514. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27515. var elem = context.getElementById(id);
  27516. return elem ? [elem] : [];
  27517. }
  27518. };
  27519. } else {
  27520. Expr.filter.ID = function(id) {
  27521. var attrId = id.replace(runescape, funescape);
  27522. return function(elem) {
  27523. var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  27524. return node2 && node2.value === attrId;
  27525. };
  27526. };
  27527. Expr.find.ID = function(id, context) {
  27528. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27529. var node2, i3, elems, elem = context.getElementById(id);
  27530. if (elem) {
  27531. node2 = elem.getAttributeNode("id");
  27532. if (node2 && node2.value === id) {
  27533. return [elem];
  27534. }
  27535. elems = context.getElementsByName(id);
  27536. i3 = 0;
  27537. while (elem = elems[i3++]) {
  27538. node2 = elem.getAttributeNode("id");
  27539. if (node2 && node2.value === id) {
  27540. return [elem];
  27541. }
  27542. }
  27543. }
  27544. return [];
  27545. }
  27546. };
  27547. }
  27548. Expr.find.TAG = function(tag, context) {
  27549. if (typeof context.getElementsByTagName !== "undefined") {
  27550. return context.getElementsByTagName(tag);
  27551. } else {
  27552. return context.querySelectorAll(tag);
  27553. }
  27554. };
  27555. Expr.find.CLASS = function(className, context) {
  27556. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  27557. return context.getElementsByClassName(className);
  27558. }
  27559. };
  27560. rbuggyQSA = [];
  27561. assert(function(el) {
  27562. var input;
  27563. documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a><select id='" + expando + "-\r\\' disabled='disabled'><option selected=''></option></select>";
  27564. if (!el.querySelectorAll("[selected]").length) {
  27565. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  27566. }
  27567. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  27568. rbuggyQSA.push("~=");
  27569. }
  27570. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  27571. rbuggyQSA.push(".#.+[+~]");
  27572. }
  27573. if (!el.querySelectorAll(":checked").length) {
  27574. rbuggyQSA.push(":checked");
  27575. }
  27576. input = document3.createElement("input");
  27577. input.setAttribute("type", "hidden");
  27578. el.appendChild(input).setAttribute("name", "D");
  27579. documentElement2.appendChild(el).disabled = true;
  27580. if (el.querySelectorAll(":disabled").length !== 2) {
  27581. rbuggyQSA.push(":enabled", ":disabled");
  27582. }
  27583. input = document3.createElement("input");
  27584. input.setAttribute("name", "");
  27585. el.appendChild(input);
  27586. if (!el.querySelectorAll("[name='']").length) {
  27587. rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`);
  27588. }
  27589. });
  27590. if (!support.cssHas) {
  27591. rbuggyQSA.push(":has");
  27592. }
  27593. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  27594. sortOrder = function(a, b) {
  27595. if (a === b) {
  27596. hasDuplicate = true;
  27597. return 0;
  27598. }
  27599. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  27600. if (compare) {
  27601. return compare;
  27602. }
  27603. compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
  27604. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  27605. if (a === document3 || a.ownerDocument == preferredDoc && find2.contains(preferredDoc, a)) {
  27606. return -1;
  27607. }
  27608. if (b === document3 || b.ownerDocument == preferredDoc && find2.contains(preferredDoc, b)) {
  27609. return 1;
  27610. }
  27611. return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
  27612. }
  27613. return compare & 4 ? -1 : 1;
  27614. };
  27615. return document3;
  27616. }
  27617. find2.matches = function(expr, elements) {
  27618. return find2(expr, null, null, elements);
  27619. };
  27620. find2.matchesSelector = function(elem, expr) {
  27621. setDocument(elem);
  27622. if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  27623. try {
  27624. var ret = matches.call(elem, expr);
  27625. if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
  27626. return ret;
  27627. }
  27628. } catch (e) {
  27629. nonnativeSelectorCache(expr, true);
  27630. }
  27631. }
  27632. return find2(expr, document3, null, [elem]).length > 0;
  27633. };
  27634. find2.contains = function(context, elem) {
  27635. if ((context.ownerDocument || context) != document3) {
  27636. setDocument(context);
  27637. }
  27638. return jQuery.contains(context, elem);
  27639. };
  27640. find2.attr = function(elem, name) {
  27641. if ((elem.ownerDocument || elem) != document3) {
  27642. setDocument(elem);
  27643. }
  27644. var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn2.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : void 0;
  27645. if (val !== void 0) {
  27646. return val;
  27647. }
  27648. return elem.getAttribute(name);
  27649. };
  27650. find2.error = function(msg) {
  27651. throw new Error("Syntax error, unrecognized expression: " + msg);
  27652. };
  27653. jQuery.uniqueSort = function(results) {
  27654. var elem, duplicates = [], j = 0, i3 = 0;
  27655. hasDuplicate = !support.sortStable;
  27656. sortInput = !support.sortStable && slice.call(results, 0);
  27657. sort.call(results, sortOrder);
  27658. if (hasDuplicate) {
  27659. while (elem = results[i3++]) {
  27660. if (elem === results[i3]) {
  27661. j = duplicates.push(i3);
  27662. }
  27663. }
  27664. while (j--) {
  27665. splice2.call(results, duplicates[j], 1);
  27666. }
  27667. }
  27668. sortInput = null;
  27669. return results;
  27670. };
  27671. jQuery.fn.uniqueSort = function() {
  27672. return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
  27673. };
  27674. Expr = jQuery.expr = {
  27675. cacheLength: 50,
  27676. createPseudo: markFunction,
  27677. match: matchExpr,
  27678. attrHandle: {},
  27679. find: {},
  27680. relative: {
  27681. ">": { dir: "parentNode", first: true },
  27682. " ": { dir: "parentNode" },
  27683. "+": { dir: "previousSibling", first: true },
  27684. "~": { dir: "previousSibling" }
  27685. },
  27686. preFilter: {
  27687. ATTR: function(match) {
  27688. match[1] = match[1].replace(runescape, funescape);
  27689. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  27690. if (match[2] === "~=") {
  27691. match[3] = " " + match[3] + " ";
  27692. }
  27693. return match.slice(0, 4);
  27694. },
  27695. CHILD: function(match) {
  27696. match[1] = match[1].toLowerCase();
  27697. if (match[1].slice(0, 3) === "nth") {
  27698. if (!match[3]) {
  27699. find2.error(match[0]);
  27700. }
  27701. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  27702. match[5] = +(match[7] + match[8] || match[3] === "odd");
  27703. } else if (match[3]) {
  27704. find2.error(match[0]);
  27705. }
  27706. return match;
  27707. },
  27708. PSEUDO: function(match) {
  27709. var excess, unquoted = !match[6] && match[2];
  27710. if (matchExpr.CHILD.test(match[0])) {
  27711. return null;
  27712. }
  27713. if (match[3]) {
  27714. match[2] = match[4] || match[5] || "";
  27715. } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  27716. match[0] = match[0].slice(0, excess);
  27717. match[2] = unquoted.slice(0, excess);
  27718. }
  27719. return match.slice(0, 3);
  27720. }
  27721. },
  27722. filter: {
  27723. TAG: function(nodeNameSelector) {
  27724. var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  27725. return nodeNameSelector === "*" ? function() {
  27726. return true;
  27727. } : function(elem) {
  27728. return nodeName(elem, expectedNodeName);
  27729. };
  27730. },
  27731. CLASS: function(className) {
  27732. var pattern = classCache[className + " "];
  27733. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
  27734. return pattern.test(
  27735. typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
  27736. );
  27737. });
  27738. },
  27739. ATTR: function(name, operator, check) {
  27740. return function(elem) {
  27741. var result = find2.attr(elem, name);
  27742. if (result == null) {
  27743. return operator === "!=";
  27744. }
  27745. if (!operator) {
  27746. return true;
  27747. }
  27748. result += "";
  27749. if (operator === "=") {
  27750. return result === check;
  27751. }
  27752. if (operator === "!=") {
  27753. return result !== check;
  27754. }
  27755. if (operator === "^=") {
  27756. return check && result.indexOf(check) === 0;
  27757. }
  27758. if (operator === "*=") {
  27759. return check && result.indexOf(check) > -1;
  27760. }
  27761. if (operator === "$=") {
  27762. return check && result.slice(-check.length) === check;
  27763. }
  27764. if (operator === "~=") {
  27765. return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
  27766. }
  27767. if (operator === "|=") {
  27768. return result === check || result.slice(0, check.length + 1) === check + "-";
  27769. }
  27770. return false;
  27771. };
  27772. },
  27773. CHILD: function(type2, what, _argument, first, last) {
  27774. var simple = type2.slice(0, 3) !== "nth", forward = type2.slice(-4) !== "last", ofType = what === "of-type";
  27775. return first === 1 && last === 0 ? function(elem) {
  27776. return !!elem.parentNode;
  27777. } : function(elem, _context, xml) {
  27778. var cache, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
  27779. if (parent) {
  27780. if (simple) {
  27781. while (dir2) {
  27782. node = elem;
  27783. while (node = node[dir2]) {
  27784. if (ofType ? nodeName(node, name) : node.nodeType === 1) {
  27785. return false;
  27786. }
  27787. }
  27788. start2 = dir2 = type2 === "only" && !start2 && "nextSibling";
  27789. }
  27790. return true;
  27791. }
  27792. start2 = [forward ? parent.firstChild : parent.lastChild];
  27793. if (forward && useCache) {
  27794. outerCache = parent[expando] || (parent[expando] = {});
  27795. cache = outerCache[type2] || [];
  27796. nodeIndex = cache[0] === dirruns && cache[1];
  27797. diff = nodeIndex && cache[2];
  27798. node = nodeIndex && parent.childNodes[nodeIndex];
  27799. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27800. if (node.nodeType === 1 && ++diff && node === elem) {
  27801. outerCache[type2] = [dirruns, nodeIndex, diff];
  27802. break;
  27803. }
  27804. }
  27805. } else {
  27806. if (useCache) {
  27807. outerCache = elem[expando] || (elem[expando] = {});
  27808. cache = outerCache[type2] || [];
  27809. nodeIndex = cache[0] === dirruns && cache[1];
  27810. diff = nodeIndex;
  27811. }
  27812. if (diff === false) {
  27813. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27814. if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
  27815. if (useCache) {
  27816. outerCache = node[expando] || (node[expando] = {});
  27817. outerCache[type2] = [dirruns, diff];
  27818. }
  27819. if (node === elem) {
  27820. break;
  27821. }
  27822. }
  27823. }
  27824. }
  27825. }
  27826. diff -= last;
  27827. return diff === first || diff % first === 0 && diff / first >= 0;
  27828. }
  27829. };
  27830. },
  27831. PSEUDO: function(pseudo, argument) {
  27832. var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find2.error("unsupported pseudo: " + pseudo);
  27833. if (fn2[expando]) {
  27834. return fn2(argument);
  27835. }
  27836. if (fn2.length > 1) {
  27837. args = [pseudo, pseudo, "", argument];
  27838. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) {
  27839. var idx, matched = fn2(seed, argument), i3 = matched.length;
  27840. while (i3--) {
  27841. idx = indexOf.call(seed, matched[i3]);
  27842. seed[idx] = !(matches2[idx] = matched[i3]);
  27843. }
  27844. }) : function(elem) {
  27845. return fn2(elem, 0, args);
  27846. };
  27847. }
  27848. return fn2;
  27849. }
  27850. },
  27851. pseudos: {
  27852. not: markFunction(function(selector) {
  27853. var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
  27854. return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) {
  27855. var elem, unmatched = matcher(seed, null, xml, []), i3 = seed.length;
  27856. while (i3--) {
  27857. if (elem = unmatched[i3]) {
  27858. seed[i3] = !(matches2[i3] = elem);
  27859. }
  27860. }
  27861. }) : function(elem, _context, xml) {
  27862. input[0] = elem;
  27863. matcher(input, null, xml, results);
  27864. input[0] = null;
  27865. return !results.pop();
  27866. };
  27867. }),
  27868. has: markFunction(function(selector) {
  27869. return function(elem) {
  27870. return find2(selector, elem).length > 0;
  27871. };
  27872. }),
  27873. contains: markFunction(function(text) {
  27874. text = text.replace(runescape, funescape);
  27875. return function(elem) {
  27876. return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
  27877. };
  27878. }),
  27879. lang: markFunction(function(lang) {
  27880. if (!ridentifier.test(lang || "")) {
  27881. find2.error("unsupported lang: " + lang);
  27882. }
  27883. lang = lang.replace(runescape, funescape).toLowerCase();
  27884. return function(elem) {
  27885. var elemLang;
  27886. do {
  27887. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  27888. elemLang = elemLang.toLowerCase();
  27889. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  27890. }
  27891. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  27892. return false;
  27893. };
  27894. }),
  27895. target: function(elem) {
  27896. var hash = window2.location && window2.location.hash;
  27897. return hash && hash.slice(1) === elem.id;
  27898. },
  27899. root: function(elem) {
  27900. return elem === documentElement2;
  27901. },
  27902. focus: function(elem) {
  27903. return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
  27904. },
  27905. enabled: createDisabledPseudo(false),
  27906. disabled: createDisabledPseudo(true),
  27907. checked: function(elem) {
  27908. return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
  27909. },
  27910. selected: function(elem) {
  27911. if (elem.parentNode) {
  27912. elem.parentNode.selectedIndex;
  27913. }
  27914. return elem.selected === true;
  27915. },
  27916. empty: function(elem) {
  27917. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  27918. if (elem.nodeType < 6) {
  27919. return false;
  27920. }
  27921. }
  27922. return true;
  27923. },
  27924. parent: function(elem) {
  27925. return !Expr.pseudos.empty(elem);
  27926. },
  27927. header: function(elem) {
  27928. return rheader.test(elem.nodeName);
  27929. },
  27930. input: function(elem) {
  27931. return rinputs.test(elem.nodeName);
  27932. },
  27933. button: function(elem) {
  27934. return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
  27935. },
  27936. text: function(elem) {
  27937. var attr;
  27938. return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  27939. },
  27940. first: createPositionalPseudo(function() {
  27941. return [0];
  27942. }),
  27943. last: createPositionalPseudo(function(_matchIndexes, length) {
  27944. return [length - 1];
  27945. }),
  27946. eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
  27947. return [argument < 0 ? argument + length : argument];
  27948. }),
  27949. even: createPositionalPseudo(function(matchIndexes, length) {
  27950. var i3 = 0;
  27951. for (; i3 < length; i3 += 2) {
  27952. matchIndexes.push(i3);
  27953. }
  27954. return matchIndexes;
  27955. }),
  27956. odd: createPositionalPseudo(function(matchIndexes, length) {
  27957. var i3 = 1;
  27958. for (; i3 < length; i3 += 2) {
  27959. matchIndexes.push(i3);
  27960. }
  27961. return matchIndexes;
  27962. }),
  27963. lt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27964. var i3;
  27965. if (argument < 0) {
  27966. i3 = argument + length;
  27967. } else if (argument > length) {
  27968. i3 = length;
  27969. } else {
  27970. i3 = argument;
  27971. }
  27972. for (; --i3 >= 0; ) {
  27973. matchIndexes.push(i3);
  27974. }
  27975. return matchIndexes;
  27976. }),
  27977. gt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27978. var i3 = argument < 0 ? argument + length : argument;
  27979. for (; ++i3 < length; ) {
  27980. matchIndexes.push(i3);
  27981. }
  27982. return matchIndexes;
  27983. })
  27984. }
  27985. };
  27986. Expr.pseudos.nth = Expr.pseudos.eq;
  27987. for (i2 in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  27988. Expr.pseudos[i2] = createInputPseudo(i2);
  27989. }
  27990. for (i2 in { submit: true, reset: true }) {
  27991. Expr.pseudos[i2] = createButtonPseudo(i2);
  27992. }
  27993. function setFilters() {
  27994. }
  27995. setFilters.prototype = Expr.filters = Expr.pseudos;
  27996. Expr.setFilters = new setFilters();
  27997. function tokenize(selector, parseOnly) {
  27998. var matched, match, tokens, type2, soFar, groups, preFilters, cached = tokenCache[selector + " "];
  27999. if (cached) {
  28000. return parseOnly ? 0 : cached.slice(0);
  28001. }
  28002. soFar = selector;
  28003. groups = [];
  28004. preFilters = Expr.preFilter;
  28005. while (soFar) {
  28006. if (!matched || (match = rcomma.exec(soFar))) {
  28007. if (match) {
  28008. soFar = soFar.slice(match[0].length) || soFar;
  28009. }
  28010. groups.push(tokens = []);
  28011. }
  28012. matched = false;
  28013. if (match = rleadingCombinator.exec(soFar)) {
  28014. matched = match.shift();
  28015. tokens.push({
  28016. value: matched,
  28017. type: match[0].replace(rtrimCSS, " ")
  28018. });
  28019. soFar = soFar.slice(matched.length);
  28020. }
  28021. for (type2 in Expr.filter) {
  28022. if ((match = matchExpr[type2].exec(soFar)) && (!preFilters[type2] || (match = preFilters[type2](match)))) {
  28023. matched = match.shift();
  28024. tokens.push({
  28025. value: matched,
  28026. type: type2,
  28027. matches: match
  28028. });
  28029. soFar = soFar.slice(matched.length);
  28030. }
  28031. }
  28032. if (!matched) {
  28033. break;
  28034. }
  28035. }
  28036. if (parseOnly) {
  28037. return soFar.length;
  28038. }
  28039. return soFar ? find2.error(selector) : tokenCache(selector, groups).slice(0);
  28040. }
  28041. function toSelector(tokens) {
  28042. var i3 = 0, len = tokens.length, selector = "";
  28043. for (; i3 < len; i3++) {
  28044. selector += tokens[i3].value;
  28045. }
  28046. return selector;
  28047. }
  28048. function addCombinator(matcher, combinator, base2) {
  28049. var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base2 && key === "parentNode", doneName = done++;
  28050. return combinator.first ? function(elem, context, xml) {
  28051. while (elem = elem[dir2]) {
  28052. if (elem.nodeType === 1 || checkNonElements) {
  28053. return matcher(elem, context, xml);
  28054. }
  28055. }
  28056. return false;
  28057. } : function(elem, context, xml) {
  28058. var oldCache, outerCache, newCache = [dirruns, doneName];
  28059. if (xml) {
  28060. while (elem = elem[dir2]) {
  28061. if (elem.nodeType === 1 || checkNonElements) {
  28062. if (matcher(elem, context, xml)) {
  28063. return true;
  28064. }
  28065. }
  28066. }
  28067. } else {
  28068. while (elem = elem[dir2]) {
  28069. if (elem.nodeType === 1 || checkNonElements) {
  28070. outerCache = elem[expando] || (elem[expando] = {});
  28071. if (skip && nodeName(elem, skip)) {
  28072. elem = elem[dir2] || elem;
  28073. } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  28074. return newCache[2] = oldCache[2];
  28075. } else {
  28076. outerCache[key] = newCache;
  28077. if (newCache[2] = matcher(elem, context, xml)) {
  28078. return true;
  28079. }
  28080. }
  28081. }
  28082. }
  28083. }
  28084. return false;
  28085. };
  28086. }
  28087. function elementMatcher(matchers2) {
  28088. return matchers2.length > 1 ? function(elem, context, xml) {
  28089. var i3 = matchers2.length;
  28090. while (i3--) {
  28091. if (!matchers2[i3](elem, context, xml)) {
  28092. return false;
  28093. }
  28094. }
  28095. return true;
  28096. } : matchers2[0];
  28097. }
  28098. function multipleContexts(selector, contexts, results) {
  28099. var i3 = 0, len = contexts.length;
  28100. for (; i3 < len; i3++) {
  28101. find2(selector, contexts[i3], results);
  28102. }
  28103. return results;
  28104. }
  28105. function condense(unmatched, map, filter, context, xml) {
  28106. var elem, newUnmatched = [], i3 = 0, len = unmatched.length, mapped = map != null;
  28107. for (; i3 < len; i3++) {
  28108. if (elem = unmatched[i3]) {
  28109. if (!filter || filter(elem, context, xml)) {
  28110. newUnmatched.push(elem);
  28111. if (mapped) {
  28112. map.push(i3);
  28113. }
  28114. }
  28115. }
  28116. }
  28117. return newUnmatched;
  28118. }
  28119. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  28120. if (postFilter && !postFilter[expando]) {
  28121. postFilter = setMatcher(postFilter);
  28122. }
  28123. if (postFinder && !postFinder[expando]) {
  28124. postFinder = setMatcher(postFinder, postSelector);
  28125. }
  28126. return markFunction(function(seed, results, context, xml) {
  28127. var temp, i3, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
  28128. selector || "*",
  28129. context.nodeType ? [context] : context,
  28130. []
  28131. ), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
  28132. if (matcher) {
  28133. matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results;
  28134. matcher(matcherIn, matcherOut, context, xml);
  28135. } else {
  28136. matcherOut = matcherIn;
  28137. }
  28138. if (postFilter) {
  28139. temp = condense(matcherOut, postMap);
  28140. postFilter(temp, [], context, xml);
  28141. i3 = temp.length;
  28142. while (i3--) {
  28143. if (elem = temp[i3]) {
  28144. matcherOut[postMap[i3]] = !(matcherIn[postMap[i3]] = elem);
  28145. }
  28146. }
  28147. }
  28148. if (seed) {
  28149. if (postFinder || preFilter) {
  28150. if (postFinder) {
  28151. temp = [];
  28152. i3 = matcherOut.length;
  28153. while (i3--) {
  28154. if (elem = matcherOut[i3]) {
  28155. temp.push(matcherIn[i3] = elem);
  28156. }
  28157. }
  28158. postFinder(null, matcherOut = [], temp, xml);
  28159. }
  28160. i3 = matcherOut.length;
  28161. while (i3--) {
  28162. if ((elem = matcherOut[i3]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i3]) > -1) {
  28163. seed[temp] = !(results[temp] = elem);
  28164. }
  28165. }
  28166. }
  28167. } else {
  28168. matcherOut = condense(
  28169. matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
  28170. );
  28171. if (postFinder) {
  28172. postFinder(null, results, matcherOut, xml);
  28173. } else {
  28174. push2.apply(results, matcherOut);
  28175. }
  28176. }
  28177. });
  28178. }
  28179. function matcherFromTokens(tokens) {
  28180. 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) {
  28181. return elem === checkContext;
  28182. }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
  28183. return indexOf.call(checkContext, elem) > -1;
  28184. }, implicitRelative, true), matchers2 = [function(elem, context, xml) {
  28185. var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  28186. checkContext = null;
  28187. return ret;
  28188. }];
  28189. for (; i3 < len; i3++) {
  28190. if (matcher = Expr.relative[tokens[i3].type]) {
  28191. matchers2 = [addCombinator(elementMatcher(matchers2), matcher)];
  28192. } else {
  28193. matcher = Expr.filter[tokens[i3].type].apply(null, tokens[i3].matches);
  28194. if (matcher[expando]) {
  28195. j = ++i3;
  28196. for (; j < len; j++) {
  28197. if (Expr.relative[tokens[j].type]) {
  28198. break;
  28199. }
  28200. }
  28201. return setMatcher(
  28202. i3 > 1 && elementMatcher(matchers2),
  28203. i3 > 1 && toSelector(
  28204. tokens.slice(0, i3 - 1).concat({ value: tokens[i3 - 2].type === " " ? "*" : "" })
  28205. ).replace(rtrimCSS, "$1"),
  28206. matcher,
  28207. i3 < j && matcherFromTokens(tokens.slice(i3, j)),
  28208. j < len && matcherFromTokens(tokens = tokens.slice(j)),
  28209. j < len && toSelector(tokens)
  28210. );
  28211. }
  28212. matchers2.push(matcher);
  28213. }
  28214. }
  28215. return elementMatcher(matchers2);
  28216. }
  28217. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  28218. var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
  28219. 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;
  28220. if (outermost) {
  28221. outermostContext = context == document3 || context || outermost;
  28222. }
  28223. for (; i3 !== len && (elem = elems[i3]) != null; i3++) {
  28224. if (byElement && elem) {
  28225. j = 0;
  28226. if (!context && elem.ownerDocument != document3) {
  28227. setDocument(elem);
  28228. xml = !documentIsHTML;
  28229. }
  28230. while (matcher = elementMatchers[j++]) {
  28231. if (matcher(elem, context || document3, xml)) {
  28232. push2.call(results, elem);
  28233. break;
  28234. }
  28235. }
  28236. if (outermost) {
  28237. dirruns = dirrunsUnique;
  28238. }
  28239. }
  28240. if (bySet) {
  28241. if (elem = !matcher && elem) {
  28242. matchedCount--;
  28243. }
  28244. if (seed) {
  28245. unmatched.push(elem);
  28246. }
  28247. }
  28248. }
  28249. matchedCount += i3;
  28250. if (bySet && i3 !== matchedCount) {
  28251. j = 0;
  28252. while (matcher = setMatchers[j++]) {
  28253. matcher(unmatched, setMatched, context, xml);
  28254. }
  28255. if (seed) {
  28256. if (matchedCount > 0) {
  28257. while (i3--) {
  28258. if (!(unmatched[i3] || setMatched[i3])) {
  28259. setMatched[i3] = pop.call(results);
  28260. }
  28261. }
  28262. }
  28263. setMatched = condense(setMatched);
  28264. }
  28265. push2.apply(results, setMatched);
  28266. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  28267. jQuery.uniqueSort(results);
  28268. }
  28269. }
  28270. if (outermost) {
  28271. dirruns = dirrunsUnique;
  28272. outermostContext = contextBackup;
  28273. }
  28274. return unmatched;
  28275. };
  28276. return bySet ? markFunction(superMatcher) : superMatcher;
  28277. }
  28278. function compile(selector, match) {
  28279. var i3, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
  28280. if (!cached) {
  28281. if (!match) {
  28282. match = tokenize(selector);
  28283. }
  28284. i3 = match.length;
  28285. while (i3--) {
  28286. cached = matcherFromTokens(match[i3]);
  28287. if (cached[expando]) {
  28288. setMatchers.push(cached);
  28289. } else {
  28290. elementMatchers.push(cached);
  28291. }
  28292. }
  28293. cached = compilerCache(
  28294. selector,
  28295. matcherFromGroupMatchers(elementMatchers, setMatchers)
  28296. );
  28297. cached.selector = selector;
  28298. }
  28299. return cached;
  28300. }
  28301. function select(selector, context, results, seed) {
  28302. var i3, tokens, token, type2, find3, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
  28303. results = results || [];
  28304. if (match.length === 1) {
  28305. tokens = match[0] = match[0].slice(0);
  28306. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  28307. context = (Expr.find.ID(
  28308. token.matches[0].replace(runescape, funescape),
  28309. context
  28310. ) || [])[0];
  28311. if (!context) {
  28312. return results;
  28313. } else if (compiled) {
  28314. context = context.parentNode;
  28315. }
  28316. selector = selector.slice(tokens.shift().value.length);
  28317. }
  28318. i3 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
  28319. while (i3--) {
  28320. token = tokens[i3];
  28321. if (Expr.relative[type2 = token.type]) {
  28322. break;
  28323. }
  28324. if (find3 = Expr.find[type2]) {
  28325. if (seed = find3(
  28326. token.matches[0].replace(runescape, funescape),
  28327. rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
  28328. )) {
  28329. tokens.splice(i3, 1);
  28330. selector = seed.length && toSelector(tokens);
  28331. if (!selector) {
  28332. push2.apply(results, seed);
  28333. return results;
  28334. }
  28335. break;
  28336. }
  28337. }
  28338. }
  28339. }
  28340. (compiled || compile(selector, match))(
  28341. seed,
  28342. context,
  28343. !documentIsHTML,
  28344. results,
  28345. !context || rsibling.test(selector) && testContext(context.parentNode) || context
  28346. );
  28347. return results;
  28348. }
  28349. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  28350. setDocument();
  28351. support.sortDetached = assert(function(el) {
  28352. return el.compareDocumentPosition(document3.createElement("fieldset")) & 1;
  28353. });
  28354. jQuery.find = find2;
  28355. jQuery.expr[":"] = jQuery.expr.pseudos;
  28356. jQuery.unique = jQuery.uniqueSort;
  28357. find2.compile = compile;
  28358. find2.select = select;
  28359. find2.setDocument = setDocument;
  28360. find2.escape = jQuery.escapeSelector;
  28361. find2.getText = jQuery.text;
  28362. find2.isXML = jQuery.isXMLDoc;
  28363. find2.selectors = jQuery.expr;
  28364. find2.support = jQuery.support;
  28365. find2.uniqueSort = jQuery.uniqueSort;
  28366. })();
  28367. var dir = function(elem, dir2, until) {
  28368. var matched = [], truncate = until !== void 0;
  28369. while ((elem = elem[dir2]) && elem.nodeType !== 9) {
  28370. if (elem.nodeType === 1) {
  28371. if (truncate && jQuery(elem).is(until)) {
  28372. break;
  28373. }
  28374. matched.push(elem);
  28375. }
  28376. }
  28377. return matched;
  28378. };
  28379. var siblings = function(n, elem) {
  28380. var matched = [];
  28381. for (; n; n = n.nextSibling) {
  28382. if (n.nodeType === 1 && n !== elem) {
  28383. matched.push(n);
  28384. }
  28385. }
  28386. return matched;
  28387. };
  28388. var rneedsContext = jQuery.expr.match.needsContext;
  28389. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  28390. function winnow(elements, qualifier, not) {
  28391. if (isFunction2(qualifier)) {
  28392. return jQuery.grep(elements, function(elem, i2) {
  28393. return !!qualifier.call(elem, i2, elem) !== not;
  28394. });
  28395. }
  28396. if (qualifier.nodeType) {
  28397. return jQuery.grep(elements, function(elem) {
  28398. return elem === qualifier !== not;
  28399. });
  28400. }
  28401. if (typeof qualifier !== "string") {
  28402. return jQuery.grep(elements, function(elem) {
  28403. return indexOf.call(qualifier, elem) > -1 !== not;
  28404. });
  28405. }
  28406. return jQuery.filter(qualifier, elements, not);
  28407. }
  28408. jQuery.filter = function(expr, elems, not) {
  28409. var elem = elems[0];
  28410. if (not) {
  28411. expr = ":not(" + expr + ")";
  28412. }
  28413. if (elems.length === 1 && elem.nodeType === 1) {
  28414. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  28415. }
  28416. return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) {
  28417. return elem2.nodeType === 1;
  28418. }));
  28419. };
  28420. jQuery.fn.extend({
  28421. find: function(selector) {
  28422. var i2, ret, len = this.length, self2 = this;
  28423. if (typeof selector !== "string") {
  28424. return this.pushStack(jQuery(selector).filter(function() {
  28425. for (i2 = 0; i2 < len; i2++) {
  28426. if (jQuery.contains(self2[i2], this)) {
  28427. return true;
  28428. }
  28429. }
  28430. }));
  28431. }
  28432. ret = this.pushStack([]);
  28433. for (i2 = 0; i2 < len; i2++) {
  28434. jQuery.find(selector, self2[i2], ret);
  28435. }
  28436. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  28437. },
  28438. filter: function(selector) {
  28439. return this.pushStack(winnow(this, selector || [], false));
  28440. },
  28441. not: function(selector) {
  28442. return this.pushStack(winnow(this, selector || [], true));
  28443. },
  28444. is: function(selector) {
  28445. return !!winnow(
  28446. this,
  28447. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [],
  28448. false
  28449. ).length;
  28450. }
  28451. });
  28452. var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root2) {
  28453. var match, elem;
  28454. if (!selector) {
  28455. return this;
  28456. }
  28457. root2 = root2 || rootjQuery;
  28458. if (typeof selector === "string") {
  28459. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  28460. match = [null, selector, null];
  28461. } else {
  28462. match = rquickExpr.exec(selector);
  28463. }
  28464. if (match && (match[1] || !context)) {
  28465. if (match[1]) {
  28466. context = context instanceof jQuery ? context[0] : context;
  28467. jQuery.merge(this, jQuery.parseHTML(
  28468. match[1],
  28469. context && context.nodeType ? context.ownerDocument || context : document2,
  28470. true
  28471. ));
  28472. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  28473. for (match in context) {
  28474. if (isFunction2(this[match])) {
  28475. this[match](context[match]);
  28476. } else {
  28477. this.attr(match, context[match]);
  28478. }
  28479. }
  28480. }
  28481. return this;
  28482. } else {
  28483. elem = document2.getElementById(match[2]);
  28484. if (elem) {
  28485. this[0] = elem;
  28486. this.length = 1;
  28487. }
  28488. return this;
  28489. }
  28490. } else if (!context || context.jquery) {
  28491. return (context || root2).find(selector);
  28492. } else {
  28493. return this.constructor(context).find(selector);
  28494. }
  28495. } else if (selector.nodeType) {
  28496. this[0] = selector;
  28497. this.length = 1;
  28498. return this;
  28499. } else if (isFunction2(selector)) {
  28500. return root2.ready !== void 0 ? root2.ready(selector) : selector(jQuery);
  28501. }
  28502. return jQuery.makeArray(selector, this);
  28503. };
  28504. init.prototype = jQuery.fn;
  28505. rootjQuery = jQuery(document2);
  28506. var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
  28507. children: true,
  28508. contents: true,
  28509. next: true,
  28510. prev: true
  28511. };
  28512. jQuery.fn.extend({
  28513. has: function(target) {
  28514. var targets = jQuery(target, this), l = targets.length;
  28515. return this.filter(function() {
  28516. var i2 = 0;
  28517. for (; i2 < l; i2++) {
  28518. if (jQuery.contains(this, targets[i2])) {
  28519. return true;
  28520. }
  28521. }
  28522. });
  28523. },
  28524. closest: function(selectors, context) {
  28525. var cur, i2 = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors);
  28526. if (!rneedsContext.test(selectors)) {
  28527. for (; i2 < l; i2++) {
  28528. for (cur = this[i2]; cur && cur !== context; cur = cur.parentNode) {
  28529. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  28530. matched.push(cur);
  28531. break;
  28532. }
  28533. }
  28534. }
  28535. }
  28536. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  28537. },
  28538. index: function(elem) {
  28539. if (!elem) {
  28540. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  28541. }
  28542. if (typeof elem === "string") {
  28543. return indexOf.call(jQuery(elem), this[0]);
  28544. }
  28545. return indexOf.call(
  28546. this,
  28547. elem.jquery ? elem[0] : elem
  28548. );
  28549. },
  28550. add: function(selector, context) {
  28551. return this.pushStack(
  28552. jQuery.uniqueSort(
  28553. jQuery.merge(this.get(), jQuery(selector, context))
  28554. )
  28555. );
  28556. },
  28557. addBack: function(selector) {
  28558. return this.add(
  28559. selector == null ? this.prevObject : this.prevObject.filter(selector)
  28560. );
  28561. }
  28562. });
  28563. function sibling(cur, dir2) {
  28564. while ((cur = cur[dir2]) && cur.nodeType !== 1) {
  28565. }
  28566. return cur;
  28567. }
  28568. jQuery.each({
  28569. parent: function(elem) {
  28570. var parent = elem.parentNode;
  28571. return parent && parent.nodeType !== 11 ? parent : null;
  28572. },
  28573. parents: function(elem) {
  28574. return dir(elem, "parentNode");
  28575. },
  28576. parentsUntil: function(elem, _i, until) {
  28577. return dir(elem, "parentNode", until);
  28578. },
  28579. next: function(elem) {
  28580. return sibling(elem, "nextSibling");
  28581. },
  28582. prev: function(elem) {
  28583. return sibling(elem, "previousSibling");
  28584. },
  28585. nextAll: function(elem) {
  28586. return dir(elem, "nextSibling");
  28587. },
  28588. prevAll: function(elem) {
  28589. return dir(elem, "previousSibling");
  28590. },
  28591. nextUntil: function(elem, _i, until) {
  28592. return dir(elem, "nextSibling", until);
  28593. },
  28594. prevUntil: function(elem, _i, until) {
  28595. return dir(elem, "previousSibling", until);
  28596. },
  28597. siblings: function(elem) {
  28598. return siblings((elem.parentNode || {}).firstChild, elem);
  28599. },
  28600. children: function(elem) {
  28601. return siblings(elem.firstChild);
  28602. },
  28603. contents: function(elem) {
  28604. if (elem.contentDocument != null && getProto(elem.contentDocument)) {
  28605. return elem.contentDocument;
  28606. }
  28607. if (nodeName(elem, "template")) {
  28608. elem = elem.content || elem;
  28609. }
  28610. return jQuery.merge([], elem.childNodes);
  28611. }
  28612. }, function(name, fn2) {
  28613. jQuery.fn[name] = function(until, selector) {
  28614. var matched = jQuery.map(this, fn2, until);
  28615. if (name.slice(-5) !== "Until") {
  28616. selector = until;
  28617. }
  28618. if (selector && typeof selector === "string") {
  28619. matched = jQuery.filter(selector, matched);
  28620. }
  28621. if (this.length > 1) {
  28622. if (!guaranteedUnique[name]) {
  28623. jQuery.uniqueSort(matched);
  28624. }
  28625. if (rparentsprev.test(name)) {
  28626. matched.reverse();
  28627. }
  28628. }
  28629. return this.pushStack(matched);
  28630. };
  28631. });
  28632. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  28633. function createOptions(options2) {
  28634. var object = {};
  28635. jQuery.each(options2.match(rnothtmlwhite) || [], function(_, flag) {
  28636. object[flag] = true;
  28637. });
  28638. return object;
  28639. }
  28640. jQuery.Callbacks = function(options2) {
  28641. options2 = typeof options2 === "string" ? createOptions(options2) : jQuery.extend({}, options2);
  28642. var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
  28643. locked = locked || options2.once;
  28644. fired = firing = true;
  28645. for (; queue.length; firingIndex = -1) {
  28646. memory = queue.shift();
  28647. while (++firingIndex < list.length) {
  28648. if (list[firingIndex].apply(memory[0], memory[1]) === false && options2.stopOnFalse) {
  28649. firingIndex = list.length;
  28650. memory = false;
  28651. }
  28652. }
  28653. }
  28654. if (!options2.memory) {
  28655. memory = false;
  28656. }
  28657. firing = false;
  28658. if (locked) {
  28659. if (memory) {
  28660. list = [];
  28661. } else {
  28662. list = "";
  28663. }
  28664. }
  28665. }, self2 = {
  28666. add: function() {
  28667. if (list) {
  28668. if (memory && !firing) {
  28669. firingIndex = list.length - 1;
  28670. queue.push(memory);
  28671. }
  28672. (function add(args) {
  28673. jQuery.each(args, function(_, arg) {
  28674. if (isFunction2(arg)) {
  28675. if (!options2.unique || !self2.has(arg)) {
  28676. list.push(arg);
  28677. }
  28678. } else if (arg && arg.length && toType(arg) !== "string") {
  28679. add(arg);
  28680. }
  28681. });
  28682. })(arguments);
  28683. if (memory && !firing) {
  28684. fire();
  28685. }
  28686. }
  28687. return this;
  28688. },
  28689. remove: function() {
  28690. jQuery.each(arguments, function(_, arg) {
  28691. var index2;
  28692. while ((index2 = jQuery.inArray(arg, list, index2)) > -1) {
  28693. list.splice(index2, 1);
  28694. if (index2 <= firingIndex) {
  28695. firingIndex--;
  28696. }
  28697. }
  28698. });
  28699. return this;
  28700. },
  28701. has: function(fn2) {
  28702. return fn2 ? jQuery.inArray(fn2, list) > -1 : list.length > 0;
  28703. },
  28704. empty: function() {
  28705. if (list) {
  28706. list = [];
  28707. }
  28708. return this;
  28709. },
  28710. disable: function() {
  28711. locked = queue = [];
  28712. list = memory = "";
  28713. return this;
  28714. },
  28715. disabled: function() {
  28716. return !list;
  28717. },
  28718. lock: function() {
  28719. locked = queue = [];
  28720. if (!memory && !firing) {
  28721. list = memory = "";
  28722. }
  28723. return this;
  28724. },
  28725. locked: function() {
  28726. return !!locked;
  28727. },
  28728. fireWith: function(context, args) {
  28729. if (!locked) {
  28730. args = args || [];
  28731. args = [context, args.slice ? args.slice() : args];
  28732. queue.push(args);
  28733. if (!firing) {
  28734. fire();
  28735. }
  28736. }
  28737. return this;
  28738. },
  28739. fire: function() {
  28740. self2.fireWith(this, arguments);
  28741. return this;
  28742. },
  28743. fired: function() {
  28744. return !!fired;
  28745. }
  28746. };
  28747. return self2;
  28748. };
  28749. function Identity(v) {
  28750. return v;
  28751. }
  28752. function Thrower(ex) {
  28753. throw ex;
  28754. }
  28755. function adoptValue(value, resolve2, reject2, noValue) {
  28756. var method;
  28757. try {
  28758. if (value && isFunction2(method = value.promise)) {
  28759. method.call(value).done(resolve2).fail(reject2);
  28760. } else if (value && isFunction2(method = value.then)) {
  28761. method.call(value, resolve2, reject2);
  28762. } else {
  28763. resolve2.apply(void 0, [value].slice(noValue));
  28764. }
  28765. } catch (value2) {
  28766. reject2.apply(void 0, [value2]);
  28767. }
  28768. }
  28769. jQuery.extend({
  28770. Deferred: function(func) {
  28771. var tuples = [
  28772. [
  28773. "notify",
  28774. "progress",
  28775. jQuery.Callbacks("memory"),
  28776. jQuery.Callbacks("memory"),
  28777. 2
  28778. ],
  28779. [
  28780. "resolve",
  28781. "done",
  28782. jQuery.Callbacks("once memory"),
  28783. jQuery.Callbacks("once memory"),
  28784. 0,
  28785. "resolved"
  28786. ],
  28787. [
  28788. "reject",
  28789. "fail",
  28790. jQuery.Callbacks("once memory"),
  28791. jQuery.Callbacks("once memory"),
  28792. 1,
  28793. "rejected"
  28794. ]
  28795. ], state = "pending", promise = {
  28796. state: function() {
  28797. return state;
  28798. },
  28799. always: function() {
  28800. deferred.done(arguments).fail(arguments);
  28801. return this;
  28802. },
  28803. "catch": function(fn2) {
  28804. return promise.then(null, fn2);
  28805. },
  28806. pipe: function() {
  28807. var fns = arguments;
  28808. return jQuery.Deferred(function(newDefer) {
  28809. jQuery.each(tuples, function(_i, tuple2) {
  28810. var fn2 = isFunction2(fns[tuple2[4]]) && fns[tuple2[4]];
  28811. deferred[tuple2[1]](function() {
  28812. var returned = fn2 && fn2.apply(this, arguments);
  28813. if (returned && isFunction2(returned.promise)) {
  28814. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  28815. } else {
  28816. newDefer[tuple2[0] + "With"](
  28817. this,
  28818. fn2 ? [returned] : arguments
  28819. );
  28820. }
  28821. });
  28822. });
  28823. fns = null;
  28824. }).promise();
  28825. },
  28826. then: function(onFulfilled, onRejected, onProgress) {
  28827. var maxDepth = 0;
  28828. function resolve2(depth, deferred2, handler, special) {
  28829. return function() {
  28830. var that = this, args = arguments, mightThrow = function() {
  28831. var returned, then;
  28832. if (depth < maxDepth) {
  28833. return;
  28834. }
  28835. returned = handler.apply(that, args);
  28836. if (returned === deferred2.promise()) {
  28837. throw new TypeError("Thenable self-resolution");
  28838. }
  28839. then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then;
  28840. if (isFunction2(then)) {
  28841. if (special) {
  28842. then.call(
  28843. returned,
  28844. resolve2(maxDepth, deferred2, Identity, special),
  28845. resolve2(maxDepth, deferred2, Thrower, special)
  28846. );
  28847. } else {
  28848. maxDepth++;
  28849. then.call(
  28850. returned,
  28851. resolve2(maxDepth, deferred2, Identity, special),
  28852. resolve2(maxDepth, deferred2, Thrower, special),
  28853. resolve2(
  28854. maxDepth,
  28855. deferred2,
  28856. Identity,
  28857. deferred2.notifyWith
  28858. )
  28859. );
  28860. }
  28861. } else {
  28862. if (handler !== Identity) {
  28863. that = void 0;
  28864. args = [returned];
  28865. }
  28866. (special || deferred2.resolveWith)(that, args);
  28867. }
  28868. }, process2 = special ? mightThrow : function() {
  28869. try {
  28870. mightThrow();
  28871. } catch (e) {
  28872. if (jQuery.Deferred.exceptionHook) {
  28873. jQuery.Deferred.exceptionHook(
  28874. e,
  28875. process2.error
  28876. );
  28877. }
  28878. if (depth + 1 >= maxDepth) {
  28879. if (handler !== Thrower) {
  28880. that = void 0;
  28881. args = [e];
  28882. }
  28883. deferred2.rejectWith(that, args);
  28884. }
  28885. }
  28886. };
  28887. if (depth) {
  28888. process2();
  28889. } else {
  28890. if (jQuery.Deferred.getErrorHook) {
  28891. process2.error = jQuery.Deferred.getErrorHook();
  28892. } else if (jQuery.Deferred.getStackHook) {
  28893. process2.error = jQuery.Deferred.getStackHook();
  28894. }
  28895. window2.setTimeout(process2);
  28896. }
  28897. };
  28898. }
  28899. return jQuery.Deferred(function(newDefer) {
  28900. tuples[0][3].add(
  28901. resolve2(
  28902. 0,
  28903. newDefer,
  28904. isFunction2(onProgress) ? onProgress : Identity,
  28905. newDefer.notifyWith
  28906. )
  28907. );
  28908. tuples[1][3].add(
  28909. resolve2(
  28910. 0,
  28911. newDefer,
  28912. isFunction2(onFulfilled) ? onFulfilled : Identity
  28913. )
  28914. );
  28915. tuples[2][3].add(
  28916. resolve2(
  28917. 0,
  28918. newDefer,
  28919. isFunction2(onRejected) ? onRejected : Thrower
  28920. )
  28921. );
  28922. }).promise();
  28923. },
  28924. promise: function(obj) {
  28925. return obj != null ? jQuery.extend(obj, promise) : promise;
  28926. }
  28927. }, deferred = {};
  28928. jQuery.each(tuples, function(i2, tuple2) {
  28929. var list = tuple2[2], stateString = tuple2[5];
  28930. promise[tuple2[1]] = list.add;
  28931. if (stateString) {
  28932. list.add(
  28933. function() {
  28934. state = stateString;
  28935. },
  28936. tuples[3 - i2][2].disable,
  28937. tuples[3 - i2][3].disable,
  28938. tuples[0][2].lock,
  28939. tuples[0][3].lock
  28940. );
  28941. }
  28942. list.add(tuple2[3].fire);
  28943. deferred[tuple2[0]] = function() {
  28944. deferred[tuple2[0] + "With"](this === deferred ? void 0 : this, arguments);
  28945. return this;
  28946. };
  28947. deferred[tuple2[0] + "With"] = list.fireWith;
  28948. });
  28949. promise.promise(deferred);
  28950. if (func) {
  28951. func.call(deferred, deferred);
  28952. }
  28953. return deferred;
  28954. },
  28955. when: function(singleValue) {
  28956. var remaining = arguments.length, i2 = remaining, resolveContexts = Array(i2), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i3) {
  28957. return function(value) {
  28958. resolveContexts[i3] = this;
  28959. resolveValues[i3] = arguments.length > 1 ? slice.call(arguments) : value;
  28960. if (!--remaining) {
  28961. primary.resolveWith(resolveContexts, resolveValues);
  28962. }
  28963. };
  28964. };
  28965. if (remaining <= 1) {
  28966. adoptValue(
  28967. singleValue,
  28968. primary.done(updateFunc(i2)).resolve,
  28969. primary.reject,
  28970. !remaining
  28971. );
  28972. if (primary.state() === "pending" || isFunction2(resolveValues[i2] && resolveValues[i2].then)) {
  28973. return primary.then();
  28974. }
  28975. }
  28976. while (i2--) {
  28977. adoptValue(resolveValues[i2], updateFunc(i2), primary.reject);
  28978. }
  28979. return primary.promise();
  28980. }
  28981. });
  28982. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  28983. jQuery.Deferred.exceptionHook = function(error, asyncError) {
  28984. if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) {
  28985. window2.console.warn(
  28986. "jQuery.Deferred exception: " + error.message,
  28987. error.stack,
  28988. asyncError
  28989. );
  28990. }
  28991. };
  28992. jQuery.readyException = function(error) {
  28993. window2.setTimeout(function() {
  28994. throw error;
  28995. });
  28996. };
  28997. var readyList = jQuery.Deferred();
  28998. jQuery.fn.ready = function(fn2) {
  28999. readyList.then(fn2).catch(function(error) {
  29000. jQuery.readyException(error);
  29001. });
  29002. return this;
  29003. };
  29004. jQuery.extend({
  29005. isReady: false,
  29006. readyWait: 1,
  29007. ready: function(wait) {
  29008. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  29009. return;
  29010. }
  29011. jQuery.isReady = true;
  29012. if (wait !== true && --jQuery.readyWait > 0) {
  29013. return;
  29014. }
  29015. readyList.resolveWith(document2, [jQuery]);
  29016. }
  29017. });
  29018. jQuery.ready.then = readyList.then;
  29019. function completed() {
  29020. document2.removeEventListener("DOMContentLoaded", completed);
  29021. window2.removeEventListener("load", completed);
  29022. jQuery.ready();
  29023. }
  29024. if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) {
  29025. window2.setTimeout(jQuery.ready);
  29026. } else {
  29027. document2.addEventListener("DOMContentLoaded", completed);
  29028. window2.addEventListener("load", completed);
  29029. }
  29030. var access = function(elems, fn2, key, value, chainable, emptyGet, raw) {
  29031. var i2 = 0, len = elems.length, bulk = key == null;
  29032. if (toType(key) === "object") {
  29033. chainable = true;
  29034. for (i2 in key) {
  29035. access(elems, fn2, i2, key[i2], true, emptyGet, raw);
  29036. }
  29037. } else if (value !== void 0) {
  29038. chainable = true;
  29039. if (!isFunction2(value)) {
  29040. raw = true;
  29041. }
  29042. if (bulk) {
  29043. if (raw) {
  29044. fn2.call(elems, value);
  29045. fn2 = null;
  29046. } else {
  29047. bulk = fn2;
  29048. fn2 = function(elem, _key, value2) {
  29049. return bulk.call(jQuery(elem), value2);
  29050. };
  29051. }
  29052. }
  29053. if (fn2) {
  29054. for (; i2 < len; i2++) {
  29055. fn2(
  29056. elems[i2],
  29057. key,
  29058. raw ? value : value.call(elems[i2], i2, fn2(elems[i2], key))
  29059. );
  29060. }
  29061. }
  29062. }
  29063. if (chainable) {
  29064. return elems;
  29065. }
  29066. if (bulk) {
  29067. return fn2.call(elems);
  29068. }
  29069. return len ? fn2(elems[0], key) : emptyGet;
  29070. };
  29071. var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
  29072. function fcamelCase(_all, letter) {
  29073. return letter.toUpperCase();
  29074. }
  29075. function camelCase3(string) {
  29076. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  29077. }
  29078. var acceptData = function(owner) {
  29079. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  29080. };
  29081. function Data() {
  29082. this.expando = jQuery.expando + Data.uid++;
  29083. }
  29084. Data.uid = 1;
  29085. Data.prototype = {
  29086. cache: function(owner) {
  29087. var value = owner[this.expando];
  29088. if (!value) {
  29089. value = {};
  29090. if (acceptData(owner)) {
  29091. if (owner.nodeType) {
  29092. owner[this.expando] = value;
  29093. } else {
  29094. Object.defineProperty(owner, this.expando, {
  29095. value,
  29096. configurable: true
  29097. });
  29098. }
  29099. }
  29100. }
  29101. return value;
  29102. },
  29103. set: function(owner, data, value) {
  29104. var prop, cache = this.cache(owner);
  29105. if (typeof data === "string") {
  29106. cache[camelCase3(data)] = value;
  29107. } else {
  29108. for (prop in data) {
  29109. cache[camelCase3(prop)] = data[prop];
  29110. }
  29111. }
  29112. return cache;
  29113. },
  29114. get: function(owner, key) {
  29115. return key === void 0 ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase3(key)];
  29116. },
  29117. access: function(owner, key, value) {
  29118. if (key === void 0 || key && typeof key === "string" && value === void 0) {
  29119. return this.get(owner, key);
  29120. }
  29121. this.set(owner, key, value);
  29122. return value !== void 0 ? value : key;
  29123. },
  29124. remove: function(owner, key) {
  29125. var i2, cache = owner[this.expando];
  29126. if (cache === void 0) {
  29127. return;
  29128. }
  29129. if (key !== void 0) {
  29130. if (Array.isArray(key)) {
  29131. key = key.map(camelCase3);
  29132. } else {
  29133. key = camelCase3(key);
  29134. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  29135. }
  29136. i2 = key.length;
  29137. while (i2--) {
  29138. delete cache[key[i2]];
  29139. }
  29140. }
  29141. if (key === void 0 || jQuery.isEmptyObject(cache)) {
  29142. if (owner.nodeType) {
  29143. owner[this.expando] = void 0;
  29144. } else {
  29145. delete owner[this.expando];
  29146. }
  29147. }
  29148. },
  29149. hasData: function(owner) {
  29150. var cache = owner[this.expando];
  29151. return cache !== void 0 && !jQuery.isEmptyObject(cache);
  29152. }
  29153. };
  29154. var dataPriv = new Data();
  29155. var dataUser = new Data();
  29156. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
  29157. function getData(data) {
  29158. if (data === "true") {
  29159. return true;
  29160. }
  29161. if (data === "false") {
  29162. return false;
  29163. }
  29164. if (data === "null") {
  29165. return null;
  29166. }
  29167. if (data === +data + "") {
  29168. return +data;
  29169. }
  29170. if (rbrace.test(data)) {
  29171. return JSON.parse(data);
  29172. }
  29173. return data;
  29174. }
  29175. function dataAttr(elem, key, data) {
  29176. var name;
  29177. if (data === void 0 && elem.nodeType === 1) {
  29178. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  29179. data = elem.getAttribute(name);
  29180. if (typeof data === "string") {
  29181. try {
  29182. data = getData(data);
  29183. } catch (e) {
  29184. }
  29185. dataUser.set(elem, key, data);
  29186. } else {
  29187. data = void 0;
  29188. }
  29189. }
  29190. return data;
  29191. }
  29192. jQuery.extend({
  29193. hasData: function(elem) {
  29194. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  29195. },
  29196. data: function(elem, name, data) {
  29197. return dataUser.access(elem, name, data);
  29198. },
  29199. removeData: function(elem, name) {
  29200. dataUser.remove(elem, name);
  29201. },
  29202. _data: function(elem, name, data) {
  29203. return dataPriv.access(elem, name, data);
  29204. },
  29205. _removeData: function(elem, name) {
  29206. dataPriv.remove(elem, name);
  29207. }
  29208. });
  29209. jQuery.fn.extend({
  29210. data: function(key, value) {
  29211. var i2, name, data, elem = this[0], attrs = elem && elem.attributes;
  29212. if (key === void 0) {
  29213. if (this.length) {
  29214. data = dataUser.get(elem);
  29215. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  29216. i2 = attrs.length;
  29217. while (i2--) {
  29218. if (attrs[i2]) {
  29219. name = attrs[i2].name;
  29220. if (name.indexOf("data-") === 0) {
  29221. name = camelCase3(name.slice(5));
  29222. dataAttr(elem, name, data[name]);
  29223. }
  29224. }
  29225. }
  29226. dataPriv.set(elem, "hasDataAttrs", true);
  29227. }
  29228. }
  29229. return data;
  29230. }
  29231. if (typeof key === "object") {
  29232. return this.each(function() {
  29233. dataUser.set(this, key);
  29234. });
  29235. }
  29236. return access(this, function(value2) {
  29237. var data2;
  29238. if (elem && value2 === void 0) {
  29239. data2 = dataUser.get(elem, key);
  29240. if (data2 !== void 0) {
  29241. return data2;
  29242. }
  29243. data2 = dataAttr(elem, key);
  29244. if (data2 !== void 0) {
  29245. return data2;
  29246. }
  29247. return;
  29248. }
  29249. this.each(function() {
  29250. dataUser.set(this, key, value2);
  29251. });
  29252. }, null, value, arguments.length > 1, null, true);
  29253. },
  29254. removeData: function(key) {
  29255. return this.each(function() {
  29256. dataUser.remove(this, key);
  29257. });
  29258. }
  29259. });
  29260. jQuery.extend({
  29261. queue: function(elem, type2, data) {
  29262. var queue;
  29263. if (elem) {
  29264. type2 = (type2 || "fx") + "queue";
  29265. queue = dataPriv.get(elem, type2);
  29266. if (data) {
  29267. if (!queue || Array.isArray(data)) {
  29268. queue = dataPriv.access(elem, type2, jQuery.makeArray(data));
  29269. } else {
  29270. queue.push(data);
  29271. }
  29272. }
  29273. return queue || [];
  29274. }
  29275. },
  29276. dequeue: function(elem, type2) {
  29277. type2 = type2 || "fx";
  29278. var queue = jQuery.queue(elem, type2), startLength = queue.length, fn2 = queue.shift(), hooks3 = jQuery._queueHooks(elem, type2), next = function() {
  29279. jQuery.dequeue(elem, type2);
  29280. };
  29281. if (fn2 === "inprogress") {
  29282. fn2 = queue.shift();
  29283. startLength--;
  29284. }
  29285. if (fn2) {
  29286. if (type2 === "fx") {
  29287. queue.unshift("inprogress");
  29288. }
  29289. delete hooks3.stop;
  29290. fn2.call(elem, next, hooks3);
  29291. }
  29292. if (!startLength && hooks3) {
  29293. hooks3.empty.fire();
  29294. }
  29295. },
  29296. _queueHooks: function(elem, type2) {
  29297. var key = type2 + "queueHooks";
  29298. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  29299. empty: jQuery.Callbacks("once memory").add(function() {
  29300. dataPriv.remove(elem, [type2 + "queue", key]);
  29301. })
  29302. });
  29303. }
  29304. });
  29305. jQuery.fn.extend({
  29306. queue: function(type2, data) {
  29307. var setter = 2;
  29308. if (typeof type2 !== "string") {
  29309. data = type2;
  29310. type2 = "fx";
  29311. setter--;
  29312. }
  29313. if (arguments.length < setter) {
  29314. return jQuery.queue(this[0], type2);
  29315. }
  29316. return data === void 0 ? this : this.each(function() {
  29317. var queue = jQuery.queue(this, type2, data);
  29318. jQuery._queueHooks(this, type2);
  29319. if (type2 === "fx" && queue[0] !== "inprogress") {
  29320. jQuery.dequeue(this, type2);
  29321. }
  29322. });
  29323. },
  29324. dequeue: function(type2) {
  29325. return this.each(function() {
  29326. jQuery.dequeue(this, type2);
  29327. });
  29328. },
  29329. clearQueue: function(type2) {
  29330. return this.queue(type2 || "fx", []);
  29331. },
  29332. promise: function(type2, obj) {
  29333. var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i2 = this.length, resolve2 = function() {
  29334. if (!--count) {
  29335. defer.resolveWith(elements, [elements]);
  29336. }
  29337. };
  29338. if (typeof type2 !== "string") {
  29339. obj = type2;
  29340. type2 = void 0;
  29341. }
  29342. type2 = type2 || "fx";
  29343. while (i2--) {
  29344. tmp = dataPriv.get(elements[i2], type2 + "queueHooks");
  29345. if (tmp && tmp.empty) {
  29346. count++;
  29347. tmp.empty.add(resolve2);
  29348. }
  29349. }
  29350. resolve2();
  29351. return defer.promise(obj);
  29352. }
  29353. });
  29354. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  29355. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  29356. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  29357. var documentElement = document2.documentElement;
  29358. var isAttached = function(elem) {
  29359. return jQuery.contains(elem.ownerDocument, elem);
  29360. }, composed = { composed: true };
  29361. if (documentElement.getRootNode) {
  29362. isAttached = function(elem) {
  29363. return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
  29364. };
  29365. }
  29366. var isHiddenWithinTree = function(elem, el) {
  29367. elem = el || elem;
  29368. return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery.css(elem, "display") === "none";
  29369. };
  29370. function adjustCSS(elem, prop, valueParts, tween) {
  29371. var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
  29372. return tween.cur();
  29373. } : function() {
  29374. return jQuery.css(elem, prop, "");
  29375. }, 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));
  29376. if (initialInUnit && initialInUnit[3] !== unit) {
  29377. initial = initial / 2;
  29378. unit = unit || initialInUnit[3];
  29379. initialInUnit = +initial || 1;
  29380. while (maxIterations--) {
  29381. jQuery.style(elem, prop, initialInUnit + unit);
  29382. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  29383. maxIterations = 0;
  29384. }
  29385. initialInUnit = initialInUnit / scale;
  29386. }
  29387. initialInUnit = initialInUnit * 2;
  29388. jQuery.style(elem, prop, initialInUnit + unit);
  29389. valueParts = valueParts || [];
  29390. }
  29391. if (valueParts) {
  29392. initialInUnit = +initialInUnit || +initial || 0;
  29393. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  29394. if (tween) {
  29395. tween.unit = unit;
  29396. tween.start = initialInUnit;
  29397. tween.end = adjusted;
  29398. }
  29399. }
  29400. return adjusted;
  29401. }
  29402. var defaultDisplayMap = {};
  29403. function getDefaultDisplay(elem) {
  29404. var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2];
  29405. if (display) {
  29406. return display;
  29407. }
  29408. temp = doc.body.appendChild(doc.createElement(nodeName2));
  29409. display = jQuery.css(temp, "display");
  29410. temp.parentNode.removeChild(temp);
  29411. if (display === "none") {
  29412. display = "block";
  29413. }
  29414. defaultDisplayMap[nodeName2] = display;
  29415. return display;
  29416. }
  29417. function showHide(elements, show) {
  29418. var display, elem, values3 = [], index2 = 0, length = elements.length;
  29419. for (; index2 < length; index2++) {
  29420. elem = elements[index2];
  29421. if (!elem.style) {
  29422. continue;
  29423. }
  29424. display = elem.style.display;
  29425. if (show) {
  29426. if (display === "none") {
  29427. values3[index2] = dataPriv.get(elem, "display") || null;
  29428. if (!values3[index2]) {
  29429. elem.style.display = "";
  29430. }
  29431. }
  29432. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  29433. values3[index2] = getDefaultDisplay(elem);
  29434. }
  29435. } else {
  29436. if (display !== "none") {
  29437. values3[index2] = "none";
  29438. dataPriv.set(elem, "display", display);
  29439. }
  29440. }
  29441. }
  29442. for (index2 = 0; index2 < length; index2++) {
  29443. if (values3[index2] != null) {
  29444. elements[index2].style.display = values3[index2];
  29445. }
  29446. }
  29447. return elements;
  29448. }
  29449. jQuery.fn.extend({
  29450. show: function() {
  29451. return showHide(this, true);
  29452. },
  29453. hide: function() {
  29454. return showHide(this);
  29455. },
  29456. toggle: function(state) {
  29457. if (typeof state === "boolean") {
  29458. return state ? this.show() : this.hide();
  29459. }
  29460. return this.each(function() {
  29461. if (isHiddenWithinTree(this)) {
  29462. jQuery(this).show();
  29463. } else {
  29464. jQuery(this).hide();
  29465. }
  29466. });
  29467. }
  29468. });
  29469. var rcheckableType = /^(?:checkbox|radio)$/i;
  29470. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
  29471. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  29472. (function() {
  29473. var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input");
  29474. input.setAttribute("type", "radio");
  29475. input.setAttribute("checked", "checked");
  29476. input.setAttribute("name", "t");
  29477. div.appendChild(input);
  29478. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  29479. div.innerHTML = "<textarea>x</textarea>";
  29480. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  29481. div.innerHTML = "<option></option>";
  29482. support.option = !!div.lastChild;
  29483. })();
  29484. var wrapMap = {
  29485. thead: [1, "<table>", "</table>"],
  29486. col: [2, "<table><colgroup>", "</colgroup></table>"],
  29487. tr: [2, "<table><tbody>", "</tbody></table>"],
  29488. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  29489. _default: [0, "", ""]
  29490. };
  29491. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  29492. wrapMap.th = wrapMap.td;
  29493. if (!support.option) {
  29494. wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
  29495. }
  29496. function getAll(context, tag) {
  29497. var ret;
  29498. if (typeof context.getElementsByTagName !== "undefined") {
  29499. ret = context.getElementsByTagName(tag || "*");
  29500. } else if (typeof context.querySelectorAll !== "undefined") {
  29501. ret = context.querySelectorAll(tag || "*");
  29502. } else {
  29503. ret = [];
  29504. }
  29505. if (tag === void 0 || tag && nodeName(context, tag)) {
  29506. return jQuery.merge([context], ret);
  29507. }
  29508. return ret;
  29509. }
  29510. function setGlobalEval(elems, refElements) {
  29511. var i2 = 0, l = elems.length;
  29512. for (; i2 < l; i2++) {
  29513. dataPriv.set(
  29514. elems[i2],
  29515. "globalEval",
  29516. !refElements || dataPriv.get(refElements[i2], "globalEval")
  29517. );
  29518. }
  29519. }
  29520. var rhtml = /<|&#?\w+;/;
  29521. function buildFragment(elems, context, scripts, selection, ignored) {
  29522. var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i2 = 0, l = elems.length;
  29523. for (; i2 < l; i2++) {
  29524. elem = elems[i2];
  29525. if (elem || elem === 0) {
  29526. if (toType(elem) === "object") {
  29527. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  29528. } else if (!rhtml.test(elem)) {
  29529. nodes.push(context.createTextNode(elem));
  29530. } else {
  29531. tmp = tmp || fragment.appendChild(context.createElement("div"));
  29532. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  29533. wrap = wrapMap[tag] || wrapMap._default;
  29534. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  29535. j = wrap[0];
  29536. while (j--) {
  29537. tmp = tmp.lastChild;
  29538. }
  29539. jQuery.merge(nodes, tmp.childNodes);
  29540. tmp = fragment.firstChild;
  29541. tmp.textContent = "";
  29542. }
  29543. }
  29544. }
  29545. fragment.textContent = "";
  29546. i2 = 0;
  29547. while (elem = nodes[i2++]) {
  29548. if (selection && jQuery.inArray(elem, selection) > -1) {
  29549. if (ignored) {
  29550. ignored.push(elem);
  29551. }
  29552. continue;
  29553. }
  29554. attached = isAttached(elem);
  29555. tmp = getAll(fragment.appendChild(elem), "script");
  29556. if (attached) {
  29557. setGlobalEval(tmp);
  29558. }
  29559. if (scripts) {
  29560. j = 0;
  29561. while (elem = tmp[j++]) {
  29562. if (rscriptType.test(elem.type || "")) {
  29563. scripts.push(elem);
  29564. }
  29565. }
  29566. }
  29567. }
  29568. return fragment;
  29569. }
  29570. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  29571. function returnTrue() {
  29572. return true;
  29573. }
  29574. function returnFalse() {
  29575. return false;
  29576. }
  29577. function on3(elem, types, selector, data, fn2, one3) {
  29578. var origFn, type2;
  29579. if (typeof types === "object") {
  29580. if (typeof selector !== "string") {
  29581. data = data || selector;
  29582. selector = void 0;
  29583. }
  29584. for (type2 in types) {
  29585. on3(elem, type2, selector, data, types[type2], one3);
  29586. }
  29587. return elem;
  29588. }
  29589. if (data == null && fn2 == null) {
  29590. fn2 = selector;
  29591. data = selector = void 0;
  29592. } else if (fn2 == null) {
  29593. if (typeof selector === "string") {
  29594. fn2 = data;
  29595. data = void 0;
  29596. } else {
  29597. fn2 = data;
  29598. data = selector;
  29599. selector = void 0;
  29600. }
  29601. }
  29602. if (fn2 === false) {
  29603. fn2 = returnFalse;
  29604. } else if (!fn2) {
  29605. return elem;
  29606. }
  29607. if (one3 === 1) {
  29608. origFn = fn2;
  29609. fn2 = function(event2) {
  29610. jQuery().off(event2);
  29611. return origFn.apply(this, arguments);
  29612. };
  29613. fn2.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  29614. }
  29615. return elem.each(function() {
  29616. jQuery.event.add(this, types, fn2, data, selector);
  29617. });
  29618. }
  29619. jQuery.event = {
  29620. global: {},
  29621. add: function(elem, types, handler, data, selector) {
  29622. var handleObjIn, eventHandle, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.get(elem);
  29623. if (!acceptData(elem)) {
  29624. return;
  29625. }
  29626. if (handler.handler) {
  29627. handleObjIn = handler;
  29628. handler = handleObjIn.handler;
  29629. selector = handleObjIn.selector;
  29630. }
  29631. if (selector) {
  29632. jQuery.find.matchesSelector(documentElement, selector);
  29633. }
  29634. if (!handler.guid) {
  29635. handler.guid = jQuery.guid++;
  29636. }
  29637. if (!(events = elemData.events)) {
  29638. events = elemData.events = /* @__PURE__ */ Object.create(null);
  29639. }
  29640. if (!(eventHandle = elemData.handle)) {
  29641. eventHandle = elemData.handle = function(e) {
  29642. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
  29643. };
  29644. }
  29645. types = (types || "").match(rnothtmlwhite) || [""];
  29646. t2 = types.length;
  29647. while (t2--) {
  29648. tmp = rtypenamespace.exec(types[t2]) || [];
  29649. type2 = origType = tmp[1];
  29650. namespaces = (tmp[2] || "").split(".").sort();
  29651. if (!type2) {
  29652. continue;
  29653. }
  29654. special = jQuery.event.special[type2] || {};
  29655. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29656. special = jQuery.event.special[type2] || {};
  29657. handleObj = jQuery.extend({
  29658. type: type2,
  29659. origType,
  29660. data,
  29661. handler,
  29662. guid: handler.guid,
  29663. selector,
  29664. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  29665. namespace: namespaces.join(".")
  29666. }, handleObjIn);
  29667. if (!(handlers = events[type2])) {
  29668. handlers = events[type2] = [];
  29669. handlers.delegateCount = 0;
  29670. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  29671. if (elem.addEventListener) {
  29672. elem.addEventListener(type2, eventHandle);
  29673. }
  29674. }
  29675. }
  29676. if (special.add) {
  29677. special.add.call(elem, handleObj);
  29678. if (!handleObj.handler.guid) {
  29679. handleObj.handler.guid = handler.guid;
  29680. }
  29681. }
  29682. if (selector) {
  29683. handlers.splice(handlers.delegateCount++, 0, handleObj);
  29684. } else {
  29685. handlers.push(handleObj);
  29686. }
  29687. jQuery.event.global[type2] = true;
  29688. }
  29689. },
  29690. remove: function(elem, types, handler, selector, mappedTypes) {
  29691. var j, origCount, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  29692. if (!elemData || !(events = elemData.events)) {
  29693. return;
  29694. }
  29695. types = (types || "").match(rnothtmlwhite) || [""];
  29696. t2 = types.length;
  29697. while (t2--) {
  29698. tmp = rtypenamespace.exec(types[t2]) || [];
  29699. type2 = origType = tmp[1];
  29700. namespaces = (tmp[2] || "").split(".").sort();
  29701. if (!type2) {
  29702. for (type2 in events) {
  29703. jQuery.event.remove(elem, type2 + types[t2], handler, selector, true);
  29704. }
  29705. continue;
  29706. }
  29707. special = jQuery.event.special[type2] || {};
  29708. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29709. handlers = events[type2] || [];
  29710. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  29711. origCount = j = handlers.length;
  29712. while (j--) {
  29713. handleObj = handlers[j];
  29714. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  29715. handlers.splice(j, 1);
  29716. if (handleObj.selector) {
  29717. handlers.delegateCount--;
  29718. }
  29719. if (special.remove) {
  29720. special.remove.call(elem, handleObj);
  29721. }
  29722. }
  29723. }
  29724. if (origCount && !handlers.length) {
  29725. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  29726. jQuery.removeEvent(elem, type2, elemData.handle);
  29727. }
  29728. delete events[type2];
  29729. }
  29730. }
  29731. if (jQuery.isEmptyObject(events)) {
  29732. dataPriv.remove(elem, "handle events");
  29733. }
  29734. },
  29735. dispatch: function(nativeEvent) {
  29736. 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] || {};
  29737. args[0] = event2;
  29738. for (i2 = 1; i2 < arguments.length; i2++) {
  29739. args[i2] = arguments[i2];
  29740. }
  29741. event2.delegateTarget = this;
  29742. if (special.preDispatch && special.preDispatch.call(this, event2) === false) {
  29743. return;
  29744. }
  29745. handlerQueue = jQuery.event.handlers.call(this, event2, handlers);
  29746. i2 = 0;
  29747. while ((matched = handlerQueue[i2++]) && !event2.isPropagationStopped()) {
  29748. event2.currentTarget = matched.elem;
  29749. j = 0;
  29750. while ((handleObj = matched.handlers[j++]) && !event2.isImmediatePropagationStopped()) {
  29751. if (!event2.rnamespace || handleObj.namespace === false || event2.rnamespace.test(handleObj.namespace)) {
  29752. event2.handleObj = handleObj;
  29753. event2.data = handleObj.data;
  29754. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  29755. if (ret !== void 0) {
  29756. if ((event2.result = ret) === false) {
  29757. event2.preventDefault();
  29758. event2.stopPropagation();
  29759. }
  29760. }
  29761. }
  29762. }
  29763. }
  29764. if (special.postDispatch) {
  29765. special.postDispatch.call(this, event2);
  29766. }
  29767. return event2.result;
  29768. },
  29769. handlers: function(event2, handlers) {
  29770. var i2, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event2.target;
  29771. if (delegateCount && cur.nodeType && !(event2.type === "click" && event2.button >= 1)) {
  29772. for (; cur !== this; cur = cur.parentNode || this) {
  29773. if (cur.nodeType === 1 && !(event2.type === "click" && cur.disabled === true)) {
  29774. matchedHandlers = [];
  29775. matchedSelectors = {};
  29776. for (i2 = 0; i2 < delegateCount; i2++) {
  29777. handleObj = handlers[i2];
  29778. sel = handleObj.selector + " ";
  29779. if (matchedSelectors[sel] === void 0) {
  29780. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  29781. }
  29782. if (matchedSelectors[sel]) {
  29783. matchedHandlers.push(handleObj);
  29784. }
  29785. }
  29786. if (matchedHandlers.length) {
  29787. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  29788. }
  29789. }
  29790. }
  29791. }
  29792. cur = this;
  29793. if (delegateCount < handlers.length) {
  29794. handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
  29795. }
  29796. return handlerQueue;
  29797. },
  29798. addProp: function(name, hook3) {
  29799. Object.defineProperty(jQuery.Event.prototype, name, {
  29800. enumerable: true,
  29801. configurable: true,
  29802. get: isFunction2(hook3) ? function() {
  29803. if (this.originalEvent) {
  29804. return hook3(this.originalEvent);
  29805. }
  29806. } : function() {
  29807. if (this.originalEvent) {
  29808. return this.originalEvent[name];
  29809. }
  29810. },
  29811. set: function(value) {
  29812. Object.defineProperty(this, name, {
  29813. enumerable: true,
  29814. configurable: true,
  29815. writable: true,
  29816. value
  29817. });
  29818. }
  29819. });
  29820. },
  29821. fix: function(originalEvent) {
  29822. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  29823. },
  29824. special: {
  29825. load: {
  29826. noBubble: true
  29827. },
  29828. click: {
  29829. setup: function(data) {
  29830. var el = this || data;
  29831. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29832. leverageNative(el, "click", true);
  29833. }
  29834. return false;
  29835. },
  29836. trigger: function(data) {
  29837. var el = this || data;
  29838. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29839. leverageNative(el, "click");
  29840. }
  29841. return true;
  29842. },
  29843. _default: function(event2) {
  29844. var target = event2.target;
  29845. return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
  29846. }
  29847. },
  29848. beforeunload: {
  29849. postDispatch: function(event2) {
  29850. if (event2.result !== void 0 && event2.originalEvent) {
  29851. event2.originalEvent.returnValue = event2.result;
  29852. }
  29853. }
  29854. }
  29855. }
  29856. };
  29857. function leverageNative(el, type2, isSetup) {
  29858. if (!isSetup) {
  29859. if (dataPriv.get(el, type2) === void 0) {
  29860. jQuery.event.add(el, type2, returnTrue);
  29861. }
  29862. return;
  29863. }
  29864. dataPriv.set(el, type2, false);
  29865. jQuery.event.add(el, type2, {
  29866. namespace: false,
  29867. handler: function(event2) {
  29868. var result, saved = dataPriv.get(this, type2);
  29869. if (event2.isTrigger & 1 && this[type2]) {
  29870. if (!saved) {
  29871. saved = slice.call(arguments);
  29872. dataPriv.set(this, type2, saved);
  29873. this[type2]();
  29874. result = dataPriv.get(this, type2);
  29875. dataPriv.set(this, type2, false);
  29876. if (saved !== result) {
  29877. event2.stopImmediatePropagation();
  29878. event2.preventDefault();
  29879. return result;
  29880. }
  29881. } else if ((jQuery.event.special[type2] || {}).delegateType) {
  29882. event2.stopPropagation();
  29883. }
  29884. } else if (saved) {
  29885. dataPriv.set(this, type2, jQuery.event.trigger(
  29886. saved[0],
  29887. saved.slice(1),
  29888. this
  29889. ));
  29890. event2.stopPropagation();
  29891. event2.isImmediatePropagationStopped = returnTrue;
  29892. }
  29893. }
  29894. });
  29895. }
  29896. jQuery.removeEvent = function(elem, type2, handle) {
  29897. if (elem.removeEventListener) {
  29898. elem.removeEventListener(type2, handle);
  29899. }
  29900. };
  29901. jQuery.Event = function(src, props) {
  29902. if (!(this instanceof jQuery.Event)) {
  29903. return new jQuery.Event(src, props);
  29904. }
  29905. if (src && src.type) {
  29906. this.originalEvent = src;
  29907. this.type = src.type;
  29908. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && src.returnValue === false ? returnTrue : returnFalse;
  29909. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  29910. this.currentTarget = src.currentTarget;
  29911. this.relatedTarget = src.relatedTarget;
  29912. } else {
  29913. this.type = src;
  29914. }
  29915. if (props) {
  29916. jQuery.extend(this, props);
  29917. }
  29918. this.timeStamp = src && src.timeStamp || Date.now();
  29919. this[jQuery.expando] = true;
  29920. };
  29921. jQuery.Event.prototype = {
  29922. constructor: jQuery.Event,
  29923. isDefaultPrevented: returnFalse,
  29924. isPropagationStopped: returnFalse,
  29925. isImmediatePropagationStopped: returnFalse,
  29926. isSimulated: false,
  29927. preventDefault: function() {
  29928. var e = this.originalEvent;
  29929. this.isDefaultPrevented = returnTrue;
  29930. if (e && !this.isSimulated) {
  29931. e.preventDefault();
  29932. }
  29933. },
  29934. stopPropagation: function() {
  29935. var e = this.originalEvent;
  29936. this.isPropagationStopped = returnTrue;
  29937. if (e && !this.isSimulated) {
  29938. e.stopPropagation();
  29939. }
  29940. },
  29941. stopImmediatePropagation: function() {
  29942. var e = this.originalEvent;
  29943. this.isImmediatePropagationStopped = returnTrue;
  29944. if (e && !this.isSimulated) {
  29945. e.stopImmediatePropagation();
  29946. }
  29947. this.stopPropagation();
  29948. }
  29949. };
  29950. jQuery.each({
  29951. altKey: true,
  29952. bubbles: true,
  29953. cancelable: true,
  29954. changedTouches: true,
  29955. ctrlKey: true,
  29956. detail: true,
  29957. eventPhase: true,
  29958. metaKey: true,
  29959. pageX: true,
  29960. pageY: true,
  29961. shiftKey: true,
  29962. view: true,
  29963. "char": true,
  29964. code: true,
  29965. charCode: true,
  29966. key: true,
  29967. keyCode: true,
  29968. button: true,
  29969. buttons: true,
  29970. clientX: true,
  29971. clientY: true,
  29972. offsetX: true,
  29973. offsetY: true,
  29974. pointerId: true,
  29975. pointerType: true,
  29976. screenX: true,
  29977. screenY: true,
  29978. targetTouches: true,
  29979. toElement: true,
  29980. touches: true,
  29981. which: true
  29982. }, jQuery.event.addProp);
  29983. jQuery.each({ focus: "focusin", blur: "focusout" }, function(type2, delegateType) {
  29984. function focusMappedHandler(nativeEvent) {
  29985. if (document2.documentMode) {
  29986. var handle = dataPriv.get(this, "handle"), event2 = jQuery.event.fix(nativeEvent);
  29987. event2.type = nativeEvent.type === "focusin" ? "focus" : "blur";
  29988. event2.isSimulated = true;
  29989. handle(nativeEvent);
  29990. if (event2.target === event2.currentTarget) {
  29991. handle(event2);
  29992. }
  29993. } else {
  29994. jQuery.event.simulate(
  29995. delegateType,
  29996. nativeEvent.target,
  29997. jQuery.event.fix(nativeEvent)
  29998. );
  29999. }
  30000. }
  30001. jQuery.event.special[type2] = {
  30002. setup: function() {
  30003. var attaches;
  30004. leverageNative(this, type2, true);
  30005. if (document2.documentMode) {
  30006. attaches = dataPriv.get(this, delegateType);
  30007. if (!attaches) {
  30008. this.addEventListener(delegateType, focusMappedHandler);
  30009. }
  30010. dataPriv.set(this, delegateType, (attaches || 0) + 1);
  30011. } else {
  30012. return false;
  30013. }
  30014. },
  30015. trigger: function() {
  30016. leverageNative(this, type2);
  30017. return true;
  30018. },
  30019. teardown: function() {
  30020. var attaches;
  30021. if (document2.documentMode) {
  30022. attaches = dataPriv.get(this, delegateType) - 1;
  30023. if (!attaches) {
  30024. this.removeEventListener(delegateType, focusMappedHandler);
  30025. dataPriv.remove(this, delegateType);
  30026. } else {
  30027. dataPriv.set(this, delegateType, attaches);
  30028. }
  30029. } else {
  30030. return false;
  30031. }
  30032. },
  30033. _default: function(event2) {
  30034. return dataPriv.get(event2.target, type2);
  30035. },
  30036. delegateType
  30037. };
  30038. jQuery.event.special[delegateType] = {
  30039. setup: function() {
  30040. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType);
  30041. if (!attaches) {
  30042. if (document2.documentMode) {
  30043. this.addEventListener(delegateType, focusMappedHandler);
  30044. } else {
  30045. doc.addEventListener(type2, focusMappedHandler, true);
  30046. }
  30047. }
  30048. dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
  30049. },
  30050. teardown: function() {
  30051. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1;
  30052. if (!attaches) {
  30053. if (document2.documentMode) {
  30054. this.removeEventListener(delegateType, focusMappedHandler);
  30055. } else {
  30056. doc.removeEventListener(type2, focusMappedHandler, true);
  30057. }
  30058. dataPriv.remove(dataHolder, delegateType);
  30059. } else {
  30060. dataPriv.set(dataHolder, delegateType, attaches);
  30061. }
  30062. }
  30063. };
  30064. });
  30065. jQuery.each({
  30066. mouseenter: "mouseover",
  30067. mouseleave: "mouseout",
  30068. pointerenter: "pointerover",
  30069. pointerleave: "pointerout"
  30070. }, function(orig, fix) {
  30071. jQuery.event.special[orig] = {
  30072. delegateType: fix,
  30073. bindType: fix,
  30074. handle: function(event2) {
  30075. var ret, target = this, related = event2.relatedTarget, handleObj = event2.handleObj;
  30076. if (!related || related !== target && !jQuery.contains(target, related)) {
  30077. event2.type = handleObj.origType;
  30078. ret = handleObj.handler.apply(this, arguments);
  30079. event2.type = fix;
  30080. }
  30081. return ret;
  30082. }
  30083. };
  30084. });
  30085. jQuery.fn.extend({
  30086. on: function(types, selector, data, fn2) {
  30087. return on3(this, types, selector, data, fn2);
  30088. },
  30089. one: function(types, selector, data, fn2) {
  30090. return on3(this, types, selector, data, fn2, 1);
  30091. },
  30092. off: function(types, selector, fn2) {
  30093. var handleObj, type2;
  30094. if (types && types.preventDefault && types.handleObj) {
  30095. handleObj = types.handleObj;
  30096. jQuery(types.delegateTarget).off(
  30097. handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
  30098. handleObj.selector,
  30099. handleObj.handler
  30100. );
  30101. return this;
  30102. }
  30103. if (typeof types === "object") {
  30104. for (type2 in types) {
  30105. this.off(type2, selector, types[type2]);
  30106. }
  30107. return this;
  30108. }
  30109. if (selector === false || typeof selector === "function") {
  30110. fn2 = selector;
  30111. selector = void 0;
  30112. }
  30113. if (fn2 === false) {
  30114. fn2 = returnFalse;
  30115. }
  30116. return this.each(function() {
  30117. jQuery.event.remove(this, types, fn2, selector);
  30118. });
  30119. }
  30120. });
  30121. var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
  30122. function manipulationTarget(elem, content) {
  30123. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  30124. return jQuery(elem).children("tbody")[0] || elem;
  30125. }
  30126. return elem;
  30127. }
  30128. function disableScript(elem) {
  30129. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  30130. return elem;
  30131. }
  30132. function restoreScript(elem) {
  30133. if ((elem.type || "").slice(0, 5) === "true/") {
  30134. elem.type = elem.type.slice(5);
  30135. } else {
  30136. elem.removeAttribute("type");
  30137. }
  30138. return elem;
  30139. }
  30140. function cloneCopyEvent(src, dest) {
  30141. var i2, l, type2, pdataOld, udataOld, udataCur, events;
  30142. if (dest.nodeType !== 1) {
  30143. return;
  30144. }
  30145. if (dataPriv.hasData(src)) {
  30146. pdataOld = dataPriv.get(src);
  30147. events = pdataOld.events;
  30148. if (events) {
  30149. dataPriv.remove(dest, "handle events");
  30150. for (type2 in events) {
  30151. for (i2 = 0, l = events[type2].length; i2 < l; i2++) {
  30152. jQuery.event.add(dest, type2, events[type2][i2]);
  30153. }
  30154. }
  30155. }
  30156. }
  30157. if (dataUser.hasData(src)) {
  30158. udataOld = dataUser.access(src);
  30159. udataCur = jQuery.extend({}, udataOld);
  30160. dataUser.set(dest, udataCur);
  30161. }
  30162. }
  30163. function fixInput(src, dest) {
  30164. var nodeName2 = dest.nodeName.toLowerCase();
  30165. if (nodeName2 === "input" && rcheckableType.test(src.type)) {
  30166. dest.checked = src.checked;
  30167. } else if (nodeName2 === "input" || nodeName2 === "textarea") {
  30168. dest.defaultValue = src.defaultValue;
  30169. }
  30170. }
  30171. function domManip(collection, args, callback2, ignored) {
  30172. args = flat2(args);
  30173. var fragment, first, scripts, hasScripts, node, doc, i2 = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction2(value);
  30174. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  30175. return collection.each(function(index2) {
  30176. var self2 = collection.eq(index2);
  30177. if (valueIsFunction) {
  30178. args[0] = value.call(this, index2, self2.html());
  30179. }
  30180. domManip(self2, args, callback2, ignored);
  30181. });
  30182. }
  30183. if (l) {
  30184. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  30185. first = fragment.firstChild;
  30186. if (fragment.childNodes.length === 1) {
  30187. fragment = first;
  30188. }
  30189. if (first || ignored) {
  30190. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  30191. hasScripts = scripts.length;
  30192. for (; i2 < l; i2++) {
  30193. node = fragment;
  30194. if (i2 !== iNoClone) {
  30195. node = jQuery.clone(node, true, true);
  30196. if (hasScripts) {
  30197. jQuery.merge(scripts, getAll(node, "script"));
  30198. }
  30199. }
  30200. callback2.call(collection[i2], node, i2);
  30201. }
  30202. if (hasScripts) {
  30203. doc = scripts[scripts.length - 1].ownerDocument;
  30204. jQuery.map(scripts, restoreScript);
  30205. for (i2 = 0; i2 < hasScripts; i2++) {
  30206. node = scripts[i2];
  30207. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  30208. if (node.src && (node.type || "").toLowerCase() !== "module") {
  30209. if (jQuery._evalUrl && !node.noModule) {
  30210. jQuery._evalUrl(node.src, {
  30211. nonce: node.nonce || node.getAttribute("nonce")
  30212. }, doc);
  30213. }
  30214. } else {
  30215. DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
  30216. }
  30217. }
  30218. }
  30219. }
  30220. }
  30221. }
  30222. return collection;
  30223. }
  30224. function remove2(elem, selector, keepData) {
  30225. var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i2 = 0;
  30226. for (; (node = nodes[i2]) != null; i2++) {
  30227. if (!keepData && node.nodeType === 1) {
  30228. jQuery.cleanData(getAll(node));
  30229. }
  30230. if (node.parentNode) {
  30231. if (keepData && isAttached(node)) {
  30232. setGlobalEval(getAll(node, "script"));
  30233. }
  30234. node.parentNode.removeChild(node);
  30235. }
  30236. }
  30237. return elem;
  30238. }
  30239. jQuery.extend({
  30240. htmlPrefilter: function(html) {
  30241. return html;
  30242. },
  30243. clone: function(elem, dataAndEvents, deepDataAndEvents) {
  30244. var i2, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem);
  30245. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  30246. destElements = getAll(clone);
  30247. srcElements = getAll(elem);
  30248. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30249. fixInput(srcElements[i2], destElements[i2]);
  30250. }
  30251. }
  30252. if (dataAndEvents) {
  30253. if (deepDataAndEvents) {
  30254. srcElements = srcElements || getAll(elem);
  30255. destElements = destElements || getAll(clone);
  30256. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30257. cloneCopyEvent(srcElements[i2], destElements[i2]);
  30258. }
  30259. } else {
  30260. cloneCopyEvent(elem, clone);
  30261. }
  30262. }
  30263. destElements = getAll(clone, "script");
  30264. if (destElements.length > 0) {
  30265. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  30266. }
  30267. return clone;
  30268. },
  30269. cleanData: function(elems) {
  30270. var data, elem, type2, special = jQuery.event.special, i2 = 0;
  30271. for (; (elem = elems[i2]) !== void 0; i2++) {
  30272. if (acceptData(elem)) {
  30273. if (data = elem[dataPriv.expando]) {
  30274. if (data.events) {
  30275. for (type2 in data.events) {
  30276. if (special[type2]) {
  30277. jQuery.event.remove(elem, type2);
  30278. } else {
  30279. jQuery.removeEvent(elem, type2, data.handle);
  30280. }
  30281. }
  30282. }
  30283. elem[dataPriv.expando] = void 0;
  30284. }
  30285. if (elem[dataUser.expando]) {
  30286. elem[dataUser.expando] = void 0;
  30287. }
  30288. }
  30289. }
  30290. }
  30291. });
  30292. jQuery.fn.extend({
  30293. detach: function(selector) {
  30294. return remove2(this, selector, true);
  30295. },
  30296. remove: function(selector) {
  30297. return remove2(this, selector);
  30298. },
  30299. text: function(value) {
  30300. return access(this, function(value2) {
  30301. return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() {
  30302. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30303. this.textContent = value2;
  30304. }
  30305. });
  30306. }, null, value, arguments.length);
  30307. },
  30308. append: function() {
  30309. return domManip(this, arguments, function(elem) {
  30310. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30311. var target = manipulationTarget(this, elem);
  30312. target.appendChild(elem);
  30313. }
  30314. });
  30315. },
  30316. prepend: function() {
  30317. return domManip(this, arguments, function(elem) {
  30318. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30319. var target = manipulationTarget(this, elem);
  30320. target.insertBefore(elem, target.firstChild);
  30321. }
  30322. });
  30323. },
  30324. before: function() {
  30325. return domManip(this, arguments, function(elem) {
  30326. if (this.parentNode) {
  30327. this.parentNode.insertBefore(elem, this);
  30328. }
  30329. });
  30330. },
  30331. after: function() {
  30332. return domManip(this, arguments, function(elem) {
  30333. if (this.parentNode) {
  30334. this.parentNode.insertBefore(elem, this.nextSibling);
  30335. }
  30336. });
  30337. },
  30338. empty: function() {
  30339. var elem, i2 = 0;
  30340. for (; (elem = this[i2]) != null; i2++) {
  30341. if (elem.nodeType === 1) {
  30342. jQuery.cleanData(getAll(elem, false));
  30343. elem.textContent = "";
  30344. }
  30345. }
  30346. return this;
  30347. },
  30348. clone: function(dataAndEvents, deepDataAndEvents) {
  30349. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  30350. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  30351. return this.map(function() {
  30352. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  30353. });
  30354. },
  30355. html: function(value) {
  30356. return access(this, function(value2) {
  30357. var elem = this[0] || {}, i2 = 0, l = this.length;
  30358. if (value2 === void 0 && elem.nodeType === 1) {
  30359. return elem.innerHTML;
  30360. }
  30361. if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) {
  30362. value2 = jQuery.htmlPrefilter(value2);
  30363. try {
  30364. for (; i2 < l; i2++) {
  30365. elem = this[i2] || {};
  30366. if (elem.nodeType === 1) {
  30367. jQuery.cleanData(getAll(elem, false));
  30368. elem.innerHTML = value2;
  30369. }
  30370. }
  30371. elem = 0;
  30372. } catch (e) {
  30373. }
  30374. }
  30375. if (elem) {
  30376. this.empty().append(value2);
  30377. }
  30378. }, null, value, arguments.length);
  30379. },
  30380. replaceWith: function() {
  30381. var ignored = [];
  30382. return domManip(this, arguments, function(elem) {
  30383. var parent = this.parentNode;
  30384. if (jQuery.inArray(this, ignored) < 0) {
  30385. jQuery.cleanData(getAll(this));
  30386. if (parent) {
  30387. parent.replaceChild(elem, this);
  30388. }
  30389. }
  30390. }, ignored);
  30391. }
  30392. });
  30393. jQuery.each({
  30394. appendTo: "append",
  30395. prependTo: "prepend",
  30396. insertBefore: "before",
  30397. insertAfter: "after",
  30398. replaceAll: "replaceWith"
  30399. }, function(name, original) {
  30400. jQuery.fn[name] = function(selector) {
  30401. var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i2 = 0;
  30402. for (; i2 <= last; i2++) {
  30403. elems = i2 === last ? this : this.clone(true);
  30404. jQuery(insert[i2])[original](elems);
  30405. push.apply(ret, elems.get());
  30406. }
  30407. return this.pushStack(ret);
  30408. };
  30409. });
  30410. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  30411. var rcustomProp = /^--/;
  30412. var getStyles = function(elem) {
  30413. var view = elem.ownerDocument.defaultView;
  30414. if (!view || !view.opener) {
  30415. view = window2;
  30416. }
  30417. return view.getComputedStyle(elem);
  30418. };
  30419. var swap = function(elem, options2, callback2) {
  30420. var ret, name, old = {};
  30421. for (name in options2) {
  30422. old[name] = elem.style[name];
  30423. elem.style[name] = options2[name];
  30424. }
  30425. ret = callback2.call(elem);
  30426. for (name in options2) {
  30427. elem.style[name] = old[name];
  30428. }
  30429. return ret;
  30430. };
  30431. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  30432. (function() {
  30433. function computeStyleTests() {
  30434. if (!div) {
  30435. return;
  30436. }
  30437. container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0";
  30438. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%";
  30439. documentElement.appendChild(container).appendChild(div);
  30440. var divStyle = window2.getComputedStyle(div);
  30441. pixelPositionVal = divStyle.top !== "1%";
  30442. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  30443. div.style.right = "60%";
  30444. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  30445. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  30446. div.style.position = "absolute";
  30447. scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
  30448. documentElement.removeChild(container);
  30449. div = null;
  30450. }
  30451. function roundPixelMeasures(measure) {
  30452. return Math.round(parseFloat(measure));
  30453. }
  30454. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div");
  30455. if (!div.style) {
  30456. return;
  30457. }
  30458. div.style.backgroundClip = "content-box";
  30459. div.cloneNode(true).style.backgroundClip = "";
  30460. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  30461. jQuery.extend(support, {
  30462. boxSizingReliable: function() {
  30463. computeStyleTests();
  30464. return boxSizingReliableVal;
  30465. },
  30466. pixelBoxStyles: function() {
  30467. computeStyleTests();
  30468. return pixelBoxStylesVal;
  30469. },
  30470. pixelPosition: function() {
  30471. computeStyleTests();
  30472. return pixelPositionVal;
  30473. },
  30474. reliableMarginLeft: function() {
  30475. computeStyleTests();
  30476. return reliableMarginLeftVal;
  30477. },
  30478. scrollboxSize: function() {
  30479. computeStyleTests();
  30480. return scrollboxSizeVal;
  30481. },
  30482. reliableTrDimensions: function() {
  30483. var table, tr, trChild, trStyle;
  30484. if (reliableTrDimensionsVal == null) {
  30485. table = document2.createElement("table");
  30486. tr = document2.createElement("tr");
  30487. trChild = document2.createElement("div");
  30488. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  30489. tr.style.cssText = "border:1px solid";
  30490. tr.style.height = "1px";
  30491. trChild.style.height = "9px";
  30492. trChild.style.display = "block";
  30493. documentElement.appendChild(table).appendChild(tr).appendChild(trChild);
  30494. trStyle = window2.getComputedStyle(tr);
  30495. reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;
  30496. documentElement.removeChild(table);
  30497. }
  30498. return reliableTrDimensionsVal;
  30499. }
  30500. });
  30501. })();
  30502. function curCSS(elem, name, computed2) {
  30503. var width2, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style;
  30504. computed2 = computed2 || getStyles(elem);
  30505. if (computed2) {
  30506. ret = computed2.getPropertyValue(name) || computed2[name];
  30507. if (isCustomProp && ret) {
  30508. ret = ret.replace(rtrimCSS, "$1") || void 0;
  30509. }
  30510. if (ret === "" && !isAttached(elem)) {
  30511. ret = jQuery.style(elem, name);
  30512. }
  30513. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  30514. width2 = style.width;
  30515. minWidth = style.minWidth;
  30516. maxWidth = style.maxWidth;
  30517. style.minWidth = style.maxWidth = style.width = ret;
  30518. ret = computed2.width;
  30519. style.width = width2;
  30520. style.minWidth = minWidth;
  30521. style.maxWidth = maxWidth;
  30522. }
  30523. }
  30524. return ret !== void 0 ? ret + "" : ret;
  30525. }
  30526. function addGetHookIf(conditionFn, hookFn) {
  30527. return {
  30528. get: function() {
  30529. if (conditionFn()) {
  30530. delete this.get;
  30531. return;
  30532. }
  30533. return (this.get = hookFn).apply(this, arguments);
  30534. }
  30535. };
  30536. }
  30537. var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {};
  30538. function vendorPropName(name) {
  30539. var capName = name[0].toUpperCase() + name.slice(1), i2 = cssPrefixes.length;
  30540. while (i2--) {
  30541. name = cssPrefixes[i2] + capName;
  30542. if (name in emptyStyle) {
  30543. return name;
  30544. }
  30545. }
  30546. }
  30547. function finalPropName(name) {
  30548. var final = jQuery.cssProps[name] || vendorProps[name];
  30549. if (final) {
  30550. return final;
  30551. }
  30552. if (name in emptyStyle) {
  30553. return name;
  30554. }
  30555. return vendorProps[name] = vendorPropName(name) || name;
  30556. }
  30557. var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = {
  30558. letterSpacing: "0",
  30559. fontWeight: "400"
  30560. };
  30561. function setPositiveNumber(_elem, value, subtract) {
  30562. var matches = rcssNum.exec(value);
  30563. return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  30564. }
  30565. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  30566. var i2 = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0;
  30567. if (box === (isBorderBox ? "border" : "content")) {
  30568. return 0;
  30569. }
  30570. for (; i2 < 4; i2 += 2) {
  30571. if (box === "margin") {
  30572. marginDelta += jQuery.css(elem, box + cssExpand[i2], true, styles);
  30573. }
  30574. if (!isBorderBox) {
  30575. delta += jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30576. if (box !== "padding") {
  30577. delta += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30578. } else {
  30579. extra += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30580. }
  30581. } else {
  30582. if (box === "content") {
  30583. delta -= jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30584. }
  30585. if (box !== "margin") {
  30586. delta -= jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30587. }
  30588. }
  30589. }
  30590. if (!isBorderBox && computedVal >= 0) {
  30591. delta += Math.max(0, Math.ceil(
  30592. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5
  30593. )) || 0;
  30594. }
  30595. return delta + marginDelta;
  30596. }
  30597. function getWidthOrHeight(elem, dimension, extra) {
  30598. 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);
  30599. if (rnumnonpx.test(val)) {
  30600. if (!extra) {
  30601. return val;
  30602. }
  30603. val = "auto";
  30604. }
  30605. if ((!support.boxSizingReliable() && isBorderBox || !support.reliableTrDimensions() && nodeName(elem, "tr") || val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && elem.getClientRects().length) {
  30606. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
  30607. valueIsBorderBox = offsetProp in elem;
  30608. if (valueIsBorderBox) {
  30609. val = elem[offsetProp];
  30610. }
  30611. }
  30612. val = parseFloat(val) || 0;
  30613. return val + boxModelAdjustment(
  30614. elem,
  30615. dimension,
  30616. extra || (isBorderBox ? "border" : "content"),
  30617. valueIsBorderBox,
  30618. styles,
  30619. val
  30620. ) + "px";
  30621. }
  30622. jQuery.extend({
  30623. cssHooks: {
  30624. opacity: {
  30625. get: function(elem, computed2) {
  30626. if (computed2) {
  30627. var ret = curCSS(elem, "opacity");
  30628. return ret === "" ? "1" : ret;
  30629. }
  30630. }
  30631. }
  30632. },
  30633. cssNumber: {
  30634. animationIterationCount: true,
  30635. aspectRatio: true,
  30636. borderImageSlice: true,
  30637. columnCount: true,
  30638. flexGrow: true,
  30639. flexShrink: true,
  30640. fontWeight: true,
  30641. gridArea: true,
  30642. gridColumn: true,
  30643. gridColumnEnd: true,
  30644. gridColumnStart: true,
  30645. gridRow: true,
  30646. gridRowEnd: true,
  30647. gridRowStart: true,
  30648. lineHeight: true,
  30649. opacity: true,
  30650. order: true,
  30651. orphans: true,
  30652. scale: true,
  30653. widows: true,
  30654. zIndex: true,
  30655. zoom: true,
  30656. fillOpacity: true,
  30657. floodOpacity: true,
  30658. stopOpacity: true,
  30659. strokeMiterlimit: true,
  30660. strokeOpacity: true
  30661. },
  30662. cssProps: {},
  30663. style: function(elem, name, value, extra) {
  30664. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  30665. return;
  30666. }
  30667. var ret, type2, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name), style = elem.style;
  30668. if (!isCustomProp) {
  30669. name = finalPropName(origName);
  30670. }
  30671. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30672. if (value !== void 0) {
  30673. type2 = typeof value;
  30674. if (type2 === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  30675. value = adjustCSS(elem, name, ret);
  30676. type2 = "number";
  30677. }
  30678. if (value == null || value !== value) {
  30679. return;
  30680. }
  30681. if (type2 === "number" && !isCustomProp) {
  30682. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  30683. }
  30684. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  30685. style[name] = "inherit";
  30686. }
  30687. if (!hooks3 || !("set" in hooks3) || (value = hooks3.set(elem, value, extra)) !== void 0) {
  30688. if (isCustomProp) {
  30689. style.setProperty(name, value);
  30690. } else {
  30691. style[name] = value;
  30692. }
  30693. }
  30694. } else {
  30695. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, false, extra)) !== void 0) {
  30696. return ret;
  30697. }
  30698. return style[name];
  30699. }
  30700. },
  30701. css: function(elem, name, extra, styles) {
  30702. var val, num, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name);
  30703. if (!isCustomProp) {
  30704. name = finalPropName(origName);
  30705. }
  30706. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30707. if (hooks3 && "get" in hooks3) {
  30708. val = hooks3.get(elem, true, extra);
  30709. }
  30710. if (val === void 0) {
  30711. val = curCSS(elem, name, styles);
  30712. }
  30713. if (val === "normal" && name in cssNormalTransform) {
  30714. val = cssNormalTransform[name];
  30715. }
  30716. if (extra === "" || extra) {
  30717. num = parseFloat(val);
  30718. return extra === true || isFinite(num) ? num || 0 : val;
  30719. }
  30720. return val;
  30721. }
  30722. });
  30723. jQuery.each(["height", "width"], function(_i, dimension) {
  30724. jQuery.cssHooks[dimension] = {
  30725. get: function(elem, computed2, extra) {
  30726. if (computed2) {
  30727. return rdisplayswap.test(jQuery.css(elem, "display")) && (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() {
  30728. return getWidthOrHeight(elem, dimension, extra);
  30729. }) : getWidthOrHeight(elem, dimension, extra);
  30730. }
  30731. },
  30732. set: function(elem, value, extra) {
  30733. 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(
  30734. elem,
  30735. dimension,
  30736. extra,
  30737. isBorderBox,
  30738. styles
  30739. ) : 0;
  30740. if (isBorderBox && scrollboxSizeBuggy) {
  30741. subtract -= Math.ceil(
  30742. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5
  30743. );
  30744. }
  30745. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  30746. elem.style[dimension] = value;
  30747. value = jQuery.css(elem, dimension);
  30748. }
  30749. return setPositiveNumber(elem, value, subtract);
  30750. }
  30751. };
  30752. });
  30753. jQuery.cssHooks.marginLeft = addGetHookIf(
  30754. support.reliableMarginLeft,
  30755. function(elem, computed2) {
  30756. if (computed2) {
  30757. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() {
  30758. return elem.getBoundingClientRect().left;
  30759. })) + "px";
  30760. }
  30761. }
  30762. );
  30763. jQuery.each({
  30764. margin: "",
  30765. padding: "",
  30766. border: "Width"
  30767. }, function(prefix, suffix) {
  30768. jQuery.cssHooks[prefix + suffix] = {
  30769. expand: function(value) {
  30770. var i2 = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value];
  30771. for (; i2 < 4; i2++) {
  30772. expanded[prefix + cssExpand[i2] + suffix] = parts[i2] || parts[i2 - 2] || parts[0];
  30773. }
  30774. return expanded;
  30775. }
  30776. };
  30777. if (prefix !== "margin") {
  30778. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  30779. }
  30780. });
  30781. jQuery.fn.extend({
  30782. css: function(name, value) {
  30783. return access(this, function(elem, name2, value2) {
  30784. var styles, len, map = {}, i2 = 0;
  30785. if (Array.isArray(name2)) {
  30786. styles = getStyles(elem);
  30787. len = name2.length;
  30788. for (; i2 < len; i2++) {
  30789. map[name2[i2]] = jQuery.css(elem, name2[i2], false, styles);
  30790. }
  30791. return map;
  30792. }
  30793. return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2);
  30794. }, name, value, arguments.length > 1);
  30795. }
  30796. });
  30797. function Tween(elem, options2, prop, end, easing) {
  30798. return new Tween.prototype.init(elem, options2, prop, end, easing);
  30799. }
  30800. jQuery.Tween = Tween;
  30801. Tween.prototype = {
  30802. constructor: Tween,
  30803. init: function(elem, options2, prop, end, easing, unit) {
  30804. this.elem = elem;
  30805. this.prop = prop;
  30806. this.easing = easing || jQuery.easing._default;
  30807. this.options = options2;
  30808. this.start = this.now = this.cur();
  30809. this.end = end;
  30810. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  30811. },
  30812. cur: function() {
  30813. var hooks3 = Tween.propHooks[this.prop];
  30814. return hooks3 && hooks3.get ? hooks3.get(this) : Tween.propHooks._default.get(this);
  30815. },
  30816. run: function(percent) {
  30817. var eased, hooks3 = Tween.propHooks[this.prop];
  30818. if (this.options.duration) {
  30819. this.pos = eased = jQuery.easing[this.easing](
  30820. percent,
  30821. this.options.duration * percent,
  30822. 0,
  30823. 1,
  30824. this.options.duration
  30825. );
  30826. } else {
  30827. this.pos = eased = percent;
  30828. }
  30829. this.now = (this.end - this.start) * eased + this.start;
  30830. if (this.options.step) {
  30831. this.options.step.call(this.elem, this.now, this);
  30832. }
  30833. if (hooks3 && hooks3.set) {
  30834. hooks3.set(this);
  30835. } else {
  30836. Tween.propHooks._default.set(this);
  30837. }
  30838. return this;
  30839. }
  30840. };
  30841. Tween.prototype.init.prototype = Tween.prototype;
  30842. Tween.propHooks = {
  30843. _default: {
  30844. get: function(tween) {
  30845. var result;
  30846. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  30847. return tween.elem[tween.prop];
  30848. }
  30849. result = jQuery.css(tween.elem, tween.prop, "");
  30850. return !result || result === "auto" ? 0 : result;
  30851. },
  30852. set: function(tween) {
  30853. if (jQuery.fx.step[tween.prop]) {
  30854. jQuery.fx.step[tween.prop](tween);
  30855. } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {
  30856. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  30857. } else {
  30858. tween.elem[tween.prop] = tween.now;
  30859. }
  30860. }
  30861. }
  30862. };
  30863. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  30864. set: function(tween) {
  30865. if (tween.elem.nodeType && tween.elem.parentNode) {
  30866. tween.elem[tween.prop] = tween.now;
  30867. }
  30868. }
  30869. };
  30870. jQuery.easing = {
  30871. linear: function(p) {
  30872. return p;
  30873. },
  30874. swing: function(p) {
  30875. return 0.5 - Math.cos(p * Math.PI) / 2;
  30876. },
  30877. _default: "swing"
  30878. };
  30879. jQuery.fx = Tween.prototype.init;
  30880. jQuery.fx.step = {};
  30881. var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;
  30882. function schedule() {
  30883. if (inProgress) {
  30884. if (document2.hidden === false && window2.requestAnimationFrame) {
  30885. window2.requestAnimationFrame(schedule);
  30886. } else {
  30887. window2.setTimeout(schedule, jQuery.fx.interval);
  30888. }
  30889. jQuery.fx.tick();
  30890. }
  30891. }
  30892. function createFxNow() {
  30893. window2.setTimeout(function() {
  30894. fxNow = void 0;
  30895. });
  30896. return fxNow = Date.now();
  30897. }
  30898. function genFx(type2, includeWidth) {
  30899. var which, i2 = 0, attrs = { height: type2 };
  30900. includeWidth = includeWidth ? 1 : 0;
  30901. for (; i2 < 4; i2 += 2 - includeWidth) {
  30902. which = cssExpand[i2];
  30903. attrs["margin" + which] = attrs["padding" + which] = type2;
  30904. }
  30905. if (includeWidth) {
  30906. attrs.opacity = attrs.width = type2;
  30907. }
  30908. return attrs;
  30909. }
  30910. function createTween(value, prop, animation) {
  30911. var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index2 = 0, length = collection.length;
  30912. for (; index2 < length; index2++) {
  30913. if (tween = collection[index2].call(animation, prop, value)) {
  30914. return tween;
  30915. }
  30916. }
  30917. }
  30918. function defaultPrefilter(elem, props, opts) {
  30919. 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");
  30920. if (!opts.queue) {
  30921. hooks3 = jQuery._queueHooks(elem, "fx");
  30922. if (hooks3.unqueued == null) {
  30923. hooks3.unqueued = 0;
  30924. oldfire = hooks3.empty.fire;
  30925. hooks3.empty.fire = function() {
  30926. if (!hooks3.unqueued) {
  30927. oldfire();
  30928. }
  30929. };
  30930. }
  30931. hooks3.unqueued++;
  30932. anim.always(function() {
  30933. anim.always(function() {
  30934. hooks3.unqueued--;
  30935. if (!jQuery.queue(elem, "fx").length) {
  30936. hooks3.empty.fire();
  30937. }
  30938. });
  30939. });
  30940. }
  30941. for (prop in props) {
  30942. value = props[prop];
  30943. if (rfxtypes.test(value)) {
  30944. delete props[prop];
  30945. toggle = toggle || value === "toggle";
  30946. if (value === (hidden ? "hide" : "show")) {
  30947. if (value === "show" && dataShow && dataShow[prop] !== void 0) {
  30948. hidden = true;
  30949. } else {
  30950. continue;
  30951. }
  30952. }
  30953. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  30954. }
  30955. }
  30956. propTween = !jQuery.isEmptyObject(props);
  30957. if (!propTween && jQuery.isEmptyObject(orig)) {
  30958. return;
  30959. }
  30960. if (isBox && elem.nodeType === 1) {
  30961. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  30962. restoreDisplay = dataShow && dataShow.display;
  30963. if (restoreDisplay == null) {
  30964. restoreDisplay = dataPriv.get(elem, "display");
  30965. }
  30966. display = jQuery.css(elem, "display");
  30967. if (display === "none") {
  30968. if (restoreDisplay) {
  30969. display = restoreDisplay;
  30970. } else {
  30971. showHide([elem], true);
  30972. restoreDisplay = elem.style.display || restoreDisplay;
  30973. display = jQuery.css(elem, "display");
  30974. showHide([elem]);
  30975. }
  30976. }
  30977. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  30978. if (jQuery.css(elem, "float") === "none") {
  30979. if (!propTween) {
  30980. anim.done(function() {
  30981. style.display = restoreDisplay;
  30982. });
  30983. if (restoreDisplay == null) {
  30984. display = style.display;
  30985. restoreDisplay = display === "none" ? "" : display;
  30986. }
  30987. }
  30988. style.display = "inline-block";
  30989. }
  30990. }
  30991. }
  30992. if (opts.overflow) {
  30993. style.overflow = "hidden";
  30994. anim.always(function() {
  30995. style.overflow = opts.overflow[0];
  30996. style.overflowX = opts.overflow[1];
  30997. style.overflowY = opts.overflow[2];
  30998. });
  30999. }
  31000. propTween = false;
  31001. for (prop in orig) {
  31002. if (!propTween) {
  31003. if (dataShow) {
  31004. if ("hidden" in dataShow) {
  31005. hidden = dataShow.hidden;
  31006. }
  31007. } else {
  31008. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  31009. }
  31010. if (toggle) {
  31011. dataShow.hidden = !hidden;
  31012. }
  31013. if (hidden) {
  31014. showHide([elem], true);
  31015. }
  31016. anim.done(function() {
  31017. if (!hidden) {
  31018. showHide([elem]);
  31019. }
  31020. dataPriv.remove(elem, "fxshow");
  31021. for (prop in orig) {
  31022. jQuery.style(elem, prop, orig[prop]);
  31023. }
  31024. });
  31025. }
  31026. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  31027. if (!(prop in dataShow)) {
  31028. dataShow[prop] = propTween.start;
  31029. if (hidden) {
  31030. propTween.end = propTween.start;
  31031. propTween.start = 0;
  31032. }
  31033. }
  31034. }
  31035. }
  31036. function propFilter(props, specialEasing) {
  31037. var index2, name, easing, value, hooks3;
  31038. for (index2 in props) {
  31039. name = camelCase3(index2);
  31040. easing = specialEasing[name];
  31041. value = props[index2];
  31042. if (Array.isArray(value)) {
  31043. easing = value[1];
  31044. value = props[index2] = value[0];
  31045. }
  31046. if (index2 !== name) {
  31047. props[name] = value;
  31048. delete props[index2];
  31049. }
  31050. hooks3 = jQuery.cssHooks[name];
  31051. if (hooks3 && "expand" in hooks3) {
  31052. value = hooks3.expand(value);
  31053. delete props[name];
  31054. for (index2 in value) {
  31055. if (!(index2 in props)) {
  31056. props[index2] = value[index2];
  31057. specialEasing[index2] = easing;
  31058. }
  31059. }
  31060. } else {
  31061. specialEasing[name] = easing;
  31062. }
  31063. }
  31064. }
  31065. function Animation(elem, properties, options2) {
  31066. var result, stopped, index2 = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function() {
  31067. delete tick.elem;
  31068. }), tick = function() {
  31069. if (stopped) {
  31070. return false;
  31071. }
  31072. 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;
  31073. for (; index3 < length2; index3++) {
  31074. animation.tweens[index3].run(percent);
  31075. }
  31076. deferred.notifyWith(elem, [animation, percent, remaining]);
  31077. if (percent < 1 && length2) {
  31078. return remaining;
  31079. }
  31080. if (!length2) {
  31081. deferred.notifyWith(elem, [animation, 1, 0]);
  31082. }
  31083. deferred.resolveWith(elem, [animation]);
  31084. return false;
  31085. }, animation = deferred.promise({
  31086. elem,
  31087. props: jQuery.extend({}, properties),
  31088. opts: jQuery.extend(true, {
  31089. specialEasing: {},
  31090. easing: jQuery.easing._default
  31091. }, options2),
  31092. originalProperties: properties,
  31093. originalOptions: options2,
  31094. startTime: fxNow || createFxNow(),
  31095. duration: options2.duration,
  31096. tweens: [],
  31097. createTween: function(prop, end) {
  31098. var tween = jQuery.Tween(
  31099. elem,
  31100. animation.opts,
  31101. prop,
  31102. end,
  31103. animation.opts.specialEasing[prop] || animation.opts.easing
  31104. );
  31105. animation.tweens.push(tween);
  31106. return tween;
  31107. },
  31108. stop: function(gotoEnd) {
  31109. var index3 = 0, length2 = gotoEnd ? animation.tweens.length : 0;
  31110. if (stopped) {
  31111. return this;
  31112. }
  31113. stopped = true;
  31114. for (; index3 < length2; index3++) {
  31115. animation.tweens[index3].run(1);
  31116. }
  31117. if (gotoEnd) {
  31118. deferred.notifyWith(elem, [animation, 1, 0]);
  31119. deferred.resolveWith(elem, [animation, gotoEnd]);
  31120. } else {
  31121. deferred.rejectWith(elem, [animation, gotoEnd]);
  31122. }
  31123. return this;
  31124. }
  31125. }), props = animation.props;
  31126. propFilter(props, animation.opts.specialEasing);
  31127. for (; index2 < length; index2++) {
  31128. result = Animation.prefilters[index2].call(animation, elem, props, animation.opts);
  31129. if (result) {
  31130. if (isFunction2(result.stop)) {
  31131. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  31132. }
  31133. return result;
  31134. }
  31135. }
  31136. jQuery.map(props, createTween, animation);
  31137. if (isFunction2(animation.opts.start)) {
  31138. animation.opts.start.call(elem, animation);
  31139. }
  31140. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  31141. jQuery.fx.timer(
  31142. jQuery.extend(tick, {
  31143. elem,
  31144. anim: animation,
  31145. queue: animation.opts.queue
  31146. })
  31147. );
  31148. return animation;
  31149. }
  31150. jQuery.Animation = jQuery.extend(Animation, {
  31151. tweeners: {
  31152. "*": [function(prop, value) {
  31153. var tween = this.createTween(prop, value);
  31154. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  31155. return tween;
  31156. }]
  31157. },
  31158. tweener: function(props, callback2) {
  31159. if (isFunction2(props)) {
  31160. callback2 = props;
  31161. props = ["*"];
  31162. } else {
  31163. props = props.match(rnothtmlwhite);
  31164. }
  31165. var prop, index2 = 0, length = props.length;
  31166. for (; index2 < length; index2++) {
  31167. prop = props[index2];
  31168. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  31169. Animation.tweeners[prop].unshift(callback2);
  31170. }
  31171. },
  31172. prefilters: [defaultPrefilter],
  31173. prefilter: function(callback2, prepend) {
  31174. if (prepend) {
  31175. Animation.prefilters.unshift(callback2);
  31176. } else {
  31177. Animation.prefilters.push(callback2);
  31178. }
  31179. }
  31180. });
  31181. jQuery.speed = function(speed, easing, fn2) {
  31182. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  31183. complete: fn2 || !fn2 && easing || isFunction2(speed) && speed,
  31184. duration: speed,
  31185. easing: fn2 && easing || easing && !isFunction2(easing) && easing
  31186. };
  31187. if (jQuery.fx.off) {
  31188. opt.duration = 0;
  31189. } else {
  31190. if (typeof opt.duration !== "number") {
  31191. if (opt.duration in jQuery.fx.speeds) {
  31192. opt.duration = jQuery.fx.speeds[opt.duration];
  31193. } else {
  31194. opt.duration = jQuery.fx.speeds._default;
  31195. }
  31196. }
  31197. }
  31198. if (opt.queue == null || opt.queue === true) {
  31199. opt.queue = "fx";
  31200. }
  31201. opt.old = opt.complete;
  31202. opt.complete = function() {
  31203. if (isFunction2(opt.old)) {
  31204. opt.old.call(this);
  31205. }
  31206. if (opt.queue) {
  31207. jQuery.dequeue(this, opt.queue);
  31208. }
  31209. };
  31210. return opt;
  31211. };
  31212. jQuery.fn.extend({
  31213. fadeTo: function(speed, to, easing, callback2) {
  31214. return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback2);
  31215. },
  31216. animate: function(prop, speed, easing, callback2) {
  31217. var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback2), doAnimation = function() {
  31218. var anim = Animation(this, jQuery.extend({}, prop), optall);
  31219. if (empty || dataPriv.get(this, "finish")) {
  31220. anim.stop(true);
  31221. }
  31222. };
  31223. doAnimation.finish = doAnimation;
  31224. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  31225. },
  31226. stop: function(type2, clearQueue, gotoEnd) {
  31227. var stopQueue = function(hooks3) {
  31228. var stop = hooks3.stop;
  31229. delete hooks3.stop;
  31230. stop(gotoEnd);
  31231. };
  31232. if (typeof type2 !== "string") {
  31233. gotoEnd = clearQueue;
  31234. clearQueue = type2;
  31235. type2 = void 0;
  31236. }
  31237. if (clearQueue) {
  31238. this.queue(type2 || "fx", []);
  31239. }
  31240. return this.each(function() {
  31241. var dequeue3 = true, index2 = type2 != null && type2 + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this);
  31242. if (index2) {
  31243. if (data[index2] && data[index2].stop) {
  31244. stopQueue(data[index2]);
  31245. }
  31246. } else {
  31247. for (index2 in data) {
  31248. if (data[index2] && data[index2].stop && rrun.test(index2)) {
  31249. stopQueue(data[index2]);
  31250. }
  31251. }
  31252. }
  31253. for (index2 = timers.length; index2--; ) {
  31254. if (timers[index2].elem === this && (type2 == null || timers[index2].queue === type2)) {
  31255. timers[index2].anim.stop(gotoEnd);
  31256. dequeue3 = false;
  31257. timers.splice(index2, 1);
  31258. }
  31259. }
  31260. if (dequeue3 || !gotoEnd) {
  31261. jQuery.dequeue(this, type2);
  31262. }
  31263. });
  31264. },
  31265. finish: function(type2) {
  31266. if (type2 !== false) {
  31267. type2 = type2 || "fx";
  31268. }
  31269. return this.each(function() {
  31270. var index2, data = dataPriv.get(this), queue = data[type2 + "queue"], hooks3 = data[type2 + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0;
  31271. data.finish = true;
  31272. jQuery.queue(this, type2, []);
  31273. if (hooks3 && hooks3.stop) {
  31274. hooks3.stop.call(this, true);
  31275. }
  31276. for (index2 = timers.length; index2--; ) {
  31277. if (timers[index2].elem === this && timers[index2].queue === type2) {
  31278. timers[index2].anim.stop(true);
  31279. timers.splice(index2, 1);
  31280. }
  31281. }
  31282. for (index2 = 0; index2 < length; index2++) {
  31283. if (queue[index2] && queue[index2].finish) {
  31284. queue[index2].finish.call(this);
  31285. }
  31286. }
  31287. delete data.finish;
  31288. });
  31289. }
  31290. });
  31291. jQuery.each(["toggle", "show", "hide"], function(_i, name) {
  31292. var cssFn = jQuery.fn[name];
  31293. jQuery.fn[name] = function(speed, easing, callback2) {
  31294. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback2);
  31295. };
  31296. });
  31297. jQuery.each({
  31298. slideDown: genFx("show"),
  31299. slideUp: genFx("hide"),
  31300. slideToggle: genFx("toggle"),
  31301. fadeIn: { opacity: "show" },
  31302. fadeOut: { opacity: "hide" },
  31303. fadeToggle: { opacity: "toggle" }
  31304. }, function(name, props) {
  31305. jQuery.fn[name] = function(speed, easing, callback2) {
  31306. return this.animate(props, speed, easing, callback2);
  31307. };
  31308. });
  31309. jQuery.timers = [];
  31310. jQuery.fx.tick = function() {
  31311. var timer, i2 = 0, timers = jQuery.timers;
  31312. fxNow = Date.now();
  31313. for (; i2 < timers.length; i2++) {
  31314. timer = timers[i2];
  31315. if (!timer() && timers[i2] === timer) {
  31316. timers.splice(i2--, 1);
  31317. }
  31318. }
  31319. if (!timers.length) {
  31320. jQuery.fx.stop();
  31321. }
  31322. fxNow = void 0;
  31323. };
  31324. jQuery.fx.timer = function(timer) {
  31325. jQuery.timers.push(timer);
  31326. jQuery.fx.start();
  31327. };
  31328. jQuery.fx.interval = 13;
  31329. jQuery.fx.start = function() {
  31330. if (inProgress) {
  31331. return;
  31332. }
  31333. inProgress = true;
  31334. schedule();
  31335. };
  31336. jQuery.fx.stop = function() {
  31337. inProgress = null;
  31338. };
  31339. jQuery.fx.speeds = {
  31340. slow: 600,
  31341. fast: 200,
  31342. _default: 400
  31343. };
  31344. jQuery.fn.delay = function(time, type2) {
  31345. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  31346. type2 = type2 || "fx";
  31347. return this.queue(type2, function(next, hooks3) {
  31348. var timeout = window2.setTimeout(next, time);
  31349. hooks3.stop = function() {
  31350. window2.clearTimeout(timeout);
  31351. };
  31352. });
  31353. };
  31354. (function() {
  31355. var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option"));
  31356. input.type = "checkbox";
  31357. support.checkOn = input.value !== "";
  31358. support.optSelected = opt.selected;
  31359. input = document2.createElement("input");
  31360. input.value = "t";
  31361. input.type = "radio";
  31362. support.radioValue = input.value === "t";
  31363. })();
  31364. var boolHook, attrHandle = jQuery.expr.attrHandle;
  31365. jQuery.fn.extend({
  31366. attr: function(name, value) {
  31367. return access(this, jQuery.attr, name, value, arguments.length > 1);
  31368. },
  31369. removeAttr: function(name) {
  31370. return this.each(function() {
  31371. jQuery.removeAttr(this, name);
  31372. });
  31373. }
  31374. });
  31375. jQuery.extend({
  31376. attr: function(elem, name, value) {
  31377. var ret, hooks3, nType = elem.nodeType;
  31378. if (nType === 3 || nType === 8 || nType === 2) {
  31379. return;
  31380. }
  31381. if (typeof elem.getAttribute === "undefined") {
  31382. return jQuery.prop(elem, name, value);
  31383. }
  31384. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31385. hooks3 = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0);
  31386. }
  31387. if (value !== void 0) {
  31388. if (value === null) {
  31389. jQuery.removeAttr(elem, name);
  31390. return;
  31391. }
  31392. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31393. return ret;
  31394. }
  31395. elem.setAttribute(name, value + "");
  31396. return value;
  31397. }
  31398. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31399. return ret;
  31400. }
  31401. ret = jQuery.find.attr(elem, name);
  31402. return ret == null ? void 0 : ret;
  31403. },
  31404. attrHooks: {
  31405. type: {
  31406. set: function(elem, value) {
  31407. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  31408. var val = elem.value;
  31409. elem.setAttribute("type", value);
  31410. if (val) {
  31411. elem.value = val;
  31412. }
  31413. return value;
  31414. }
  31415. }
  31416. }
  31417. },
  31418. removeAttr: function(elem, value) {
  31419. var name, i2 = 0, attrNames = value && value.match(rnothtmlwhite);
  31420. if (attrNames && elem.nodeType === 1) {
  31421. while (name = attrNames[i2++]) {
  31422. elem.removeAttribute(name);
  31423. }
  31424. }
  31425. }
  31426. });
  31427. boolHook = {
  31428. set: function(elem, value, name) {
  31429. if (value === false) {
  31430. jQuery.removeAttr(elem, name);
  31431. } else {
  31432. elem.setAttribute(name, name);
  31433. }
  31434. return name;
  31435. }
  31436. };
  31437. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i, name) {
  31438. var getter = attrHandle[name] || jQuery.find.attr;
  31439. attrHandle[name] = function(elem, name2, isXML) {
  31440. var ret, handle, lowercaseName = name2.toLowerCase();
  31441. if (!isXML) {
  31442. handle = attrHandle[lowercaseName];
  31443. attrHandle[lowercaseName] = ret;
  31444. ret = getter(elem, name2, isXML) != null ? lowercaseName : null;
  31445. attrHandle[lowercaseName] = handle;
  31446. }
  31447. return ret;
  31448. };
  31449. });
  31450. var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
  31451. jQuery.fn.extend({
  31452. prop: function(name, value) {
  31453. return access(this, jQuery.prop, name, value, arguments.length > 1);
  31454. },
  31455. removeProp: function(name) {
  31456. return this.each(function() {
  31457. delete this[jQuery.propFix[name] || name];
  31458. });
  31459. }
  31460. });
  31461. jQuery.extend({
  31462. prop: function(elem, name, value) {
  31463. var ret, hooks3, nType = elem.nodeType;
  31464. if (nType === 3 || nType === 8 || nType === 2) {
  31465. return;
  31466. }
  31467. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31468. name = jQuery.propFix[name] || name;
  31469. hooks3 = jQuery.propHooks[name];
  31470. }
  31471. if (value !== void 0) {
  31472. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31473. return ret;
  31474. }
  31475. return elem[name] = value;
  31476. }
  31477. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31478. return ret;
  31479. }
  31480. return elem[name];
  31481. },
  31482. propHooks: {
  31483. tabIndex: {
  31484. get: function(elem) {
  31485. var tabindex = jQuery.find.attr(elem, "tabindex");
  31486. if (tabindex) {
  31487. return parseInt(tabindex, 10);
  31488. }
  31489. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  31490. return 0;
  31491. }
  31492. return -1;
  31493. }
  31494. }
  31495. },
  31496. propFix: {
  31497. "for": "htmlFor",
  31498. "class": "className"
  31499. }
  31500. });
  31501. if (!support.optSelected) {
  31502. jQuery.propHooks.selected = {
  31503. get: function(elem) {
  31504. var parent = elem.parentNode;
  31505. if (parent && parent.parentNode) {
  31506. parent.parentNode.selectedIndex;
  31507. }
  31508. return null;
  31509. },
  31510. set: function(elem) {
  31511. var parent = elem.parentNode;
  31512. if (parent) {
  31513. parent.selectedIndex;
  31514. if (parent.parentNode) {
  31515. parent.parentNode.selectedIndex;
  31516. }
  31517. }
  31518. }
  31519. };
  31520. }
  31521. jQuery.each([
  31522. "tabIndex",
  31523. "readOnly",
  31524. "maxLength",
  31525. "cellSpacing",
  31526. "cellPadding",
  31527. "rowSpan",
  31528. "colSpan",
  31529. "useMap",
  31530. "frameBorder",
  31531. "contentEditable"
  31532. ], function() {
  31533. jQuery.propFix[this.toLowerCase()] = this;
  31534. });
  31535. function stripAndCollapse(value) {
  31536. var tokens = value.match(rnothtmlwhite) || [];
  31537. return tokens.join(" ");
  31538. }
  31539. function getClass2(elem) {
  31540. return elem.getAttribute && elem.getAttribute("class") || "";
  31541. }
  31542. function classesToArray(value) {
  31543. if (Array.isArray(value)) {
  31544. return value;
  31545. }
  31546. if (typeof value === "string") {
  31547. return value.match(rnothtmlwhite) || [];
  31548. }
  31549. return [];
  31550. }
  31551. jQuery.fn.extend({
  31552. addClass: function(value) {
  31553. var classNames, cur, curValue, className, i2, finalValue;
  31554. if (isFunction2(value)) {
  31555. return this.each(function(j) {
  31556. jQuery(this).addClass(value.call(this, j, getClass2(this)));
  31557. });
  31558. }
  31559. classNames = classesToArray(value);
  31560. if (classNames.length) {
  31561. return this.each(function() {
  31562. curValue = getClass2(this);
  31563. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31564. if (cur) {
  31565. for (i2 = 0; i2 < classNames.length; i2++) {
  31566. className = classNames[i2];
  31567. if (cur.indexOf(" " + className + " ") < 0) {
  31568. cur += className + " ";
  31569. }
  31570. }
  31571. finalValue = stripAndCollapse(cur);
  31572. if (curValue !== finalValue) {
  31573. this.setAttribute("class", finalValue);
  31574. }
  31575. }
  31576. });
  31577. }
  31578. return this;
  31579. },
  31580. removeClass: function(value) {
  31581. var classNames, cur, curValue, className, i2, finalValue;
  31582. if (isFunction2(value)) {
  31583. return this.each(function(j) {
  31584. jQuery(this).removeClass(value.call(this, j, getClass2(this)));
  31585. });
  31586. }
  31587. if (!arguments.length) {
  31588. return this.attr("class", "");
  31589. }
  31590. classNames = classesToArray(value);
  31591. if (classNames.length) {
  31592. return this.each(function() {
  31593. curValue = getClass2(this);
  31594. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31595. if (cur) {
  31596. for (i2 = 0; i2 < classNames.length; i2++) {
  31597. className = classNames[i2];
  31598. while (cur.indexOf(" " + className + " ") > -1) {
  31599. cur = cur.replace(" " + className + " ", " ");
  31600. }
  31601. }
  31602. finalValue = stripAndCollapse(cur);
  31603. if (curValue !== finalValue) {
  31604. this.setAttribute("class", finalValue);
  31605. }
  31606. }
  31607. });
  31608. }
  31609. return this;
  31610. },
  31611. toggleClass: function(value, stateVal) {
  31612. var classNames, className, i2, self2, type2 = typeof value, isValidValue = type2 === "string" || Array.isArray(value);
  31613. if (isFunction2(value)) {
  31614. return this.each(function(i3) {
  31615. jQuery(this).toggleClass(
  31616. value.call(this, i3, getClass2(this), stateVal),
  31617. stateVal
  31618. );
  31619. });
  31620. }
  31621. if (typeof stateVal === "boolean" && isValidValue) {
  31622. return stateVal ? this.addClass(value) : this.removeClass(value);
  31623. }
  31624. classNames = classesToArray(value);
  31625. return this.each(function() {
  31626. if (isValidValue) {
  31627. self2 = jQuery(this);
  31628. for (i2 = 0; i2 < classNames.length; i2++) {
  31629. className = classNames[i2];
  31630. if (self2.hasClass(className)) {
  31631. self2.removeClass(className);
  31632. } else {
  31633. self2.addClass(className);
  31634. }
  31635. }
  31636. } else if (value === void 0 || type2 === "boolean") {
  31637. className = getClass2(this);
  31638. if (className) {
  31639. dataPriv.set(this, "__className__", className);
  31640. }
  31641. if (this.setAttribute) {
  31642. this.setAttribute(
  31643. "class",
  31644. className || value === false ? "" : dataPriv.get(this, "__className__") || ""
  31645. );
  31646. }
  31647. }
  31648. });
  31649. },
  31650. hasClass: function(selector) {
  31651. var className, elem, i2 = 0;
  31652. className = " " + selector + " ";
  31653. while (elem = this[i2++]) {
  31654. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass2(elem)) + " ").indexOf(className) > -1) {
  31655. return true;
  31656. }
  31657. }
  31658. return false;
  31659. }
  31660. });
  31661. var rreturn = /\r/g;
  31662. jQuery.fn.extend({
  31663. val: function(value) {
  31664. var hooks3, ret, valueIsFunction, elem = this[0];
  31665. if (!arguments.length) {
  31666. if (elem) {
  31667. hooks3 = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  31668. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, "value")) !== void 0) {
  31669. return ret;
  31670. }
  31671. ret = elem.value;
  31672. if (typeof ret === "string") {
  31673. return ret.replace(rreturn, "");
  31674. }
  31675. return ret == null ? "" : ret;
  31676. }
  31677. return;
  31678. }
  31679. valueIsFunction = isFunction2(value);
  31680. return this.each(function(i2) {
  31681. var val;
  31682. if (this.nodeType !== 1) {
  31683. return;
  31684. }
  31685. if (valueIsFunction) {
  31686. val = value.call(this, i2, jQuery(this).val());
  31687. } else {
  31688. val = value;
  31689. }
  31690. if (val == null) {
  31691. val = "";
  31692. } else if (typeof val === "number") {
  31693. val += "";
  31694. } else if (Array.isArray(val)) {
  31695. val = jQuery.map(val, function(value2) {
  31696. return value2 == null ? "" : value2 + "";
  31697. });
  31698. }
  31699. hooks3 = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  31700. if (!hooks3 || !("set" in hooks3) || hooks3.set(this, val, "value") === void 0) {
  31701. this.value = val;
  31702. }
  31703. });
  31704. }
  31705. });
  31706. jQuery.extend({
  31707. valHooks: {
  31708. option: {
  31709. get: function(elem) {
  31710. var val = jQuery.find.attr(elem, "value");
  31711. return val != null ? val : stripAndCollapse(jQuery.text(elem));
  31712. }
  31713. },
  31714. select: {
  31715. get: function(elem) {
  31716. var value, option, i2, options2 = elem.options, index2 = elem.selectedIndex, one3 = elem.type === "select-one", values3 = one3 ? null : [], max2 = one3 ? index2 + 1 : options2.length;
  31717. if (index2 < 0) {
  31718. i2 = max2;
  31719. } else {
  31720. i2 = one3 ? index2 : 0;
  31721. }
  31722. for (; i2 < max2; i2++) {
  31723. option = options2[i2];
  31724. if ((option.selected || i2 === index2) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  31725. value = jQuery(option).val();
  31726. if (one3) {
  31727. return value;
  31728. }
  31729. values3.push(value);
  31730. }
  31731. }
  31732. return values3;
  31733. },
  31734. set: function(elem, value) {
  31735. var optionSet, option, options2 = elem.options, values3 = jQuery.makeArray(value), i2 = options2.length;
  31736. while (i2--) {
  31737. option = options2[i2];
  31738. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values3) > -1) {
  31739. optionSet = true;
  31740. }
  31741. }
  31742. if (!optionSet) {
  31743. elem.selectedIndex = -1;
  31744. }
  31745. return values3;
  31746. }
  31747. }
  31748. }
  31749. });
  31750. jQuery.each(["radio", "checkbox"], function() {
  31751. jQuery.valHooks[this] = {
  31752. set: function(elem, value) {
  31753. if (Array.isArray(value)) {
  31754. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  31755. }
  31756. }
  31757. };
  31758. if (!support.checkOn) {
  31759. jQuery.valHooks[this].get = function(elem) {
  31760. return elem.getAttribute("value") === null ? "on" : elem.value;
  31761. };
  31762. }
  31763. });
  31764. var location = window2.location;
  31765. var nonce = { guid: Date.now() };
  31766. var rquery = /\?/;
  31767. jQuery.parseXML = function(data) {
  31768. var xml, parserErrorElem;
  31769. if (!data || typeof data !== "string") {
  31770. return null;
  31771. }
  31772. try {
  31773. xml = new window2.DOMParser().parseFromString(data, "text/xml");
  31774. } catch (e) {
  31775. }
  31776. parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
  31777. if (!xml || parserErrorElem) {
  31778. jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function(el) {
  31779. return el.textContent;
  31780. }).join("\n") : data));
  31781. }
  31782. return xml;
  31783. };
  31784. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) {
  31785. e.stopPropagation();
  31786. };
  31787. jQuery.extend(jQuery.event, {
  31788. trigger: function(event2, data, elem, onlyHandlers) {
  31789. 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(".") : [];
  31790. cur = lastElement = tmp = elem = elem || document2;
  31791. if (elem.nodeType === 3 || elem.nodeType === 8) {
  31792. return;
  31793. }
  31794. if (rfocusMorph.test(type2 + jQuery.event.triggered)) {
  31795. return;
  31796. }
  31797. if (type2.indexOf(".") > -1) {
  31798. namespaces = type2.split(".");
  31799. type2 = namespaces.shift();
  31800. namespaces.sort();
  31801. }
  31802. ontype = type2.indexOf(":") < 0 && "on" + type2;
  31803. event2 = event2[jQuery.expando] ? event2 : new jQuery.Event(type2, typeof event2 === "object" && event2);
  31804. event2.isTrigger = onlyHandlers ? 2 : 3;
  31805. event2.namespace = namespaces.join(".");
  31806. event2.rnamespace = event2.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  31807. event2.result = void 0;
  31808. if (!event2.target) {
  31809. event2.target = elem;
  31810. }
  31811. data = data == null ? [event2] : jQuery.makeArray(data, [event2]);
  31812. special = jQuery.event.special[type2] || {};
  31813. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  31814. return;
  31815. }
  31816. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  31817. bubbleType = special.delegateType || type2;
  31818. if (!rfocusMorph.test(bubbleType + type2)) {
  31819. cur = cur.parentNode;
  31820. }
  31821. for (; cur; cur = cur.parentNode) {
  31822. eventPath.push(cur);
  31823. tmp = cur;
  31824. }
  31825. if (tmp === (elem.ownerDocument || document2)) {
  31826. eventPath.push(tmp.defaultView || tmp.parentWindow || window2);
  31827. }
  31828. }
  31829. i2 = 0;
  31830. while ((cur = eventPath[i2++]) && !event2.isPropagationStopped()) {
  31831. lastElement = cur;
  31832. event2.type = i2 > 1 ? bubbleType : special.bindType || type2;
  31833. handle = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event2.type] && dataPriv.get(cur, "handle");
  31834. if (handle) {
  31835. handle.apply(cur, data);
  31836. }
  31837. handle = ontype && cur[ontype];
  31838. if (handle && handle.apply && acceptData(cur)) {
  31839. event2.result = handle.apply(cur, data);
  31840. if (event2.result === false) {
  31841. event2.preventDefault();
  31842. }
  31843. }
  31844. }
  31845. event2.type = type2;
  31846. if (!onlyHandlers && !event2.isDefaultPrevented()) {
  31847. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  31848. if (ontype && isFunction2(elem[type2]) && !isWindow(elem)) {
  31849. tmp = elem[ontype];
  31850. if (tmp) {
  31851. elem[ontype] = null;
  31852. }
  31853. jQuery.event.triggered = type2;
  31854. if (event2.isPropagationStopped()) {
  31855. lastElement.addEventListener(type2, stopPropagationCallback);
  31856. }
  31857. elem[type2]();
  31858. if (event2.isPropagationStopped()) {
  31859. lastElement.removeEventListener(type2, stopPropagationCallback);
  31860. }
  31861. jQuery.event.triggered = void 0;
  31862. if (tmp) {
  31863. elem[ontype] = tmp;
  31864. }
  31865. }
  31866. }
  31867. }
  31868. return event2.result;
  31869. },
  31870. simulate: function(type2, elem, event2) {
  31871. var e = jQuery.extend(
  31872. new jQuery.Event(),
  31873. event2,
  31874. {
  31875. type: type2,
  31876. isSimulated: true
  31877. }
  31878. );
  31879. jQuery.event.trigger(e, null, elem);
  31880. }
  31881. });
  31882. jQuery.fn.extend({
  31883. trigger: function(type2, data) {
  31884. return this.each(function() {
  31885. jQuery.event.trigger(type2, data, this);
  31886. });
  31887. },
  31888. triggerHandler: function(type2, data) {
  31889. var elem = this[0];
  31890. if (elem) {
  31891. return jQuery.event.trigger(type2, data, elem, true);
  31892. }
  31893. }
  31894. });
  31895. var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
  31896. function buildParams(prefix, obj, traditional, add) {
  31897. var name;
  31898. if (Array.isArray(obj)) {
  31899. jQuery.each(obj, function(i2, v) {
  31900. if (traditional || rbracket.test(prefix)) {
  31901. add(prefix, v);
  31902. } else {
  31903. buildParams(
  31904. prefix + "[" + (typeof v === "object" && v != null ? i2 : "") + "]",
  31905. v,
  31906. traditional,
  31907. add
  31908. );
  31909. }
  31910. });
  31911. } else if (!traditional && toType(obj) === "object") {
  31912. for (name in obj) {
  31913. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  31914. }
  31915. } else {
  31916. add(prefix, obj);
  31917. }
  31918. }
  31919. jQuery.param = function(a, traditional) {
  31920. var prefix, s = [], add = function(key, valueOrFunction) {
  31921. var value = isFunction2(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  31922. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  31923. };
  31924. if (a == null) {
  31925. return "";
  31926. }
  31927. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  31928. jQuery.each(a, function() {
  31929. add(this.name, this.value);
  31930. });
  31931. } else {
  31932. for (prefix in a) {
  31933. buildParams(prefix, a[prefix], traditional, add);
  31934. }
  31935. }
  31936. return s.join("&");
  31937. };
  31938. jQuery.fn.extend({
  31939. serialize: function() {
  31940. return jQuery.param(this.serializeArray());
  31941. },
  31942. serializeArray: function() {
  31943. return this.map(function() {
  31944. var elements = jQuery.prop(this, "elements");
  31945. return elements ? jQuery.makeArray(elements) : this;
  31946. }).filter(function() {
  31947. var type2 = this.type;
  31948. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type2) && (this.checked || !rcheckableType.test(type2));
  31949. }).map(function(_i, elem) {
  31950. var val = jQuery(this).val();
  31951. if (val == null) {
  31952. return null;
  31953. }
  31954. if (Array.isArray(val)) {
  31955. return jQuery.map(val, function(val2) {
  31956. return { name: elem.name, value: val2.replace(rCRLF, "\r\n") };
  31957. });
  31958. }
  31959. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  31960. }).get();
  31961. }
  31962. });
  31963. 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");
  31964. originAnchor.href = location.href;
  31965. function addToPrefiltersOrTransports(structure) {
  31966. return function(dataTypeExpression, func) {
  31967. if (typeof dataTypeExpression !== "string") {
  31968. func = dataTypeExpression;
  31969. dataTypeExpression = "*";
  31970. }
  31971. var dataType, i2 = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  31972. if (isFunction2(func)) {
  31973. while (dataType = dataTypes[i2++]) {
  31974. if (dataType[0] === "+") {
  31975. dataType = dataType.slice(1) || "*";
  31976. (structure[dataType] = structure[dataType] || []).unshift(func);
  31977. } else {
  31978. (structure[dataType] = structure[dataType] || []).push(func);
  31979. }
  31980. }
  31981. }
  31982. };
  31983. }
  31984. function inspectPrefiltersOrTransports(structure, options2, originalOptions, jqXHR) {
  31985. var inspected = {}, seekingTransport = structure === transports;
  31986. function inspect(dataType) {
  31987. var selected;
  31988. inspected[dataType] = true;
  31989. jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
  31990. var dataTypeOrTransport = prefilterOrFactory(options2, originalOptions, jqXHR);
  31991. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  31992. options2.dataTypes.unshift(dataTypeOrTransport);
  31993. inspect(dataTypeOrTransport);
  31994. return false;
  31995. } else if (seekingTransport) {
  31996. return !(selected = dataTypeOrTransport);
  31997. }
  31998. });
  31999. return selected;
  32000. }
  32001. return inspect(options2.dataTypes[0]) || !inspected["*"] && inspect("*");
  32002. }
  32003. function ajaxExtend(target, src) {
  32004. var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};
  32005. for (key in src) {
  32006. if (src[key] !== void 0) {
  32007. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  32008. }
  32009. }
  32010. if (deep) {
  32011. jQuery.extend(true, target, deep);
  32012. }
  32013. return target;
  32014. }
  32015. function ajaxHandleResponses(s, jqXHR, responses) {
  32016. var ct2, type2, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;
  32017. while (dataTypes[0] === "*") {
  32018. dataTypes.shift();
  32019. if (ct2 === void 0) {
  32020. ct2 = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  32021. }
  32022. }
  32023. if (ct2) {
  32024. for (type2 in contents) {
  32025. if (contents[type2] && contents[type2].test(ct2)) {
  32026. dataTypes.unshift(type2);
  32027. break;
  32028. }
  32029. }
  32030. }
  32031. if (dataTypes[0] in responses) {
  32032. finalDataType = dataTypes[0];
  32033. } else {
  32034. for (type2 in responses) {
  32035. if (!dataTypes[0] || s.converters[type2 + " " + dataTypes[0]]) {
  32036. finalDataType = type2;
  32037. break;
  32038. }
  32039. if (!firstDataType) {
  32040. firstDataType = type2;
  32041. }
  32042. }
  32043. finalDataType = finalDataType || firstDataType;
  32044. }
  32045. if (finalDataType) {
  32046. if (finalDataType !== dataTypes[0]) {
  32047. dataTypes.unshift(finalDataType);
  32048. }
  32049. return responses[finalDataType];
  32050. }
  32051. }
  32052. function ajaxConvert(s, response, jqXHR, isSuccess) {
  32053. var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice();
  32054. if (dataTypes[1]) {
  32055. for (conv in s.converters) {
  32056. converters[conv.toLowerCase()] = s.converters[conv];
  32057. }
  32058. }
  32059. current = dataTypes.shift();
  32060. while (current) {
  32061. if (s.responseFields[current]) {
  32062. jqXHR[s.responseFields[current]] = response;
  32063. }
  32064. if (!prev && isSuccess && s.dataFilter) {
  32065. response = s.dataFilter(response, s.dataType);
  32066. }
  32067. prev = current;
  32068. current = dataTypes.shift();
  32069. if (current) {
  32070. if (current === "*") {
  32071. current = prev;
  32072. } else if (prev !== "*" && prev !== current) {
  32073. conv = converters[prev + " " + current] || converters["* " + current];
  32074. if (!conv) {
  32075. for (conv2 in converters) {
  32076. tmp = conv2.split(" ");
  32077. if (tmp[1] === current) {
  32078. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  32079. if (conv) {
  32080. if (conv === true) {
  32081. conv = converters[conv2];
  32082. } else if (converters[conv2] !== true) {
  32083. current = tmp[0];
  32084. dataTypes.unshift(tmp[1]);
  32085. }
  32086. break;
  32087. }
  32088. }
  32089. }
  32090. }
  32091. if (conv !== true) {
  32092. if (conv && s.throws) {
  32093. response = conv(response);
  32094. } else {
  32095. try {
  32096. response = conv(response);
  32097. } catch (e) {
  32098. return {
  32099. state: "parsererror",
  32100. error: conv ? e : "No conversion from " + prev + " to " + current
  32101. };
  32102. }
  32103. }
  32104. }
  32105. }
  32106. }
  32107. }
  32108. return { state: "success", data: response };
  32109. }
  32110. jQuery.extend({
  32111. active: 0,
  32112. lastModified: {},
  32113. etag: {},
  32114. ajaxSettings: {
  32115. url: location.href,
  32116. type: "GET",
  32117. isLocal: rlocalProtocol.test(location.protocol),
  32118. global: true,
  32119. processData: true,
  32120. async: true,
  32121. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  32122. accepts: {
  32123. "*": allTypes,
  32124. text: "text/plain",
  32125. html: "text/html",
  32126. xml: "application/xml, text/xml",
  32127. json: "application/json, text/javascript"
  32128. },
  32129. contents: {
  32130. xml: /\bxml\b/,
  32131. html: /\bhtml/,
  32132. json: /\bjson\b/
  32133. },
  32134. responseFields: {
  32135. xml: "responseXML",
  32136. text: "responseText",
  32137. json: "responseJSON"
  32138. },
  32139. converters: {
  32140. "* text": String,
  32141. "text html": true,
  32142. "text json": JSON.parse,
  32143. "text xml": jQuery.parseXML
  32144. },
  32145. flatOptions: {
  32146. url: true,
  32147. context: true
  32148. }
  32149. },
  32150. ajaxSetup: function(target, settings) {
  32151. return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target);
  32152. },
  32153. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  32154. ajaxTransport: addToPrefiltersOrTransports(transports),
  32155. ajax: function(url, options2) {
  32156. if (typeof url === "object") {
  32157. options2 = url;
  32158. url = void 0;
  32159. }
  32160. options2 = options2 || {};
  32161. 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 = {
  32162. readyState: 0,
  32163. getResponseHeader: function(key) {
  32164. var match;
  32165. if (completed2) {
  32166. if (!responseHeaders) {
  32167. responseHeaders = {};
  32168. while (match = rheaders.exec(responseHeadersString)) {
  32169. responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]);
  32170. }
  32171. }
  32172. match = responseHeaders[key.toLowerCase() + " "];
  32173. }
  32174. return match == null ? null : match.join(", ");
  32175. },
  32176. getAllResponseHeaders: function() {
  32177. return completed2 ? responseHeadersString : null;
  32178. },
  32179. setRequestHeader: function(name, value) {
  32180. if (completed2 == null) {
  32181. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  32182. requestHeaders[name] = value;
  32183. }
  32184. return this;
  32185. },
  32186. overrideMimeType: function(type2) {
  32187. if (completed2 == null) {
  32188. s.mimeType = type2;
  32189. }
  32190. return this;
  32191. },
  32192. statusCode: function(map) {
  32193. var code;
  32194. if (map) {
  32195. if (completed2) {
  32196. jqXHR.always(map[jqXHR.status]);
  32197. } else {
  32198. for (code in map) {
  32199. statusCode[code] = [statusCode[code], map[code]];
  32200. }
  32201. }
  32202. }
  32203. return this;
  32204. },
  32205. abort: function(statusText) {
  32206. var finalText = statusText || strAbort;
  32207. if (transport) {
  32208. transport.abort(finalText);
  32209. }
  32210. done(0, finalText);
  32211. return this;
  32212. }
  32213. };
  32214. deferred.promise(jqXHR);
  32215. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  32216. s.type = options2.method || options2.type || s.method || s.type;
  32217. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  32218. if (s.crossDomain == null) {
  32219. urlAnchor = document2.createElement("a");
  32220. try {
  32221. urlAnchor.href = s.url;
  32222. urlAnchor.href = urlAnchor.href;
  32223. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  32224. } catch (e) {
  32225. s.crossDomain = true;
  32226. }
  32227. }
  32228. if (s.data && s.processData && typeof s.data !== "string") {
  32229. s.data = jQuery.param(s.data, s.traditional);
  32230. }
  32231. inspectPrefiltersOrTransports(prefilters, s, options2, jqXHR);
  32232. if (completed2) {
  32233. return jqXHR;
  32234. }
  32235. fireGlobals = jQuery.event && s.global;
  32236. if (fireGlobals && jQuery.active++ === 0) {
  32237. jQuery.event.trigger("ajaxStart");
  32238. }
  32239. s.type = s.type.toUpperCase();
  32240. s.hasContent = !rnoContent.test(s.type);
  32241. cacheURL = s.url.replace(rhash, "");
  32242. if (!s.hasContent) {
  32243. uncached = s.url.slice(cacheURL.length);
  32244. if (s.data && (s.processData || typeof s.data === "string")) {
  32245. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  32246. delete s.data;
  32247. }
  32248. if (s.cache === false) {
  32249. cacheURL = cacheURL.replace(rantiCache, "$1");
  32250. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached;
  32251. }
  32252. s.url = cacheURL + uncached;
  32253. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  32254. s.data = s.data.replace(r20, "+");
  32255. }
  32256. if (s.ifModified) {
  32257. if (jQuery.lastModified[cacheURL]) {
  32258. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  32259. }
  32260. if (jQuery.etag[cacheURL]) {
  32261. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  32262. }
  32263. }
  32264. if (s.data && s.hasContent && s.contentType !== false || options2.contentType) {
  32265. jqXHR.setRequestHeader("Content-Type", s.contentType);
  32266. }
  32267. jqXHR.setRequestHeader(
  32268. "Accept",
  32269. s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]
  32270. );
  32271. for (i2 in s.headers) {
  32272. jqXHR.setRequestHeader(i2, s.headers[i2]);
  32273. }
  32274. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed2)) {
  32275. return jqXHR.abort();
  32276. }
  32277. strAbort = "abort";
  32278. completeDeferred.add(s.complete);
  32279. jqXHR.done(s.success);
  32280. jqXHR.fail(s.error);
  32281. transport = inspectPrefiltersOrTransports(transports, s, options2, jqXHR);
  32282. if (!transport) {
  32283. done(-1, "No Transport");
  32284. } else {
  32285. jqXHR.readyState = 1;
  32286. if (fireGlobals) {
  32287. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  32288. }
  32289. if (completed2) {
  32290. return jqXHR;
  32291. }
  32292. if (s.async && s.timeout > 0) {
  32293. timeoutTimer = window2.setTimeout(function() {
  32294. jqXHR.abort("timeout");
  32295. }, s.timeout);
  32296. }
  32297. try {
  32298. completed2 = false;
  32299. transport.send(requestHeaders, done);
  32300. } catch (e) {
  32301. if (completed2) {
  32302. throw e;
  32303. }
  32304. done(-1, e);
  32305. }
  32306. }
  32307. function done(status, nativeStatusText, responses, headers) {
  32308. var isSuccess, success, error, response, modified, statusText = nativeStatusText;
  32309. if (completed2) {
  32310. return;
  32311. }
  32312. completed2 = true;
  32313. if (timeoutTimer) {
  32314. window2.clearTimeout(timeoutTimer);
  32315. }
  32316. transport = void 0;
  32317. responseHeadersString = headers || "";
  32318. jqXHR.readyState = status > 0 ? 4 : 0;
  32319. isSuccess = status >= 200 && status < 300 || status === 304;
  32320. if (responses) {
  32321. response = ajaxHandleResponses(s, jqXHR, responses);
  32322. }
  32323. if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1 && jQuery.inArray("json", s.dataTypes) < 0) {
  32324. s.converters["text script"] = function() {
  32325. };
  32326. }
  32327. response = ajaxConvert(s, response, jqXHR, isSuccess);
  32328. if (isSuccess) {
  32329. if (s.ifModified) {
  32330. modified = jqXHR.getResponseHeader("Last-Modified");
  32331. if (modified) {
  32332. jQuery.lastModified[cacheURL] = modified;
  32333. }
  32334. modified = jqXHR.getResponseHeader("etag");
  32335. if (modified) {
  32336. jQuery.etag[cacheURL] = modified;
  32337. }
  32338. }
  32339. if (status === 204 || s.type === "HEAD") {
  32340. statusText = "nocontent";
  32341. } else if (status === 304) {
  32342. statusText = "notmodified";
  32343. } else {
  32344. statusText = response.state;
  32345. success = response.data;
  32346. error = response.error;
  32347. isSuccess = !error;
  32348. }
  32349. } else {
  32350. error = statusText;
  32351. if (status || !statusText) {
  32352. statusText = "error";
  32353. if (status < 0) {
  32354. status = 0;
  32355. }
  32356. }
  32357. }
  32358. jqXHR.status = status;
  32359. jqXHR.statusText = (nativeStatusText || statusText) + "";
  32360. if (isSuccess) {
  32361. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  32362. } else {
  32363. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  32364. }
  32365. jqXHR.statusCode(statusCode);
  32366. statusCode = void 0;
  32367. if (fireGlobals) {
  32368. globalEventContext.trigger(
  32369. isSuccess ? "ajaxSuccess" : "ajaxError",
  32370. [jqXHR, s, isSuccess ? success : error]
  32371. );
  32372. }
  32373. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  32374. if (fireGlobals) {
  32375. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  32376. if (!--jQuery.active) {
  32377. jQuery.event.trigger("ajaxStop");
  32378. }
  32379. }
  32380. }
  32381. return jqXHR;
  32382. },
  32383. getJSON: function(url, data, callback2) {
  32384. return jQuery.get(url, data, callback2, "json");
  32385. },
  32386. getScript: function(url, callback2) {
  32387. return jQuery.get(url, void 0, callback2, "script");
  32388. }
  32389. });
  32390. jQuery.each(["get", "post"], function(_i, method) {
  32391. jQuery[method] = function(url, data, callback2, type2) {
  32392. if (isFunction2(data)) {
  32393. type2 = type2 || callback2;
  32394. callback2 = data;
  32395. data = void 0;
  32396. }
  32397. return jQuery.ajax(jQuery.extend({
  32398. url,
  32399. type: method,
  32400. dataType: type2,
  32401. data,
  32402. success: callback2
  32403. }, jQuery.isPlainObject(url) && url));
  32404. };
  32405. });
  32406. jQuery.ajaxPrefilter(function(s) {
  32407. var i2;
  32408. for (i2 in s.headers) {
  32409. if (i2.toLowerCase() === "content-type") {
  32410. s.contentType = s.headers[i2] || "";
  32411. }
  32412. }
  32413. });
  32414. jQuery._evalUrl = function(url, options2, doc) {
  32415. return jQuery.ajax({
  32416. url,
  32417. type: "GET",
  32418. dataType: "script",
  32419. cache: true,
  32420. async: false,
  32421. global: false,
  32422. converters: {
  32423. "text script": function() {
  32424. }
  32425. },
  32426. dataFilter: function(response) {
  32427. jQuery.globalEval(response, options2, doc);
  32428. }
  32429. });
  32430. };
  32431. jQuery.fn.extend({
  32432. wrapAll: function(html) {
  32433. var wrap;
  32434. if (this[0]) {
  32435. if (isFunction2(html)) {
  32436. html = html.call(this[0]);
  32437. }
  32438. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  32439. if (this[0].parentNode) {
  32440. wrap.insertBefore(this[0]);
  32441. }
  32442. wrap.map(function() {
  32443. var elem = this;
  32444. while (elem.firstElementChild) {
  32445. elem = elem.firstElementChild;
  32446. }
  32447. return elem;
  32448. }).append(this);
  32449. }
  32450. return this;
  32451. },
  32452. wrapInner: function(html) {
  32453. if (isFunction2(html)) {
  32454. return this.each(function(i2) {
  32455. jQuery(this).wrapInner(html.call(this, i2));
  32456. });
  32457. }
  32458. return this.each(function() {
  32459. var self2 = jQuery(this), contents = self2.contents();
  32460. if (contents.length) {
  32461. contents.wrapAll(html);
  32462. } else {
  32463. self2.append(html);
  32464. }
  32465. });
  32466. },
  32467. wrap: function(html) {
  32468. var htmlIsFunction = isFunction2(html);
  32469. return this.each(function(i2) {
  32470. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i2) : html);
  32471. });
  32472. },
  32473. unwrap: function(selector) {
  32474. this.parent(selector).not("body").each(function() {
  32475. jQuery(this).replaceWith(this.childNodes);
  32476. });
  32477. return this;
  32478. }
  32479. });
  32480. jQuery.expr.pseudos.hidden = function(elem) {
  32481. return !jQuery.expr.pseudos.visible(elem);
  32482. };
  32483. jQuery.expr.pseudos.visible = function(elem) {
  32484. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  32485. };
  32486. jQuery.ajaxSettings.xhr = function() {
  32487. try {
  32488. return new window2.XMLHttpRequest();
  32489. } catch (e) {
  32490. }
  32491. };
  32492. var xhrSuccessStatus = {
  32493. 0: 200,
  32494. 1223: 204
  32495. }, xhrSupported = jQuery.ajaxSettings.xhr();
  32496. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  32497. support.ajax = xhrSupported = !!xhrSupported;
  32498. jQuery.ajaxTransport(function(options2) {
  32499. var callback2, errorCallback;
  32500. if (support.cors || xhrSupported && !options2.crossDomain) {
  32501. return {
  32502. send: function(headers, complete) {
  32503. var i2, xhr = options2.xhr();
  32504. xhr.open(
  32505. options2.type,
  32506. options2.url,
  32507. options2.async,
  32508. options2.username,
  32509. options2.password
  32510. );
  32511. if (options2.xhrFields) {
  32512. for (i2 in options2.xhrFields) {
  32513. xhr[i2] = options2.xhrFields[i2];
  32514. }
  32515. }
  32516. if (options2.mimeType && xhr.overrideMimeType) {
  32517. xhr.overrideMimeType(options2.mimeType);
  32518. }
  32519. if (!options2.crossDomain && !headers["X-Requested-With"]) {
  32520. headers["X-Requested-With"] = "XMLHttpRequest";
  32521. }
  32522. for (i2 in headers) {
  32523. xhr.setRequestHeader(i2, headers[i2]);
  32524. }
  32525. callback2 = function(type2) {
  32526. return function() {
  32527. if (callback2) {
  32528. callback2 = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  32529. if (type2 === "abort") {
  32530. xhr.abort();
  32531. } else if (type2 === "error") {
  32532. if (typeof xhr.status !== "number") {
  32533. complete(0, "error");
  32534. } else {
  32535. complete(
  32536. xhr.status,
  32537. xhr.statusText
  32538. );
  32539. }
  32540. } else {
  32541. complete(
  32542. xhrSuccessStatus[xhr.status] || xhr.status,
  32543. xhr.statusText,
  32544. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText },
  32545. xhr.getAllResponseHeaders()
  32546. );
  32547. }
  32548. }
  32549. };
  32550. };
  32551. xhr.onload = callback2();
  32552. errorCallback = xhr.onerror = xhr.ontimeout = callback2("error");
  32553. if (xhr.onabort !== void 0) {
  32554. xhr.onabort = errorCallback;
  32555. } else {
  32556. xhr.onreadystatechange = function() {
  32557. if (xhr.readyState === 4) {
  32558. window2.setTimeout(function() {
  32559. if (callback2) {
  32560. errorCallback();
  32561. }
  32562. });
  32563. }
  32564. };
  32565. }
  32566. callback2 = callback2("abort");
  32567. try {
  32568. xhr.send(options2.hasContent && options2.data || null);
  32569. } catch (e) {
  32570. if (callback2) {
  32571. throw e;
  32572. }
  32573. }
  32574. },
  32575. abort: function() {
  32576. if (callback2) {
  32577. callback2();
  32578. }
  32579. }
  32580. };
  32581. }
  32582. });
  32583. jQuery.ajaxPrefilter(function(s) {
  32584. if (s.crossDomain) {
  32585. s.contents.script = false;
  32586. }
  32587. });
  32588. jQuery.ajaxSetup({
  32589. accepts: {
  32590. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  32591. },
  32592. contents: {
  32593. script: /\b(?:java|ecma)script\b/
  32594. },
  32595. converters: {
  32596. "text script": function(text) {
  32597. jQuery.globalEval(text);
  32598. return text;
  32599. }
  32600. }
  32601. });
  32602. jQuery.ajaxPrefilter("script", function(s) {
  32603. if (s.cache === void 0) {
  32604. s.cache = false;
  32605. }
  32606. if (s.crossDomain) {
  32607. s.type = "GET";
  32608. }
  32609. });
  32610. jQuery.ajaxTransport("script", function(s) {
  32611. if (s.crossDomain || s.scriptAttrs) {
  32612. var script, callback2;
  32613. return {
  32614. send: function(_, complete) {
  32615. script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback2 = function(evt) {
  32616. script.remove();
  32617. callback2 = null;
  32618. if (evt) {
  32619. complete(evt.type === "error" ? 404 : 200, evt.type);
  32620. }
  32621. });
  32622. document2.head.appendChild(script[0]);
  32623. },
  32624. abort: function() {
  32625. if (callback2) {
  32626. callback2();
  32627. }
  32628. }
  32629. };
  32630. }
  32631. });
  32632. var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/;
  32633. jQuery.ajaxSetup({
  32634. jsonp: "callback",
  32635. jsonpCallback: function() {
  32636. var callback2 = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
  32637. this[callback2] = true;
  32638. return callback2;
  32639. }
  32640. });
  32641. jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
  32642. 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");
  32643. if (jsonProp || s.dataTypes[0] === "jsonp") {
  32644. callbackName = s.jsonpCallback = isFunction2(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  32645. if (jsonProp) {
  32646. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  32647. } else if (s.jsonp !== false) {
  32648. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  32649. }
  32650. s.converters["script json"] = function() {
  32651. if (!responseContainer) {
  32652. jQuery.error(callbackName + " was not called");
  32653. }
  32654. return responseContainer[0];
  32655. };
  32656. s.dataTypes[0] = "json";
  32657. overwritten = window2[callbackName];
  32658. window2[callbackName] = function() {
  32659. responseContainer = arguments;
  32660. };
  32661. jqXHR.always(function() {
  32662. if (overwritten === void 0) {
  32663. jQuery(window2).removeProp(callbackName);
  32664. } else {
  32665. window2[callbackName] = overwritten;
  32666. }
  32667. if (s[callbackName]) {
  32668. s.jsonpCallback = originalSettings.jsonpCallback;
  32669. oldCallbacks.push(callbackName);
  32670. }
  32671. if (responseContainer && isFunction2(overwritten)) {
  32672. overwritten(responseContainer[0]);
  32673. }
  32674. responseContainer = overwritten = void 0;
  32675. });
  32676. return "script";
  32677. }
  32678. });
  32679. support.createHTMLDocument = function() {
  32680. var body = document2.implementation.createHTMLDocument("").body;
  32681. body.innerHTML = "<form></form><form></form>";
  32682. return body.childNodes.length === 2;
  32683. }();
  32684. jQuery.parseHTML = function(data, context, keepScripts) {
  32685. if (typeof data !== "string") {
  32686. return [];
  32687. }
  32688. if (typeof context === "boolean") {
  32689. keepScripts = context;
  32690. context = false;
  32691. }
  32692. var base2, parsed, scripts;
  32693. if (!context) {
  32694. if (support.createHTMLDocument) {
  32695. context = document2.implementation.createHTMLDocument("");
  32696. base2 = context.createElement("base");
  32697. base2.href = document2.location.href;
  32698. context.head.appendChild(base2);
  32699. } else {
  32700. context = document2;
  32701. }
  32702. }
  32703. parsed = rsingleTag.exec(data);
  32704. scripts = !keepScripts && [];
  32705. if (parsed) {
  32706. return [context.createElement(parsed[1])];
  32707. }
  32708. parsed = buildFragment([data], context, scripts);
  32709. if (scripts && scripts.length) {
  32710. jQuery(scripts).remove();
  32711. }
  32712. return jQuery.merge([], parsed.childNodes);
  32713. };
  32714. jQuery.fn.load = function(url, params, callback2) {
  32715. var selector, type2, response, self2 = this, off2 = url.indexOf(" ");
  32716. if (off2 > -1) {
  32717. selector = stripAndCollapse(url.slice(off2));
  32718. url = url.slice(0, off2);
  32719. }
  32720. if (isFunction2(params)) {
  32721. callback2 = params;
  32722. params = void 0;
  32723. } else if (params && typeof params === "object") {
  32724. type2 = "POST";
  32725. }
  32726. if (self2.length > 0) {
  32727. jQuery.ajax({
  32728. url,
  32729. type: type2 || "GET",
  32730. dataType: "html",
  32731. data: params
  32732. }).done(function(responseText) {
  32733. response = arguments;
  32734. self2.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText);
  32735. }).always(callback2 && function(jqXHR, status) {
  32736. self2.each(function() {
  32737. callback2.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  32738. });
  32739. });
  32740. }
  32741. return this;
  32742. };
  32743. jQuery.expr.pseudos.animated = function(elem) {
  32744. return jQuery.grep(jQuery.timers, function(fn2) {
  32745. return elem === fn2.elem;
  32746. }).length;
  32747. };
  32748. jQuery.offset = {
  32749. setOffset: function(elem, options2, i2) {
  32750. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position2 = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {};
  32751. if (position2 === "static") {
  32752. elem.style.position = "relative";
  32753. }
  32754. curOffset = curElem.offset();
  32755. curCSSTop = jQuery.css(elem, "top");
  32756. curCSSLeft = jQuery.css(elem, "left");
  32757. calculatePosition = (position2 === "absolute" || position2 === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  32758. if (calculatePosition) {
  32759. curPosition = curElem.position();
  32760. curTop = curPosition.top;
  32761. curLeft = curPosition.left;
  32762. } else {
  32763. curTop = parseFloat(curCSSTop) || 0;
  32764. curLeft = parseFloat(curCSSLeft) || 0;
  32765. }
  32766. if (isFunction2(options2)) {
  32767. options2 = options2.call(elem, i2, jQuery.extend({}, curOffset));
  32768. }
  32769. if (options2.top != null) {
  32770. props.top = options2.top - curOffset.top + curTop;
  32771. }
  32772. if (options2.left != null) {
  32773. props.left = options2.left - curOffset.left + curLeft;
  32774. }
  32775. if ("using" in options2) {
  32776. options2.using.call(elem, props);
  32777. } else {
  32778. curElem.css(props);
  32779. }
  32780. }
  32781. };
  32782. jQuery.fn.extend({
  32783. offset: function(options2) {
  32784. if (arguments.length) {
  32785. return options2 === void 0 ? this : this.each(function(i2) {
  32786. jQuery.offset.setOffset(this, options2, i2);
  32787. });
  32788. }
  32789. var rect, win2, elem = this[0];
  32790. if (!elem) {
  32791. return;
  32792. }
  32793. if (!elem.getClientRects().length) {
  32794. return { top: 0, left: 0 };
  32795. }
  32796. rect = elem.getBoundingClientRect();
  32797. win2 = elem.ownerDocument.defaultView;
  32798. return {
  32799. top: rect.top + win2.pageYOffset,
  32800. left: rect.left + win2.pageXOffset
  32801. };
  32802. },
  32803. position: function() {
  32804. if (!this[0]) {
  32805. return;
  32806. }
  32807. var offsetParent, offset, doc, elem = this[0], parentOffset = { top: 0, left: 0 };
  32808. if (jQuery.css(elem, "position") === "fixed") {
  32809. offset = elem.getBoundingClientRect();
  32810. } else {
  32811. offset = this.offset();
  32812. doc = elem.ownerDocument;
  32813. offsetParent = elem.offsetParent || doc.documentElement;
  32814. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  32815. offsetParent = offsetParent.parentNode;
  32816. }
  32817. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  32818. parentOffset = jQuery(offsetParent).offset();
  32819. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  32820. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  32821. }
  32822. }
  32823. return {
  32824. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  32825. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  32826. };
  32827. },
  32828. offsetParent: function() {
  32829. return this.map(function() {
  32830. var offsetParent = this.offsetParent;
  32831. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  32832. offsetParent = offsetParent.offsetParent;
  32833. }
  32834. return offsetParent || documentElement;
  32835. });
  32836. }
  32837. });
  32838. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) {
  32839. var top = "pageYOffset" === prop;
  32840. jQuery.fn[method] = function(val) {
  32841. return access(this, function(elem, method2, val2) {
  32842. var win2;
  32843. if (isWindow(elem)) {
  32844. win2 = elem;
  32845. } else if (elem.nodeType === 9) {
  32846. win2 = elem.defaultView;
  32847. }
  32848. if (val2 === void 0) {
  32849. return win2 ? win2[prop] : elem[method2];
  32850. }
  32851. if (win2) {
  32852. win2.scrollTo(
  32853. !top ? val2 : win2.pageXOffset,
  32854. top ? val2 : win2.pageYOffset
  32855. );
  32856. } else {
  32857. elem[method2] = val2;
  32858. }
  32859. }, method, val, arguments.length);
  32860. };
  32861. });
  32862. jQuery.each(["top", "left"], function(_i, prop) {
  32863. jQuery.cssHooks[prop] = addGetHookIf(
  32864. support.pixelPosition,
  32865. function(elem, computed2) {
  32866. if (computed2) {
  32867. computed2 = curCSS(elem, prop);
  32868. return rnumnonpx.test(computed2) ? jQuery(elem).position()[prop] + "px" : computed2;
  32869. }
  32870. }
  32871. );
  32872. });
  32873. jQuery.each({ Height: "height", Width: "width" }, function(name, type2) {
  32874. jQuery.each({
  32875. padding: "inner" + name,
  32876. content: type2,
  32877. "": "outer" + name
  32878. }, function(defaultExtra, funcName) {
  32879. jQuery.fn[funcName] = function(margin, value) {
  32880. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  32881. return access(this, function(elem, type3, value2) {
  32882. var doc;
  32883. if (isWindow(elem)) {
  32884. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  32885. }
  32886. if (elem.nodeType === 9) {
  32887. doc = elem.documentElement;
  32888. return Math.max(
  32889. elem.body["scroll" + name],
  32890. doc["scroll" + name],
  32891. elem.body["offset" + name],
  32892. doc["offset" + name],
  32893. doc["client" + name]
  32894. );
  32895. }
  32896. return value2 === void 0 ? jQuery.css(elem, type3, extra) : jQuery.style(elem, type3, value2, extra);
  32897. }, type2, chainable ? margin : void 0, chainable);
  32898. };
  32899. });
  32900. });
  32901. jQuery.each([
  32902. "ajaxStart",
  32903. "ajaxStop",
  32904. "ajaxComplete",
  32905. "ajaxError",
  32906. "ajaxSuccess",
  32907. "ajaxSend"
  32908. ], function(_i, type2) {
  32909. jQuery.fn[type2] = function(fn2) {
  32910. return this.on(type2, fn2);
  32911. };
  32912. });
  32913. jQuery.fn.extend({
  32914. bind: function(types, data, fn2) {
  32915. return this.on(types, null, data, fn2);
  32916. },
  32917. unbind: function(types, fn2) {
  32918. return this.off(types, null, fn2);
  32919. },
  32920. delegate: function(selector, types, data, fn2) {
  32921. return this.on(types, selector, data, fn2);
  32922. },
  32923. undelegate: function(selector, types, fn2) {
  32924. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2);
  32925. },
  32926. hover: function(fnOver, fnOut) {
  32927. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  32928. }
  32929. });
  32930. jQuery.each(
  32931. "blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),
  32932. function(_i, name) {
  32933. jQuery.fn[name] = function(data, fn2) {
  32934. return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name);
  32935. };
  32936. }
  32937. );
  32938. var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
  32939. jQuery.proxy = function(fn2, context) {
  32940. var tmp, args, proxy;
  32941. if (typeof context === "string") {
  32942. tmp = fn2[context];
  32943. context = fn2;
  32944. fn2 = tmp;
  32945. }
  32946. if (!isFunction2(fn2)) {
  32947. return void 0;
  32948. }
  32949. args = slice.call(arguments, 2);
  32950. proxy = function() {
  32951. return fn2.apply(context || this, args.concat(slice.call(arguments)));
  32952. };
  32953. proxy.guid = fn2.guid = fn2.guid || jQuery.guid++;
  32954. return proxy;
  32955. };
  32956. jQuery.holdReady = function(hold) {
  32957. if (hold) {
  32958. jQuery.readyWait++;
  32959. } else {
  32960. jQuery.ready(true);
  32961. }
  32962. };
  32963. jQuery.isArray = Array.isArray;
  32964. jQuery.parseJSON = JSON.parse;
  32965. jQuery.nodeName = nodeName;
  32966. jQuery.isFunction = isFunction2;
  32967. jQuery.isWindow = isWindow;
  32968. jQuery.camelCase = camelCase3;
  32969. jQuery.type = toType;
  32970. jQuery.now = Date.now;
  32971. jQuery.isNumeric = function(obj) {
  32972. var type2 = jQuery.type(obj);
  32973. return (type2 === "number" || type2 === "string") && !isNaN(obj - parseFloat(obj));
  32974. };
  32975. jQuery.trim = function(text) {
  32976. return text == null ? "" : (text + "").replace(rtrim, "$1");
  32977. };
  32978. var _jQuery = window2.jQuery, _$ = window2.$;
  32979. jQuery.noConflict = function(deep) {
  32980. if (window2.$ === jQuery) {
  32981. window2.$ = _$;
  32982. }
  32983. if (deep && window2.jQuery === jQuery) {
  32984. window2.jQuery = _jQuery;
  32985. }
  32986. return jQuery;
  32987. };
  32988. if (typeof noGlobal === "undefined") {
  32989. window2.jQuery = window2.$ = jQuery;
  32990. }
  32991. return jQuery;
  32992. });
  32993. })(jquery);
  32994. 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}
  32995. `;
  32996. var _export_sfc = (sfc, props) => {
  32997. const target = sfc.__vccOpts || sfc;
  32998. for (const [key, val] of props) {
  32999. target[key] = val;
  33000. }
  33001. return target;
  33002. };
  33003. const _hoisted_1$2 = { class: "jt-wall-dialog" };
  33004. const _hoisted_2$2 = {
  33005. slot: "title",
  33006. class: "header-title"
  33007. };
  33008. const _hoisted_3$2 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  33009. const _hoisted_4$2 = { class: "odin-dialog__content" };
  33010. const _hoisted_5$2 = { class: "jt-wall-row" };
  33011. const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u9AD8\u5EA6", -1);
  33012. const _hoisted_7$2 = { class: "col-main" };
  33013. const _hoisted_8$2 = { class: "jt-wall-row" };
  33014. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5F2F\u66F2\u5EA6", -1);
  33015. const _hoisted_10$1 = { class: "col-main" };
  33016. const _hoisted_11$1 = { class: "jt-wall-row" };
  33017. const _hoisted_12$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EBF\u5BBD", -1);
  33018. const _hoisted_13$1 = { class: "col-main" };
  33019. const _hoisted_14$1 = { class: "jt-wall-row" };
  33020. const _hoisted_15$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u53D1\u5149\u5F3A\u5EA6", -1);
  33021. const _hoisted_16$1 = { class: "col-main" };
  33022. const _hoisted_17$1 = { class: "jt-wall-row" };
  33023. const _hoisted_18$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  33024. const _hoisted_19$1 = { class: "col-main" };
  33025. const _hoisted_20$1 = { class: "jt-wall-row" };
  33026. const _hoisted_21$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65B9\u5411", -1);
  33027. const _hoisted_22$1 = { class: "col-main" };
  33028. const _hoisted_23$1 = { class: "jt-wall-row" };
  33029. const _hoisted_24$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u987A\u5E8F", -1);
  33030. const _hoisted_25$1 = { class: "col-main" };
  33031. const _hoisted_26$1 = { class: "jt-wall-row" };
  33032. const _hoisted_27$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65F6\u95F4", -1);
  33033. const _hoisted_28$1 = { class: "col-main" };
  33034. const _hoisted_29$1 = { class: "col-main" };
  33035. const _hoisted_30$1 = { class: "jt-wall-row" };
  33036. const _hoisted_31$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u91CD\u590D\u6570\u91CF", -1);
  33037. const _hoisted_32$1 = { class: "col-main" };
  33038. const _hoisted_33$1 = {
  33039. class: "jt-wall-row",
  33040. style: { "height": "60rem" }
  33041. };
  33042. const _hoisted_34$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6587\u5B57\u5185\u5BB9", -1);
  33043. const _hoisted_35$1 = { class: "col-main" };
  33044. const _hoisted_36$1 = { class: "jt-wall-row" };
  33045. const _hoisted_37$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u5BBD\u5EA6", -1);
  33046. const _hoisted_38$1 = { class: "col-main" };
  33047. const _hoisted_39$1 = { class: "jt-wall-row" };
  33048. const _hoisted_40$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u989C\u8272", -1);
  33049. const _hoisted_41$1 = { class: "col-main" };
  33050. const _hoisted_42$1 = {
  33051. class: "jt-wall-row",
  33052. style: { "height": "100rem" }
  33053. };
  33054. const _hoisted_43$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u89C6\u9891\u5730\u5740", -1);
  33055. const _hoisted_44$1 = { class: "col-main" };
  33056. const _hoisted_45$1 = { class: "jt-wall-row" };
  33057. const _hoisted_46$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "X\u8F74\u5E73\u79FB", -1);
  33058. const _hoisted_47$1 = { class: "col-main" };
  33059. const _hoisted_48$1 = { class: "jt-wall-row" };
  33060. const _hoisted_49$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Y\u8F74\u5E73\u79FB", -1);
  33061. const _hoisted_50$1 = { class: "col-main" };
  33062. const _hoisted_51$1 = { class: "jt-wall-row" };
  33063. const _hoisted_52$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Z\u8F74\u5E73\u79FB", -1);
  33064. const _hoisted_53$1 = { class: "col-main" };
  33065. const _hoisted_54$1 = { class: "el-body-foot" };
  33066. const _sfc_main$2 = {
  33067. __name: "CrEditProperty.ce",
  33068. props: {
  33069. params: {
  33070. id: {
  33071. type: String,
  33072. default: () => void 0
  33073. },
  33074. height: {
  33075. type: Number,
  33076. default: () => 13
  33077. },
  33078. bottomHeight: {
  33079. type: Number,
  33080. default: () => 0
  33081. },
  33082. color: {
  33083. type: String,
  33084. default: () => "255,255,0,0.9"
  33085. },
  33086. direction: {
  33087. type: String,
  33088. default: () => "horizontal"
  33089. },
  33090. order: {
  33091. type: String,
  33092. default: () => "+"
  33093. },
  33094. count: {
  33095. type: Number,
  33096. default: () => 2
  33097. },
  33098. text: {
  33099. type: String,
  33100. default: () => ""
  33101. },
  33102. lineWidth: {
  33103. type: Number,
  33104. default: () => 2
  33105. },
  33106. glowPower: {
  33107. type: Number,
  33108. default: () => 0.25
  33109. },
  33110. outlineWidth: {
  33111. type: Number,
  33112. default: () => 0
  33113. },
  33114. outlineColor: {
  33115. type: String,
  33116. default: () => "255,255,0,0.9"
  33117. },
  33118. speed: {
  33119. type: Number,
  33120. default: () => 1.5
  33121. },
  33122. videoUrl: {
  33123. type: String,
  33124. default: () => ""
  33125. },
  33126. arcHeight: {
  33127. type: Number,
  33128. default: () => 1e3
  33129. },
  33130. axisX: {
  33131. type: Number,
  33132. default: () => 0
  33133. },
  33134. axisY: {
  33135. type: Number,
  33136. default: () => 0
  33137. },
  33138. axisZ: {
  33139. type: Number,
  33140. default: () => 0
  33141. }
  33142. },
  33143. showDialog: {
  33144. type: Boolean,
  33145. default: () => false
  33146. }
  33147. },
  33148. emits: ["submit", "update:showDialog", "update:params", "remove"],
  33149. setup(__props, { expose: __expose, emit }) {
  33150. const props = __props;
  33151. const language = ref("zh-cn");
  33152. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  33153. const {
  33154. proxy
  33155. } = getCurrentInstance();
  33156. const predefineColors = ref([
  33157. "#ff4500",
  33158. "#ff8c00",
  33159. "#ffd700",
  33160. "#90ee90",
  33161. "#00ced1",
  33162. "#1e90ff",
  33163. "#c71585",
  33164. "rgba(255, 69, 0, 0.68)",
  33165. "rgb(255, 120, 0)",
  33166. "hsv(51, 100, 98)",
  33167. "hsva(120, 40, 94, 0.5)",
  33168. "hsl(181, 100%, 37%)",
  33169. "hsla(209, 100%, 56%, 0.73)",
  33170. "#c7158577"
  33171. ]);
  33172. const isShowColor = ref(false);
  33173. const isShowText = ref(false);
  33174. const isShowHeight = ref(false);
  33175. const isShowDirection = ref(false);
  33176. const isShowOrder = ref(false);
  33177. const isShowCount = ref(false);
  33178. ref(false);
  33179. const isShowLineWidth = ref(false);
  33180. const isShowGlowpower = ref(false);
  33181. const isShowOutlineWidth = ref(false);
  33182. const isShowOutlineColor = ref(false);
  33183. const isShowSpeed = ref(false);
  33184. const isShowVideoUrl = ref(false);
  33185. const isShowArcHeight = ref(false);
  33186. const isShowAxis = ref(false);
  33187. const color2 = ref(props.params.color);
  33188. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  33189. const dialogVisible = ref(props.showDialog);
  33190. const directions = reactive([{
  33191. key: "\u5DE6\u53F3",
  33192. value: "horizontal"
  33193. }, {
  33194. key: "\u4E0A\u4E0B",
  33195. value: "vertical"
  33196. }]);
  33197. const orders = reactive([]);
  33198. const radioDirection = ref("");
  33199. const radioOrder = ref("");
  33200. const wallHeight = ref(0);
  33201. const yCount = ref(0);
  33202. const txtContent = ref("");
  33203. const lineWidth = ref(0);
  33204. const glowPower = ref(0.25);
  33205. const outlineWidth = ref(0);
  33206. const outlineColor = ref(props.params.outlineColor);
  33207. const speed = ref(1.5);
  33208. const txtVideoUrl = ref("");
  33209. const arcHeight = ref(1e3);
  33210. const axisX = ref(0);
  33211. const axisY = ref(0);
  33212. const axisZ = ref(0);
  33213. updateParams(props.params);
  33214. function updateParams(params) {
  33215. proxy._params = params;
  33216. _setShowControls(false);
  33217. if (params.id === DrawTools.DrawType.TextWall) {
  33218. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  33219. isShowColor.value = true;
  33220. isShowText.value = true;
  33221. isShowHeight.value = true;
  33222. } else if (params.id === DrawTools.DrawType.DynamicWall) {
  33223. title.value = "\u52A8\u6001\u56F4\u680F\u7F16\u8F91";
  33224. isShowColor.value = true;
  33225. isShowDirection.value = true;
  33226. isShowOrder.value = true;
  33227. isShowCount.value = true;
  33228. isShowHeight.value = true;
  33229. isShowSpeed.value = true;
  33230. } else if (params.id === DrawTools.DrawType.NormalWall) {
  33231. title.value = "\u666E\u901A\u56F4\u680F\u7F16\u8F91";
  33232. isShowColor.value = true;
  33233. isShowHeight.value = true;
  33234. } else if (params.id === DrawTools.DrawType.Circle) {
  33235. title.value = "\u8D34\u5730\u5706\u7F16\u8F91";
  33236. isShowColor.value = true;
  33237. isShowOutlineColor.value = true;
  33238. isShowOutlineWidth.value = true;
  33239. } else if (params.id === DrawTools.DrawType.DynamicCircle) {
  33240. title.value = "\u6269\u6563\u5706\u7F16\u8F91";
  33241. isShowColor.value = true;
  33242. isShowCount.value = true;
  33243. isShowSpeed.value = true;
  33244. } else if (params.id === DrawTools.DrawType.House) {
  33245. title.value = "\u623F\u5C4B\u7F16\u8F91";
  33246. isShowColor.value = true;
  33247. isShowHeight.value = true;
  33248. } else if (params.id === DrawTools.DrawType.VideoWall) {
  33249. title.value = "\u89C6\u9891\u5899\u7F16\u8F91";
  33250. isShowHeight.value = true;
  33251. isShowVideoUrl.value = true;
  33252. isShowAxis.value = true;
  33253. } else if (params.id === DrawTools.DrawType.Polyline) {
  33254. title.value = "\u8D34\u5730\u7EBF\u7F16\u8F91";
  33255. isShowColor.value = true;
  33256. isShowLineWidth.value = true;
  33257. } else if (params.id === DrawTools.DrawType.ArrowPolyline) {
  33258. title.value = "\u7BAD\u5934\u7EBF\u7F16\u8F91";
  33259. isShowColor.value = true;
  33260. isShowLineWidth.value = true;
  33261. } else if (params.id === DrawTools.DrawType.DynamicPolyline) {
  33262. title.value = "\u52A8\u6001\u7EBF\u7F16\u8F91";
  33263. isShowColor.value = true;
  33264. isShowOrder.value = true;
  33265. isShowCount.value = true;
  33266. isShowLineWidth.value = true;
  33267. isShowSpeed.value = true;
  33268. } else if (params.id === DrawTools.DrawType.GrowPolyline) {
  33269. title.value = "\u53D1\u5149\u7EBF\u7F16\u8F91";
  33270. isShowColor.value = true;
  33271. isShowLineWidth.value = true;
  33272. isShowGlowpower.value = true;
  33273. } else if (params.id === DrawTools.DrawType.OutlinePolyline) {
  33274. title.value = "\u63CF\u8FB9\u7EBF\u7F16\u8F91";
  33275. isShowColor.value = true;
  33276. isShowLineWidth.value = true;
  33277. isShowOutlineColor.value = true;
  33278. isShowOutlineWidth.value = true;
  33279. } else if (params.id === DrawTools.DrawType.Polygon) {
  33280. title.value = "\u8D34\u5730\u9762\u7F16\u8F91";
  33281. isShowColor.value = true;
  33282. isShowOutlineColor.value = true;
  33283. isShowOutlineWidth.value = true;
  33284. } else if (params.id === DrawTools.DrawType.Rectangle) {
  33285. title.value = "\u77E9\u5F62\u7F16\u8F91";
  33286. isShowColor.value = true;
  33287. isShowOutlineColor.value = true;
  33288. isShowOutlineWidth.value = true;
  33289. } else if (params.id === DrawTools.DrawType.SpatialLine) {
  33290. title.value = "\u7A7A\u95F4\u7EBF\u7F16\u8F91";
  33291. isShowColor.value = true;
  33292. isShowLineWidth.value = true;
  33293. } else if (params.id === DrawTools.DrawType.OdLine) {
  33294. title.value = "OD\u7EBF\u7F16\u8F91";
  33295. isShowSpeed.value = true;
  33296. isShowColor.value = true;
  33297. isShowLineWidth.value = true;
  33298. isShowOrder.value = true;
  33299. isShowArcHeight.value = true;
  33300. } else {
  33301. _setShowControls(false);
  33302. }
  33303. color2.value = params.color;
  33304. if (params.direction === "horizontal") {
  33305. radioDirection.value = directions[0].key;
  33306. Object.assign(orders, [{
  33307. key: "\u81EA\u5DE6\u81F3\u53F3",
  33308. value: "-"
  33309. }, {
  33310. key: "\u81EA\u53F3\u81F3\u5DE6",
  33311. value: "+"
  33312. }]);
  33313. if (params.order === "-") {
  33314. radioOrder.value = orders[0].key;
  33315. } else {
  33316. radioOrder.value = orders[1].key;
  33317. }
  33318. } else {
  33319. radioDirection.value = directions[1].key;
  33320. Object.assign(orders, [{
  33321. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33322. value: "+"
  33323. }, {
  33324. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33325. value: "-"
  33326. }]);
  33327. if (params.order === "+") {
  33328. radioOrder.value = orders[0].key;
  33329. } else {
  33330. radioOrder.value = orders[1].key;
  33331. }
  33332. }
  33333. if (params.id === DrawTools.DrawType.OdLine) {
  33334. Object.assign(orders, [{
  33335. key: "\u6C47\u805A",
  33336. value: "+"
  33337. }, {
  33338. key: "\u6269\u6563",
  33339. value: "-"
  33340. }]);
  33341. if (params.order === "+") {
  33342. radioOrder.value = orders[0].key;
  33343. } else {
  33344. radioOrder.value = orders[1].key;
  33345. }
  33346. }
  33347. wallHeight.value = parseFloat(params.height).toFixed(2);
  33348. yCount.value = params.count;
  33349. txtContent.value = params.text;
  33350. lineWidth.value = params.lineWidth;
  33351. glowPower.value = params.power;
  33352. outlineColor.value = params.outlineColor;
  33353. outlineWidth.value = params.outlineWidth;
  33354. speed.value = (parseFloat(params.duration) / 1e3).toFixed(2);
  33355. txtVideoUrl.value = params.videoUrl;
  33356. arcHeight.value = params.odlineHeight;
  33357. axisX.value = params.axisX;
  33358. axisY.value = params.axisY;
  33359. axisZ.value = params.axisZ;
  33360. }
  33361. function _setShowControls(isShow) {
  33362. isShowColor.value = isShow;
  33363. isShowText.value = isShow;
  33364. isShowDirection.value = isShow;
  33365. isShowOrder.value = isShow;
  33366. isShowCount.value = isShow;
  33367. isShowHeight.value = isShow;
  33368. isShowLineWidth.value = isShow;
  33369. isShowGlowpower.value = isShow;
  33370. isShowOutlineColor.value = isShow;
  33371. isShowOutlineWidth.value = isShow;
  33372. isShowSpeed.value = isShow;
  33373. isShowVideoUrl.value = isShow;
  33374. isShowArcHeight.value = isShow;
  33375. isShowAxis.value = isShow;
  33376. }
  33377. __expose({});
  33378. function submit() {
  33379. let outParam = proxy._params;
  33380. outParam.height = wallHeight.value;
  33381. outParam.color = color2.value;
  33382. outParam.direction = directions.filter((item) => {
  33383. return item.key === radioDirection.value;
  33384. })[0].value;
  33385. outParam.order = orders.filter((item) => {
  33386. return item.key === radioOrder.value;
  33387. })[0].value;
  33388. outParam.count = yCount.value;
  33389. outParam.text = txtContent.value;
  33390. outParam.lineWidth = lineWidth.value;
  33391. outParam.power = glowPower.value;
  33392. outParam.outlineColor = outlineColor.value;
  33393. outParam.outlineWidth = outlineWidth.value;
  33394. outParam.duration = speed.value * 1e3;
  33395. outParam.videoUrl = txtVideoUrl.value;
  33396. outParam.odlineHeight = arcHeight.value;
  33397. outParam.bottomHeight = props.params.bottomHeight;
  33398. outParam.axisX = axisX.value;
  33399. outParam.axisY = axisY.value;
  33400. outParam.axisZ = axisZ.value;
  33401. emit("submit", outParam);
  33402. axisX.value = axisY.value = axisZ.value = 0;
  33403. }
  33404. function close() {
  33405. dialogVisible.value = false;
  33406. }
  33407. function remove2() {
  33408. emit("remove", {});
  33409. dialogVisible.value = false;
  33410. }
  33411. function directionChange(e) {
  33412. if (e.target.value === directions[0].key) {
  33413. Object.assign(orders, [{
  33414. key: "\u81EA\u5DE6\u81F3\u53F3",
  33415. value: "-"
  33416. }, {
  33417. key: "\u81EA\u53F3\u81F3\u5DE6",
  33418. value: "+"
  33419. }]);
  33420. radioOrder.value = orders[0].key;
  33421. } else if (e.target.value === directions[1].key) {
  33422. Object.assign(orders, [{
  33423. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33424. value: "-"
  33425. }, {
  33426. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33427. value: "+"
  33428. }]);
  33429. radioOrder.value = orders[0].key;
  33430. }
  33431. }
  33432. function closeDialog() {
  33433. emit("update:showDialog", false);
  33434. }
  33435. function openDialog() {
  33436. updateParams(props.params);
  33437. }
  33438. return (_ctx, _cache) => {
  33439. return openBlock(), createElementBlock("div", _hoisted_1$2, [
  33440. createVNode(unref(ElDialog), {
  33441. modal: false,
  33442. "destroy-on-close": false,
  33443. modelValue: dialogVisible.value,
  33444. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => dialogVisible.value = $event),
  33445. title: title.value,
  33446. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  33447. onClose: closeDialog,
  33448. onOpen: openDialog,
  33449. "show-close": false
  33450. }, {
  33451. header: withCtx(() => [
  33452. createElementVNode("div", _hoisted_2$2, [
  33453. createElementVNode("span", _hoisted_3$2, toDisplayString(title.value), 1)
  33454. ])
  33455. ]),
  33456. default: withCtx(() => [
  33457. createElementVNode("div", _hoisted_4$2, [
  33458. withDirectives(createElementVNode("div", _hoisted_5$2, [
  33459. _hoisted_6$2,
  33460. createElementVNode("div", _hoisted_7$2, [
  33461. createVNode(unref(ElInput), {
  33462. modelValue: wallHeight.value,
  33463. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => wallHeight.value = $event),
  33464. placeholder: "\u8F93\u5165\u9AD8\u5EA6\u503C",
  33465. clearable: ""
  33466. }, null, 8, ["modelValue"])
  33467. ])
  33468. ], 512), [
  33469. [vShow, isShowHeight.value]
  33470. ]),
  33471. withDirectives(createElementVNode("div", _hoisted_8$2, [
  33472. _hoisted_9$1,
  33473. createElementVNode("div", _hoisted_10$1, [
  33474. createVNode(unref(ElInput), {
  33475. modelValue: arcHeight.value,
  33476. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => arcHeight.value = $event),
  33477. placeholder: "\u8F93\u5165\u5F2F\u66F2\u5EA60\uFF5E9000",
  33478. clearable: ""
  33479. }, null, 8, ["modelValue"])
  33480. ])
  33481. ], 512), [
  33482. [vShow, isShowArcHeight.value]
  33483. ]),
  33484. withDirectives(createElementVNode("div", _hoisted_11$1, [
  33485. _hoisted_12$1,
  33486. createElementVNode("div", _hoisted_13$1, [
  33487. createVNode(unref(ElInput), {
  33488. modelValue: lineWidth.value,
  33489. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => lineWidth.value = $event),
  33490. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33491. clearable: ""
  33492. }, null, 8, ["modelValue"])
  33493. ])
  33494. ], 512), [
  33495. [vShow, isShowLineWidth.value]
  33496. ]),
  33497. withDirectives(createElementVNode("div", _hoisted_14$1, [
  33498. _hoisted_15$1,
  33499. createElementVNode("div", _hoisted_16$1, [
  33500. createVNode(unref(ElInput), {
  33501. modelValue: glowPower.value,
  33502. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => glowPower.value = $event),
  33503. placeholder: "\u8F93\u5165\u53D1\u5149\u5F3A\u5EA60\uFF5E1",
  33504. clearable: ""
  33505. }, null, 8, ["modelValue"])
  33506. ])
  33507. ], 512), [
  33508. [vShow, isShowGlowpower.value]
  33509. ]),
  33510. withDirectives(createElementVNode("div", _hoisted_17$1, [
  33511. _hoisted_18$1,
  33512. createElementVNode("div", _hoisted_19$1, [
  33513. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33514. default: withCtx(() => [
  33515. createVNode(unref(ElColorPicker), {
  33516. modelValue: color2.value,
  33517. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => color2.value = $event),
  33518. "show-alpha": "",
  33519. predefine: predefineColors.value,
  33520. label: "12"
  33521. }, null, 8, ["modelValue", "predefine"])
  33522. ]),
  33523. _: 1
  33524. }, 8, ["locale"])
  33525. ])
  33526. ], 512), [
  33527. [vShow, isShowColor.value]
  33528. ]),
  33529. withDirectives(createElementVNode("div", _hoisted_20$1, [
  33530. _hoisted_21$1,
  33531. createElementVNode("div", _hoisted_22$1, [
  33532. createVNode(unref(ElRadioGroup), {
  33533. modelValue: radioDirection.value,
  33534. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioDirection.value = $event)
  33535. }, {
  33536. default: withCtx(() => [
  33537. (openBlock(true), createElementBlock(Fragment, null, renderList(directions, (item, index2) => {
  33538. return openBlock(), createBlock(unref(ElRadioButton), {
  33539. label: item.key,
  33540. modelValue: item.value,
  33541. "onUpdate:modelValue": ($event) => item.value = $event,
  33542. onChange: directionChange
  33543. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33544. }), 256))
  33545. ]),
  33546. _: 1
  33547. }, 8, ["modelValue"])
  33548. ])
  33549. ], 512), [
  33550. [vShow, isShowDirection.value]
  33551. ]),
  33552. withDirectives(createElementVNode("div", _hoisted_23$1, [
  33553. _hoisted_24$1,
  33554. createElementVNode("div", _hoisted_25$1, [
  33555. createVNode(unref(ElRadioGroup), {
  33556. modelValue: radioOrder.value,
  33557. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => radioOrder.value = $event)
  33558. }, {
  33559. default: withCtx(() => [
  33560. (openBlock(true), createElementBlock(Fragment, null, renderList(orders, (item, index2) => {
  33561. return openBlock(), createBlock(unref(ElRadioButton), {
  33562. label: item.key,
  33563. modelValue: item.value,
  33564. "onUpdate:modelValue": ($event) => item.value = $event
  33565. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33566. }), 256))
  33567. ]),
  33568. _: 1
  33569. }, 8, ["modelValue"])
  33570. ])
  33571. ], 512), [
  33572. [vShow, isShowOrder.value]
  33573. ]),
  33574. withDirectives(createElementVNode("div", _hoisted_26$1, [
  33575. _hoisted_27$1,
  33576. createElementVNode("div", _hoisted_28$1, [
  33577. createElementVNode("div", _hoisted_29$1, [
  33578. createVNode(unref(ElInput), {
  33579. modelValue: speed.value,
  33580. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => speed.value = $event),
  33581. placeholder: "\u8F93\u5165\u6D41\u52A8\u65F6\u95F40\uFF5E10",
  33582. clearable: ""
  33583. }, null, 8, ["modelValue"])
  33584. ])
  33585. ])
  33586. ], 512), [
  33587. [vShow, isShowSpeed.value]
  33588. ]),
  33589. withDirectives(createElementVNode("div", _hoisted_30$1, [
  33590. _hoisted_31$1,
  33591. createElementVNode("div", _hoisted_32$1, [
  33592. createVNode(unref(ElInput), {
  33593. modelValue: yCount.value,
  33594. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => yCount.value = $event),
  33595. placeholder: "\u8F93\u51651\uFF5E100",
  33596. clearable: ""
  33597. }, null, 8, ["modelValue"])
  33598. ])
  33599. ], 512), [
  33600. [vShow, isShowCount.value]
  33601. ]),
  33602. withDirectives(createElementVNode("div", _hoisted_33$1, [
  33603. _hoisted_34$1,
  33604. createElementVNode("div", _hoisted_35$1, [
  33605. createVNode(unref(ElInput), {
  33606. modelValue: txtContent.value,
  33607. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => txtContent.value = $event),
  33608. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  33609. clearable: "",
  33610. type: "textarea",
  33611. rows: 2
  33612. }, null, 8, ["modelValue"])
  33613. ])
  33614. ], 512), [
  33615. [vShow, isShowText.value]
  33616. ]),
  33617. withDirectives(createElementVNode("div", _hoisted_36$1, [
  33618. _hoisted_37$1,
  33619. createElementVNode("div", _hoisted_38$1, [
  33620. createVNode(unref(ElInput), {
  33621. modelValue: outlineWidth.value,
  33622. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => outlineWidth.value = $event),
  33623. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33624. clearable: ""
  33625. }, null, 8, ["modelValue"])
  33626. ])
  33627. ], 512), [
  33628. [vShow, isShowOutlineWidth.value]
  33629. ]),
  33630. withDirectives(createElementVNode("div", _hoisted_39$1, [
  33631. _hoisted_40$1,
  33632. createElementVNode("div", _hoisted_41$1, [
  33633. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33634. default: withCtx(() => [
  33635. createVNode(unref(ElColorPicker), {
  33636. modelValue: outlineColor.value,
  33637. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => outlineColor.value = $event),
  33638. "show-alpha": "",
  33639. predefine: predefineColors.value,
  33640. label: "12"
  33641. }, null, 8, ["modelValue", "predefine"])
  33642. ]),
  33643. _: 1
  33644. }, 8, ["locale"])
  33645. ])
  33646. ], 512), [
  33647. [vShow, isShowOutlineColor.value]
  33648. ]),
  33649. withDirectives(createElementVNode("div", _hoisted_42$1, [
  33650. _hoisted_43$1,
  33651. createElementVNode("div", _hoisted_44$1, [
  33652. createVNode(unref(ElInput), {
  33653. modelValue: txtVideoUrl.value,
  33654. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => txtVideoUrl.value = $event),
  33655. placeholder: "\u8F93\u5165\u64AD\u653E\u89C6\u9891\u7684\u5730\u5740",
  33656. clearable: "",
  33657. type: "textarea",
  33658. rows: 4
  33659. }, null, 8, ["modelValue"])
  33660. ])
  33661. ], 512), [
  33662. [vShow, isShowVideoUrl.value]
  33663. ]),
  33664. withDirectives(createElementVNode("div", _hoisted_45$1, [
  33665. _hoisted_46$1,
  33666. createElementVNode("div", _hoisted_47$1, [
  33667. createVNode(unref(ElInputNumber), {
  33668. modelValue: axisX.value,
  33669. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => axisX.value = $event),
  33670. precision: 2,
  33671. step: 0.1,
  33672. max: 10
  33673. }, null, 8, ["modelValue"])
  33674. ])
  33675. ], 512), [
  33676. [vShow, isShowAxis.value]
  33677. ]),
  33678. withDirectives(createElementVNode("div", _hoisted_48$1, [
  33679. _hoisted_49$1,
  33680. createElementVNode("div", _hoisted_50$1, [
  33681. createVNode(unref(ElInputNumber), {
  33682. modelValue: axisY.value,
  33683. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => axisY.value = $event),
  33684. precision: 2,
  33685. step: 0.1,
  33686. max: 10
  33687. }, null, 8, ["modelValue"])
  33688. ])
  33689. ], 512), [
  33690. [vShow, isShowAxis.value]
  33691. ]),
  33692. withDirectives(createElementVNode("div", _hoisted_51$1, [
  33693. _hoisted_52$1,
  33694. createElementVNode("div", _hoisted_53$1, [
  33695. createVNode(unref(ElInputNumber), {
  33696. modelValue: axisZ.value,
  33697. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => axisZ.value = $event),
  33698. precision: 2,
  33699. step: 0.1,
  33700. max: 10
  33701. }, null, 8, ["modelValue"])
  33702. ])
  33703. ], 512), [
  33704. [vShow, isShowAxis.value]
  33705. ]),
  33706. createElementVNode("div", _hoisted_54$1, [
  33707. createVNode(unref(ElButtonGroup), null, {
  33708. default: withCtx(() => [
  33709. createVNode(unref(ElButton), {
  33710. type: "primary",
  33711. icon: unref(edit_default),
  33712. onClick: _cache[16] || (_cache[16] = ($event) => submit())
  33713. }, {
  33714. default: withCtx(() => [
  33715. createTextVNode("\u4FEE\u6539")
  33716. ]),
  33717. _: 1
  33718. }, 8, ["icon"]),
  33719. createVNode(unref(ElButton), {
  33720. type: "primary",
  33721. style: { "background-color": "rgb(222, 146, 47)" },
  33722. icon: unref(delete_default),
  33723. onClick: _cache[17] || (_cache[17] = ($event) => remove2())
  33724. }, {
  33725. default: withCtx(() => [
  33726. createTextVNode("\u5220\u9664")
  33727. ]),
  33728. _: 1
  33729. }, 8, ["icon"]),
  33730. createVNode(unref(ElButton), {
  33731. type: "primary",
  33732. style: { "background-color": "rgb(126, 128, 135)" },
  33733. icon: unref(close_default),
  33734. onClick: _cache[18] || (_cache[18] = ($event) => close())
  33735. }, {
  33736. default: withCtx(() => [
  33737. createTextVNode("\u5173\u95ED")
  33738. ]),
  33739. _: 1
  33740. }, 8, ["icon"])
  33741. ]),
  33742. _: 1
  33743. })
  33744. ])
  33745. ])
  33746. ]),
  33747. _: 1
  33748. }, 8, ["modelValue", "title", "style"])
  33749. ]);
  33750. };
  33751. }
  33752. };
  33753. var DialogEditProperty$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["styles", [_style_0$2]]]);
  33754. Array.prototype.last = function() {
  33755. if (this === void 0 || this.length === void 0 || this.length === 0)
  33756. return void 0;
  33757. return this[this.length - 1];
  33758. };
  33759. Array.prototype.first = function() {
  33760. if (this === void 0 || this.length === void 0 || this.length === 0)
  33761. return void 0;
  33762. return this[0];
  33763. };
  33764. Cesium.Entity.prototype.setEditType = function(options2) {
  33765. this._editType = options2;
  33766. };
  33767. Cesium.Entity.prototype.getEditType = function() {
  33768. return this._editType;
  33769. };
  33770. Cesium.Entity.prototype.setEntityType = function(entityType) {
  33771. this._entityType = entityType;
  33772. };
  33773. Cesium.Entity.prototype.getEntityType = function(entityType) {
  33774. return this._entityType;
  33775. };
  33776. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  33777. this._isEdit = isEdit;
  33778. };
  33779. Cesium.Entity.prototype.getIsEdit = function() {
  33780. return this._isEdit;
  33781. };
  33782. Cesium.Entity.prototype.setParams = function(params) {
  33783. this._params = params;
  33784. };
  33785. Cesium.Entity.prototype.getParams = function() {
  33786. return this._params;
  33787. };
  33788. Cesium.Entity.prototype.bindEntity = function(entity) {
  33789. this._bindEntity = entity;
  33790. };
  33791. Cesium.Entity.prototype.getBindEntity = function() {
  33792. return this._bindEntity;
  33793. };
  33794. class DrawTools {
  33795. constructor(viewer2, options2) {
  33796. this._viewer = viewer2;
  33797. this._init(options2);
  33798. }
  33799. static initEditPropertyParams() {
  33800. return {
  33801. id: void 0,
  33802. height: 20,
  33803. bottomHeight: 0,
  33804. color: "rgba(0,255,0,0.75)",
  33805. direction: "horizontal",
  33806. order: "-",
  33807. count: 2,
  33808. text: "",
  33809. lineWidth: 0,
  33810. power: 0.25,
  33811. outlineWidth: 0,
  33812. outlineColor: "rgba(255,255,255,1)",
  33813. videoUrl: "",
  33814. duration: 1500,
  33815. odlineHeight: 1e3,
  33816. odlineCount: 50,
  33817. axisX: 0,
  33818. axisY: 0,
  33819. axisZ: 0
  33820. };
  33821. }
  33822. _init(options2) {
  33823. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  33824. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  33825. this._sketchEntityName = this._guid();
  33826. let dataSource = new Cesium.CustomDataSource(this._sketchEntityName);
  33827. this._viewer.dataSources.add(dataSource);
  33828. this._entities = dataSource.entities;
  33829. this._pointEntitys = [];
  33830. this._sketchPointImage = void 0;
  33831. 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==";
  33832. 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";
  33833. 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=";
  33834. 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";
  33835. 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==";
  33836. 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";
  33837. 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=";
  33838. 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";
  33839. 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";
  33840. 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=";
  33841. this._sketchTempPoints = [];
  33842. this._sketchPoints = [];
  33843. this._sketchOutputPoints = [];
  33844. this._sketchWallHeights = [];
  33845. this._drawEntity = void 0;
  33846. this._lineLabel = void 0;
  33847. this._polygonLabel = void 0;
  33848. if (options2 && options2.isDrawPoint)
  33849. this._isDrawPoint = options2.isDrawPoint;
  33850. else
  33851. this._isDrawPoint = false;
  33852. if (options2 && options2.isRetainDrawPoint)
  33853. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  33854. else
  33855. this._isRetainDrawPoint = false;
  33856. this._param = {
  33857. lineWidth: 3,
  33858. lineColor: "rgba(0,255,0,0.75)",
  33859. outlineWidth: 2,
  33860. outlineColor: "rgba(255,255,255,1)",
  33861. polygonColor: "rgba(0,255,0,0.5)",
  33862. wallHeight: 30,
  33863. power: 0.25,
  33864. odlineHeight: 1e3,
  33865. odlineCount: 50,
  33866. text: "\u91D1\u7530\u4EA7\u4E1A\u96C6\u56E2",
  33867. duration: 1500,
  33868. count: 1,
  33869. direction_h: "horizontal",
  33870. direction_v: "vertical",
  33871. order_add: "+",
  33872. order_minus: "-",
  33873. houseColor: "rgba(0,255,0,0.95)"
  33874. };
  33875. if (options2 && options2.iconType) {
  33876. switch (options2.iconType) {
  33877. case DrawTools.IconType.Normal:
  33878. this._sketchPointImage = this._iconNormal;
  33879. break;
  33880. case DrawTools.IconType.Blue:
  33881. this._sketchPointImage = this._iconBlue;
  33882. break;
  33883. case DrawTools.IconType.Green:
  33884. this._sketchPointImage = this._iconGreen;
  33885. break;
  33886. case DrawTools.IconType.Violet:
  33887. this._sketchPointImage = this._iconViolet;
  33888. break;
  33889. default:
  33890. this._sketchPointImage = this._iconNormal;
  33891. break;
  33892. }
  33893. } else {
  33894. this._sketchPointImage = this._iconNormal;
  33895. }
  33896. this._canvasWidth = this._viewer.scene.canvas.width;
  33897. this._canvasHeight = this._viewer.scene.canvas.height;
  33898. if (this._isRuntimeApp()) {
  33899. this._viewer._cesiumWidget._supportsImageRenderingPixelated = Cesium.FeatureDetection.supportsImageRenderingPixelated();
  33900. this._viewer._cesiumWidget._forceResize = true;
  33901. if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
  33902. this._viewer.resolutionScale = 2.6;
  33903. }
  33904. }
  33905. }
  33906. _arcToDegree(arc) {
  33907. return arc / Math.PI * 180;
  33908. }
  33909. _toColor(red, green, blue, alpha) {
  33910. let normalColor = new Cesium.Color(0, 0, 0, 1);
  33911. if (typeof red != "number")
  33912. return normalColor;
  33913. if (typeof green != "number")
  33914. return normalColor;
  33915. if (typeof blue != "number")
  33916. return normalColor;
  33917. if (typeof alpha != "number")
  33918. return normalColor;
  33919. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  33920. return normalColor;
  33921. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  33922. }
  33923. _toColorFromArray(array) {
  33924. if (!array || array.length === void 0 || array.length === 0)
  33925. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  33926. let r2 = 255, g = 255, b = 255, a = 1;
  33927. if (array.length === 1) {
  33928. r2 = parseInt(array[0]);
  33929. } else if (array.length === 2) {
  33930. r2 = parseInt(array[0]);
  33931. g = parseInt(array[1]);
  33932. } else if (array.length === 3) {
  33933. r2 = parseInt(array[0]);
  33934. g = parseInt(array[1]);
  33935. b = parseInt(array[2]);
  33936. } else if (array.length >= 4) {
  33937. r2 = parseInt(array[0]);
  33938. g = parseInt(array[1]);
  33939. b = parseInt(array[2]);
  33940. a = parseFloat(array[3]);
  33941. }
  33942. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  33943. }
  33944. _updateScene() {
  33945. this._viewer.scene.requestRender();
  33946. }
  33947. _getScreenClickPosition(screenPosition) {
  33948. let resCartesian = void 0;
  33949. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  33950. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33951. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33952. if (Cesium.defined(position2)) {
  33953. resCartesian = {
  33954. x: position2.x,
  33955. y: position2.y,
  33956. z: position2.z
  33957. };
  33958. }
  33959. return resCartesian;
  33960. }
  33961. _getScreenClickPositionAndHeight(screenPoint) {
  33962. var lng = void 0, lat = void 0, height2 = void 0;
  33963. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  33964. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33965. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33966. cartographic = Cesium.Cartographic.fromCartesian(position2);
  33967. var feature2 = this._viewer.scene.pick(screenPoint);
  33968. if (feature2 === void 0 && Cesium.defined(cartographic)) {
  33969. lng = this._arcToDegree(cartographic.longitude);
  33970. lat = this._arcToDegree(cartographic.latitude);
  33971. height2 = cartographic.height;
  33972. } else {
  33973. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  33974. if (Cesium.defined(cartesian)) {
  33975. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  33976. if (Cesium.defined(cartographic)) {
  33977. lng = this._arcToDegree(cartographic.longitude);
  33978. lat = this._arcToDegree(cartographic.latitude);
  33979. height2 = cartographic.height;
  33980. }
  33981. }
  33982. }
  33983. return {
  33984. lng,
  33985. lat,
  33986. height: height2
  33987. };
  33988. }
  33989. _transfromFromScreenPoint(screenPosition) {
  33990. let location = this._getScreenClickPositionAndHeight(screenPosition);
  33991. if (location.lng != void 0) {
  33992. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  33993. return {
  33994. gLocation: location,
  33995. sLocation: cartesian
  33996. };
  33997. } else {
  33998. return {
  33999. gLocation: void 0,
  34000. sLocation: void 0
  34001. };
  34002. }
  34003. }
  34004. _removeEntityByName(entityName) {
  34005. var entities2 = this._entities;
  34006. if (!entities2 || !entities2.values)
  34007. return;
  34008. var delEntitys = [];
  34009. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  34010. if (entities2.values[i2].name == entityName) {
  34011. delEntitys.push(entities2.values[i2]);
  34012. }
  34013. }
  34014. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  34015. entities2.remove(delEntitys[i2]);
  34016. }
  34017. this._updateScene();
  34018. }
  34019. _removeEntityByObject(objEntity) {
  34020. if (!Cesium.defined(objEntity))
  34021. return;
  34022. this._entities.remove(objEntity);
  34023. }
  34024. _createPoint(coord, label2) {
  34025. let _self = this;
  34026. let entity = new Cesium.Entity({
  34027. name: _self._sketchEntityName + "_Point",
  34028. position: coord,
  34029. billboard: {
  34030. image: _self._sketchPointImage,
  34031. horizontalOrigin: Cesium.HorizontalOrigin.center,
  34032. verticalOrigin: Cesium.VerticalOrigin.bottom,
  34033. scale: 0.5,
  34034. pixelOffset: new Cesium.Cartesian2(0, -11),
  34035. disableDepthTestDistance: Number.POSITIVE_INFINITY
  34036. }
  34037. });
  34038. if (label2) {
  34039. entity.label = {
  34040. text: label2,
  34041. font: "12px sans-serif",
  34042. fillColor: this._toColor(255, 255, 255, 1),
  34043. outlineColor: this._toColor(0, 154, 94, 1),
  34044. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  34045. outlineWidth: 1,
  34046. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  34047. pixelOffset: new Cesium.Cartesian2(0, -28),
  34048. showBackground: true,
  34049. backgroundColor: this._toColor(0, 0, 0, 0.6),
  34050. disableDepthTestDistance: Number.POSITIVE_INFINITY
  34051. };
  34052. }
  34053. this._entities.add(entity);
  34054. this._pointEntitys.push(entity);
  34055. this._updateScene();
  34056. }
  34057. _removePointEntitys() {
  34058. this._removeEntityByName(this._sketchEntityName + "_Point");
  34059. this._pointEntitys = [];
  34060. }
  34061. _callUpdaeEllipseCenterPosition() {
  34062. let _self = this;
  34063. return function() {
  34064. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  34065. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  34066. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(
  34067. Cesium.Math.toDegrees(
  34068. point1cartographic.longitude
  34069. ),
  34070. Cesium.Math.toDegrees(point1cartographic.latitude),
  34071. point2cartographic.height
  34072. );
  34073. return _self._sketchEllipseCenterPosition;
  34074. };
  34075. }
  34076. _callUpdateEllipseMinorAxis(positions) {
  34077. let _self = this;
  34078. return function() {
  34079. if (positions === void 0 || positions.length === void 0 || positions.length < 2) {
  34080. _self._sketchEllipseRadius = 0;
  34081. } else {
  34082. _self._sketchEllipseRadius = _self._calculateEllipseMinorAxis(positions[0], positions[1]);
  34083. if (_self._sketchEllipseRadius <= 0)
  34084. _self._sketchEllipseRadius = 1;
  34085. }
  34086. return _self._sketchEllipseRadius;
  34087. };
  34088. }
  34089. _calculateEllipseMinorAxis(position1, position2) {
  34090. let point1cartographic = Cesium.Cartographic.fromCartesian(position1);
  34091. let point2cartographic = Cesium.Cartographic.fromCartesian(position2);
  34092. let geodesic = new Cesium.EllipsoidGeodesic();
  34093. geodesic.setEndPoints(point1cartographic, point2cartographic);
  34094. return geodesic.surfaceDistance;
  34095. }
  34096. _calculateEllipseOutlineCoordinate(position1, position2) {
  34097. let positionCenter = position1;
  34098. let positionRotate = position2;
  34099. let ellipseOutlineCoordinates = [];
  34100. for (let angle = 5; angle < 360; ) {
  34101. let newPosition = this._rotatedPointByAngle(positionRotate, positionCenter, angle);
  34102. ellipseOutlineCoordinates.push(newPosition);
  34103. angle = angle + 5;
  34104. }
  34105. ellipseOutlineCoordinates.push(ellipseOutlineCoordinates[0]);
  34106. return ellipseOutlineCoordinates;
  34107. }
  34108. _callEllipseOutlineCoordinate(positions) {
  34109. let _self = this;
  34110. return function() {
  34111. _self._ellipseOutlineCoordinates = _self._calculateEllipseOutlineCoordinate(positions[0], positions[1]);
  34112. return _self._ellipseOutlineCoordinates;
  34113. };
  34114. }
  34115. _rotatedPointByAngle(position_A, position_B, angle) {
  34116. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  34117. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  34118. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  34119. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  34120. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  34121. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  34122. var new_z = localPosition_A.z;
  34123. return Cesium.Matrix4.multiplyByPoint(
  34124. localToWorld_Matrix,
  34125. new Cesium.Cartesian3(new_x, new_y, new_z),
  34126. new Cesium.Cartesian3()
  34127. );
  34128. }
  34129. _callUpdateRectangleCoordinates(positions) {
  34130. let _self = this;
  34131. return function() {
  34132. let g0 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[0]);
  34133. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[1]);
  34134. let lng0 = Cesium.Math.toDegrees(g0.longitude);
  34135. let lat0 = Cesium.Math.toDegrees(g0.latitude);
  34136. let lng1 = Cesium.Math.toDegrees(g1.longitude);
  34137. let lat1 = Cesium.Math.toDegrees(g1.latitude);
  34138. _self._rectangleCoordinates = [0, 0, 1, 1];
  34139. if (lng0 < lng1) {
  34140. _self._rectangleCoordinates[0] = lng0;
  34141. _self._rectangleCoordinates[2] = lng1;
  34142. } else {
  34143. _self._rectangleCoordinates[0] = lng1;
  34144. _self._rectangleCoordinates[2] = lng0;
  34145. }
  34146. if (lat0 < lat1) {
  34147. _self._rectangleCoordinates[1] = lat0;
  34148. _self._rectangleCoordinates[3] = lat1;
  34149. } else {
  34150. _self._rectangleCoordinates[1] = lat1;
  34151. _self._rectangleCoordinates[3] = lat0;
  34152. }
  34153. let rectangle = Cesium.Rectangle.fromDegrees(
  34154. _self._rectangleCoordinates[0],
  34155. _self._rectangleCoordinates[1],
  34156. _self._rectangleCoordinates[2],
  34157. _self._rectangleCoordinates[3]
  34158. );
  34159. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  34160. _self._rectangleOutlineCoordinates = res.cPoints;
  34161. _self._sketchOutputPoints = res.gPoints;
  34162. return rectangle;
  34163. };
  34164. }
  34165. _calculateRectangleOutlineCoordinates(rectangle) {
  34166. let south_east = Cesium.Rectangle.southeast(rectangle);
  34167. let se2 = Cesium.Cartographic.toCartesian(south_east);
  34168. let south_west = Cesium.Rectangle.southwest(rectangle);
  34169. let sw = Cesium.Cartographic.toCartesian(south_west);
  34170. let north_east = Cesium.Rectangle.northeast(rectangle);
  34171. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  34172. let north_west = Cesium.Rectangle.northwest(rectangle);
  34173. let nw = Cesium.Cartographic.toCartesian(north_west);
  34174. let gPoints = [];
  34175. gPoints.push({
  34176. lng: Cesium.Math.toDegrees(south_west.longitude),
  34177. lat: Cesium.Math.toDegrees(south_west.latitude),
  34178. height: south_west.height
  34179. });
  34180. gPoints.push({
  34181. lng: Cesium.Math.toDegrees(south_east.longitude),
  34182. lat: Cesium.Math.toDegrees(south_east.latitude),
  34183. height: south_east.height
  34184. });
  34185. gPoints.push({
  34186. lng: Cesium.Math.toDegrees(north_east.longitude),
  34187. lat: Cesium.Math.toDegrees(north_east.latitude),
  34188. height: north_east.height
  34189. });
  34190. gPoints.push({
  34191. lng: Cesium.Math.toDegrees(north_west.longitude),
  34192. lat: Cesium.Math.toDegrees(north_west.latitude),
  34193. height: north_west.height
  34194. });
  34195. gPoints.push({
  34196. lng: Cesium.Math.toDegrees(south_west.longitude),
  34197. lat: Cesium.Math.toDegrees(south_west.latitude),
  34198. height: south_west.height
  34199. });
  34200. return {
  34201. cPoints: [sw, se2, ne2, nw, sw],
  34202. gPoints
  34203. };
  34204. }
  34205. _callUpdateRectangleOutlineCoordinates() {
  34206. let _self = this;
  34207. return function() {
  34208. return _self._rectangleOutlineCoordinates;
  34209. };
  34210. }
  34211. _materialTextImageProperty(options2) {
  34212. this._canvasId = "canvasJt";
  34213. let canvasObj = document.getElementById(this._canvasId);
  34214. if (canvasObj != null) {
  34215. document.body.removeChild(canvasObj);
  34216. }
  34217. canvasObj = document.createElement("canvas");
  34218. canvasObj.id = this._canvasId;
  34219. canvasObj.setAttribute("width", "1024px");
  34220. canvasObj.setAttribute("height", "256px");
  34221. document.body.appendChild(canvasObj);
  34222. let context = canvasObj.getContext("2d");
  34223. context.fillStyle = options2.color === void 0 ? "rgba(255,0,0,1)" : options2.color;
  34224. context.font = "bold 240px \u5FAE\u8F6F\u96C5\u9ED1";
  34225. context.textAlign = "left";
  34226. context.textBaseline = "bottom";
  34227. context.fillText(options2.text, 12, 250, 1e3);
  34228. let textMaterial = new Cesium.ImageMaterialProperty({
  34229. image: canvasObj,
  34230. transparent: true
  34231. });
  34232. textMaterial._param = {
  34233. color: context.fillStyle,
  34234. text: options2.text
  34235. };
  34236. return textMaterial;
  34237. }
  34238. _materialColorProperty(options2) {
  34239. let mColor = "rgba(0,255,0,1)";
  34240. if (options2 !== void 0 && options2.color !== void 0)
  34241. mColor = options2.color;
  34242. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34243. colorMaterial._param = {
  34244. color: mColor
  34245. };
  34246. return colorMaterial;
  34247. }
  34248. _materialPolylineArrowProperty(options2) {
  34249. let mColor = "rgba(0,255,0,1)";
  34250. if (options2 !== void 0 && options2.color !== void 0)
  34251. mColor = options2.color;
  34252. let colorMaterial = new Cesium.PolylineArrowMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34253. colorMaterial._param = {
  34254. color: mColor
  34255. };
  34256. return colorMaterial;
  34257. }
  34258. _materialPolylineGlowProperty(options2) {
  34259. let mColor = "rgba(0,255,0,1)";
  34260. if (options2 !== void 0 && options2.color !== void 0)
  34261. mColor = options2.color;
  34262. let power = 0.25;
  34263. if (options2 !== void 0 && options2.power !== void 0 && typeof options2.power === "number")
  34264. power = options2.power;
  34265. let colorMaterial = new Cesium.PolylineGlowMaterialProperty({
  34266. color: Cesium.Color.fromCssColorString(mColor),
  34267. glowPower: power
  34268. });
  34269. colorMaterial._param = {
  34270. color: mColor,
  34271. power
  34272. };
  34273. return colorMaterial;
  34274. }
  34275. _materialPolylineOutlineProperty(options2) {
  34276. let mColor = "rgba(0,255,0,1)";
  34277. let outlineColor = "rgba(255,255,255,1.0)";
  34278. let outlineWidth = 1.2;
  34279. if (options2 !== void 0 && options2.color !== void 0)
  34280. mColor = options2.color;
  34281. if (options2 !== void 0 && options2.outlineColor !== void 0)
  34282. outlineColor = options2.outlineColor;
  34283. if (options2 !== void 0 && options2.outlineWidth !== void 0 && typeof options2.outlineWidth === "number")
  34284. outlineWidth = options2.outlineWidth;
  34285. let colorMaterial = new Cesium.PolylineOutlineMaterialProperty({
  34286. color: Cesium.Color.fromCssColorString(mColor),
  34287. outlineColor: Cesium.Color.fromCssColorString(outlineColor),
  34288. outlineWidth
  34289. });
  34290. colorMaterial._param = {
  34291. color: mColor,
  34292. outlineColor,
  34293. outlineWidth
  34294. };
  34295. return colorMaterial;
  34296. }
  34297. _clear(isAll) {
  34298. if (isAll != void 0 && isAll === true) {
  34299. this._removeEntityByName(this._sketchEntityName);
  34300. this._removePointEntitys();
  34301. }
  34302. this._sketchTempPoints = [];
  34303. this._sketchPoints = [];
  34304. this._sketchOutputPoints = [];
  34305. this._sketchWallHeights = [];
  34306. this._drawEntity = void 0;
  34307. this._removeOperationDom();
  34308. this._tooltipRemove();
  34309. if (this._drawEventHandler !== null && this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  34310. this._clearEvent(this._drawEventHandler);
  34311. }
  34312. }
  34313. }
  34314. Object.assign(DrawTools.prototype, {
  34315. setLabel: function(options2) {
  34316. if (!options2) {
  34317. options2 = {
  34318. lineLabel: void 0,
  34319. polygonLabel: void 0
  34320. };
  34321. }
  34322. if (options2.lineLabel)
  34323. this._lineLabel = options2.lineLabel;
  34324. if (options2.polygonLabel)
  34325. this._lineLabel = options2.polygonLabel;
  34326. }
  34327. });
  34328. Object.assign(DrawTools.prototype, {
  34329. _registerLeftClickEvent: function(handler, callChange) {
  34330. let _self = this;
  34331. if (!handler)
  34332. return;
  34333. handler.setInputAction(function(event2) {
  34334. _self._lock = true;
  34335. clearTimeout(_self._timer);
  34336. _self._timer = setTimeout(function() {
  34337. if (callChange)
  34338. callChange(event2);
  34339. _self._lock = false;
  34340. }, 200);
  34341. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  34342. },
  34343. _registerLeftDoubleClickEvent: function(handler, callChange) {
  34344. let _self = this;
  34345. if (!handler)
  34346. return;
  34347. handler.setInputAction(function(event2) {
  34348. clearTimeout(_self._timer);
  34349. _self._lock = false;
  34350. if (callChange)
  34351. callChange(event2);
  34352. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  34353. },
  34354. _registerMouseMoveEvent: function(handler, callChange) {
  34355. let _self = this;
  34356. if (!handler)
  34357. return;
  34358. handler.setInputAction(function(event2) {
  34359. if (_self._lock === void 0 || _self._lock === false) {
  34360. if (callChange)
  34361. callChange(event2);
  34362. }
  34363. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  34364. },
  34365. _registerRightClickEvent: function(handler, callChange) {
  34366. if (!handler)
  34367. return;
  34368. handler.setInputAction(function(event2) {
  34369. if (callChange)
  34370. callChange(event2);
  34371. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  34372. },
  34373. _registerLeftDownEvent: function(handler, callChange) {
  34374. if (!handler)
  34375. return;
  34376. handler.setInputAction(function(event2) {
  34377. if (callChange)
  34378. callChange(event2);
  34379. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  34380. },
  34381. _registerLeftUpEvent: function(handler, callChange) {
  34382. if (!handler)
  34383. return;
  34384. handler.setInputAction(function(event2) {
  34385. if (callChange)
  34386. callChange(event2);
  34387. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  34388. },
  34389. _clearEvent: function(handler) {
  34390. this._endTooltip();
  34391. this._removeOperationDom();
  34392. if (!handler)
  34393. return;
  34394. handler.destroy();
  34395. handler = null;
  34396. }
  34397. });
  34398. Object.assign(DrawTools.prototype, {
  34399. _createPolyline: function(polylineType) {
  34400. let _self = this;
  34401. let entityParam = DrawTools.initEditPropertyParams();
  34402. let polylineWidth = _self._param.lineWidth;
  34403. let polylineMaterial = this._materialColorProperty({
  34404. color: _self._param.lineColor
  34405. });
  34406. entityParam.id = DrawTools.DrawType.Polyline;
  34407. if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.ArrowsPolyline) {
  34408. polylineMaterial = this._materialPolylineArrowProperty({
  34409. color: _self._param.lineColor
  34410. });
  34411. polylineWidth = _self._param.lineWidth * 3;
  34412. entityParam.color = _self._param.lineColor;
  34413. entityParam.id = DrawTools.DrawType.ArrowPolyline;
  34414. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.GrowPolyline) {
  34415. polylineMaterial = this._materialPolylineGlowProperty({
  34416. color: _self._param.lineColor,
  34417. power: _self._param.power
  34418. });
  34419. polylineWidth = _self._param.lineWidth * 3;
  34420. entityParam.color = _self._param.lineColor;
  34421. entityParam.power = _self._param.power;
  34422. entityParam.id = DrawTools.DrawType.GrowPolyline;
  34423. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.OutlinePolyline) {
  34424. polylineMaterial = this._materialPolylineOutlineProperty({
  34425. color: _self._param.lineColor,
  34426. outlineColor: _self._param.outlineColor,
  34427. outlineWidth: _self._param.outlineWidth
  34428. });
  34429. polylineWidth = _self._param.lineWidth * 2;
  34430. entityParam.color = _self._param.lineColor;
  34431. entityParam.outlineColor = _self._param.outlineColor;
  34432. entityParam.outlineWidth = _self._param.outlineWidth;
  34433. entityParam.id = DrawTools.DrawType.OutlinePolyline;
  34434. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.DynamicPolyline) {
  34435. polylineMaterial = new WallMaterialProperty({
  34436. viewer: _self._viewer,
  34437. trailImage: _self._image_h_l_r,
  34438. duration: _self._param.duration,
  34439. color: Cesium.Color.fromCssColorString(_self._param.lineColor),
  34440. param: {
  34441. direction: _self._param.direction_h,
  34442. count: _self._param.count,
  34443. order: _self._param.order_minus
  34444. }
  34445. });
  34446. polylineWidth = _self._param.lineWidth;
  34447. entityParam.color = _self._param.lineColor;
  34448. entityParam.duration = _self._param.duration;
  34449. entityParam.direction = _self._param.direction_h;
  34450. entityParam.count = _self._param.count;
  34451. entityParam.order = _self._param.order_minus;
  34452. entityParam.id = DrawTools.DrawType.DynamicPolyline;
  34453. }
  34454. entityParam.lineWidth = polylineWidth;
  34455. let entityPolyline = new Cesium.Entity({
  34456. name: _self._sketchEntityName,
  34457. polyline: {
  34458. show: true,
  34459. positions: new Cesium.CallbackProperty(function() {
  34460. return _self._sketchTempPoints;
  34461. }, false),
  34462. material: polylineMaterial,
  34463. width: polylineWidth,
  34464. clampToGround: true
  34465. }
  34466. });
  34467. this._drawEntity = this._entities.add(entityPolyline);
  34468. this._drawEntity.setParams(entityParam);
  34469. },
  34470. _updatePolyline: function(isEdit) {
  34471. this._drawEntity.polyline.positions = this._sketchPoints;
  34472. this._drawEntity.setEntityType(DrawTools.DrawType.Polyline);
  34473. if (isEdit != void 0 && isEdit === true) {
  34474. this._removePointEntitys();
  34475. this._setEntityIsEdit(this._drawEntity);
  34476. }
  34477. },
  34478. _createSpatialPolyline: function() {
  34479. let _self = this;
  34480. let entityParam = DrawTools.initEditPropertyParams();
  34481. let lineMaterial = this._materialColorProperty({
  34482. color: _self._param.lineColor
  34483. });
  34484. entityParam.id = DrawTools.DrawType.SpatialLine;
  34485. entityParam.color = _self._param.lineColor;
  34486. entityParam.lineWidth = _self._param.lineWidth;
  34487. let entity = new Cesium.Entity({
  34488. name: _self._sketchEntityName,
  34489. polyline: {
  34490. show: true,
  34491. positions: new Cesium.CallbackProperty(function() {
  34492. return _self._sketchTempPoints;
  34493. }, false),
  34494. material: lineMaterial,
  34495. width: _self._param.lineWidth,
  34496. clampToGround: false
  34497. }
  34498. });
  34499. this._drawEntity = this._entities.add(entity);
  34500. this._drawEntity.setParams(entityParam);
  34501. },
  34502. _updateSpatialPolyline: function(isEdit) {
  34503. this._drawEntity.polyline.positions = this._sketchPoints;
  34504. this._drawEntity.setEntityType(DrawTools.DrawType.SpatialLine);
  34505. if (isEdit != void 0 && isEdit === true) {
  34506. this._removePointEntitys();
  34507. this._setEntityIsEdit(this._drawEntity);
  34508. }
  34509. },
  34510. _createPolygon: function(polygonType) {
  34511. let _self = this;
  34512. let entityParam = DrawTools.initEditPropertyParams();
  34513. let polygonMaterial = this._materialColorProperty({
  34514. color: _self._param.polygonColor
  34515. });
  34516. let lineMaterial = this._materialColorProperty({
  34517. color: _self._param.outlineColor
  34518. });
  34519. let entityPolygon = new Cesium.Entity({
  34520. name: _self._sketchEntityName,
  34521. polygon: {
  34522. show: true,
  34523. hierarchy: new Cesium.CallbackProperty(function() {
  34524. return {
  34525. positions: _self._sketchTempPoints
  34526. };
  34527. }, false),
  34528. material: polygonMaterial,
  34529. classificationType: Cesium.ClassificationType.BOTH
  34530. },
  34531. polyline: {
  34532. show: true,
  34533. positions: new Cesium.CallbackProperty(function() {
  34534. return _self._sketchTempPoints;
  34535. }, false),
  34536. material: lineMaterial,
  34537. width: _self._param.outlineWidth,
  34538. clampToGround: true
  34539. }
  34540. });
  34541. entityParam.color = _self._param.polygonColor;
  34542. entityParam.outlineColor = _self._param.outlineColor;
  34543. entityParam.outlineWidth = _self._param.outlineWidth;
  34544. this._drawEntity = this._entities.add(entityPolygon);
  34545. if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.NormalPolygon) {
  34546. this._drawEntity.setEntityType(DrawTools.DrawType.Polygon);
  34547. entityParam.id = DrawTools.DrawType.Polygon;
  34548. } else if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.HousePolygon) {
  34549. this._drawEntity.setEntityType(DrawTools.DrawType.House);
  34550. entityParam.id = DrawTools.DrawType.House;
  34551. }
  34552. this._drawEntity.setParams(entityParam);
  34553. },
  34554. _updatePolygon: function(isEdit) {
  34555. let _self = this;
  34556. let houseMaterial = this._materialColorProperty({
  34557. color: _self._param.houseColor
  34558. });
  34559. let entityType = this._drawEntity.getEntityType();
  34560. if (entityType === DrawTools.DrawType.Polygon) {
  34561. this._drawEntity.polygon.hierarchy = {
  34562. positions: _self._sketchPoints
  34563. };
  34564. this._drawEntity.polyline.positions = this._sketchPoints;
  34565. } else if (entityType === DrawTools.DrawType.House) {
  34566. let entityParam = this._drawEntity.getParams();
  34567. this._removeEntityByObject(this._drawEntity);
  34568. let height2 = parseFloat(this._sketchOutputPoints[0].height);
  34569. let houseHeight = height2 + parseInt(_self._param.wallHeight);
  34570. let houseEntity = new Cesium.Entity({
  34571. name: _self._sketchEntityName,
  34572. polygon: {
  34573. show: true,
  34574. hierarchy: {
  34575. positions: _self._sketchPoints
  34576. },
  34577. extrudedHeight: houseHeight,
  34578. material: houseMaterial
  34579. }
  34580. });
  34581. this._drawEntity = this._entities.add(houseEntity);
  34582. this._drawEntity.setEntityType(entityType);
  34583. entityParam.height = _self._param.wallHeight;
  34584. entityParam.bottomHeight = height2;
  34585. entityParam.color = _self._param.houseColor;
  34586. this._drawEntity.setParams(entityParam);
  34587. }
  34588. if (isEdit != void 0 && isEdit === true) {
  34589. this._removePointEntitys();
  34590. this._setEntityIsEdit(this._drawEntity);
  34591. }
  34592. },
  34593. _createRectangle: function() {
  34594. let _self = this;
  34595. let entityParam = DrawTools.initEditPropertyParams();
  34596. let rectMaterial = this._materialColorProperty({
  34597. color: _self._param.polygonColor
  34598. });
  34599. let lineMaterial = this._materialColorProperty({
  34600. color: _self._param.outlineColor
  34601. });
  34602. let entityRectangle = new Cesium.Entity({
  34603. name: _self._sketchEntityName,
  34604. polyline: {
  34605. show: true,
  34606. positions: new Cesium.CallbackProperty(
  34607. _self._callUpdateRectangleOutlineCoordinates(),
  34608. false
  34609. ),
  34610. material: lineMaterial,
  34611. width: _self._param.outlineWidth,
  34612. clampToGround: true
  34613. },
  34614. rectangle: {
  34615. show: true,
  34616. coordinates: new Cesium.CallbackProperty(
  34617. _self._callUpdateRectangleCoordinates(
  34618. _self._sketchTempPoints
  34619. ),
  34620. false
  34621. ),
  34622. material: rectMaterial,
  34623. classificationType: Cesium.ClassificationType.BOTH
  34624. }
  34625. });
  34626. entityParam.id = DrawTools.DrawType.Rectangle;
  34627. entityParam.color = _self._param.polygonColor;
  34628. entityParam.outlineColor = _self._param.outlineColor;
  34629. entityParam.outlineWidth = _self._param.outlineWidth;
  34630. this._drawEntity = this._entities.add(entityRectangle);
  34631. this._drawEntity.setParams(entityParam);
  34632. },
  34633. _updateRectangle(isEdit) {
  34634. this._drawEntity.polyline.positions = this._rectangleOutlineCoordinates;
  34635. let coordinates = this._rectangleCoordinates;
  34636. this._drawEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
  34637. this._drawEntity.setEntityType(DrawTools.DrawType.Rectangle);
  34638. if (isEdit != void 0 && isEdit === true) {
  34639. this._setEntityIsEdit(this._drawEntity);
  34640. }
  34641. },
  34642. _createCircle: function(centerPosition, circleType) {
  34643. let _self = this;
  34644. let entityParam = DrawTools.initEditPropertyParams();
  34645. let circleMaterial = this._materialColorProperty({
  34646. color: _self._param.polygonColor
  34647. });
  34648. let lineMaterial = this._materialColorProperty({
  34649. color: _self._param.outlineColor
  34650. });
  34651. if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34652. circleMaterial = new CircleMaterialProperty({
  34653. viewer: _self._viewer,
  34654. duration: _self._param.duration,
  34655. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34656. count: _self._param.count
  34657. });
  34658. }
  34659. this._sketchEllipseCenterPosition = centerPosition.clone();
  34660. let entityCircle = new Cesium.Entity({
  34661. name: _self._sketchEntityName,
  34662. position: centerPosition,
  34663. ellipse: {
  34664. show: true,
  34665. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34666. _self._sketchTempPoints
  34667. ), false),
  34668. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34669. _self._sketchTempPoints
  34670. ), false),
  34671. material: circleMaterial,
  34672. classificationType: Cesium.ClassificationType.BOTH
  34673. }
  34674. });
  34675. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34676. entityCircle.polyline = {
  34677. show: true,
  34678. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(
  34679. _self._sketchTempPoints
  34680. ), false),
  34681. material: lineMaterial,
  34682. width: _self._param.outlineWidth,
  34683. clampToGround: true
  34684. };
  34685. }
  34686. this._drawEntity = this._entities.add(entityCircle);
  34687. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34688. this._drawEntity.setEntityType(DrawTools.DrawType.Circle);
  34689. entityParam.id = DrawTools.DrawType.Circle;
  34690. entityParam.color = _self._param.polygonColor;
  34691. entityParam.outlineColor = _self._param.outlineColor;
  34692. entityParam.outlineWidth = _self._param.outlineWidth;
  34693. } else if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34694. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicCircle);
  34695. entityParam.id = DrawTools.DrawType.DynamicCircle;
  34696. entityParam.color = _self._param.polygonColor;
  34697. entityParam.duration = _self._param.duration;
  34698. entityParam.count = _self._param.count;
  34699. }
  34700. this._drawEntity.setParams(entityParam);
  34701. },
  34702. _updateCircle(isEdit) {
  34703. this._drawEntity.position = this._sketchEllipseCenterPosition;
  34704. let center2 = this._sketchTempPoints.first();
  34705. let outpoint = this._sketchTempPoints.last();
  34706. this._ellipseOutlineCoordinates = this._calculateEllipseOutlineCoordinate(center2, outpoint);
  34707. this._sketchEllipseRadius = this._calculateEllipseMinorAxis(center2, outpoint);
  34708. if (this._drawEntity.polyline != void 0) {
  34709. this._drawEntity.polyline.positions = this._ellipseOutlineCoordinates;
  34710. }
  34711. this._drawEntity.ellipse.semiMajorAxis = this._sketchEllipseRadius;
  34712. this._drawEntity.ellipse.semiMinorAxis = this._sketchEllipseRadius;
  34713. if (isEdit != void 0 && isEdit === true) {
  34714. this._setEntityIsEdit(this._drawEntity);
  34715. }
  34716. },
  34717. _createWall: function(wallType) {
  34718. let _self = this;
  34719. let entityParam = DrawTools.initEditPropertyParams();
  34720. let wallMaterial = this._materialColorProperty({
  34721. color: _self._param.polygonColor
  34722. });
  34723. entityParam.color = _self._param.polygonColor;
  34724. if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34725. wallMaterial = this._materialTextImageProperty({
  34726. color: _self._param.polygonColor,
  34727. text: _self._param.text
  34728. });
  34729. entityParam.text = _self._param.text;
  34730. entityParam.color = _self._param.polygonColor;
  34731. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34732. wallMaterial = new WallMaterialProperty({
  34733. viewer: _self._viewer,
  34734. trailImage: _self._image_v_t_b,
  34735. duration: _self._param.duration,
  34736. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34737. param: {
  34738. count: _self._param.count,
  34739. direction: _self._param.direction_v,
  34740. order: _self._param.order_minus
  34741. }
  34742. });
  34743. entityParam.color = _self._param.polygonColor;
  34744. entityParam.duration = _self._param.duration;
  34745. entityParam.direction = _self._param.direction_v;
  34746. entityParam.count = _self._param.count;
  34747. entityParam.order = _self._param.order_minus;
  34748. }
  34749. let normalWall = new Cesium.Entity({
  34750. name: _self._sketchEntityName,
  34751. wall: {
  34752. show: true,
  34753. positions: new Cesium.CallbackProperty(function() {
  34754. return _self._sketchTempPoints;
  34755. }, false),
  34756. minimumHeights: new Cesium.CallbackProperty(function() {
  34757. return _self._sketchWallHeights;
  34758. }, false),
  34759. maximumHeights: new Cesium.CallbackProperty(function() {
  34760. _self._sketchWallMaxHeights = [];
  34761. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  34762. _self._sketchWallMaxHeights.push(_self._sketchWallHeights[i2] + _self._param.wallHeight);
  34763. }
  34764. return _self._sketchWallMaxHeights;
  34765. }, false),
  34766. material: wallMaterial
  34767. }
  34768. });
  34769. this._drawEntity = this._entities.add(normalWall);
  34770. entityParam.height = this._param.wallHeight;
  34771. if (wallType === void 0 || wallType === DrawTools.WallType.ColorWall) {
  34772. this._drawEntity.setEntityType(DrawTools.DrawType.NormalWall);
  34773. entityParam.id = DrawTools.DrawType.NormalWall;
  34774. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34775. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicWall);
  34776. entityParam.id = DrawTools.DrawType.DynamicWall;
  34777. } else if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34778. this._drawEntity.setEntityType(DrawTools.DrawType.TextWall);
  34779. entityParam.id = DrawTools.DrawType.TextWall;
  34780. }
  34781. this._drawEntity.setParams(entityParam);
  34782. },
  34783. _updateWall: function(isEdit) {
  34784. let hLength = this._sketchWallHeights.length;
  34785. let mhLength = this._sketchWallMaxHeights.length;
  34786. let pLength = this._sketchPoints.length;
  34787. if (hLength === mhLength && hLength - pLength === 1) {
  34788. this._sketchWallHeights.pop();
  34789. this._sketchWallMaxHeights.pop();
  34790. this._drawEntity.wall.positions = this._sketchPoints;
  34791. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34792. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34793. if (isEdit != void 0 && isEdit === true) {
  34794. this._removePointEntitys();
  34795. this._setEntityIsEdit(this._drawEntity);
  34796. }
  34797. } else {
  34798. this._console(hLength, mhLength, pLength);
  34799. }
  34800. },
  34801. _createVideoWall: function() {
  34802. let _self = this;
  34803. let entityWall = new Cesium.Entity({
  34804. name: _self._sketchEntityName,
  34805. position: _self._sketchOutputPoints[0],
  34806. wall: {
  34807. show: true,
  34808. positions: new Cesium.CallbackProperty(function() {
  34809. let pt0 = _self._sketchOutputPoints[0];
  34810. let pt1 = _self._sketchOutputPoints[1];
  34811. _self._wallPositions = [];
  34812. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34813. pt0.lng,
  34814. pt0.lat,
  34815. pt0.height
  34816. ));
  34817. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34818. pt1.lng,
  34819. pt1.lat,
  34820. pt0.height
  34821. ));
  34822. return _self._wallPositions;
  34823. }, false),
  34824. maximumHeights: new Cesium.CallbackProperty(function() {
  34825. _self._sketchWallHeights = [];
  34826. let pt2 = _self._sketchOutputPoints[0];
  34827. _self._sketchWallHeights.push(pt2.height);
  34828. _self._sketchWallHeights.push(pt2.height);
  34829. return _self._sketchWallHeights;
  34830. }, false),
  34831. minimumHeights: new Cesium.CallbackProperty(function() {
  34832. _self._sketchWallMaxHeights = [];
  34833. let pt2 = _self._sketchOutputPoints[1];
  34834. _self._sketchWallMaxHeights.push(pt2.height);
  34835. _self._sketchWallMaxHeights.push(pt2.height);
  34836. return _self._sketchWallMaxHeights;
  34837. }, false),
  34838. material: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34839. outline: true,
  34840. outlineColor: Cesium.Color.fromCssColorString(_self._param.outlineColor),
  34841. outlineWidth: _self._param.outlineWidth
  34842. }
  34843. });
  34844. _self._drawEntity = _self._entities.add(entityWall);
  34845. },
  34846. _updateVideoWall: function(isEdit) {
  34847. let entityParam = DrawTools.initEditPropertyParams();
  34848. entityParam.id = DrawTools.DrawType.VideoWall;
  34849. let videoElement = document.getElementById("wallVideo");
  34850. if (videoElement !== null) {
  34851. document.body.removeChild(videoElement);
  34852. }
  34853. videoElement = document.createElement("video");
  34854. videoElement.id = "wallVideo";
  34855. videoElement.setAttribute("crossorigin", "anonymous");
  34856. videoElement.setAttribute("width", "1024px");
  34857. videoElement.setAttribute("height", "256px");
  34858. videoElement.setAttribute("controls", "controls");
  34859. videoElement.setAttribute(
  34860. "src",
  34861. "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4"
  34862. );
  34863. videoElement.setAttribute("loop", "loop");
  34864. videoElement.play();
  34865. document.body.appendChild(videoElement);
  34866. this._drawEntity.wall.positions = this._wallPositions;
  34867. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34868. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34869. entityParam.height = this._sketchWallMaxHeights[0] - this._sketchWallHeights[0];
  34870. this._drawEntity.wall.material = videoElement;
  34871. this._removePointEntitys();
  34872. this._drawEntity.setEntityType(DrawTools.DrawType.VideoWall);
  34873. entityParam.videoUrl = "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4";
  34874. entityParam.id = DrawTools.DrawType.VideoWall;
  34875. this._drawEntity.setParams(entityParam);
  34876. if (isEdit != void 0 && isEdit === true) {
  34877. this._setEntityIsEdit(this._drawEntity);
  34878. }
  34879. },
  34880. _calculateOdlinePositios: function(strPoint, endPoint, height2, count) {
  34881. let pt1 = this._cartesian3ToGeo(strPoint);
  34882. let pt2 = this._cartesian3ToGeo(endPoint);
  34883. var h2 = height2 && height2 < 1e3 ? height2 : 1e3;
  34884. 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);
  34885. var num = count && count > 50 ? count : 50;
  34886. var result = [];
  34887. var tempResult = [];
  34888. var dlt = L / num;
  34889. var addHeight = pt1.height > pt2.height ? pt1.height : pt2.height;
  34890. var maxHeight = addHeight + h2;
  34891. var minHeight1 = pt1.height;
  34892. var minHeight2 = pt2.height;
  34893. if (Math.abs(pt1.longitude - pt2.longitude) > Math.abs(pt1.latitude - pt2.latitude)) {
  34894. var delLat = (pt2.latitude - pt1.latitude) / num;
  34895. if (pt1.longitude - pt2.longitude > 0) {
  34896. dlt = -dlt;
  34897. }
  34898. for (var i2 = 1; i2 < num; i2++) {
  34899. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34900. var lon = pt1.longitude + dlt * i2;
  34901. var lat = pt1.latitude + delLat * i2;
  34902. var alt = void 0;
  34903. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34904. alt = maxHeight;
  34905. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34906. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34907. } else {
  34908. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34909. }
  34910. tempResult.push([lon, lat, alt]);
  34911. }
  34912. } else {
  34913. var delLon = (pt2.longitude - pt1.longitude) / num;
  34914. if (pt1.latitude - pt2.latitude > 0) {
  34915. dlt = -dlt;
  34916. }
  34917. for (var i2 = 1; i2 < num; i2++) {
  34918. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34919. var lon = pt1.longitude + delLon * i2;
  34920. var lat = pt1.latitude + dlt * i2;
  34921. var alt = void 0;
  34922. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34923. alt = maxHeight;
  34924. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34925. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34926. } else {
  34927. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34928. }
  34929. tempResult.push([lon, lat, alt]);
  34930. }
  34931. }
  34932. result.push([pt1.longitude, pt1.latitude, pt1.height]);
  34933. for (var i2 = 0; i2 < tempResult.length; i2++) {
  34934. result.push(tempResult[i2]);
  34935. }
  34936. result.push([pt2.longitude, pt2.latitude, pt2.height]);
  34937. let results = [];
  34938. for (let i3 = 0; i3 < result.length; i3++) {
  34939. results.push(Cesium.Cartesian3.fromDegrees(result[i3][0], result[i3][1], result[i3][2]));
  34940. }
  34941. return results;
  34942. },
  34943. _createOdline: function(isFirst) {
  34944. let _self = this;
  34945. if (isFirst !== void 0 && isFirst === true) {
  34946. let fatherEntity = new Cesium.Entity({
  34947. name: this._sketchEntityName
  34948. });
  34949. this._odlineFatherEntity = this._entities.add(fatherEntity);
  34950. let entityParam = DrawTools.initEditPropertyParams();
  34951. entityParam.id = DrawTools.DrawType.OdLine;
  34952. entityParam.color = _self._param.polygonColor;
  34953. entityParam.duration = _self._param.duration;
  34954. entityParam.direction = _self._param.direction_h;
  34955. entityParam.count = _self._param.count;
  34956. entityParam.order = _self._param.order_add;
  34957. entityParam.odlineHeight = _self._param.odlineHeight;
  34958. entityParam.odlineCount = _self._param.odlineCount;
  34959. entityParam.lineWidth = _self._param.lineWidth * 3;
  34960. this._odlineFatherEntity.setParams(entityParam);
  34961. this._odlineEntitys = [];
  34962. }
  34963. let faterParam = this._odlineFatherEntity.getParams();
  34964. let odLineMaterial = new WallMaterialProperty({
  34965. viewer: _self._viewer,
  34966. trailImage: _self._image_arrow_reverse,
  34967. duration: faterParam.duration,
  34968. color: Cesium.Color.fromCssColorString(faterParam.color),
  34969. param: {
  34970. direction: faterParam.direction,
  34971. count: faterParam.count,
  34972. order: faterParam.order
  34973. }
  34974. });
  34975. let entity = new Cesium.Entity({
  34976. name: _self._sketchEntityName,
  34977. parent: this._odlineFatherEntity,
  34978. polyline: {
  34979. show: true,
  34980. positions: new Cesium.CallbackProperty(function() {
  34981. let center2 = _self._sketchTempPoints[0];
  34982. let endPoint = _self._sketchTempPoints[_self._sketchTempPoints.length - 1];
  34983. let results = _self._calculateOdlinePositios(
  34984. center2,
  34985. endPoint,
  34986. parseInt(
  34987. faterParam.odlineHeight
  34988. ),
  34989. parseInt(faterParam.odlineCount)
  34990. );
  34991. return results;
  34992. }, false),
  34993. material: odLineMaterial,
  34994. width: faterParam.lineWidth,
  34995. clampToGround: false
  34996. }
  34997. });
  34998. this._drawEntity = this._entities.add(entity);
  34999. },
  35000. _updateOdline: function(isLast, isEdit) {
  35001. if (isLast !== void 0 && isLast === true) {
  35002. if (isEdit !== void 0 && isEdit === true) {
  35003. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  35004. this._setEntityIsEdit(this._drawEntity);
  35005. this._drawEntity.parent.setIsEdit(true);
  35006. }
  35007. } else {
  35008. let params = this._drawEntity.parent.getParams();
  35009. let center2 = this._sketchTempPoints[0];
  35010. let endPoint = this._sketchTempPoints[this._sketchTempPoints.length - 1];
  35011. let results = this._calculateOdlinePositios(
  35012. center2,
  35013. endPoint,
  35014. parseInt(params.odlineHeight),
  35015. parseInt(params.odlineCount)
  35016. );
  35017. this._drawEntity.polyline.positions = results;
  35018. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  35019. this._odlineEntitys.push(this._drawEntity);
  35020. if (isEdit !== void 0 && isEdit === true) {
  35021. this._drawEntity.setIsEdit(true);
  35022. }
  35023. }
  35024. },
  35025. _guid() {
  35026. function S4() {
  35027. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  35028. }
  35029. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  35030. },
  35031. _console(...rest) {
  35032. console.log("===>>>", rest);
  35033. }
  35034. });
  35035. Object.assign(DrawTools.prototype, {
  35036. _drawMovingDoubleTooltip(position2) {
  35037. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236,\u53F3\u952E\u5355\u51FB\u64A4\u9500<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  35038. },
  35039. _drawMovingSimpleTooltip(position2) {
  35040. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  35041. },
  35042. _removeLastDrawPointEntity() {
  35043. let lastPointEntity = this._pointEntitys.last();
  35044. if (lastPointEntity !== void 0) {
  35045. this._removeEntityByObject(lastPointEntity);
  35046. this._pointEntitys.pop();
  35047. }
  35048. },
  35049. _sketchDrawPoint(handler, options2) {
  35050. let _self = this;
  35051. this._registerLeftClickEvent(handler, function(event2) {
  35052. let scene = _self._viewer.scene;
  35053. if (scene.mode !== Cesium.SceneMode.MORPHING) {
  35054. var pickedObject = scene.pick(event2.position);
  35055. if (scene.pickPositionSupported && Cesium.defined(pickedObject)) {
  35056. var cartesian = scene.pickPosition(event2.position);
  35057. if (Cesium.defined(cartesian)) {
  35058. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  35059. var lng = Cesium.Math.toDegrees(cartographic.longitude);
  35060. var lat = Cesium.Math.toDegrees(cartographic.latitude);
  35061. var height2 = cartographic.height;
  35062. _self._sketchOutputPoints.push({
  35063. lng,
  35064. lat,
  35065. height: height2
  35066. });
  35067. }
  35068. _self._createPoint(cartesian, "\u70B9");
  35069. _self._sketchPoints.push(cartesian.clone());
  35070. if (_self._sketchPoints.length >= 2) {
  35071. _self._createVideoWall();
  35072. _self._clearEvent(handler);
  35073. }
  35074. }
  35075. }
  35076. if (options2.onComplete)
  35077. options2.onComplete(loc.sLocation, loc.gLocation);
  35078. });
  35079. },
  35080. _sketchDrawMultiplePoint(handler, options2) {
  35081. let _self = this;
  35082. this._registerLeftClickEvent(handler, function(event2) {
  35083. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35084. if (!Cesium.defined(loc2.sLocation))
  35085. return;
  35086. if (_self._isDrawPoint) {
  35087. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35088. }
  35089. _self._sketchPoints.push(loc2.sLocation);
  35090. _self._sketchOutputPoints.push(loc2.gLocation);
  35091. if (options2.onAdded)
  35092. options2.onAdded(loc2.sLocation, loc2.gLocation);
  35093. });
  35094. this._registerRightClickEvent(handler, function(event2) {
  35095. if (_self._sketchPoints.length > 0) {
  35096. _self._sketchPoints.pop();
  35097. _self._sketchOutputPoints.pop();
  35098. if (options2.onUndo)
  35099. options2.onUndo();
  35100. }
  35101. });
  35102. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35103. _self._clearEvent(handler);
  35104. if (options2.onComplete)
  35105. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35106. });
  35107. },
  35108. _sketchDrawPolyline(handler, options2) {
  35109. let _self = this;
  35110. this._registerLeftClickEvent(handler, function(event2) {
  35111. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35112. if (!Cesium.defined(loc2.sLocation))
  35113. return;
  35114. if (_self._isDrawPoint) {
  35115. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35116. }
  35117. if (_self._sketchTempPoints.length === 0) {
  35118. _self._createPolyline(options2.polylineType);
  35119. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35120. }
  35121. _self._sketchTempPoints.push(loc2.sLocation);
  35122. _self._sketchPoints.push(loc2.sLocation.clone());
  35123. _self._sketchOutputPoints.push(loc2.gLocation);
  35124. if (options2.onAdded)
  35125. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35126. _self._createOperationDom();
  35127. });
  35128. this._registerMouseMoveEvent(handler, function(event2) {
  35129. if (_self._isRuntimeApp())
  35130. return;
  35131. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35132. if (!Cesium.defined(loc2.sLocation))
  35133. return;
  35134. if (_self._sketchTempPoints.length > 1) {
  35135. _self._drawMovingDoubleTooltip(event2.endPosition);
  35136. _self._sketchTempPoints.pop();
  35137. _self._sketchTempPoints.push(loc2.sLocation);
  35138. if (options2.onMoving)
  35139. options2.onMoving(loc2.sLocation);
  35140. }
  35141. });
  35142. this._registerRightClickEvent(handler, function(event2) {
  35143. if (_self._sketchTempPoints.length > 2) {
  35144. _self._drawByUndo();
  35145. if (options2.onUndo)
  35146. options2.onUndo();
  35147. }
  35148. });
  35149. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35150. if (_self._sketchPoints.length < 2) {
  35151. if (options2.onError)
  35152. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35153. return;
  35154. }
  35155. _self._updatePolyline(options2.isEdit);
  35156. if (!_self._isRetainDrawPoint)
  35157. _self._removePointEntitys();
  35158. _self._clearEvent(handler);
  35159. if (options2.onComplete)
  35160. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35161. });
  35162. },
  35163. _sketchDrawSpatialPolyline(handler, options2) {
  35164. let _self = this;
  35165. this._registerLeftClickEvent(handler, function(event2) {
  35166. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35167. if (!Cesium.defined(loc2.sLocation))
  35168. return;
  35169. if (_self._isDrawPoint) {
  35170. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35171. }
  35172. if (_self._sketchTempPoints.length === 0) {
  35173. _self._createSpatialPolyline();
  35174. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35175. }
  35176. _self._sketchTempPoints.push(loc2.sLocation);
  35177. _self._sketchPoints.push(loc2.sLocation.clone());
  35178. _self._sketchOutputPoints.push(loc2.gLocation);
  35179. if (options2.onAdded)
  35180. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35181. _self._createOperationDom();
  35182. });
  35183. this._registerMouseMoveEvent(handler, function(event2) {
  35184. if (_self._isRuntimeApp())
  35185. return;
  35186. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35187. if (!Cesium.defined(loc2.sLocation))
  35188. return;
  35189. if (_self._sketchTempPoints.length > 1) {
  35190. _self._drawMovingDoubleTooltip(event2.endPosition);
  35191. _self._sketchTempPoints.pop();
  35192. _self._sketchTempPoints.push(loc2.sLocation);
  35193. if (options2.onMoving)
  35194. options2.onMoving(loc2.sLocation);
  35195. }
  35196. });
  35197. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35198. if (_self._sketchPoints.length < 2) {
  35199. if (options2.onError)
  35200. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35201. return;
  35202. }
  35203. _self._updateSpatialPolyline(options2.isEdit);
  35204. _self._removePointEntitys();
  35205. _self._clearEvent(handler);
  35206. if (options2.onComplete)
  35207. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35208. });
  35209. this._registerRightClickEvent(handler, function(event2) {
  35210. if (_self._sketchTempPoints.length > 2) {
  35211. _self._drawByUndo();
  35212. if (options2.onUndo)
  35213. options2.onUndo();
  35214. }
  35215. });
  35216. },
  35217. _sketchDrawOdline(handler, options2) {
  35218. let _self = this;
  35219. this._registerLeftClickEvent(handler, function(event2) {
  35220. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35221. if (!Cesium.defined(loc2.sLocation))
  35222. return;
  35223. if (_self._isDrawPoint) {
  35224. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35225. }
  35226. if (_self._isRuntimeApp()) {
  35227. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED8\u5236\u4E00\u6761OD\u7EBF\uFF01");
  35228. }
  35229. if (_self._sketchTempPoints.length === 0) {
  35230. _self._createOdline(true);
  35231. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35232. } else {
  35233. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35234. _self._updateOdline(false, options2.isEdit);
  35235. _self._createOdline();
  35236. }
  35237. _self._sketchTempPoints.push(loc2.sLocation);
  35238. _self._sketchPoints.push(loc2.sLocation.clone());
  35239. _self._sketchOutputPoints.push(loc2.gLocation);
  35240. if (options2.onAdded)
  35241. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35242. _self._createOperationDom();
  35243. });
  35244. this._registerMouseMoveEvent(handler, function(event2) {
  35245. if (_self._isRuntimeApp())
  35246. return;
  35247. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35248. if (!Cesium.defined(loc2.sLocation))
  35249. return;
  35250. if (_self._sketchTempPoints.length > 1) {
  35251. _self._drawMovingDoubleTooltip(event2.endPosition);
  35252. _self._sketchTempPoints.pop();
  35253. _self._sketchTempPoints.push(loc2.sLocation);
  35254. if (options2.onMoving)
  35255. options2.onMoving(loc2.sLocation);
  35256. }
  35257. });
  35258. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35259. _self._removeEntityByObject(_self._drawEntity);
  35260. _self._updateOdline(true, options2.isEdit);
  35261. _self._removePointEntitys();
  35262. _self._clearEvent(handler);
  35263. if (options2.onComplete)
  35264. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35265. });
  35266. this._registerRightClickEvent(handler, function(event2) {
  35267. if (_self._odlineEntitys.length > 0) {
  35268. if (_self._isDrawPoint) {
  35269. _self._removeLastDrawPointEntity();
  35270. }
  35271. _self._removeEntityByObject(_self._odlineEntitys.last());
  35272. _self._odlineEntitys.pop();
  35273. if (options2.onUndo)
  35274. options2.onUndo();
  35275. }
  35276. });
  35277. },
  35278. _sketchDrawPolygon(handler, options2) {
  35279. let _self = this;
  35280. this._registerLeftClickEvent(handler, function(event2) {
  35281. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35282. if (!Cesium.defined(loc2.sLocation))
  35283. return;
  35284. if (_self._isDrawPoint) {
  35285. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35286. }
  35287. if (_self._sketchTempPoints.length === 0) {
  35288. _self._createPolygon(options2.polygonType);
  35289. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35290. }
  35291. _self._sketchTempPoints.push(loc2.sLocation);
  35292. _self._sketchPoints.push(loc2.sLocation.clone());
  35293. _self._sketchOutputPoints.push(loc2.gLocation);
  35294. if (options2.onAdded)
  35295. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35296. _self._createOperationDom();
  35297. });
  35298. this._registerMouseMoveEvent(handler, function(event2) {
  35299. if (_self._isRuntimeApp())
  35300. return;
  35301. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35302. if (!Cesium.defined(loc2.sLocation))
  35303. return;
  35304. if (_self._sketchTempPoints.length > 1) {
  35305. _self._drawMovingDoubleTooltip(event2.endPosition);
  35306. _self._sketchTempPoints.pop();
  35307. _self._sketchTempPoints.push(loc2.sLocation);
  35308. if (options2.onMoving)
  35309. options2.onMoving(loc2.sLocation);
  35310. }
  35311. });
  35312. this._registerRightClickEvent(handler, function(event2) {
  35313. if (_self._sketchTempPoints.length > 2) {
  35314. _self._drawByUndo();
  35315. if (options2.onUndo)
  35316. options2.onUndo();
  35317. }
  35318. });
  35319. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35320. if (_self._sketchPoints.length < 3) {
  35321. if (options2.onError)
  35322. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35323. return;
  35324. }
  35325. _self._updatePolygon(options2.isEdit);
  35326. if (!_self._isRetainDrawPoint)
  35327. _self._removePointEntitys();
  35328. _self._clearEvent(handler);
  35329. if (options2.onComplete)
  35330. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35331. });
  35332. },
  35333. _sketchDrawCircle: function(handler, options2) {
  35334. let _self = this;
  35335. this._registerLeftClickEvent(handler, function(event2) {
  35336. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35337. if (!Cesium.defined(loc2.sLocation))
  35338. return;
  35339. if (_self._sketchTempPoints.length === 0) {
  35340. if (_self._isDrawPoint) {
  35341. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35342. }
  35343. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35344. _self._sketchTempPoints.push(loc2.sLocation);
  35345. _self._sketchPoints.push(loc2.sLocation.clone());
  35346. _self._sketchOutputPoints.push(loc2.gLocation);
  35347. _self._createCircle(loc2.sLocation, options2.circleType);
  35348. if (_self._isRuntimeApp()) {
  35349. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35350. }
  35351. if (options2.onAdded)
  35352. options2.onAdded(loc2.sLocation);
  35353. } else {
  35354. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35355. _self._removePointEntitys();
  35356. _self._updateCircle(options2.isEdit);
  35357. _self._clearEvent(handler);
  35358. if (options2.onComplete)
  35359. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  35360. }
  35361. });
  35362. this._registerMouseMoveEvent(handler, function(event2) {
  35363. if (_self._isRuntimeApp()) {
  35364. return;
  35365. }
  35366. if (_self._sketchTempPoints.length <= 0)
  35367. return;
  35368. _self._drawMovingSimpleTooltip(event2.endPosition);
  35369. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  35370. if (cartesian == void 0)
  35371. return;
  35372. _self._sketchTempPoints.pop();
  35373. _self._sketchTempPoints.push(cartesian);
  35374. });
  35375. },
  35376. _sketchDrawRectangle: function(handler, options2) {
  35377. let _self = this;
  35378. this._registerLeftClickEvent(handler, function(event2) {
  35379. if (_self._sketchTempPoints.length === 0) {
  35380. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35381. if (!Cesium.defined(loc2.sLocation))
  35382. return;
  35383. if (_self._isDrawPoint) {
  35384. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35385. }
  35386. _self._sketchTempPoints.push(loc2.sLocation);
  35387. _self._sketchTempPoints.push(loc2.sLocation);
  35388. _self._sketchPoints.push(loc2.gLocation);
  35389. _self._createRectangle();
  35390. if (options2.onAdded)
  35391. options2.onAdded(loc2.sLocation);
  35392. if (_self._isRuntimeApp()) {
  35393. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35394. }
  35395. } else {
  35396. _self._removePointEntitys();
  35397. _self._removeEntityByObject(_self._sketchTempRectangle);
  35398. _self._updateRectangle(options2.isEdit);
  35399. _self._clearEvent(handler);
  35400. if (options2.onComplete)
  35401. options2.onComplete(_self._sketchOutputPoints);
  35402. }
  35403. });
  35404. this._registerMouseMoveEvent(handler, function(event2) {
  35405. if (_self._sketchTempPoints.length < 1)
  35406. return;
  35407. _self._drawMovingSimpleTooltip(event2.endPosition);
  35408. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35409. if (!Cesium.defined(loc2.sLocation))
  35410. return;
  35411. _self._sketchTempPoints.pop();
  35412. _self._sketchTempPoints.push(loc2.sLocation);
  35413. });
  35414. },
  35415. _sketchDrawWall: function(handler, options2) {
  35416. let _self = this;
  35417. this._registerLeftClickEvent(handler, function(event2) {
  35418. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35419. if (!Cesium.defined(loc2.sLocation))
  35420. return;
  35421. if (_self._isDrawPoint) {
  35422. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35423. }
  35424. if (_self._sketchTempPoints.length === 0) {
  35425. _self._createWall(options2.wallType);
  35426. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35427. _self._sketchWallHeights.push(loc2.gLocation.height);
  35428. }
  35429. _self._sketchTempPoints.push(loc2.sLocation);
  35430. _self._sketchWallHeights.push(loc2.gLocation.height);
  35431. _self._sketchPoints.push(loc2.sLocation.clone());
  35432. _self._createOperationDom();
  35433. });
  35434. this._registerMouseMoveEvent(handler, function(event2) {
  35435. if (_self._isRuntimeApp()) {
  35436. return;
  35437. }
  35438. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35439. if (!Cesium.defined(loc2.sLocation))
  35440. return;
  35441. if (_self._sketchTempPoints.length > 1) {
  35442. _self._drawMovingDoubleTooltip(event2.endPosition);
  35443. _self._sketchTempPoints.pop();
  35444. _self._sketchTempPoints.push(loc2.sLocation);
  35445. _self._sketchWallHeights.pop();
  35446. _self._sketchWallHeights.push(loc2.gLocation.height);
  35447. }
  35448. });
  35449. this._registerRightClickEvent(handler, function(event2) {
  35450. if (_self._sketchTempPoints.length > 2) {
  35451. _self._sketchPoints.pop();
  35452. if (_self._isRuntimeApp()) {
  35453. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 1, 1);
  35454. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 1, 1);
  35455. } else {
  35456. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  35457. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 2, 1);
  35458. }
  35459. if (_self._isDrawPoint) {
  35460. _self._removeLastDrawPointEntity();
  35461. }
  35462. }
  35463. });
  35464. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35465. if (_self._sketchPoints.length < 2) {
  35466. if (options2.onError)
  35467. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35468. return;
  35469. }
  35470. _self._updateWall(options2.isEdit);
  35471. if (!_self._isRetainDrawPoint)
  35472. _self._removePointEntitys();
  35473. _self._clearEvent(handler);
  35474. });
  35475. },
  35476. _sketchDrawVideoWall: function(handler, options2) {
  35477. let _self = this;
  35478. this._registerLeftClickEvent(handler, function(event2) {
  35479. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35480. if (!Cesium.defined(loc2.sLocation))
  35481. return;
  35482. if (_self._isDrawPoint) {
  35483. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35484. }
  35485. if (_self._sketchOutputPoints.length === 0) {
  35486. _self._sketchOutputPoints.push(loc2.gLocation);
  35487. _self._sketchOutputPoints.push(loc2.gLocation);
  35488. _self._createVideoWall();
  35489. if (_self._isRuntimeApp()) {
  35490. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  35491. }
  35492. } else {
  35493. _self._updateVideoWall(options2.isEdit);
  35494. _self._clearEvent(handler);
  35495. }
  35496. });
  35497. this._registerMouseMoveEvent(handler, function(event2) {
  35498. if (_self._isRuntimeApp())
  35499. return;
  35500. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35501. if (!Cesium.defined(loc2.sLocation))
  35502. return;
  35503. if (_self._sketchOutputPoints.length > 1) {
  35504. _self._drawMovingSimpleTooltip(event2.endPosition);
  35505. _self._sketchOutputPoints.pop();
  35506. _self._sketchOutputPoints.push(loc2.gLocation);
  35507. }
  35508. });
  35509. },
  35510. _drawByUndo: function() {
  35511. this._sketchPoints.pop();
  35512. if (this._isRuntimeApp()) {
  35513. this._sketchTempPoints.splice(this._sketchTempPoints.length - 1, 1);
  35514. } else {
  35515. this._sketchTempPoints.splice(this._sketchTempPoints.length - 2, 1);
  35516. }
  35517. if (this._isDrawPoint) {
  35518. this._removeLastDrawPointEntity();
  35519. }
  35520. },
  35521. draw: function(type2, options2) {
  35522. let _self = this;
  35523. this._clear();
  35524. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35525. if (this._isRuntimeApp()) {
  35526. this._showTooltipMessage("\u5355\u51FB\u7ED8\u5236");
  35527. } else {
  35528. this._beginTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236", void 0);
  35529. }
  35530. this._drawType = type2;
  35531. switch (type2) {
  35532. case DrawTools.DrawType.Point:
  35533. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  35534. break;
  35535. case DrawTools.DrawType.Polyline:
  35536. options2.polylineType = DrawTools.PolylineType.NormalPolyline;
  35537. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35538. break;
  35539. case DrawTools.DrawType.ArrowPolyline:
  35540. options2.polylineType = DrawTools.PolylineType.ArrowsPolyline;
  35541. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35542. break;
  35543. case DrawTools.DrawType.DynamicPolyline:
  35544. options2.polylineType = DrawTools.PolylineType.DynamicPolyline;
  35545. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35546. break;
  35547. case DrawTools.DrawType.GrowPolyline:
  35548. options2.polylineType = DrawTools.PolylineType.GrowPolyline;
  35549. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35550. break;
  35551. case DrawTools.DrawType.OutlinePolyline:
  35552. options2.polylineType = DrawTools.PolylineType.OutlinePolyline;
  35553. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35554. break;
  35555. case DrawTools.DrawType.Polygon:
  35556. options2.polygonType = DrawTools.PolygonType.NormalPolygon;
  35557. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35558. break;
  35559. case DrawTools.DrawType.SpatialLine:
  35560. _self._sketchDrawSpatialPolyline(_self._drawEventHandler, options2);
  35561. break;
  35562. case DrawTools.DrawType.Circle:
  35563. options2.circleType = DrawTools.CircleType.ColorCircle;
  35564. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35565. break;
  35566. case DrawTools.DrawType.Rectangle:
  35567. _self._sketchDrawRectangle(_self._drawEventHandler, options2);
  35568. break;
  35569. case DrawTools.DrawType.NormalWall:
  35570. options2.wallType = DrawTools.WallType.ColorWall;
  35571. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35572. break;
  35573. case DrawTools.DrawType.DynamicWall:
  35574. options2.wallType = DrawTools.WallType.DynamicWall;
  35575. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35576. break;
  35577. case DrawTools.DrawType.TextWall:
  35578. options2.wallType = DrawTools.WallType.TextWall;
  35579. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35580. break;
  35581. case DrawTools.DrawType.DynamicCircle:
  35582. options2.circleType = DrawTools.CircleType.DynamicCircle;
  35583. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35584. break;
  35585. case DrawTools.DrawType.House:
  35586. options2.polygonType = DrawTools.PolygonType.HousePolygon;
  35587. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35588. break;
  35589. case DrawTools.DrawType.VideoWall:
  35590. _self._sketchDrawVideoWall(_self._drawEventHandler, options2);
  35591. break;
  35592. case DrawTools.DrawType.OdLine:
  35593. _self._sketchDrawOdline(_self._drawEventHandler, options2);
  35594. break;
  35595. }
  35596. },
  35597. Clear: function() {
  35598. this._clear(true);
  35599. this._unActivateEdit();
  35600. this._closePropertyEditDialog();
  35601. this._removeOperationDom();
  35602. },
  35603. sketchInit: function() {
  35604. this._clear(false);
  35605. },
  35606. _checkAppOrWeb() {
  35607. if (window.navigator.userAgent.match(
  35608. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  35609. )) {
  35610. return DrawTools.RuntimeEnvironment.App;
  35611. } else {
  35612. return DrawTools.RuntimeEnvironment.Web;
  35613. }
  35614. },
  35615. _isRuntimeApp() {
  35616. if (this._checkAppOrWeb() === DrawTools.RuntimeEnvironment.App) {
  35617. return true;
  35618. }
  35619. return false;
  35620. }
  35621. });
  35622. Object.assign(DrawTools.prototype, {
  35623. _tooltipInit: function(text, mousePosition) {
  35624. let _self = this;
  35625. this._tooltipId = "tooltipSketchmodel";
  35626. let tooltipObj = document.getElementById(this._tooltipId);
  35627. if (tooltipObj === null) {
  35628. tooltipObj = document.createElement("div");
  35629. tooltipObj.id = this._tooltipId;
  35630. document.body.appendChild(tooltipObj);
  35631. let divStyle = "";
  35632. divStyle += "top: 30px;";
  35633. divStyle += "left: 30px;";
  35634. divStyle += "position: absolute;";
  35635. divStyle += "display: flex;";
  35636. divStyle += "align-items: center;";
  35637. divStyle += "width: 12x0px;";
  35638. divStyle += "height: auto;";
  35639. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  35640. divStyle += "border-radius: 5px;";
  35641. divStyle += "color: rgb(255, 255, 255);";
  35642. divStyle += "font-size: 12px;";
  35643. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  35644. divStyle += "padding: 8px;";
  35645. divStyle += "border:solid 1px rgb(255,0,0);";
  35646. tooltipObj.setAttribute("style", divStyle);
  35647. }
  35648. if (text != void 0)
  35649. tooltipObj.innerHTML = text;
  35650. if (mousePosition === void 0) {
  35651. document.onmousemove = function(event2) {
  35652. if (event2.clientX < 100 || event2.clientX > _self._canvasWidth - 100 || event2.clientY < 100 || event2.clientY > _self._canvasHeight - 100) {
  35653. tooltipObj.style.display = "none";
  35654. } else {
  35655. tooltipObj.style.display = "flex";
  35656. tooltipObj.style.left = event2.clientX + 10 + "px";
  35657. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  35658. }
  35659. };
  35660. } else {
  35661. if (mousePosition.x < 100 || mousePosition.x > _self._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > _self._canvasHeight - 100) {
  35662. tooltipObj.style.display = "none";
  35663. } else {
  35664. tooltipObj.style.display = "flex";
  35665. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35666. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35667. }
  35668. }
  35669. },
  35670. _tooltipRemove: function() {
  35671. let tooltipObj = document.getElementById(this._tooltipId);
  35672. if (tooltipObj != null) {
  35673. document.body.removeChild(tooltipObj);
  35674. }
  35675. },
  35676. _tooltipSetText: function(text, mousePosition) {
  35677. let tooltipObj = document.getElementById(this._tooltipId);
  35678. if (tooltipObj != null) {
  35679. if (text != void 0)
  35680. tooltipObj.innerHTML = text;
  35681. if (mousePosition != void 0) {
  35682. if (mousePosition.x < 100 || mousePosition.x > this._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > this._canvasHeight - 100) {
  35683. tooltipObj.style.display = "none";
  35684. } else {
  35685. tooltipObj.style.display = "flex";
  35686. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35687. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35688. }
  35689. }
  35690. }
  35691. },
  35692. _setMousePointerStyle: function() {
  35693. document.querySelector("body").style.cursor = "crosshair";
  35694. },
  35695. _setMouseDefaultStyle: function() {
  35696. document.querySelector("body").style.cursor = "default";
  35697. },
  35698. _beginTooltip(text, position2) {
  35699. this._tooltipInit(text, position2);
  35700. this._setMousePointerStyle();
  35701. },
  35702. _updateTooltip(text, position2) {
  35703. this._tooltipSetText(text, position2);
  35704. },
  35705. _endTooltip() {
  35706. this._tooltipRemove();
  35707. this._setMouseDefaultStyle();
  35708. },
  35709. _showTooltipMessage: function(message) {
  35710. let msgMainDom = document.getElementById("messageMainDom");
  35711. if (msgMainDom !== null && msgMainDom !== void 0) {
  35712. document.body.removeChild(msgMainDom);
  35713. }
  35714. msgMainDom = document.createElement("div");
  35715. msgMainDom.style.width = "30%";
  35716. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  35717. msgMainDom.style.height = "45px";
  35718. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  35719. msgMainDom.style.borderRadius = "8px";
  35720. msgMainDom.style.display = "flex";
  35721. msgMainDom.style.alignItems = "center";
  35722. msgMainDom.style.paddingLeft = "10px";
  35723. msgMainDom.style.color = "rgb(91, 188, 48)";
  35724. msgMainDom.style.fontSize = "14px";
  35725. msgMainDom.style.fontWeight = "600";
  35726. msgMainDom.style.position = "absolute";
  35727. msgMainDom.style.left = "35%";
  35728. msgMainDom.style.transition = "transform 1s";
  35729. msgMainDom.style.transform = "translateY(-90px)";
  35730. msgMainDom.style.top = "0px";
  35731. msgMainDom.style.zIndex = 1e3;
  35732. document.body.appendChild(msgMainDom);
  35733. let strHtml = "";
  35734. strHtml += "<div style='";
  35735. strHtml += "background-color: rgb(88, 185, 45);";
  35736. strHtml += "color: rgb(255, 255, 255);";
  35737. strHtml += "height: 24px;";
  35738. strHtml += "width: 24px;";
  35739. strHtml += "border-radius: 20px;";
  35740. strHtml += "display: flex;";
  35741. strHtml += "justify-content: center;";
  35742. strHtml += "align-items: center;";
  35743. strHtml += "font-size: 14px;";
  35744. strHtml += "margin-right: 18px;";
  35745. strHtml += "'>&#10003</div>";
  35746. strHtml += "<div>" + message + "</div>";
  35747. msgMainDom.innerHTML = strHtml;
  35748. msgMainDom.addEventListener("transitionend", function() {
  35749. setTimeout(function() {
  35750. document.body.removeChild(msgMainDom);
  35751. }, 1e3);
  35752. }, false);
  35753. setTimeout(function() {
  35754. msgMainDom.style.transform = "translateY(50px)";
  35755. }, 100);
  35756. }
  35757. });
  35758. Object.assign(DrawTools.prototype, {
  35759. _createSingleCoordinateAxisArrow(positions, color2, axisEntityId) {
  35760. let _self = this;
  35761. let coordinateAxisEntity = new Cesium.Entity({
  35762. id: axisEntityId,
  35763. name: _self._coordinateAxisEntityName,
  35764. position: positions[0],
  35765. polyline: {
  35766. positions,
  35767. width: 10,
  35768. material: _self._materialPolylineArrowProperty({
  35769. color: color2
  35770. })
  35771. }
  35772. });
  35773. coordinateAxisEntity.setEditType({
  35774. type: DrawTools.EditPointType.CoordinateAxis
  35775. });
  35776. return this._entities.add(coordinateAxisEntity);
  35777. },
  35778. _getTranslatePostion: function(originPosition, translateCartesian) {
  35779. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(originPosition);
  35780. let m = new Cesium.Matrix4();
  35781. Cesium.Matrix4.setTranslation(
  35782. Cesium.Matrix4.IDENTITY,
  35783. translateCartesian,
  35784. m
  35785. );
  35786. let modelMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  35787. let outPosition = new Cesium.Cartesian3(0, 0, 0);
  35788. Cesium.Matrix4.getTranslation(modelMatrix, outPosition);
  35789. return outPosition;
  35790. },
  35791. _createCoordinateAxis: function(position2) {
  35792. this._showTooltipMessage("\u5355\u51FB\u53F3\u952E\u79FB\u9664\u8C03\u6574\u8F74\u7EBF\uFF01");
  35793. this._removeCoorinateAxis();
  35794. let _self = this;
  35795. let cameraRight = this._viewer.scene.camera.rightWC;
  35796. this._tx = cameraRight.x > 0 ? 150 : -150;
  35797. this._ty = cameraRight.y > 0 ? 150 : -150;
  35798. this._tz = 150;
  35799. this._coordinateAxisEntityId_x = "coordinateAxisId_x";
  35800. this._coordinateAxisEntityId_y = "coordinateAxisId_y";
  35801. this._coordinateAxisEntityId_z = "coordinateAxisId_z";
  35802. this._coordinateAxisEntityName = "coordinateAxisEntity";
  35803. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35804. let endPosition = this._getTranslatePostion(position2, translateCartesian);
  35805. const xPos = [position2, endPosition];
  35806. this._coordinateEntity_x = this._createSingleCoordinateAxisArrow(xPos, "rgba(0,255,0,1.0)", this._coordinateAxisEntityId_x);
  35807. this._coordinateAxisBindEntity(this._coordinateEntity_x);
  35808. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35809. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35810. const yPos = [position2, endPosition];
  35811. this._coordinateEntity_y = this._createSingleCoordinateAxisArrow(yPos, "rgba(0,0,255,1.0)", this._coordinateAxisEntityId_y);
  35812. this._coordinateAxisBindEntity(this._coordinateEntity_y);
  35813. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35814. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35815. const zPos = [position2, endPosition];
  35816. this._coordinateEntity_z = this._createSingleCoordinateAxisArrow(zPos, "rgba(255,0,0,1.0)", this._coordinateAxisEntityId_z);
  35817. this._coordinateAxisBindEntity(this._coordinateEntity_z);
  35818. this._eventCoorinateAxis = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35819. this._registerLeftDownEvent(this._eventCoorinateAxis, function(event2) {
  35820. _self._coorinateAxisMouseDown(event2);
  35821. });
  35822. this._registerMouseMoveEvent(this._eventCoorinateAxis, function(event2) {
  35823. _self._coorinateAxisMouseMove(event2);
  35824. });
  35825. this._registerLeftUpEvent(this._eventCoorinateAxis, function(event2) {
  35826. _self._coorinateAxisMouseUp(event2);
  35827. });
  35828. this._registerRightClickEvent(this._eventCoorinateAxis, function(event2) {
  35829. _self._removeCoorinateAxis();
  35830. });
  35831. },
  35832. _coordinateAxisBindEntity: function(axisEntity) {
  35833. if (this._editEntity === void 0)
  35834. return;
  35835. let editEntityType = this._editEntity.getEntityType();
  35836. if (editEntityType === void 0)
  35837. return;
  35838. if (editEntityType === DrawTools.DrawType.VideoWall) {
  35839. axisEntity.bindEntity(this._editEntity);
  35840. }
  35841. },
  35842. _coorinateAxisMouseDown: function(event2) {
  35843. let _self = this;
  35844. let feature2 = this._viewer.scene.pick(event2.position);
  35845. if (feature2 === void 0)
  35846. return;
  35847. if (feature2.id != void 0 && feature2.id instanceof Cesium.Entity) {
  35848. this._viewer.scene.screenSpaceCameraController.enableRotate = false;
  35849. if (feature2.id.getEditType() === void 0)
  35850. return;
  35851. let entityType = feature2.id.getEditType().type;
  35852. if (entityType !== DrawTools.EditPointType.CoordinateAxis)
  35853. return;
  35854. this._editCoorinateAxis = feature2.id;
  35855. this._editCoorinateAxis.polyline.width = 15;
  35856. this._coordinateAxisMoveStartPosition = this._viewer.scene.camera.pickEllipsoid(
  35857. event2.position,
  35858. this._viewer.scene.globe.ellipsoid
  35859. );
  35860. this._coordinateAxisMoveStartScreen = event2.position;
  35861. this._coorinateAxisPosition = this._editCoorinateAxis.position._value;
  35862. this._coordinateEntity_x.polyline.positions = new Cesium.CallbackProperty(function() {
  35863. let translateCartesian = new Cesium.Cartesian3(_self._tx, 0, 0);
  35864. let endPosition = _self._getTranslatePostion(
  35865. _self._coorinateAxisPosition,
  35866. translateCartesian
  35867. );
  35868. return [_self._coorinateAxisPosition, endPosition];
  35869. }, false);
  35870. this._coordinateEntity_y.polyline.positions = new Cesium.CallbackProperty(function() {
  35871. let translateCartesian = new Cesium.Cartesian3(0, _self._ty, 0);
  35872. let endPosition = _self._getTranslatePostion(
  35873. _self._coorinateAxisPosition,
  35874. translateCartesian
  35875. );
  35876. return [_self._coorinateAxisPosition, endPosition];
  35877. }, false);
  35878. this._coordinateEntity_z.polyline.positions = new Cesium.CallbackProperty(function() {
  35879. let translateCartesian = new Cesium.Cartesian3(0, 0, _self._tz);
  35880. let endPosition = _self._getTranslatePostion(
  35881. _self._coorinateAxisPosition,
  35882. translateCartesian
  35883. );
  35884. return [_self._coorinateAxisPosition, endPosition];
  35885. }, false);
  35886. this._coordinateAxisActivateEditEntity(this._editCoorinateAxis);
  35887. }
  35888. },
  35889. _coorinateAxisMouseMove: function(event2) {
  35890. if (!Cesium.defined(this._editCoorinateAxis))
  35891. return;
  35892. let position2 = this._viewer.scene.camera.pickEllipsoid(
  35893. event2.endPosition,
  35894. this._viewer.scene.globe.ellipsoid
  35895. );
  35896. if (!position2)
  35897. return;
  35898. let strGeo = this._cartesian3ToGeo(this._coordinateAxisMoveStartPosition);
  35899. let endGeo = this._cartesian3ToGeo(position2);
  35900. let entityId = this._editCoorinateAxis.id;
  35901. let entityPosition = this._editCoorinateAxis.position._value;
  35902. let entityGeo = this._cartesian3ToGeo(entityPosition);
  35903. let heightDifference = 0;
  35904. if (entityId === this._coordinateAxisEntityId_x) {
  35905. let difference = strGeo.longitude - endGeo.longitude;
  35906. entityGeo.longitude = entityGeo.longitude - difference;
  35907. } else if (entityId === this._coordinateAxisEntityId_y) {
  35908. let difference = strGeo.latitude - endGeo.latitude;
  35909. entityGeo.latitude = entityGeo.latitude - difference;
  35910. } else if (entityId === this._coordinateAxisEntityId_z) {
  35911. heightDifference = event2.endPosition.y - this._coordinateAxisMoveStartScreen.y;
  35912. heightDifference = heightDifference * 0.5;
  35913. entityGeo.height = entityGeo.height - heightDifference;
  35914. }
  35915. this._coorinateAxisPosition = Cesium.Cartesian3.fromDegrees(entityGeo.longitude, entityGeo.latitude, entityGeo.height);
  35916. this._moveEditEntityByCoordinateAxis(entityPosition, this._coorinateAxisPosition, heightDifference);
  35917. },
  35918. _coorinateAxisMouseUp: function(event2) {
  35919. this._viewer.scene.screenSpaceCameraController.enableRotate = true;
  35920. if (this._editCoorinateAxis !== void 0) {
  35921. this._editCoorinateAxis.polyline.width = 10;
  35922. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35923. let endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35924. this._coordinateEntity_x.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35925. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35926. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35927. this._coordinateEntity_y.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35928. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35929. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35930. this._coordinateEntity_z.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35931. this._coordinateEntity_x.position = this._coorinateAxisPosition;
  35932. this._coordinateEntity_y.position = this._coorinateAxisPosition;
  35933. this._coordinateEntity_z.position = this._coorinateAxisPosition;
  35934. this._coordinateAxisUpdateEditEntity(this._editCoorinateAxis);
  35935. this._editCoorinateAxis = void 0;
  35936. }
  35937. },
  35938. _moveEditEntityByCoordinateAxis: function(strPosition, endPosition, heightDifference) {
  35939. let movePosition = Cesium.Cartesian3.subtract(endPosition, strPosition, new Cesium.Cartesian3());
  35940. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35941. let moveResult = Cesium.Cartesian3.add(this._moveInitPositions[i2], movePosition, new Cesium.Cartesian3());
  35942. this._moveUpdatePositions[i2] = moveResult.clone();
  35943. }
  35944. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35945. this._moveUpdateHeights[i2] = parseFloat(this._moveInitHeights[i2]) + heightDifference * -1;
  35946. }
  35947. },
  35948. _coordinateAxisActivateEditEntity: function(moveAxisEntity) {
  35949. let _self = this;
  35950. let bindEntity = moveAxisEntity.getBindEntity();
  35951. if (bindEntity === void 0)
  35952. return;
  35953. let bindEntityType = bindEntity.getEntityType();
  35954. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  35955. let wall = bindEntity.wall;
  35956. this._moveInitPositions = wall.positions._value;
  35957. this._moveInitHeights = wall.minimumHeights._value;
  35958. this._moveInitHeight = wall.maximumHeights._value[0] - wall.minimumHeights._value[0];
  35959. this._moveUpdatePositions = [];
  35960. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35961. this._moveUpdatePositions.push(this._moveInitPositions[i2].clone());
  35962. }
  35963. wall.positions = new Cesium.CallbackProperty(function() {
  35964. return _self._moveUpdatePositions;
  35965. }, false);
  35966. this._moveUpdateHeights = [];
  35967. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35968. this._moveUpdateHeights.push(this._moveInitHeights[i2]);
  35969. }
  35970. wall.minimumHeights = new Cesium.CallbackProperty(function() {
  35971. return _self._moveUpdateHeights;
  35972. }, false);
  35973. wall.maximumHeights = new Cesium.CallbackProperty(function() {
  35974. let maxHeights = [];
  35975. for (let i2 = 0; i2 < _self._moveUpdateHeights.length; i2++) {
  35976. maxHeights.push(parseFloat(_self._moveUpdateHeights[i2]) + _self._moveInitHeight);
  35977. }
  35978. return maxHeights;
  35979. }, false);
  35980. }
  35981. },
  35982. _coordinateAxisUpdateEditEntity: function(moveAxisEntity) {
  35983. let bindEntity = moveAxisEntity.getBindEntity();
  35984. if (bindEntity === void 0)
  35985. return;
  35986. let bindEntityType = bindEntity.getEntityType();
  35987. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  35988. let wall = bindEntity.wall;
  35989. wall.positions = this._moveUpdatePositions;
  35990. wall.minimumHeights = this._moveUpdateHeights;
  35991. let maxHeights = [];
  35992. for (let i2 = 0; i2 < this._moveUpdateHeights.length; i2++) {
  35993. maxHeights.push(parseFloat(this._moveUpdateHeights[i2]) + this._moveInitHeight);
  35994. }
  35995. wall.maximumHeights = maxHeights;
  35996. }
  35997. },
  35998. _coordinateCalculateEntityOrientation: function(entity, options2) {
  35999. let position2 = entity.position._value;
  36000. let orientation = entity.orientation === void 0 ? new Cesium.Cartesian3(0, 0, 0) : entity.orientation._value;
  36001. let transform3 = Cesium.Matrix4.fromTranslationQuaternionRotationScale(
  36002. position2,
  36003. orientation,
  36004. new Cesium.Cartesian3(1, 1, 1),
  36005. new Cesium.Matrix4()
  36006. );
  36007. let _rotateX = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.x));
  36008. let _rotateY = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.y));
  36009. let _rotateZ = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.z));
  36010. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateX, transform3);
  36011. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateY, transform3);
  36012. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateZ, transform3);
  36013. let m3 = Cesium.Matrix4.getRotation(transform3, new Cesium.Matrix3());
  36014. let resOrientation = new Cesium.Quaternion();
  36015. Cesium.Quaternion.fromRotationMatrix(m3, resOrientation);
  36016. return resOrientation;
  36017. },
  36018. _removeCoorinateAxis: function() {
  36019. if (this._coordinateAxisEntityName !== void 0) {
  36020. this._removeEntityByName(this._coordinateAxisEntityName);
  36021. }
  36022. if (this._eventCoorinateAxis !== void 0) {
  36023. this._clearEvent(this._eventCoorinateAxis);
  36024. this._eventCoorinateAxis = void 0;
  36025. }
  36026. }
  36027. });
  36028. Object.assign(DrawTools.prototype, {
  36029. _setEntityIsEdit(entity) {
  36030. let _self = this;
  36031. entity.setIsEdit(true);
  36032. this._unActivateEdit();
  36033. this._sendShowPropertyDialog(entity);
  36034. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36035. this._registerLeftClickEvent(handler, function(event2) {
  36036. _self._unActivateEdit();
  36037. let feature2 = _self._viewer.scene.pick(event2.position);
  36038. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  36039. let featureType = feature2.id.getEditType();
  36040. let entityType = feature2.id.getEntityType();
  36041. 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) {
  36042. _self._sendShowPropertyDialog(feature2.id);
  36043. }
  36044. }
  36045. });
  36046. },
  36047. _sendShowPropertyDialog(entity) {
  36048. let _self = this;
  36049. let editEntityType = entity.getEntityType();
  36050. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  36051. this._unActivateEdit();
  36052. return;
  36053. }
  36054. let editProperty = entity.getParams();
  36055. if (editEntityType === DrawTools.DrawType.OdLine) {
  36056. editProperty = entity.parent.getParams();
  36057. }
  36058. this._console("\u9009\u62E9\u5B9E\u4F53\u7684\u5C5E\u6027", editProperty);
  36059. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  36060. this._openPropertyEditDialog(editProperty, function(params) {
  36061. _self.updateEditEntityProperty(params);
  36062. }, function() {
  36063. _self._removeEditEntity();
  36064. });
  36065. }
  36066. this._activateEdit(entity);
  36067. },
  36068. _removeEditEntity() {
  36069. if (this._editEntity !== void 0) {
  36070. this._console("\u79FB\u9664\u5B9E\u4F53", this._editEntity);
  36071. let entityType = this._editEntity.getEntityType();
  36072. if (entityType === DrawTools.DrawType.OdLine) {
  36073. let fatherEntityId = this._editEntity.parent.id;
  36074. let removeEntitys = [];
  36075. for (let entity of this._entities.values) {
  36076. if (entity.parent !== void 0 && entity.parent.id === fatherEntityId) {
  36077. removeEntitys.push(entity);
  36078. }
  36079. }
  36080. for (let removeEntity of removeEntitys) {
  36081. this._removeEntityByObject(removeEntity);
  36082. }
  36083. } else {
  36084. this._removeEntityByObject(this._editEntity);
  36085. }
  36086. this._unActivateEdit();
  36087. this._editEntity = void 0;
  36088. }
  36089. },
  36090. updateEditEntityProperty: function(params) {
  36091. if (this._editEntity === void 0)
  36092. return;
  36093. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  36094. return;
  36095. let editEntityType = this._editEntity.getEntityType();
  36096. if (editEntityType === void 0)
  36097. return;
  36098. if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36099. this._updateWallProperty(params);
  36100. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36101. this._updateCircleProperty(params);
  36102. } else if (editEntityType === DrawTools.DrawType.House) {
  36103. this._updateHouseProperty(params);
  36104. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36105. this._updateVideoWallProperty(params);
  36106. } else if (editEntityType === DrawTools.DrawType.Polyline) {
  36107. this._updatePolylineProperty(params);
  36108. } else if (editEntityType === DrawTools.DrawType.Polygon) {
  36109. this._updatePolygonProperty(params);
  36110. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36111. this._updateRectangleProperty(params);
  36112. } else if (editEntityType === DrawTools.DrawType.SpatialLine) {
  36113. this._updateSpatialPolylineProperty(params);
  36114. } else if (editEntityType === DrawTools.DrawType.OdLine) {
  36115. this._updateOdlineProperty(params);
  36116. }
  36117. },
  36118. _updateOdlineProperty(params) {
  36119. let _self = this;
  36120. let fatherEntity = this._editEntity.parent;
  36121. this._editOdlineEntities = [];
  36122. for (let entity of this._entities.values) {
  36123. if (entity.parent !== void 0 && entity.parent.id === fatherEntity.id) {
  36124. this._editOdlineEntities.push(entity);
  36125. }
  36126. }
  36127. let meterialImage = this._image_arrow_reverse;
  36128. if (params.order === this._param.order_add) {
  36129. meterialImage = this._image_arrow_reverse;
  36130. } else if (params.order === this._param.order_minus) {
  36131. meterialImage = this._image_arrow_forward;
  36132. }
  36133. let odLineMaterial = new WallMaterialProperty({
  36134. viewer: _self._viewer,
  36135. trailImage: meterialImage,
  36136. duration: params.duration,
  36137. color: Cesium.Color.fromCssColorString(params.color),
  36138. param: {
  36139. direction: params.direction,
  36140. count: params.count,
  36141. order: params.order
  36142. }
  36143. });
  36144. for (let entity of this._editOdlineEntities) {
  36145. entity.polyline.material = odLineMaterial;
  36146. let positions = entity.polyline.positions._value;
  36147. let strPoint = positions.first();
  36148. let endPoint = positions.last();
  36149. let newPositios = this._calculateOdlinePositios(
  36150. strPoint,
  36151. endPoint,
  36152. parseInt(params.odlineHeight),
  36153. parseInt(params.odlineCount)
  36154. );
  36155. entity.polyline.positions = newPositios;
  36156. entity.polyline.width = parseInt(params.lineWidth);
  36157. }
  36158. fatherEntity.setParams(params);
  36159. },
  36160. _updateSpatialPolylineProperty(params) {
  36161. let material = this._editEntity.polyline.material;
  36162. let newMaterial = void 0;
  36163. if (material instanceof Cesium.ColorMaterialProperty) {
  36164. newMaterial = this._materialColorProperty({
  36165. color: params.color
  36166. });
  36167. }
  36168. if (newMaterial !== void 0)
  36169. this._editEntity.polyline.material = newMaterial;
  36170. this._editEntity.polyline.width = parseFloat(params.lineWidth);
  36171. this._editEntity.setParams(params);
  36172. },
  36173. _updateRectangleProperty(params) {
  36174. let material = this._editEntity.rectangle.material;
  36175. if (material instanceof Cesium.ColorMaterialProperty) {
  36176. let newMaterial = this._materialColorProperty({
  36177. color: params.color
  36178. });
  36179. this._editEntity.rectangle.material = newMaterial;
  36180. }
  36181. if (this._editEntity.polyline !== void 0) {
  36182. let newMaterial = this._materialColorProperty({
  36183. color: params.outlineColor
  36184. });
  36185. this._editEntity.polyline.material = newMaterial;
  36186. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36187. }
  36188. this._editEntity.setParams(params);
  36189. },
  36190. _updatePolygonProperty(params) {
  36191. let material = this._editEntity.polygon.material;
  36192. if (material instanceof Cesium.ColorMaterialProperty) {
  36193. let newMaterial = this._materialColorProperty({
  36194. color: params.color
  36195. });
  36196. this._editEntity.polygon.material = newMaterial;
  36197. }
  36198. if (this._editEntity.polyline !== void 0) {
  36199. let newMaterial = this._materialColorProperty({
  36200. color: params.outlineColor
  36201. });
  36202. this._editEntity.polyline.material = newMaterial;
  36203. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36204. }
  36205. this._editEntity.setParams(params);
  36206. },
  36207. _updatePolylineProperty(params) {
  36208. let material = this._editEntity.polyline.material;
  36209. let newMaterial = void 0;
  36210. if (material instanceof Cesium.ColorMaterialProperty) {
  36211. newMaterial = this._materialColorProperty({
  36212. color: params.color
  36213. });
  36214. } else if (material instanceof Cesium.PolylineArrowMaterialProperty) {
  36215. newMaterial = this._materialPolylineArrowProperty({
  36216. color: params.color
  36217. });
  36218. } else if (material instanceof WallMaterialProperty) {
  36219. let materialImage = this._image_h_l_r;
  36220. if (params.order === this._param.order_minus) {
  36221. materialImage = this._image_h_r_l;
  36222. } else if (params.order === this._param.order_add) {
  36223. materialImage = this._image_h_l_r;
  36224. }
  36225. newMaterial = new WallMaterialProperty({
  36226. viewer: this._viewer,
  36227. trailImage: materialImage,
  36228. duration: params.duration,
  36229. color: Cesium.Color.fromCssColorString(params.color),
  36230. param: {
  36231. count: parseInt(params.count),
  36232. direction: params.direction,
  36233. order: params.order
  36234. }
  36235. });
  36236. } else if (material instanceof Cesium.PolylineGlowMaterialProperty) {
  36237. newMaterial = this._materialPolylineGlowProperty({
  36238. color: params.color,
  36239. power: parseFloat(params.power)
  36240. });
  36241. } else if (material instanceof Cesium.PolylineOutlineMaterialProperty) {
  36242. newMaterial = this._materialPolylineOutlineProperty({
  36243. color: params.color,
  36244. outlineWidth: parseFloat(params.outlineWidth),
  36245. outlineColor: params.outlineColor
  36246. });
  36247. }
  36248. if (newMaterial !== void 0)
  36249. this._editEntity.polyline.material = newMaterial;
  36250. this._editEntity.polyline.width = params.lineWidth;
  36251. this._editEntity.setParams(params);
  36252. },
  36253. _updateHouseProperty(params) {
  36254. let entityParams = this._editEntity.getParams();
  36255. let polygonMaterial = this._editEntity.polygon.material;
  36256. if (polygonMaterial instanceof Cesium.ColorMaterialProperty) {
  36257. let material = this._materialColorProperty({
  36258. color: params.color
  36259. });
  36260. this._editEntity.polygon.material = material;
  36261. this._editEntity.polygon.extrudedHeight = parseFloat(params.height) + parseFloat(
  36262. entityParams.bottomHeight
  36263. );
  36264. this._editEntity.setParams(params);
  36265. }
  36266. },
  36267. _updateCircleProperty(params) {
  36268. let circleMaterial = this._editEntity.ellipse.material;
  36269. if (circleMaterial instanceof CircleMaterialProperty) {
  36270. let material = new CircleMaterialProperty({
  36271. viewer: this._viewer,
  36272. duration: params.duration,
  36273. color: Cesium.Color.fromCssColorString(params.color),
  36274. count: parseFloat(params.count)
  36275. });
  36276. this._editEntity.ellipse.material = material;
  36277. } else if (circleMaterial instanceof Cesium.ColorMaterialProperty) {
  36278. let material = this._materialColorProperty({
  36279. color: params.color
  36280. });
  36281. this._editEntity.ellipse.material = material;
  36282. if (this._editEntity.polyline !== void 0) {
  36283. let newMaterial = this._materialColorProperty({
  36284. color: params.outlineColor
  36285. });
  36286. this._editEntity.polyline.material = newMaterial;
  36287. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36288. }
  36289. }
  36290. this._editEntity.setParams(params);
  36291. },
  36292. _updateVideoWallProperty(params) {
  36293. let videoElement = document.getElementById("wallVideo");
  36294. if (videoElement !== null) {
  36295. document.body.removeChild(videoElement);
  36296. }
  36297. videoElement = document.createElement("video");
  36298. videoElement.id = "wallVideo";
  36299. videoElement.setAttribute("crossorigin", "anonymous");
  36300. videoElement.setAttribute("width", "1024px");
  36301. videoElement.setAttribute("height", "256px");
  36302. videoElement.setAttribute("controls", "controls");
  36303. videoElement.setAttribute("src", params.videoUrl);
  36304. videoElement.setAttribute("loop", "loop");
  36305. videoElement.play();
  36306. document.body.appendChild(videoElement);
  36307. let minimumHeights = this._editEntity.wall.minimumHeights._value;
  36308. let maximumHeights = [];
  36309. for (let i2 = 0; i2 < minimumHeights.length; i2++) {
  36310. maximumHeights.push(minimumHeights[i2] + parseFloat(params.height));
  36311. }
  36312. this._editEntity.wall.maximumHeights = maximumHeights;
  36313. this._editEntity.wall.material = videoElement;
  36314. let wallPositions = this._editEntity.wall.positions._value;
  36315. let newPositions = [];
  36316. for (let wallPosition of wallPositions) {
  36317. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(wallPosition);
  36318. let m = new Cesium.Matrix4();
  36319. Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY, new Cesium.Cartesian3(
  36320. parseFloat(params.axisX),
  36321. parseFloat(params.axisY),
  36322. parseFloat(params.axisZ)
  36323. ), m);
  36324. let moveMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  36325. let newPosition = new Cesium.Cartesian3();
  36326. Cesium.Matrix4.getTranslation(moveMatrix, newPosition);
  36327. newPositions.push(newPosition);
  36328. }
  36329. this._editEntity.wall.positions = newPositions;
  36330. params.axisX = params.axisY = params.axisZ = 0;
  36331. this._editEntity.setParams(params);
  36332. this._activateEdit(this._editEntity);
  36333. },
  36334. _updateWallProperty(params) {
  36335. let minHeights = this._editEntity.wall.minimumHeights._value;
  36336. let maxHeights = [];
  36337. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36338. maxHeights.push(minHeights[i2] + parseFloat(params.height));
  36339. }
  36340. this._editEntity.wall.maximumHeights = maxHeights;
  36341. this._sketchWallMaxHeights = maxHeights;
  36342. let wallMaterial = this._editEntity.wall.material;
  36343. if (wallMaterial instanceof Cesium.ImageMaterialProperty) {
  36344. let material = this._materialTextImageProperty({
  36345. color: params.color,
  36346. text: params.text
  36347. });
  36348. this._editEntity.wall.material = material;
  36349. } else if (wallMaterial instanceof WallMaterialProperty) {
  36350. let materialImage = this._image_h_l_r;
  36351. if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36352. materialImage = this._image_h_l_r;
  36353. } else if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36354. materialImage = this._image_h_r_l;
  36355. } else if (params.direction === this._param.direction_v && params.order === this._param.order_minus) {
  36356. materialImage = this._image_v_t_b;
  36357. } else if (params.direction === this._param.direction_v && params.order === this._param.order_add) {
  36358. materialImage = this._image_v_b_t;
  36359. }
  36360. let material = new WallMaterialProperty({
  36361. viewer: this._viewer,
  36362. trailImage: materialImage,
  36363. duration: params.duration,
  36364. color: Cesium.Color.fromCssColorString(params.color),
  36365. param: {
  36366. count: parseFloat(params.count),
  36367. direction: params.direction,
  36368. order: params.order
  36369. }
  36370. });
  36371. this._editEntity.wall.material = material;
  36372. } else if (wallMaterial instanceof Cesium.ColorMaterialProperty) {
  36373. let material = this._materialColorProperty({
  36374. color: params.color
  36375. });
  36376. this._editEntity.wall.material = material;
  36377. }
  36378. this._editEntity.setParams(params);
  36379. },
  36380. rotationEntity(options2) {
  36381. if (this._editEntity === void 0)
  36382. return;
  36383. this._coordinateCalculateEntityOrientation(this._editEntity, options2);
  36384. },
  36385. _getEntityEditData: function(entity) {
  36386. if (entity instanceof Cesium.Entity) {
  36387. let editEntityType = entity.getEntityType();
  36388. if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36389. return entity.polyline.positions._value;
  36390. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36391. let positions = entity.polygon.hierarchy._value.positions;
  36392. if (positions[0].x !== positions[positions.length - 1].x) {
  36393. positions.push(positions[0].clone());
  36394. }
  36395. return positions;
  36396. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36397. let rect = entity.rectangle.coordinates._value;
  36398. let gNw = Cesium.Rectangle.northwest(rect);
  36399. if (gNw.height <= 0) {
  36400. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gNw.longitude), Cesium.Math.toDegrees(gNw.latitude));
  36401. gNw.height = height2;
  36402. }
  36403. let cNw = Cesium.Cartesian3.fromRadians(gNw.longitude, gNw.latitude, gNw.height);
  36404. let gSe = Cesium.Rectangle.southeast(rect);
  36405. if (gSe.height <= 0) {
  36406. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gSe.longitude), Cesium.Math.toDegrees(gSe.latitude));
  36407. gSe.height = height2;
  36408. }
  36409. let cSe = Cesium.Cartesian3.fromRadians(gSe.longitude, gSe.latitude, gSe.height);
  36410. return [cNw, cSe];
  36411. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36412. let centerPosition = entity.position._value;
  36413. let radius = entity.ellipse.semiMajorAxis._value;
  36414. let cbPoint = this._calculateCircleBoundaryPoint(centerPosition, radius);
  36415. return [centerPosition, cbPoint];
  36416. } else if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36417. this._sketchWallHeights = [];
  36418. this._sketchWallMaxHeights = [];
  36419. let minHeights = entity.wall.minimumHeights._value;
  36420. let maxHeights = entity.wall.maximumHeights._value;
  36421. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36422. this._sketchWallHeights.push(minHeights[i2]);
  36423. this._sketchWallMaxHeights.push(maxHeights[i2]);
  36424. }
  36425. return entity.wall.positions._value;
  36426. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36427. let positions = entity.wall.positions._value;
  36428. return [positions[0].clone()];
  36429. } else {
  36430. return [];
  36431. }
  36432. } else {
  36433. return [];
  36434. }
  36435. },
  36436. _calculateCircleBoundaryPoint: function(centerPosition, radius) {
  36437. let gCenter = Cesium.Ellipsoid.WGS84.cartesianToCartographic(centerPosition);
  36438. let cPoint = point([Cesium.Math.toDegrees(gCenter.longitude), Cesium.Math.toDegrees(
  36439. gCenter.latitude
  36440. )]);
  36441. let boundaryPoint = destination(cPoint, radius / 1e3, 90, {
  36442. units: "kilometers"
  36443. }).geometry.coordinates;
  36444. let height2 = this._queryHeightFromGeo(boundaryPoint[0], boundaryPoint[1]);
  36445. let cbPoint = Cesium.Cartesian3.fromDegrees(boundaryPoint[0], boundaryPoint[1], height2);
  36446. return cbPoint;
  36447. },
  36448. _calculateCenterPosition: function(positions) {
  36449. if (positions === void 0 || positions.length === 0)
  36450. return void 0;
  36451. else if (positions.length === 1) {
  36452. return positions[0];
  36453. } else if (positions.length === 2) {
  36454. let pt0 = this._cartesian3ToGeo(positions[0]);
  36455. let pt1 = this._cartesian3ToGeo(positions[1]);
  36456. let point0 = point([pt0.longitude, pt0.latitude]);
  36457. let point1 = point([pt1.longitude, pt1.latitude]);
  36458. let center2 = midpoint(point0, point1).geometry.coordinates;
  36459. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36460. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36461. } else {
  36462. let geoPoints = [
  36463. []
  36464. ];
  36465. for (let i2 = 0; i2 < positions.length; i2++) {
  36466. let geoPoint = this._cartesian3ToGeo(positions[i2]);
  36467. geoPoints[0].push([geoPoint.longitude, geoPoint.latitude]);
  36468. }
  36469. geoPoints[0].push(geoPoints[0][0]);
  36470. let polygon$1 = polygon(geoPoints);
  36471. let center2 = centerOfMass(polygon$1).geometry.coordinates;
  36472. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36473. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36474. }
  36475. },
  36476. _calculateTransformPosition: function(position2, distance2, bearing2, options2) {
  36477. let geoPoint = this._cartesian3ToGeo(position2);
  36478. let point$1 = point([geoPoint.longitude, geoPoint.latitude]);
  36479. let resPoint = destination(point$1, distance2, bearing2, options2).geometry.coordinates;
  36480. let height2 = geoPoint.height;
  36481. if (options2 !== void 0 && options2.calculateHeight !== void 0 && options2.calculateHeight === true) {
  36482. height2 = this._queryHeightFromGeo(resPoint[0], resPoint[1]);
  36483. }
  36484. let cPosition = Cesium.Cartesian3.fromDegrees(
  36485. resPoint[0],
  36486. resPoint[1],
  36487. height2
  36488. );
  36489. return cPosition;
  36490. },
  36491. _unActivateEdit: function() {
  36492. this._clearEditPoint();
  36493. this._removeCoorinateAxis();
  36494. this._closePropertyEditDialog();
  36495. },
  36496. _activateEdit: function(editEntity) {
  36497. let entityType = editEntity.getEntityType();
  36498. let entityIsEdit = editEntity.getIsEdit();
  36499. if (entityIsEdit === void 0 || entityType === void 0 || entityIsEdit === false) {
  36500. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91");
  36501. return;
  36502. }
  36503. if (entityType === DrawTools.DrawType.OdLine) {
  36504. this._activeteOdlineEdit(editEntity);
  36505. } else {
  36506. this._activeteNormalEdit(editEntity);
  36507. }
  36508. },
  36509. _activeteOdlineEdit: function(editEntity) {
  36510. let _self = this;
  36511. let entityType = editEntity.getEntityType();
  36512. if (entityType === void 0 || entityType !== DrawTools.DrawType.OdLine) {
  36513. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91\u6216\u8BE5\u5B9E\u4F53\u4E0D\u662FOD\u7EBF\u7C7B\u578B");
  36514. return;
  36515. }
  36516. let faterEntityId = editEntity.parent.id;
  36517. this._editOdlineEntities = [];
  36518. for (let entity of this._entities.values) {
  36519. if (entity.parent !== void 0 && entity.parent.id === faterEntityId) {
  36520. this._editOdlineEntities.push(entity);
  36521. }
  36522. }
  36523. if (this._editOdlineEntities.length === 0)
  36524. return;
  36525. this._editEntity = this._editOdlineEntities[0];
  36526. for (let i2 = 0; i2 < this._editOdlineEntities.length; i2++) {
  36527. let entity = this._editOdlineEntities[i2];
  36528. let positions = entity.polyline.positions._value;
  36529. if (i2 === 0) {
  36530. this._createEditOdlineStartPoint(positions.first(), entity);
  36531. this._createEditOdlineEndPoint(positions.last(), entity);
  36532. } else {
  36533. this._createEditOdlineEndPoint(positions.last(), entity);
  36534. }
  36535. }
  36536. if (this._sketchEditHandler === void 0) {
  36537. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36538. }
  36539. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36540. _self._eventEditMouseDown(event2);
  36541. });
  36542. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36543. _self._eventEditMouseMove(event2);
  36544. });
  36545. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36546. _self._eventEditMouseUp(event2);
  36547. });
  36548. },
  36549. _activeteNormalEdit: function(editEntity) {
  36550. let _self = this;
  36551. let positions = this._getEntityEditData(editEntity);
  36552. this._removePointEntitys();
  36553. let entityType = editEntity.getEntityType();
  36554. this._editEntity = editEntity;
  36555. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36556. this._createEditCenterPoint(positions[0]);
  36557. this._createEditNodePoint(positions, 1);
  36558. } else if (entityType === DrawTools.DrawType.VideoWall) {
  36559. if (!this._isRuntimeApp()) {
  36560. let position2 = positions[0];
  36561. this._removeCoorinateAxis();
  36562. this._createCoordinateAxis(position2);
  36563. }
  36564. } else {
  36565. this._createEditNodePoint(positions);
  36566. let centerPosition = this._calculateCenterPosition(positions);
  36567. if (centerPosition !== void 0) {
  36568. this._createEditCenterPoint(centerPosition);
  36569. }
  36570. }
  36571. if (entityType !== DrawTools.DrawType.Rectangle && entityType !== DrawTools.DrawType.Circle && entityType !== DrawTools.DrawType.DynamicCircle && entityType !== DrawTools.DrawType.VideoWall) {
  36572. if (entityType === DrawTools.DrawType.SpatialLine) {
  36573. this._createEditMiddlePoint(positions, true);
  36574. } else {
  36575. this._createEditMiddlePoint(positions);
  36576. }
  36577. }
  36578. if (this._sketchEditHandler === void 0) {
  36579. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36580. }
  36581. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36582. _self._eventEditMouseDown(event2);
  36583. });
  36584. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36585. _self._eventEditMouseMove(event2);
  36586. });
  36587. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36588. _self._eventEditMouseUp(event2);
  36589. });
  36590. },
  36591. _eventEditMouseDown: function(event2) {
  36592. let _self = this;
  36593. let feature2 = _self._viewer.scene.pick(event2.position);
  36594. if (feature2 != void 0 && feature2.id instanceof Cesium.Entity) {
  36595. let featureType = feature2.id.getEditType();
  36596. if (featureType === void 0)
  36597. return;
  36598. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  36599. let entityPosition = feature2.id.position._value;
  36600. _self._editPointEntity = feature2.id;
  36601. _self._setMousePointerStyle();
  36602. if (featureType.type === DrawTools.EditPointType.Node || featureType.type === DrawTools.EditPointType.Middle) {
  36603. _self._entityCallbackPropertyByMouseDown();
  36604. _self._removeEntityByObject(_self._editPointEntity);
  36605. if (_self._sketchEditEntitySpatialName != void 0) {
  36606. _self._removeEntityByName(_self._sketchEditEntitySpatialName);
  36607. }
  36608. } else if (featureType.type === DrawTools.EditPointType.Center) {
  36609. _self._entityCenterMouseDownEvent();
  36610. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode) {
  36611. _self._removeEntityByObject(_self._editPointEntity);
  36612. _self._editEntity = featureType.joinEntity;
  36613. let params = _self._editEntity.parent.getParams();
  36614. _self._sketchEditPoints = [];
  36615. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36616. _self._sketchEditPoints.push(joinEntityPositions.first());
  36617. _self._sketchEditPoints.push(joinEntityPositions.last());
  36618. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36619. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36620. return positions;
  36621. }, false);
  36622. } else if (featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36623. _self._removeEntityByObject(_self._editPointEntity);
  36624. _self._editEntity = featureType.joinEntity;
  36625. let params = _self._editEntity.parent.getParams();
  36626. _self._sketchEditPoints = [];
  36627. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36628. _self._sketchEditPoints.push(joinEntityPositions.first());
  36629. for (let odEntity of _self._editOdlineEntities) {
  36630. let odEntityPositions = odEntity.polyline.positions._value;
  36631. let lastPosition = odEntityPositions.last();
  36632. _self._sketchEditPoints.push(lastPosition.clone());
  36633. odEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36634. let positions = _self._calculateOdlinePositios(
  36635. _self._sketchEditPoints[0],
  36636. lastPosition,
  36637. parseInt(params.odlineHeight),
  36638. parseInt(params.odlineCount)
  36639. );
  36640. return positions;
  36641. }, false);
  36642. }
  36643. }
  36644. if (featureType.type === DrawTools.EditPointType.Middle) {
  36645. let index2 = featureType.index;
  36646. _self._sketchEditPoints.splice(index2, 0, entityPosition);
  36647. _self._sketchEditIndex = index2;
  36648. if (_self._sketchWallHeights != void 0 && _self._sketchWallHeights.length > 0) {
  36649. let geoPoint = _self._cartesian3ToGeo(entityPosition);
  36650. let height2 = _self._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  36651. _self._sketchWallHeights.splice(index2, 0, height2);
  36652. let heightDifference = _self._sketchWallMaxHeights[0] - _self._sketchWallHeights[0];
  36653. _self._sketchWallMaxHeights.splice(index2, 0, height2 + heightDifference);
  36654. }
  36655. _self._tooltipInit("\u62D6\u52A8\u4E2D\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36656. } else if (featureType.type === DrawTools.EditPointType.Node) {
  36657. _self._sketchEditIndex = featureType.index;
  36658. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36659. } else if (featureType.type === DrawTools.EditPointType.Spatial) {
  36660. _self._sketchEditIndex = featureType.index;
  36661. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u9AD8\u5EA6", event2.position);
  36662. } else if (featureType.type === DrawTools.EditPointType.CoordinateAxis) {
  36663. _self._tooltipInit("\u62D6\u52A8\u5750\u6807\u8F74\uFF0C\u6539\u53D8\u4F4D\u7F6E", event2.position);
  36664. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode || featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36665. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8OD\u7EBF\u4F4D\u7F6E", event2.position);
  36666. }
  36667. }
  36668. },
  36669. _eventEditMouseMove: function(event2) {
  36670. let _self = this;
  36671. if (_self._editPointEntity != void 0) {
  36672. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  36673. if (!Cesium.defined(loc2.sLocation))
  36674. return;
  36675. _self._editPosition = loc2.sLocation;
  36676. let editEntityType = _self._editPointEntity.getEditType();
  36677. if (editEntityType.type === DrawTools.EditPointType.Node) {
  36678. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36679. let editEntityType2 = _self._editEntity.getEntityType();
  36680. if (editEntityType2 != DrawTools.DrawType.Rectangle && editEntityType2 != DrawTools.DrawType.Circle && editEntityType2 != DrawTools.DrawType.DynamicCircle) {
  36681. if ((editEntityType2 === DrawTools.DrawType.Polygon || editEntityType2 === DrawTools.DrawType.House) && _self._sketchEditIndex === 0) {
  36682. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36683. } else if (editEntityType2 === DrawTools.DrawType.NormalWall || editEntityType2 === DrawTools.DrawType.DynamicWall || editEntityType2 === DrawTools.DrawType.TextWall) {
  36684. _self._sketchWallHeights[_self._sketchEditIndex] = loc2.gLocation.height;
  36685. }
  36686. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36687. if (editEntityType2 === DrawTools.DrawType.SpatialLine) {
  36688. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36689. } else {
  36690. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36691. }
  36692. }
  36693. } else if (editEntityType.type === DrawTools.EditPointType.Middle) {
  36694. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36695. } else if (editEntityType.type === DrawTools.EditPointType.Center) {
  36696. _self._entityCenterMouseMoveEvent(event2);
  36697. } else if (editEntityType.type === DrawTools.EditPointType.Spatial) {
  36698. let ellipsoid = _self._viewer.scene.globe.ellipsoid;
  36699. let cartesian = _self._viewer.camera.pickEllipsoid(
  36700. event2.endPosition,
  36701. ellipsoid
  36702. );
  36703. let bottomPoint = _self._sketchEditPoints[_self._sketchEditIndex];
  36704. let heightDifference = cartesian.z - bottomPoint.z;
  36705. if (heightDifference > 0 && heightDifference < 500) {
  36706. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  36707. _self._sketchWallMaxHeights[i2] = _self._sketchWallHeights[i2] + heightDifference;
  36708. }
  36709. }
  36710. } else if (editEntityType.type === DrawTools.EditPointType.OdlineEndNode) {
  36711. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36712. } else if (editEntityType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36713. _self._sketchEditPoints[0] = loc2.sLocation;
  36714. }
  36715. _self._tooltipInit("\u62AC\u8D77\u9F20\u6807\uFF0C\u5B8C\u6210\u66F4\u6539", event2.endPosition);
  36716. }
  36717. },
  36718. _eventEditMouseUp: function(event2) {
  36719. let _self = this;
  36720. if (_self._editPointEntity != void 0) {
  36721. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  36722. _self._tooltipRemove();
  36723. _self._setMouseDefaultStyle();
  36724. let editEntityPointType = _self._editPointEntity.getEditType().type;
  36725. let entityType = _self._editEntity.getEntityType();
  36726. if (editEntityPointType === DrawTools.EditPointType.CoordinateAxis)
  36727. ;
  36728. else if (editEntityPointType === DrawTools.EditPointType.OdlineEndNode) {
  36729. let params = _self._editEntity.parent.getParams();
  36730. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36731. _self._editEntity.polyline.positions = positions;
  36732. _self._createEditOdlineEndPoint(_self._sketchEditPoints[1], _self._editEntity);
  36733. } else if (editEntityPointType === DrawTools.EditPointType.OdlineStrartNode) {
  36734. let params = _self._editEntity.parent.getParams();
  36735. let index2 = 1;
  36736. for (let odEntity of _self._editOdlineEntities) {
  36737. let lastPosition = _self._sketchEditPoints[index2++];
  36738. let positions = _self._calculateOdlinePositios(
  36739. _self._sketchEditPoints[0],
  36740. lastPosition,
  36741. parseInt(params.odlineHeight),
  36742. parseInt(params.odlineCount)
  36743. );
  36744. odEntity.polyline.positions = positions;
  36745. }
  36746. _self._createEditOdlineStartPoint(_self._sketchEditPoints[0], _self._editOdlineEntities[0]);
  36747. } else {
  36748. if (editEntityPointType === DrawTools.EditPointType.Node || editEntityPointType === DrawTools.EditPointType.Middle) {
  36749. _self._entityCallbackPropertyByMouseUp();
  36750. } else if (editEntityPointType === DrawTools.EditPointType.Center) {
  36751. _self._entityCenterMouseUpEvent(event2);
  36752. }
  36753. _self._removeEntityByName(_self._sketchEditEntityNodeName);
  36754. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36755. _self._removeEntityByName(_self._sketchEditEntityCenterName);
  36756. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36757. let centerPosition = _self._editEntity.position._value;
  36758. let boundaryPosition = _self._calculateCircleBoundaryPoint(
  36759. centerPosition,
  36760. _self._sketchEllipseRadius
  36761. );
  36762. _self._sketchEditPoints[0] = centerPosition;
  36763. _self._sketchEditPoints[1] = boundaryPosition;
  36764. _self._createEditNodePoint(_self._sketchEditPoints, 1);
  36765. _self._createEditCenterPoint(centerPosition);
  36766. } else {
  36767. _self._createEditNodePoint(_self._sketchEditPoints);
  36768. let centerPosition = _self._calculateCenterPosition(_self._sketchEditPoints);
  36769. _self._createEditCenterPoint(centerPosition);
  36770. }
  36771. if (entityType != DrawTools.DrawType.Rectangle && entityType != DrawTools.DrawType.Circle && entityType != DrawTools.DrawType.DynamicCircle) {
  36772. if (entityType === DrawTools.DrawType.SpatialLine) {
  36773. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36774. } else {
  36775. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36776. }
  36777. }
  36778. }
  36779. _self._editPointEntity = void 0;
  36780. }
  36781. },
  36782. _entityCenterMouseDownEvent: function() {
  36783. let _self = this;
  36784. let entityPosition = this._editEntity.position._value;
  36785. this._removeEntityByName(this._sketchEditEntityNodeName);
  36786. this._removeEntityByName(this._sketchEditEntityMiddleName);
  36787. this._removeEntityByName(this._sketchEditEntityCenterName);
  36788. this._startPoint = entityPosition;
  36789. this._startMovePoints = [];
  36790. this._movePoint = entityPosition;
  36791. let editEntityType = this._editEntity.getEntityType();
  36792. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36793. if (this._editEntity.polyline !== void 0) {
  36794. for (let i2 = 0; i2 < this._ellipseOutlineCoordinates.length; i2++) {
  36795. this._startMovePoints.push(this._ellipseOutlineCoordinates[i2]);
  36796. }
  36797. this._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36798. function() {
  36799. return _self._ellipseOutlineCoordinates;
  36800. },
  36801. false
  36802. );
  36803. }
  36804. this._editEntity.position = new Cesium.CallbackProperty(function() {
  36805. return _self._movePoint;
  36806. }, false);
  36807. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36808. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36809. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36810. }
  36811. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(function() {
  36812. return {
  36813. positions: _self._sketchEditPoints
  36814. };
  36815. }, false);
  36816. if (_self._editEntity.polyline != void 0) {
  36817. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36818. return _self._sketchEditPoints;
  36819. }, false);
  36820. }
  36821. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36822. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36823. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36824. }
  36825. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36826. return _self._sketchEditPoints;
  36827. }, false);
  36828. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36829. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36830. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36831. }
  36832. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(_self._sketchEditPoints), false);
  36833. if (_self._editEntity.polyline != void 0) {
  36834. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36835. _self._callUpdateRectangleOutlineCoordinates(),
  36836. false
  36837. );
  36838. }
  36839. }
  36840. },
  36841. _entityCenterMouseMoveEvent: function(event2) {
  36842. this._calculatePositionsByCenter(event2.endPosition, false);
  36843. },
  36844. _calculatePositionsByCenter: function(screenPosition, calculateHeight) {
  36845. let strLoc = this._cartesian3ToGeo(this._startPoint);
  36846. let endLoc = this._transfromFromScreenPoint(screenPosition);
  36847. var point1 = point([strLoc.longitude, strLoc.latitude]);
  36848. var point2 = point([endLoc.gLocation.lng, endLoc.gLocation.lat]);
  36849. var bearing$1 = bearing(point1, point2);
  36850. var options2 = {
  36851. units: "kilometers",
  36852. calculateHeight
  36853. };
  36854. var distance$1 = distance(point1, point2, options2);
  36855. let editEntityType = this._editEntity.getEntityType();
  36856. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36857. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36858. let position2 = this._calculateTransformPosition(
  36859. this._startMovePoints[i2],
  36860. distance$1,
  36861. bearing$1,
  36862. options2
  36863. );
  36864. this._ellipseOutlineCoordinates[i2] = position2.clone();
  36865. }
  36866. this._movePoint = endLoc.sLocation;
  36867. } else {
  36868. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36869. let position2 = this._calculateTransformPosition(
  36870. this._startMovePoints[i2],
  36871. distance$1,
  36872. bearing$1,
  36873. options2
  36874. );
  36875. this._sketchEditPoints[i2] = position2.clone();
  36876. }
  36877. }
  36878. },
  36879. _entityCenterMouseUpEvent: function(event2) {
  36880. this._calculatePositionsByCenter(event2.position, true);
  36881. let _self = this;
  36882. let editEntityType = this._editEntity.getEntityType();
  36883. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36884. this._editEntity.position = this._movePoint;
  36885. if (this._editEntity.polyline !== void 0) {
  36886. this._editEntity.polyline.positions = this._ellipseOutlineCoordinates;
  36887. }
  36888. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36889. this._editEntity.polyline.positions = this._sketchEditPoints;
  36890. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36891. this._editEntity.polygon.hierarchy = {
  36892. positions: _self._sketchEditPoints
  36893. };
  36894. if (this._editEntity.polyline != void 0) {
  36895. this._editEntity.polyline.positions = this._sketchEditPoints;
  36896. }
  36897. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36898. this._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36899. if (this._editEntity.polyline != void 0) {
  36900. this._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36901. }
  36902. }
  36903. },
  36904. _entityCallbackPropertyByMouseUp: function() {
  36905. let _self = this;
  36906. let entityType = _self._editEntity.getEntityType();
  36907. if (entityType === DrawTools.DrawType.Polyline) {
  36908. _self._editEntity.polyline.positions = _self._sketchEditPoints;
  36909. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36910. _self._editEntity.polygon.hierarchy = {
  36911. positions: _self._sketchEditPoints
  36912. };
  36913. if (_self._editEntity.polyline != void 0) {
  36914. let polygonPositions = _self._editEntity.polygon.hierarchy._value.positions;
  36915. let linePositions = [];
  36916. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36917. linePositions.push(polygonPositions[i2].clone());
  36918. }
  36919. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36920. linePositions.push(linePositions[0].clone());
  36921. }
  36922. _self._editEntity.polyline.positions = linePositions;
  36923. }
  36924. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36925. _self._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36926. if (_self._editEntity.polyline != void 0) {
  36927. _self._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36928. }
  36929. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36930. _self._editEntity.ellipse.semiMajorAxis = _self._sketchEllipseRadius;
  36931. _self._editEntity.ellipse.semiMinorAxis = _self._sketchEllipseRadius;
  36932. if (_self._editEntity.polyline != void 0) {
  36933. _self._editEntity.polyline.positions = _self._ellipseOutlineCoordinates;
  36934. }
  36935. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  36936. _self._editEntity.wall.positions = _self._sketchEditPoints;
  36937. _self._editEntity.wall.minimumHeights = _self._sketchWallHeights;
  36938. _self._editEntity.wall.maximumHeights = _self._sketchWallMaxHeights;
  36939. }
  36940. },
  36941. _entityCallbackPropertyByMouseDown: function() {
  36942. let _self = this;
  36943. let entityType = _self._editEntity.getEntityType();
  36944. if (entityType === DrawTools.DrawType.Polyline || entityType === DrawTools.DrawType.SpatialLine) {
  36945. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36946. function() {
  36947. return _self._sketchEditPoints;
  36948. },
  36949. false
  36950. );
  36951. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36952. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(
  36953. function() {
  36954. return {
  36955. positions: _self._sketchEditPoints
  36956. };
  36957. },
  36958. false
  36959. );
  36960. if (_self._editEntity.polyline != void 0) {
  36961. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36962. function() {
  36963. let polygonPositions = _self._sketchEditPoints;
  36964. let linePositions = [];
  36965. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36966. linePositions.push(polygonPositions[i2].clone());
  36967. }
  36968. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36969. linePositions.push(linePositions[0].clone());
  36970. }
  36971. return linePositions;
  36972. },
  36973. false
  36974. );
  36975. }
  36976. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36977. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(
  36978. _self._callUpdateRectangleCoordinates(_self._sketchEditPoints),
  36979. false
  36980. );
  36981. if (_self._editEntity.polyline != void 0) {
  36982. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36983. _self._callUpdateRectangleOutlineCoordinates(),
  36984. false
  36985. );
  36986. }
  36987. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36988. if (_self._editPointEntity.getEditType().index === 1) {
  36989. _self._editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty(
  36990. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  36991. false
  36992. );
  36993. _self._editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty(
  36994. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  36995. false
  36996. );
  36997. }
  36998. if (_self._editEntity.polyline != void 0) {
  36999. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  37000. _self._callEllipseOutlineCoordinate(_self._sketchEditPoints),
  37001. false
  37002. );
  37003. }
  37004. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  37005. _self._editEntity.wall.positions = new Cesium.CallbackProperty(function() {
  37006. return _self._sketchEditPoints;
  37007. }, false);
  37008. _self._editEntity.wall.minimumHeights = new Cesium.CallbackProperty(function() {
  37009. return _self._sketchWallHeights;
  37010. }, false);
  37011. _self._editEntity.wall.maximumHeights = new Cesium.CallbackProperty(function() {
  37012. return _self._sketchWallMaxHeights;
  37013. }, false);
  37014. }
  37015. },
  37016. _createEditPointEntity(options2) {
  37017. let _self = this;
  37018. if (options2 === void 0 || options2.position === void 0)
  37019. return;
  37020. if (options2 === void 0 || options2.editType === void 0)
  37021. return;
  37022. let color2 = options2.color != void 0 ? options2.color : [255, 0, 0, 1];
  37023. let size = options2.size != void 0 && typeof options2.size === "number" ? options2.size : 9;
  37024. let outlineWidth = options2.outlineWidth != void 0 && typeof options2.outlineWidth === "number" ? options2.outlineWidth : 1;
  37025. let outlineColor = options2.outlineColor != void 0 ? options2.outlineColor : [255, 255, 255, 1];
  37026. let pointEntity = new Cesium.Entity({
  37027. name: options2.name != void 0 ? options2.name : _self._sketchEntityName,
  37028. position: options2.position,
  37029. point: {
  37030. show: true,
  37031. pixelSize: size,
  37032. heightReference: Cesium.HeightReference.NONE,
  37033. color: _self._toColorFromArray(color2),
  37034. outlineWidth,
  37035. outlineColor: _self._toColorFromArray(outlineColor),
  37036. disableDepthTestDistance: 15e11
  37037. }
  37038. });
  37039. pointEntity.setEditType(options2.editType);
  37040. _self._entities.add(pointEntity);
  37041. },
  37042. _createEditNodePoint(positions, startIndex) {
  37043. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37044. let _self = this;
  37045. this._sketchEditPoints = [];
  37046. let strIndex = startIndex === void 0 ? 0 : startIndex;
  37047. for (let i2 = 0; i2 < positions.length; i2++) {
  37048. let position2 = positions[i2];
  37049. this._sketchEditPoints.push(position2.clone());
  37050. if (i2 < strIndex)
  37051. continue;
  37052. if (i2 !== 0 && position2.x === positions[0].x && position2.y === positions[0].y && position2.z === positions[0].z) {
  37053. continue;
  37054. }
  37055. let geoPoint = this._cartesian3ToGeo(position2);
  37056. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37057. let newPosition = Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37058. _self._createEditPointEntity({
  37059. name: _self._sketchEditEntityNodeName,
  37060. position: newPosition,
  37061. size: 12,
  37062. color: [0, 0, 255, 1],
  37063. editType: {
  37064. type: DrawTools.EditPointType.Node,
  37065. index: i2
  37066. }
  37067. });
  37068. }
  37069. },
  37070. _createEditSpatialPoint(positions, heights, startIndex) {
  37071. return;
  37072. },
  37073. _createEditMiddlePoint(positions, isSpatial = false) {
  37074. this._sketchEditEntityMiddleName = "SketchEditEntityMiddle";
  37075. let _self = this;
  37076. if (!isSpatial) {
  37077. for (let i2 = 1; i2 < positions.length; i2++) {
  37078. let p1 = positions[i2 - 1];
  37079. let p2 = positions[i2];
  37080. let pCenter = this._calculateMiddlePoint(p1, p2);
  37081. this._createEditPointEntity({
  37082. name: _self._sketchEditEntityMiddleName,
  37083. position: pCenter,
  37084. size: 9,
  37085. color: [255, 255, 0, 1],
  37086. editType: {
  37087. type: DrawTools.EditPointType.Middle,
  37088. index: i2
  37089. }
  37090. });
  37091. }
  37092. } else {
  37093. for (let i2 = 1; i2 < positions.length; i2++) {
  37094. let p1 = positions[i2 - 1];
  37095. let p2 = positions[i2];
  37096. let pCenter = {
  37097. x: (p1.x + p2.x) / 2,
  37098. y: (p1.y + p2.y) / 2,
  37099. z: (p1.z + p2.z) / 2
  37100. };
  37101. this._createEditPointEntity({
  37102. name: _self._sketchEditEntityMiddleName,
  37103. position: pCenter,
  37104. size: 9,
  37105. color: [255, 255, 0, 1],
  37106. editType: {
  37107. type: DrawTools.EditPointType.Middle,
  37108. index: i2
  37109. }
  37110. });
  37111. }
  37112. }
  37113. },
  37114. _createEditCenterPoint(position2) {
  37115. let _self = this;
  37116. this._sketchEditEntityCenterName = "SketchEditEntityCenter";
  37117. this._createEditPointEntity({
  37118. name: _self._sketchEditEntityCenterName,
  37119. position: position2,
  37120. size: 12,
  37121. color: [0, 255, 0, 0.1],
  37122. outlineWidth: 2,
  37123. outlineColor: [255, 255, 255, 1],
  37124. editType: {
  37125. type: DrawTools.EditPointType.Center
  37126. }
  37127. });
  37128. if (this._editEntity != void 0) {
  37129. this._editEntity.position = position2.clone();
  37130. }
  37131. },
  37132. _createEditOdlineEndPoint(position2, joinEntity) {
  37133. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37134. let _self = this;
  37135. let geoPoint = this._cartesian3ToGeo(position2);
  37136. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37137. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37138. _self._createEditPointEntity({
  37139. name: _self._sketchEditEntityNodeName,
  37140. position: position2,
  37141. size: 12,
  37142. color: [0, 0, 255, 1],
  37143. editType: {
  37144. type: DrawTools.EditPointType.OdlineEndNode,
  37145. joinEntity
  37146. }
  37147. });
  37148. },
  37149. _createEditOdlineStartPoint(position2, joinEntity) {
  37150. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37151. let _self = this;
  37152. let geoPoint = this._cartesian3ToGeo(position2);
  37153. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37154. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37155. _self._createEditPointEntity({
  37156. name: _self._sketchEditEntityNodeName,
  37157. position: position2,
  37158. size: 12,
  37159. color: [0, 255, 0, 0.6],
  37160. editType: {
  37161. type: DrawTools.EditPointType.OdlineStrartNode,
  37162. joinEntity
  37163. }
  37164. });
  37165. },
  37166. _calculateMiddlePoint(position1, position2) {
  37167. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position1);
  37168. let g2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37169. let pt1 = [Cesium.Math.toDegrees(g1.longitude), Cesium.Math.toDegrees(g1.latitude)];
  37170. let pt2 = [Cesium.Math.toDegrees(g2.longitude), Cesium.Math.toDegrees(g2.latitude)];
  37171. let tpt1 = point(pt1);
  37172. let tpt2 = point(pt2);
  37173. let midpoint$1 = midpoint(tpt1, tpt2).geometry.coordinates;
  37174. let height2 = this._queryHeightFromGeo(midpoint$1[0], midpoint$1[1]);
  37175. let result = Cesium.Cartesian3.fromDegrees(midpoint$1[0], midpoint$1[1], height2);
  37176. return result;
  37177. },
  37178. _cartesian3ToGeo: function(position2) {
  37179. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37180. return {
  37181. longitude: Cesium.Math.toDegrees(g.longitude),
  37182. latitude: Cesium.Math.toDegrees(g.latitude),
  37183. height: g.height
  37184. };
  37185. },
  37186. _queryHeightFromGeo: function(longitude, latitude) {
  37187. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37188. return 0;
  37189. let rLng = Cesium.Math.toRadians(longitude);
  37190. let rLat = Cesium.Math.toRadians(latitude);
  37191. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37192. let noQueryEntities = [];
  37193. for (let i2 = 0; i2 < this._entities.values.length; i2++) {
  37194. if (this._entities.values[i2].name === this._sketchEntityName) {
  37195. noQueryEntities.push(this._entities.values[i2]);
  37196. }
  37197. }
  37198. let height2 = this._viewer.scene.sampleHeight(cartographic, noQueryEntities);
  37199. if (height2 === void 0)
  37200. return 0;
  37201. else
  37202. return height2;
  37203. },
  37204. _queryHeightFromGeoAsync: function(longitude, latitude, callComplete) {
  37205. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37206. return 0;
  37207. let rLng = Cesium.Math.toRadians(longitude);
  37208. let rLat = Cesium.Math.toRadians(latitude);
  37209. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37210. let promise = this._viewer.scene.sampleHeightMostDetailed([cartographic]);
  37211. promise.then(function(updatedPositions) {
  37212. if (callComplete)
  37213. callComplete(updatedPositions[0].height);
  37214. });
  37215. },
  37216. _clearEditPoint: function() {
  37217. if (this._sketchEditHandler != void 0) {
  37218. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  37219. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  37220. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37221. }
  37222. this._sketchEditPoints = [];
  37223. this._sketchEditIndex = void 0;
  37224. this._editEntity = void 0;
  37225. this._removeEntityByName(this._sketchEditEntityNodeName);
  37226. this._removeEntityByName(this._sketchEditEntityMiddleName);
  37227. this._removeEntityByName(this._sketchEditEntityCenterName);
  37228. this._removeEntityByName(this._sketchEditEntitySpatialName);
  37229. }
  37230. });
  37231. Object.assign(DrawTools.prototype, {
  37232. _checkColor: function(color2) {
  37233. if (color2 === void 0 || color2 === null)
  37234. return false;
  37235. if (typeof color2 != "number")
  37236. return false;
  37237. let intColor = parseInt(color2);
  37238. if (intColor < 0 || intColor > 255)
  37239. return false;
  37240. return true;
  37241. },
  37242. _checkAlpha: function(alpha) {
  37243. if (alpha === void 0 || alpha === null)
  37244. return false;
  37245. if (typeof alpha != "number")
  37246. return false;
  37247. let floatAlpha = parseFloat(alpha);
  37248. if (floatAlpha < 0 || floatAlpha > 1)
  37249. return false;
  37250. return true;
  37251. },
  37252. _checkColorAndAlpha: function(colorAndAlpah) {
  37253. let setColor = void 0;
  37254. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  37255. return void 0;
  37256. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  37257. setColor = [colorAndAlpah[0], 0, 0, 1];
  37258. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37259. colorAndAlpah[1]
  37260. )) {
  37261. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  37262. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37263. colorAndAlpah[1]
  37264. ) && this._checkColor(colorAndAlpah[2])) {
  37265. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  37266. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37267. colorAndAlpah[1]
  37268. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  37269. colorAndAlpah[3]
  37270. )) {
  37271. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  37272. }
  37273. return setColor;
  37274. }
  37275. });
  37276. Object.assign(DrawTools.prototype, {
  37277. _initOperationDom: function() {
  37278. let _self = this;
  37279. this._operationDomId = "drawButtonDiv";
  37280. this._operationDom = document.getElementById(this._operationDomId);
  37281. this._removeOperationDom();
  37282. this._createOperationMainDom();
  37283. if ([
  37284. DrawTools.DrawType.Rectangle,
  37285. DrawTools.DrawType.Circle,
  37286. DrawTools.DrawType.DynamicCircle,
  37287. DrawTools.DrawType.VideoWall
  37288. ].indexOf(this._drawType) === -1) {
  37289. let btnUndo = this._createOperationUndoButtonDom();
  37290. btnUndo.onclick = function() {
  37291. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  37292. };
  37293. }
  37294. if ([
  37295. DrawTools.DrawType.Rectangle,
  37296. DrawTools.DrawType.Circle,
  37297. DrawTools.DrawType.DynamicCircle,
  37298. DrawTools.DrawType.VideoWall
  37299. ] === -1) {
  37300. let btnCompletion = this._crateOperationCompletionButtonDom();
  37301. btnCompletion.onclick = function() {
  37302. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37303. };
  37304. } else {
  37305. let btnCompletion = this._crateOperationCompletionButtonDom();
  37306. btnCompletion.onclick = function() {
  37307. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  37308. };
  37309. }
  37310. },
  37311. _operationExecuteEvent(eventType) {
  37312. if (this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  37313. let event2 = {
  37314. position: new Cesium.Cartesian2(300, 300)
  37315. };
  37316. let action = this._drawEventHandler.getInputAction(eventType);
  37317. action(event2);
  37318. }
  37319. },
  37320. _createOperationMainDom: function() {
  37321. this._operationDom = document.createElement("div");
  37322. this._operationDom.id = this._operationDomId;
  37323. this._operationDom.style.width = "80px";
  37324. this._operationDom.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37325. this._operationDom.style.borderRadius = "5px";
  37326. this._operationDom.style.display = "flex";
  37327. this._operationDom.style.flexDirection = "column";
  37328. this._operationDom.style.padding = "8px";
  37329. this._operationDom.style.justifyContent = "center";
  37330. this._operationDom.style.position = "absolute";
  37331. this._operationDom.style.bottom = "150px";
  37332. this._operationDom.style.right = "10px";
  37333. document.body.appendChild(this._operationDom);
  37334. },
  37335. _createOperationUndoButtonDom: function() {
  37336. let btnUndo = document.createElement("button");
  37337. btnUndo.id = "btnDrawBackout";
  37338. btnUndo.style.height = "30px";
  37339. btnUndo.style.marginBottom = "8px";
  37340. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37341. btnUndo.style.color = "rgb(255, 255, 255)";
  37342. btnUndo.style.border = "0px solid red";
  37343. btnUndo.style.borderRadius = "5px";
  37344. btnUndo.innerHTML = "\u56DE\u9000";
  37345. btnUndo.style.fontSize = "13px";
  37346. btnUndo.style.cursor = "pointer";
  37347. this._operationDom.appendChild(btnUndo);
  37348. return btnUndo;
  37349. },
  37350. _crateOperationCompletionButtonDom: function() {
  37351. let btnCompletion = document.createElement("button");
  37352. btnCompletion.id = "btnDrawComplete";
  37353. btnCompletion.style.height = "30px";
  37354. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37355. btnCompletion.style.color = "rgb(255, 255, 255)";
  37356. btnCompletion.style.border = "0px solid red";
  37357. btnCompletion.style.borderRadius = "5px";
  37358. btnCompletion.innerHTML = "\u5B8C\u6210";
  37359. btnCompletion.style.fontSize = "13px";
  37360. btnCompletion.style.cursor = "pointer";
  37361. this._operationDom.appendChild(btnCompletion);
  37362. return btnCompletion;
  37363. },
  37364. _removeOperationDom: function() {
  37365. if (this._operationDom !== null && this._operationDom !== void 0) {
  37366. document.body.removeChild(this._operationDom);
  37367. this._operationDom = void 0;
  37368. }
  37369. },
  37370. _createOperationDom: function() {
  37371. if (this._isRuntimeApp()) {
  37372. this._initOperationDom();
  37373. }
  37374. }
  37375. });
  37376. Object.assign(DrawTools.prototype, {
  37377. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  37378. this._editPropertyDialogDomId = "dialog-property-dom";
  37379. this._registerDOMPropertyEdit = "dialog-edit-property";
  37380. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  37381. if (PropertyEditComponent === void 0) {
  37382. PropertyEditComponent = defineCustomElement(DialogEditProperty$2);
  37383. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  37384. }
  37385. this._closePropertyEditDialog();
  37386. let dialogPropertyElement = new PropertyEditComponent({
  37387. params
  37388. });
  37389. dialogPropertyElement.id = this._editPropertyDialogDomId;
  37390. dialogPropertyElement.showDialog = true;
  37391. document.body.appendChild(dialogPropertyElement);
  37392. dialogPropertyElement.addEventListener(
  37393. "submit",
  37394. (e) => {
  37395. if (callEdit)
  37396. callEdit(e.detail[0]);
  37397. },
  37398. false
  37399. );
  37400. dialogPropertyElement.addEventListener(
  37401. "remove",
  37402. (e) => {
  37403. if (callRemove)
  37404. callRemove();
  37405. },
  37406. false
  37407. );
  37408. },
  37409. _closePropertyEditDialog() {
  37410. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  37411. if (dom2 !== null && dom2 !== void 0) {
  37412. document.body.removeChild(dom2);
  37413. }
  37414. }
  37415. });
  37416. DrawTools.DrawType = Object.freeze({
  37417. Point: "point",
  37418. Polyline: "polyline",
  37419. ArrowPolyline: "arrowPolyline",
  37420. DynamicPolyline: "dynamicPolyline",
  37421. GrowPolyline: "\u53D1\u5149\u7EBF",
  37422. OutlinePolyline: "outlinePolyline",
  37423. OdLine: "odLine",
  37424. Polygon: "polygon",
  37425. SpatialLine: "spatialLine",
  37426. Circle: "circle",
  37427. DynamicCircle: "dynamicCircle",
  37428. Rectangle: "rectangle",
  37429. NormalWall: "normalWall",
  37430. DynamicWall: "dynamicWall",
  37431. House: "house",
  37432. TextWall: "text",
  37433. VideoWall: "videoWall"
  37434. });
  37435. DrawTools.IconType = Object.freeze({
  37436. Normal: "normal",
  37437. Blue: "blue",
  37438. Green: "green",
  37439. Violet: "violter"
  37440. });
  37441. DrawTools.EditPointType = Object.freeze({
  37442. Node: "node",
  37443. Middle: "middle",
  37444. Center: "center",
  37445. CoordinateAxis: "coordinateAxis",
  37446. OdlineStrartNode: "odlineStartNode",
  37447. OdlineEndNode: "odlineEndNode"
  37448. });
  37449. DrawTools.WallType = Object.freeze({
  37450. ColorWall: "colorWall",
  37451. DynamicWall: "dynamicWall",
  37452. TextWall: "textWall"
  37453. });
  37454. DrawTools.CircleType = Object.freeze({
  37455. ColorCircle: "colorCircle",
  37456. DynamicCircle: "dynamicCircle"
  37457. });
  37458. DrawTools.PolylineType = Object.freeze({
  37459. NormalPolyline: "normalPolyline",
  37460. ArrowsPolyline: "arrowsPolyline",
  37461. DynamicPolyline: "dynamicPolyline",
  37462. DottedPolyline: "dottedPolyline",
  37463. GrowPolyline: "growPolyline",
  37464. OutlinePolyline: "outlinePolyline"
  37465. });
  37466. DrawTools.PolygonType = Object.freeze({
  37467. NormalPolygon: "normalPolygon",
  37468. HousePolygon: "housePolygon"
  37469. });
  37470. DrawTools.RuntimeEnvironment = Object.freeze({
  37471. App: "app",
  37472. Web: "web"
  37473. });
  37474. class WallMaterialProperty {
  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.duration = options2.duration || 1e3;
  37481. this.trailImage = options2.trailImage;
  37482. this._time = new Date().getTime();
  37483. this._materialTypeName = "WallMaterial" + this._guid();
  37484. this._param = {
  37485. color: this.color._value.toCssColorString(),
  37486. image: this.trailImage,
  37487. duration: this.duration,
  37488. count: 0,
  37489. direction: "",
  37490. order: ""
  37491. };
  37492. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37493. fabric: {
  37494. type: this._materialTypeName,
  37495. uniforms: {
  37496. time: -20,
  37497. color: new Cesium.Color(1, 0, 0, 0.5),
  37498. image: options2.trailImage
  37499. },
  37500. source: this._getDirectionWallShader(options2.param)
  37501. },
  37502. translucent: function(material) {
  37503. return true;
  37504. }
  37505. });
  37506. }
  37507. _guid() {
  37508. function S4() {
  37509. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  37510. }
  37511. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  37512. }
  37513. getType(time) {
  37514. return this._materialTypeName;
  37515. }
  37516. getValue(time, result) {
  37517. if (!Cesium.defined(result)) {
  37518. result = {};
  37519. }
  37520. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37521. result.image = this.trailImage;
  37522. if (this.duration) {
  37523. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37524. }
  37525. this._viewer.scene.requestRender();
  37526. return result;
  37527. }
  37528. equals(other) {
  37529. 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;
  37530. }
  37531. _getDirectionWallShader(options2) {
  37532. let op = Cesium.defaultValue(options2, {});
  37533. let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
  37534. let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
  37535. let order = op.order === "+" ? "+" : "-";
  37536. this._param.count = count;
  37537. this._param.direction = direction;
  37538. this._param.order = order;
  37539. let materail = "";
  37540. materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
  37541. if (direction === "vertical") {
  37542. materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
  37543. } else if (direction === "horizontal") {
  37544. materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
  37545. }
  37546. 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}";
  37547. return materail;
  37548. }
  37549. }
  37550. Object.defineProperties(WallMaterialProperty.prototype, {
  37551. isConstant: {
  37552. get: function() {
  37553. return false;
  37554. }
  37555. },
  37556. definitionChanged: {
  37557. get: function() {
  37558. return this._definitionChanged;
  37559. }
  37560. },
  37561. color: Cesium.createPropertyDescriptor("color")
  37562. });
  37563. class CircleMaterialProperty {
  37564. constructor(options2) {
  37565. this._viewer = options2.viewer;
  37566. this._definitionChanged = new Cesium.Event();
  37567. this._color = void 0;
  37568. this.color = options2.color || Cesium.Color.BLUE;
  37569. this.count = options2.count || 1;
  37570. this.duration = options2.duration || 1e3;
  37571. this._time = new Date().getTime();
  37572. this._materialTypeName = "jtCircleMaterial";
  37573. this._param = {
  37574. color: this.color._value.toCssColorString(),
  37575. duration: this.duration,
  37576. count: this.count
  37577. };
  37578. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37579. fabric: {
  37580. type: this._materialTypeName,
  37581. uniforms: {
  37582. time: 0,
  37583. color: new Cesium.Color(1, 0, 0, 0.5),
  37584. count: 1
  37585. },
  37586. source: this._getCircleMaterial()
  37587. },
  37588. translucent: function(material) {
  37589. return true;
  37590. }
  37591. });
  37592. }
  37593. _getCircleMaterial() {
  37594. 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";
  37595. return circleMaterial;
  37596. }
  37597. }
  37598. Object.assign(CircleMaterialProperty.prototype, {
  37599. getType: function(time) {
  37600. return this._materialTypeName;
  37601. },
  37602. getValue: function(time, result) {
  37603. if (!Cesium.defined(result)) {
  37604. result = {};
  37605. }
  37606. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37607. result.count = this.count;
  37608. if (this.duration) {
  37609. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37610. }
  37611. this._viewer.scene.requestRender();
  37612. return result;
  37613. },
  37614. equals: function(other) {
  37615. return this === other || other instanceof CircleMaterialProperty && Cesium.Property.equals(this._color, other._color);
  37616. }
  37617. });
  37618. Object.defineProperties(CircleMaterialProperty.prototype, {
  37619. isConstant: {
  37620. get: function() {
  37621. return false;
  37622. }
  37623. },
  37624. definitionChanged: {
  37625. get: function() {
  37626. return this._definitionChanged;
  37627. }
  37628. },
  37629. color: Cesium.createPropertyDescriptor("color")
  37630. });
  37631. const _checkAppOrWeb = function() {
  37632. if (window.navigator.userAgent.match(
  37633. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  37634. )) {
  37635. return "App";
  37636. } else {
  37637. return "Web";
  37638. }
  37639. };
  37640. const isRuntimeApp = function() {
  37641. if (_checkAppOrWeb() === "App") {
  37642. return true;
  37643. }
  37644. return false;
  37645. };
  37646. const isRuntimeWeb = function() {
  37647. if (_checkAppOrWeb() === "Web") {
  37648. return true;
  37649. }
  37650. return false;
  37651. };
  37652. function createOperationMainDom() {
  37653. let buttonDiv = document.createElement("div");
  37654. buttonDiv.id = "drawButtonDiv";
  37655. buttonDiv.style.width = "80px";
  37656. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37657. buttonDiv.style.borderRadius = "5px";
  37658. buttonDiv.style.display = "flex";
  37659. buttonDiv.style.flexDirection = "column";
  37660. buttonDiv.style.padding = "8px";
  37661. buttonDiv.style.justifyContent = "center";
  37662. buttonDiv.style.position = "absolute";
  37663. buttonDiv.style.bottom = "150px";
  37664. buttonDiv.style.right = "10px";
  37665. let btnUndo = document.createElement("button");
  37666. btnUndo.id = "btnDrawBackout";
  37667. btnUndo.style.height = "30px";
  37668. btnUndo.style.marginBottom = "8px";
  37669. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37670. btnUndo.style.color = "rgb(255, 255, 255)";
  37671. btnUndo.style.border = "0px solid red";
  37672. btnUndo.style.borderRadius = "5px";
  37673. btnUndo.innerHTML = "\u56DE\u9000";
  37674. btnUndo.style.fontSize = "13px";
  37675. btnUndo.style.cursor = "pointer";
  37676. buttonDiv.appendChild(btnUndo);
  37677. let btnCompletion = document.createElement("button");
  37678. btnCompletion.id = "btnDrawComplete";
  37679. btnCompletion.style.height = "30px";
  37680. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37681. btnCompletion.style.color = "rgb(255, 255, 255)";
  37682. btnCompletion.style.border = "0px solid red";
  37683. btnCompletion.style.borderRadius = "5px";
  37684. btnCompletion.innerHTML = "\u5B8C\u6210";
  37685. btnCompletion.style.fontSize = "13px";
  37686. btnCompletion.style.cursor = "pointer";
  37687. buttonDiv.appendChild(btnCompletion);
  37688. document.body.appendChild(buttonDiv);
  37689. }
  37690. function showTooltipMessage(message) {
  37691. let msgMainDom = document.getElementById("messageMainDom");
  37692. if (msgMainDom !== null && msgMainDom !== void 0) {
  37693. document.body.removeChild(msgMainDom);
  37694. }
  37695. msgMainDom = document.createElement("div");
  37696. msgMainDom.style.width = "30%";
  37697. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  37698. msgMainDom.style.height = "45px";
  37699. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  37700. msgMainDom.style.borderRadius = "8px";
  37701. msgMainDom.style.display = "flex";
  37702. msgMainDom.style.alignItems = "center";
  37703. msgMainDom.style.paddingLeft = "10px";
  37704. msgMainDom.style.color = "rgb(91, 188, 48)";
  37705. msgMainDom.style.fontSize = "14px";
  37706. msgMainDom.style.fontWeight = "600";
  37707. msgMainDom.style.position = "absolute";
  37708. msgMainDom.style.left = "35%";
  37709. msgMainDom.style.transition = "transform 1s";
  37710. msgMainDom.style.transform = "translateY(-90px)";
  37711. msgMainDom.style.top = "0px";
  37712. msgMainDom.style.zIndex = 1e3;
  37713. document.body.appendChild(msgMainDom);
  37714. let strHtml = "";
  37715. strHtml += "<div style='";
  37716. strHtml += "background-color: rgb(88, 185, 45);";
  37717. strHtml += "color: rgb(255, 255, 255);";
  37718. strHtml += "height: 24px;";
  37719. strHtml += "width: 24px;";
  37720. strHtml += "border-radius: 20px;";
  37721. strHtml += "display: flex;";
  37722. strHtml += "justify-content: center;";
  37723. strHtml += "align-items: center;";
  37724. strHtml += "font-size: 14px;";
  37725. strHtml += "margin-right: 18px;";
  37726. strHtml += "'>&#10003</div>";
  37727. strHtml += "<div>" + message + "</div>";
  37728. msgMainDom.innerHTML = strHtml;
  37729. msgMainDom.addEventListener("transitionend", function() {
  37730. setTimeout(function() {
  37731. document.body.removeChild(msgMainDom);
  37732. }, 1e3);
  37733. }, false);
  37734. setTimeout(function() {
  37735. msgMainDom.style.transform = "translateY(50px)";
  37736. }, 100);
  37737. }
  37738. var RuntimeEnvironment = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  37739. __proto__: null,
  37740. isRuntimeApp,
  37741. isRuntimeWeb,
  37742. createOperationMainDom,
  37743. showTooltipMessage
  37744. }, Symbol.toStringTag, { value: "Module" }));
  37745. class DrawStraightArrow {
  37746. constructor(arg) {
  37747. this.viewer = arg.viewer;
  37748. this.Cesium = arg.Cesium;
  37749. this.floatingPoint = null;
  37750. this._straightArrow = null;
  37751. this._straightArrowLast = null;
  37752. this._positions = [];
  37753. this._entities_point = [];
  37754. this._entities_straightArrow = [];
  37755. this._straightArrowData = null;
  37756. this.DrawStartEvent = new Cesium.Event();
  37757. this.DrawEndEvent = new Cesium.Event();
  37758. this._tooltip = createTooltip(this.viewer.container);
  37759. this._param = {
  37760. id: "DrawStraightArrow",
  37761. polygonColor: "rgba(0,255,0,0.5)",
  37762. outlineColor: "rgba(255, 255, 255, 1)",
  37763. outlineWidth: 1
  37764. };
  37765. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  37766. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  37767. }
  37768. get straightArrow() {
  37769. return this._straightArrowLast;
  37770. }
  37771. getData() {
  37772. return this._straightArrowData;
  37773. }
  37774. computePosition(data) {
  37775. var $this = this;
  37776. var length = data.length;
  37777. var p1 = data[0];
  37778. var p2 = data[length - 1];
  37779. var firstPoint = $this.cartesianToLatlng(p1);
  37780. var endPoints = $this.cartesianToLatlng(p2);
  37781. var arrow = [];
  37782. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37783. for (var i2 = 0; i2 < res.length; i2++) {
  37784. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37785. arrow.push(cart3);
  37786. }
  37787. $this._straightArrowData = [firstPoint, endPoints];
  37788. return new $this.Cesium.PolygonHierarchy(arrow);
  37789. }
  37790. addload(data) {
  37791. var $this = this;
  37792. if (data.length < 2) {
  37793. return null;
  37794. }
  37795. var length = data.length;
  37796. var p1 = data[0];
  37797. var p2 = data[length - 1];
  37798. var arrow = [];
  37799. var res = $this.fineArrow([p1[0], p1[1]], [p2[0], p2[1]]);
  37800. for (var i2 = 0; i2 < res.length; i2++) {
  37801. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37802. arrow.push(cart3);
  37803. }
  37804. var arrowEntity = $this.viewer.entities.add({
  37805. Type: "DrawStraightArrow",
  37806. Position: data,
  37807. id: data.id || $this.objId,
  37808. polygon: {
  37809. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  37810. show: true,
  37811. fill: true,
  37812. clampToGround: true,
  37813. material: $this.polygonMaterial
  37814. }
  37815. });
  37816. return arrowEntity;
  37817. }
  37818. startCreate(drawType) {
  37819. if (isRuntimeApp()) {
  37820. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37821. }
  37822. var $this = this;
  37823. this.drawType = drawType;
  37824. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  37825. this.handler.setInputAction(function(evt) {
  37826. if (isRuntimeApp()) {
  37827. var cartesian = $this.getCatesian3FromPX(evt.position);
  37828. if (!cartesian) {
  37829. return;
  37830. }
  37831. $this.createPoint(cartesian);
  37832. $this._positions.push(cartesian);
  37833. if ($this._positions.length === 2) {
  37834. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  37835. $this.destroy();
  37836. if (!$this.Cesium.defined($this._straightArrow)) {
  37837. $this._straightArrow = $this.createStraightArrow();
  37838. createOperationMainDom();
  37839. document.getElementById("btnDrawBackout").style.display = "none";
  37840. document.getElementById("btnDrawComplete").onclick = () => {
  37841. $this._straightArrowData = $this._positions.concat();
  37842. $this.viewer.entities.remove($this._straightArrow);
  37843. $this._straightArrow = null;
  37844. $this._positions = [];
  37845. var lnglatArr = [];
  37846. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37847. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37848. lnglatArr.push(lnglat);
  37849. }
  37850. $this._straightArrowData = lnglatArr;
  37851. var straightArrow = $this.addload($this._straightArrowData);
  37852. $this._entities_straightArrow.push(straightArrow);
  37853. $this._straightArrowLast = straightArrow;
  37854. $this.clearPoint();
  37855. $this.destroy();
  37856. let buttonDiv = document.getElementById("drawButtonDiv");
  37857. if (buttonDiv) {
  37858. document.body.removeChild(buttonDiv);
  37859. }
  37860. };
  37861. }
  37862. }
  37863. } else {
  37864. clearTimeout($this._timer);
  37865. $this._timer = setTimeout(function() {
  37866. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  37867. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  37868. if ($this._positions.length == 0) {
  37869. $this._positions.push(cartesian2.clone());
  37870. $this.floatingPoint = $this.createPoint(cartesian2);
  37871. $this._positions.push(cartesian2);
  37872. }
  37873. if (!$this._straightArrow) {
  37874. $this.createPoint(cartesian2);
  37875. } else {
  37876. $this._straightArrowData = $this._positions.concat();
  37877. $this.viewer.entities.remove($this._straightArrow);
  37878. $this._straightArrow = null;
  37879. $this._positions = [];
  37880. $this.floatingPoint.position.setValue(cartesian2);
  37881. var lnglatArr = [];
  37882. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37883. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37884. lnglatArr.push(lnglat);
  37885. }
  37886. $this._straightArrowData = lnglatArr;
  37887. var straightArrow = $this.addload($this._straightArrowData);
  37888. $this._entities_straightArrow.push(straightArrow);
  37889. $this._straightArrowLast = straightArrow;
  37890. $this.clearPoint();
  37891. $this.destroy();
  37892. $this._tooltip.setVisible(false);
  37893. }
  37894. }, 200);
  37895. }
  37896. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37897. this.handler.setInputAction(function(evt) {
  37898. if (isRuntimeApp())
  37899. return;
  37900. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37901. if ($this._positions.length < 2)
  37902. return;
  37903. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  37904. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  37905. if (!$this.Cesium.defined($this._straightArrow)) {
  37906. $this._straightArrow = $this.createStraightArrow();
  37907. }
  37908. $this.floatingPoint.position.setValue(cartesian);
  37909. if ($this._straightArrow) {
  37910. $this._positions.pop();
  37911. $this._positions.push(cartesian);
  37912. }
  37913. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37914. }
  37915. createStraightArrow() {
  37916. var $this = this;
  37917. var arrowEntity = $this.viewer.entities.add({
  37918. polygon: {
  37919. hierarchy: new $this.Cesium.CallbackProperty(
  37920. function() {
  37921. var length = $this._positions.length;
  37922. var p1 = $this._positions[0];
  37923. var p2 = $this._positions[length - 1];
  37924. var firstPoint = $this.cartesianToLatlng(p1);
  37925. var endPoints = $this.cartesianToLatlng(p2);
  37926. var arrow = [];
  37927. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37928. for (var i2 = 0; i2 < res.length; i2++) {
  37929. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37930. arrow.push(cart3);
  37931. }
  37932. return new $this.Cesium.PolygonHierarchy(arrow);
  37933. },
  37934. false
  37935. ),
  37936. show: true,
  37937. fill: true,
  37938. clampToGround: true,
  37939. material: $this.polygonMaterial
  37940. }
  37941. });
  37942. $this._entities_straightArrow.push(arrowEntity);
  37943. return arrowEntity;
  37944. }
  37945. createPoint(cartesian) {
  37946. var $this = this;
  37947. var point2 = this.viewer.entities.add({
  37948. position: cartesian,
  37949. point: {
  37950. pixelSize: 10,
  37951. color: $this.Cesium.Color.RED,
  37952. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  37953. }
  37954. });
  37955. $this._entities_point.push(point2);
  37956. return point2;
  37957. }
  37958. cartesianToLatlng(cartesian) {
  37959. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  37960. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  37961. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  37962. return [lng, lat];
  37963. }
  37964. destroy() {
  37965. if (this.handler) {
  37966. this.handler.destroy();
  37967. this.handler = null;
  37968. }
  37969. }
  37970. clearPoint() {
  37971. this.DrawEndEvent.raiseEvent(this._straightArrowLast, this._straightArrowData, this.drawType);
  37972. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  37973. this.viewer.entities.remove(this._entities_point[i2]);
  37974. }
  37975. this._entities_point = [];
  37976. }
  37977. clear() {
  37978. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  37979. this.viewer.entities.remove(this._entities_point[i2]);
  37980. }
  37981. for (var i2 = 0; i2 < this._entities_straightArrow.length; i2++) {
  37982. this.viewer.entities.remove(this._entities_straightArrow[i2]);
  37983. }
  37984. this.floatingPoint = null;
  37985. this._straightArrow = null;
  37986. this._straightArrowLast = null;
  37987. this._positions = [];
  37988. this._entities_point = [];
  37989. this._entities_straightArrow = [];
  37990. this._straightArrowData = null;
  37991. }
  37992. getCatesian3FromPX(px) {
  37993. var cartesian;
  37994. var ray = this.viewer.camera.getPickRay(px);
  37995. if (!ray)
  37996. return null;
  37997. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  37998. return cartesian;
  37999. }
  38000. fineArrowDefualParam() {
  38001. return {
  38002. tailWidthFactor: 0.15,
  38003. neckWidthFactor: 0.2,
  38004. headWidthFactor: 0.25,
  38005. headAngle: Math.PI / 8.5,
  38006. neckAngle: Math.PI / 13
  38007. };
  38008. }
  38009. fineArrow(tailPoint, headerPoint) {
  38010. var $this = this;
  38011. if (tailPoint.length < 2 || headerPoint.length < 2)
  38012. return;
  38013. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  38014. let neckWidthFactor = $this.fineArrowDefualParam().neckWidthFactor;
  38015. let headWidthFactor = $this.fineArrowDefualParam().headWidthFactor;
  38016. let headAngle = $this.fineArrowDefualParam().headAngle;
  38017. let neckAngle = $this.fineArrowDefualParam().neckAngle;
  38018. var o = [];
  38019. o[0] = tailPoint;
  38020. o[1] = headerPoint;
  38021. 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 = [];
  38022. 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]);
  38023. return $this.Cesium.Cartesian3.fromDegreesArray(d2);
  38024. }
  38025. getBaseLength(t2) {
  38026. return Math.pow(this.wholeDistance(t2), 0.99);
  38027. }
  38028. wholeDistance(t2) {
  38029. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38030. o += this.distance(t2[e], t2[e + 1]);
  38031. return o;
  38032. }
  38033. distance(t2, o) {
  38034. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38035. }
  38036. getThirdPoint(t2, o, e, r2, n) {
  38037. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38038. return [o[0] + s, o[1] + a];
  38039. }
  38040. getAzimuth(t2, o) {
  38041. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38042. 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;
  38043. }
  38044. }
  38045. class DrawAttackArrow {
  38046. constructor(arg) {
  38047. __publicField(this, "getAttackArrowBodyPoints", function(t2, o, e, r2) {
  38048. var $this = this;
  38049. 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++) {
  38050. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38051. l += $this.distance(t2[p - 1], t2[p]);
  38052. 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);
  38053. u.push(f), c.push(E2);
  38054. }
  38055. return u.concat(c);
  38056. });
  38057. __publicField(this, "getQBSplinePoints", function(t2) {
  38058. if (t2.length <= 2)
  38059. return t2;
  38060. var o = 2, e = [], r2 = t2.length - o - 1, y = 0;
  38061. e.push(t2[0]);
  38062. for (var n = 0; r2 >= n; n++)
  38063. for (var g = 0; 1 >= g; g += 0.05) {
  38064. for (var i2 = y = 0, s = 0; o >= s; s++) {
  38065. var a = this.getQuadricBSplineFactor(s, g);
  38066. i2 += a * t2[n + s][0], y += a * t2[n + s][1];
  38067. }
  38068. e.push([i2, y]);
  38069. }
  38070. return e.push(t2[t2.length - 1]), e;
  38071. });
  38072. __publicField(this, "getQuadricBSplineFactor", function(t2, o) {
  38073. 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;
  38074. });
  38075. __publicField(this, "array2Dto1D", function(array) {
  38076. var newArray = [];
  38077. array.forEach(function(elt) {
  38078. newArray.push(elt[0]);
  38079. newArray.push(elt[1]);
  38080. });
  38081. return newArray;
  38082. });
  38083. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  38084. this.viewer = arg.viewer;
  38085. this.Cesium = arg.Cesium;
  38086. this.floatingPoint = null;
  38087. this._AttackArrow = null;
  38088. this._AttackArrowLast = null;
  38089. this._positions = [];
  38090. this._entities_point = [];
  38091. this._entities_AttackArrow = [];
  38092. this._AttackArrowData = null;
  38093. this.DrawStartEvent = new Cesium.Event();
  38094. this.DrawEndEvent = new Cesium.Event();
  38095. this._tooltip = createTooltip(this.viewer.container);
  38096. this._param = {
  38097. id: "DrawStraightArrow",
  38098. polygonColor: "rgba(0,255,0,0.5)",
  38099. outlineColor: "rgba(255, 255, 255, 1)",
  38100. outlineWidth: 1
  38101. };
  38102. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38103. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38104. }
  38105. get AttackArrow() {
  38106. return this._AttackArrowLast;
  38107. }
  38108. getData() {
  38109. return this._AttackArrowData;
  38110. }
  38111. addload(data) {
  38112. var $this = this;
  38113. if (data.length < 3) {
  38114. return null;
  38115. }
  38116. var res = $this.fineArrow(data);
  38117. var returnData = res.polygonalPoint;
  38118. var arrowEntity = $this.viewer.entities.add({
  38119. Type: "DrawAttackArrow",
  38120. Position: data,
  38121. id: data.id || $this.objId,
  38122. polygon: {
  38123. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38124. show: true,
  38125. fill: true,
  38126. clampToGround: true,
  38127. material: $this.polygonMaterial
  38128. }
  38129. });
  38130. return arrowEntity;
  38131. }
  38132. computePosition(data) {
  38133. let $this = this;
  38134. var lnglatArr = [];
  38135. for (var i2 = 0; i2 < data.length; i2++) {
  38136. var lnglat = $this.cartesianToLatlng(data[i2]);
  38137. lnglatArr.push(lnglat);
  38138. }
  38139. $this._AttackArrowData = lnglatArr;
  38140. var res = $this.fineArrow(lnglatArr);
  38141. var returnData = res.polygonalPoint;
  38142. return new $this.Cesium.PolygonHierarchy(returnData);
  38143. }
  38144. startCreate(drawType) {
  38145. if (isRuntimeApp()) {
  38146. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38147. }
  38148. var $this = this;
  38149. this.drawType = drawType;
  38150. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  38151. this.handler.setInputAction(function(evt) {
  38152. if (isRuntimeApp()) {
  38153. var cartesian = $this.getCatesian3FromPX(evt.position);
  38154. if (!cartesian) {
  38155. return;
  38156. }
  38157. $this.createPoint(cartesian);
  38158. $this._positions.push(cartesian);
  38159. if ($this._positions.length <= 2) {
  38160. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38161. } else {
  38162. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38163. if ($this._positions.length === 3) {
  38164. if (!$this.Cesium.defined($this._AttackArrow)) {
  38165. $this._AttackArrow = $this.createAttackArrow();
  38166. createOperationMainDom();
  38167. document.getElementById("btnDrawBackout").style.display = "none";
  38168. document.getElementById("btnDrawComplete").onclick = () => {
  38169. $this._AttackArrowData = $this._positions.concat();
  38170. $this.viewer.entities.remove($this._AttackArrow);
  38171. $this._AttackArrow = null;
  38172. $this._positions = [];
  38173. let lnglatArr = [];
  38174. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38175. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38176. lnglatArr.push(lnglat);
  38177. }
  38178. $this._AttackArrowData = lnglatArr;
  38179. var straightArrow = $this.addload(lnglatArr);
  38180. $this._entities_AttackArrow.push(straightArrow);
  38181. $this._AttackArrowLast = straightArrow;
  38182. $this.clearPoint();
  38183. $this.destroy();
  38184. let buttonDiv = document.getElementById("drawButtonDiv");
  38185. if (buttonDiv) {
  38186. document.body.removeChild(buttonDiv);
  38187. }
  38188. };
  38189. }
  38190. }
  38191. }
  38192. } else {
  38193. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38194. clearTimeout($this._timer);
  38195. $this._timer = setTimeout(function() {
  38196. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38197. if (!cartesian2) {
  38198. return;
  38199. }
  38200. if ($this._positions.length == 0) {
  38201. $this.floatingPoint = $this.createPoint(cartesian2);
  38202. $this.createPoint(cartesian2);
  38203. }
  38204. if ($this._positions.length == 1) {
  38205. $this._positions.push(cartesian2.clone());
  38206. $this.createPoint(cartesian2);
  38207. }
  38208. $this._positions.push(cartesian2);
  38209. }, 200);
  38210. }
  38211. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38212. this.handler.setInputAction(function(evt) {
  38213. if (isRuntimeApp())
  38214. return;
  38215. if ($this._positions.length == 0) {
  38216. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38217. } else {
  38218. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38219. }
  38220. if ($this._positions.length < 3)
  38221. return;
  38222. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38223. if (!$this.Cesium.defined($this._AttackArrow)) {
  38224. $this._AttackArrow = $this.createAttackArrow();
  38225. }
  38226. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38227. if (!cartesian) {
  38228. return;
  38229. }
  38230. $this.floatingPoint.position.setValue(cartesian);
  38231. if ($this._AttackArrow) {
  38232. $this._positions.pop();
  38233. $this._positions.push(cartesian);
  38234. }
  38235. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38236. this.handler.setInputAction(function(evt) {
  38237. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38238. this.handler.setInputAction(function(evt) {
  38239. if (isRuntimeApp())
  38240. return;
  38241. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38242. clearTimeout($this._timer);
  38243. var cartesian = $this.getCatesian3FromPX(evt.position);
  38244. $this._positions.pop();
  38245. $this._positions.push(cartesian);
  38246. $this._AttackArrowData = $this._positions.concat();
  38247. $this.viewer.entities.remove($this._AttackArrow);
  38248. $this._AttackArrow = null;
  38249. $this._positions = [];
  38250. $this.floatingPoint.position.setValue(cartesian);
  38251. let lnglatArr = [];
  38252. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38253. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38254. lnglatArr.push(lnglat);
  38255. }
  38256. $this._AttackArrowData = lnglatArr;
  38257. var straightArrow = $this.addload(lnglatArr);
  38258. $this._entities_AttackArrow.push(straightArrow);
  38259. $this._AttackArrowLast = straightArrow;
  38260. $this.clearPoint();
  38261. $this.destroy();
  38262. $this._tooltip.setVisible(false);
  38263. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38264. }
  38265. createAttackArrow() {
  38266. var $this = this;
  38267. var arrowEntity = $this.viewer.entities.add({
  38268. polygon: {
  38269. hierarchy: new $this.Cesium.CallbackProperty(
  38270. function() {
  38271. var lnglatArr = [];
  38272. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38273. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38274. lnglatArr.push(lnglat);
  38275. }
  38276. var res = $this.fineArrow(lnglatArr);
  38277. var returnData = res.polygonalPoint;
  38278. return new $this.Cesium.PolygonHierarchy(returnData);
  38279. },
  38280. false
  38281. ),
  38282. show: true,
  38283. fill: true,
  38284. clampToGround: true,
  38285. material: $this.polygonMaterial
  38286. }
  38287. });
  38288. $this._entities_AttackArrow.push(arrowEntity);
  38289. return arrowEntity;
  38290. }
  38291. createPoint(cartesian) {
  38292. var $this = this;
  38293. var point2 = this.viewer.entities.add({
  38294. position: cartesian,
  38295. point: {
  38296. pixelSize: 10,
  38297. color: $this.Cesium.Color.RED,
  38298. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38299. }
  38300. });
  38301. point2.objId = this.objId;
  38302. $this._entities_point.push(point2);
  38303. return point2;
  38304. }
  38305. cartesianToLatlng(cartesian) {
  38306. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38307. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38308. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38309. let alt = cartographic.height;
  38310. return [lng, lat, alt];
  38311. }
  38312. destroy() {
  38313. if (this.handler) {
  38314. this.handler.destroy();
  38315. this.handler = null;
  38316. }
  38317. }
  38318. clearPoint() {
  38319. this.DrawEndEvent.raiseEvent(this._AttackArrowLast, this._AttackArrowData, this.drawType);
  38320. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38321. this.viewer.entities.remove(this._entities_point[i2]);
  38322. }
  38323. this._entities_point = [];
  38324. }
  38325. clear() {
  38326. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38327. this.viewer.entities.remove(this._entities_point[i2]);
  38328. }
  38329. for (var i2 = 0; i2 < this._entities_AttackArrow.length; i2++) {
  38330. this.viewer.entities.remove(this._entities_AttackArrow[i2]);
  38331. }
  38332. this.floatingPoint = null;
  38333. this._AttackArrow = null;
  38334. this._AttackArrowLast = null;
  38335. this._positions = [];
  38336. this._entities_point = [];
  38337. this._entities_AttackArrow = [];
  38338. this._AttackArrowData = null;
  38339. }
  38340. getCatesian3FromPX(px) {
  38341. var cartesian;
  38342. var ray = this.viewer.camera.getPickRay(px);
  38343. if (!ray)
  38344. return null;
  38345. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38346. return cartesian;
  38347. }
  38348. fineArrowDefualParam() {
  38349. return {
  38350. headHeightFactor: 0.18,
  38351. headWidthFactor: 0.3,
  38352. neckHeightFactor: 0.85,
  38353. neckWidthFactor: 0.15,
  38354. tailWidthFactor: 0.1,
  38355. headTailFactor: 0.8,
  38356. swallowTailFactor: 1
  38357. };
  38358. }
  38359. fineArrow(inputPoint) {
  38360. var $this = this;
  38361. inputPoint = $this.dereplication(inputPoint);
  38362. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  38363. let swallowTailFactor = $this.fineArrowDefualParam().swallowTailFactor;
  38364. let swallowTailPnt = $this.fineArrowDefualParam().swallowTailPnt;
  38365. var result = {
  38366. controlPoint: null,
  38367. polygonalPoint: null
  38368. };
  38369. result.controlPoint = inputPoint;
  38370. var t2 = inputPoint.length;
  38371. if (!(2 > t2)) {
  38372. if (2 == inputPoint.length) {
  38373. result.polygonalPoint = inputPoint;
  38374. return result;
  38375. }
  38376. var o = inputPoint, e = o[0], r2 = o[1];
  38377. $this.isClockWise(o[0], o[1], o[2]) && (e = o[1], r2 = o[0]);
  38378. 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;
  38379. swallowTailPnt = $this.getThirdPoint(g[1], g[0], 0, c, true);
  38380. var p = l / u, h2 = $this.getAttackArrowBodyPoints(g, s, a, p), t2 = h2.length, d2 = [e].concat(h2.slice(0, t2 / 2));
  38381. d2.push(s);
  38382. var f = [r2].concat(h2.slice(t2 / 2, t2));
  38383. var newArray = [];
  38384. f.push(a), d2 = $this.getQBSplinePoints(d2), f = $this.getQBSplinePoints(f), newArray = $this.array2Dto1D(d2.concat(i2, f.reverse(), [swallowTailPnt, d2[0]]));
  38385. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38386. }
  38387. return result;
  38388. }
  38389. getArrowBodyPoints(t2, o, e, r2) {
  38390. var $this = this;
  38391. 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++) {
  38392. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38393. l += $this.distance(t2[p - 1], t2[p]);
  38394. 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);
  38395. u.push(f), c.push(E2);
  38396. }
  38397. return u.concat(c);
  38398. }
  38399. getAttackArrowHeadPoints(t2, o, e, defaultParam) {
  38400. var $this = this;
  38401. let headHeightFactor = defaultParam.headHeightFactor;
  38402. let headTailFactor = defaultParam.headTailFactor;
  38403. let headWidthFactor = defaultParam.headWidthFactor;
  38404. let neckWidthFactor = defaultParam.neckWidthFactor;
  38405. let neckHeightFactor = defaultParam.neckHeightFactor;
  38406. var r2 = $this.getBaseLength(t2), n = r2 * headHeightFactor, g = t2[t2.length - 1];
  38407. r2 = $this.distance(g, t2[t2.length - 2]);
  38408. var i2 = $this.distance(o, e);
  38409. n > i2 * headTailFactor && (n = i2 * headTailFactor);
  38410. var s = n * headWidthFactor, a = n * neckWidthFactor;
  38411. n = n > r2 ? r2 : n;
  38412. 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);
  38413. return [d2, p, g, h2, f];
  38414. }
  38415. getAngleOfThreePoints(t2, o, e) {
  38416. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38417. return 0 > r2 ? r2 + Math.PI * 2 : r2;
  38418. }
  38419. dereplication(array) {
  38420. var last = array[array.length - 1];
  38421. var change = false;
  38422. var newArray = [];
  38423. newArray = array.filter(function(i2) {
  38424. if (i2[0] != last[0] && i2[1] != last[1]) {
  38425. return i2;
  38426. }
  38427. change = true;
  38428. });
  38429. if (change)
  38430. newArray.push(last);
  38431. return newArray;
  38432. }
  38433. getBaseLength(t2) {
  38434. return Math.pow(this.wholeDistance(t2), 0.99);
  38435. }
  38436. wholeDistance(t2) {
  38437. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38438. o += this.distance(t2[e], t2[e + 1]);
  38439. return o;
  38440. }
  38441. distance(t2, o) {
  38442. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38443. }
  38444. getThirdPoint(t2, o, e, r2, n) {
  38445. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38446. return [o[0] + s, o[1] + a];
  38447. }
  38448. getAzimuth(t2, o) {
  38449. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38450. 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;
  38451. }
  38452. isClockWise(t2, o, e) {
  38453. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38454. }
  38455. mid(t2, o) {
  38456. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38457. }
  38458. }
  38459. class DrawPincerArrow {
  38460. constructor(arg) {
  38461. this.viewer = arg.viewer;
  38462. this.Cesium = arg.Cesium;
  38463. this.floatingPoint = null;
  38464. this._PincerArrow = null;
  38465. this._PincerArrowLast = null;
  38466. this._positions = [];
  38467. this._entities_point = [];
  38468. this._entities_PincerArrow = [];
  38469. this._PincerArrowData = null;
  38470. this.DrawStartEvent = new Cesium.Event();
  38471. this.DrawEndEvent = new Cesium.Event();
  38472. this._tooltip = createTooltip(this.viewer.container);
  38473. this._param = {
  38474. id: "DrawStraightArrow",
  38475. polygonColor: "rgba(0,255,0,0.5)",
  38476. outlineColor: "rgba(255, 255, 255, 1)",
  38477. outlineWidth: 1
  38478. };
  38479. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38480. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38481. }
  38482. get PincerArrow() {
  38483. return this._PincerArrowLast;
  38484. }
  38485. getData() {
  38486. return this._PincerArrowData;
  38487. }
  38488. addload(data) {
  38489. var $this = this;
  38490. if (data.length < 3) {
  38491. return;
  38492. }
  38493. var res = $this.doubleArrow(data);
  38494. var returnData = res.polygonalPoint;
  38495. var arrowEntity = $this.viewer.entities.add({
  38496. Type: "DrawPincerArrow",
  38497. Position: data,
  38498. id: data.id || $this.objId,
  38499. polygon: {
  38500. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38501. show: true,
  38502. fill: true,
  38503. clampToGround: true,
  38504. material: $this.polygonMaterial
  38505. }
  38506. });
  38507. return arrowEntity;
  38508. }
  38509. computePosition(data) {
  38510. let $this = this;
  38511. var lnglatArr = [];
  38512. for (var i2 = 0; i2 < data.length; i2++) {
  38513. var lnglat = $this.cartesianToLatlng(data[i2]);
  38514. lnglatArr.push(lnglat);
  38515. }
  38516. $this._PincerArrowData = lnglatArr;
  38517. var res = $this.doubleArrow(lnglatArr);
  38518. var returnData = res.polygonalPoint;
  38519. return new $this.Cesium.PolygonHierarchy(returnData);
  38520. }
  38521. startCreate(drawType) {
  38522. if (isRuntimeApp()) {
  38523. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38524. }
  38525. var $this = this;
  38526. this.drawType = drawType;
  38527. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  38528. this.handler.setInputAction(function(evt) {
  38529. if (isRuntimeApp()) {
  38530. var cartesian = $this.getCatesian3FromPX(evt.position);
  38531. if (!cartesian) {
  38532. return;
  38533. }
  38534. $this.createPoint(cartesian);
  38535. $this._positions.push(cartesian);
  38536. if ($this._positions.length < 3 || $this._positions.length === 4) {
  38537. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38538. }
  38539. if ($this._positions.length === 2) {
  38540. if (!$this.Cesium.defined($this._PincerArrow)) {
  38541. $this._PincerArrow = $this.createPincerArrow();
  38542. }
  38543. }
  38544. if ($this._positions.length === 3) {
  38545. $this._positions.pop();
  38546. $this._positions.push(cartesian);
  38547. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38548. createOperationMainDom();
  38549. document.getElementById("btnDrawBackout").style.display = "none";
  38550. document.getElementById("btnDrawComplete").onclick = () => {
  38551. $this._PincerArrowData = $this._positions.concat();
  38552. $this.viewer.entities.remove($this._PincerArrow);
  38553. $this._PincerArrow = null;
  38554. $this._positions = [];
  38555. var lnglatArr = [];
  38556. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38557. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38558. lnglatArr.push(lnglat);
  38559. }
  38560. $this._PincerArrowData = lnglatArr;
  38561. var pincerArrow = $this.addload(lnglatArr);
  38562. $this._entities_PincerArrow.push(pincerArrow);
  38563. $this._PincerArrowLast = pincerArrow;
  38564. $this.clearPoint();
  38565. $this.destroy();
  38566. let buttonDiv = document.getElementById("drawButtonDiv");
  38567. if (buttonDiv) {
  38568. document.body.removeChild(buttonDiv);
  38569. }
  38570. };
  38571. }
  38572. if ($this._positions.length === 5) {
  38573. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38574. $this.destroy();
  38575. }
  38576. } else {
  38577. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38578. clearTimeout($this._timer);
  38579. $this._timer = setTimeout(function() {
  38580. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38581. if (!cartesian2) {
  38582. return;
  38583. }
  38584. if ($this._positions.length == 0) {
  38585. $this.floatingPoint = $this.createPoint(cartesian2);
  38586. }
  38587. if ($this._positions.length < 5) {
  38588. $this._positions.push(cartesian2);
  38589. $this.createPoint(cartesian2);
  38590. }
  38591. if ($this._positions.length == 5) {
  38592. $this._positions[4] = cartesian2;
  38593. $this.floatingPoint.position.setValue(cartesian2);
  38594. }
  38595. }, 200);
  38596. }
  38597. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38598. this.handler.setInputAction(function(evt) {
  38599. if (isRuntimeApp())
  38600. return;
  38601. if ($this._positions.length == 0) {
  38602. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38603. } else {
  38604. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38605. }
  38606. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38607. if (!cartesian)
  38608. return;
  38609. if ($this._positions.length < 2)
  38610. return;
  38611. if (!$this.Cesium.defined($this._PincerArrow)) {
  38612. if ($this._positions.length == 2) {
  38613. $this._positions.push(cartesian);
  38614. }
  38615. $this._PincerArrow = $this.createPincerArrow();
  38616. }
  38617. $this.floatingPoint.position.setValue(cartesian);
  38618. if ($this._positions.length == 3) {
  38619. $this._positions[2] = cartesian;
  38620. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38621. }
  38622. if ($this._positions.length > 3) {
  38623. $this._positions.pop();
  38624. $this._positions.push(cartesian);
  38625. if ($this._positions === 4) {
  38626. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38627. }
  38628. if ($this._positions.length == 5) {
  38629. $this._tooltip.showAt(evt.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38630. }
  38631. }
  38632. console.log($this._positions.length);
  38633. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38634. this.handler.setInputAction(function(evt) {
  38635. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38636. this.handler.setInputAction(function(evt) {
  38637. if (isRuntimeApp())
  38638. return;
  38639. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38640. clearTimeout($this._timer);
  38641. if (!$this._PincerArrow) {
  38642. return;
  38643. }
  38644. var cartesian = $this.getCatesian3FromPX(evt.position);
  38645. if (!cartesian)
  38646. return;
  38647. $this._positions.pop();
  38648. $this._PincerArrowData = $this._positions.concat();
  38649. $this.viewer.entities.remove($this._PincerArrow);
  38650. $this._PincerArrow = null;
  38651. $this._positions = [];
  38652. $this.floatingPoint.position.setValue(cartesian);
  38653. var lnglatArr = [];
  38654. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38655. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38656. lnglatArr.push(lnglat);
  38657. }
  38658. $this._PincerArrowData = lnglatArr;
  38659. var pincerArrow = $this.addload(lnglatArr);
  38660. $this._entities_PincerArrow.push(pincerArrow);
  38661. $this._PincerArrowLast = pincerArrow;
  38662. $this.clearPoint();
  38663. $this.destroy();
  38664. $this._tooltip.setVisible(false);
  38665. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38666. }
  38667. createPincerArrow() {
  38668. var $this = this;
  38669. $this._computeTempPositions();
  38670. var arrowEntity = $this.viewer.entities.add({
  38671. polygon: {
  38672. hierarchy: new $this.Cesium.CallbackProperty(
  38673. function() {
  38674. var lnglatArr = [];
  38675. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38676. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38677. lnglatArr.push(lnglat);
  38678. }
  38679. var res = $this.doubleArrow(lnglatArr);
  38680. var returnData = res.polygonalPoint;
  38681. return new $this.Cesium.PolygonHierarchy(returnData);
  38682. },
  38683. false
  38684. ),
  38685. show: true,
  38686. fill: true,
  38687. clampToGround: true,
  38688. material: $this.polygonMaterial
  38689. }
  38690. });
  38691. $this._entities_PincerArrow.push(arrowEntity);
  38692. return arrowEntity;
  38693. }
  38694. createPoint(cartesian) {
  38695. var $this = this;
  38696. var point2 = this.viewer.entities.add({
  38697. position: cartesian,
  38698. point: {
  38699. pixelSize: 10,
  38700. color: $this.Cesium.Color.RED,
  38701. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38702. }
  38703. });
  38704. $this._entities_point.push(point2);
  38705. return point2;
  38706. }
  38707. cartesianToLatlng(cartesian) {
  38708. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38709. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38710. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38711. let alt = cartographic.height;
  38712. return [lng, lat, alt];
  38713. }
  38714. destroy() {
  38715. if (this.handler) {
  38716. this.handler.destroy();
  38717. this.handler = null;
  38718. }
  38719. }
  38720. clearPoint() {
  38721. this.DrawEndEvent.raiseEvent(this._PincerArrowLast, this._PincerArrowData, this.drawType);
  38722. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38723. this.viewer.entities.remove(this._entities_point[i2]);
  38724. }
  38725. this._entities_point = [];
  38726. }
  38727. clear() {
  38728. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38729. this.viewer.entities.remove(this._entities_point[i2]);
  38730. }
  38731. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  38732. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  38733. }
  38734. this.floatingPoint = null;
  38735. this._PincerArrow = null;
  38736. this._PincerArrowLast = null;
  38737. this._positions = [];
  38738. this._entities_point = [];
  38739. this._entities_PincerArrow = [];
  38740. this._PincerArrowData = null;
  38741. }
  38742. getCatesian3FromPX(px) {
  38743. var cartesian;
  38744. var ray = this.viewer.camera.getPickRay(px);
  38745. if (!ray)
  38746. return null;
  38747. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38748. return cartesian;
  38749. }
  38750. _computeTempPositions() {
  38751. var _this = this;
  38752. var pnts = [].concat(_this._positions);
  38753. var num = pnts.length;
  38754. var first = pnts[0];
  38755. var last = pnts[num - 1];
  38756. if (_this._isSimpleXYZ(first, last) == false) {
  38757. pnts.push(first);
  38758. num += 1;
  38759. }
  38760. _this.tempPositions = [];
  38761. for (var i2 = 1; i2 < num; i2++) {
  38762. var p1 = pnts[i2 - 1];
  38763. var p2 = pnts[i2];
  38764. var cp = _this._computeCenterPotition(p1, p2);
  38765. _this.tempPositions.push(p1);
  38766. _this.tempPositions.push(cp);
  38767. }
  38768. }
  38769. _isSimpleXYZ(p1, p2) {
  38770. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  38771. return true;
  38772. }
  38773. return false;
  38774. }
  38775. _computeCenterPotition(p1, p2) {
  38776. var _this = this;
  38777. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  38778. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  38779. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  38780. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  38781. return cp;
  38782. }
  38783. doubleArrow(inputPoint) {
  38784. var $this = this;
  38785. this.connPoint = null;
  38786. this.tempPoint4 = null;
  38787. this.points = inputPoint;
  38788. var result = {
  38789. controlPoint: null,
  38790. polygonalPoint: null
  38791. };
  38792. var t2 = inputPoint.length;
  38793. if (!(2 > t2)) {
  38794. if (2 == t2)
  38795. return inputPoint;
  38796. var o = this.points[0], e = this.points[1], r2 = this.points[2], t2 = inputPoint.length;
  38797. 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];
  38798. var n, g;
  38799. $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));
  38800. 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);
  38801. c = $this.getBezierPoints(c);
  38802. var d2 = $this.getBezierPoints(h2.concat(a.slice(1)));
  38803. u = $this.getBezierPoints(u);
  38804. var f = c.concat(p, d2, l, u);
  38805. var newArray = $this.array2Dto1D(f);
  38806. result.controlPoint = [o, e, r2, this.tempPoint4, this.connPoint];
  38807. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38808. }
  38809. return result;
  38810. }
  38811. getTempPoint4(t2, o, e) {
  38812. var $this = this;
  38813. var r2, n, g, i2, s = $this.mid(t2, o), a = $this.distance(s, e), l = $this.getAngleOfThreePoints(t2, s, e);
  38814. 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;
  38815. }
  38816. mid(t2, o) {
  38817. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38818. }
  38819. isClockWise(t2, o, e) {
  38820. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38821. }
  38822. getArrowPoints(t2, o, e, r2) {
  38823. var $this = this;
  38824. var doubleArrowDefualParam = {
  38825. type: "doublearrow",
  38826. headHeightFactor: 0.25,
  38827. headWidthFactor: 0.3,
  38828. neckHeightFactor: 0.85,
  38829. fixPointCount: 4,
  38830. neckWidthFactor: 0.15
  38831. };
  38832. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38833. 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);
  38834. i2 = $this.getThirdPoint(n, i2, Math.PI / 2, g / 5, r2), s = $this.getThirdPoint(n, s, Math.PI / 2, g / 4, r2);
  38835. 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);
  38836. return f.push(u), E2.push(c), f = f.reverse(), f.push(o), E2 = E2.reverse(), E2.push(t2), f.reverse().concat(l, E2);
  38837. }
  38838. getArrowHeadPoints(t2, o, e) {
  38839. var $this = this;
  38840. var doubleArrowDefualParam = {
  38841. type: "doublearrow",
  38842. headHeightFactor: 0.25,
  38843. headWidthFactor: 0.3,
  38844. neckHeightFactor: 0.85,
  38845. fixPointCount: 4,
  38846. neckWidthFactor: 0.15
  38847. };
  38848. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38849. 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);
  38850. return [h2, c, g, p, d2];
  38851. }
  38852. getArrowBodyPoints(t2, o, e, r2) {
  38853. var $this = this;
  38854. 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++) {
  38855. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38856. l += $this.distance(t2[p - 1], t2[p]);
  38857. 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);
  38858. u.push(f), c.push(E2);
  38859. }
  38860. return u.concat(c);
  38861. }
  38862. getBezierPoints(t2) {
  38863. if (t2.length <= 2)
  38864. return t2;
  38865. for (var o = [], e = t2.length - 1, r2 = 0; 1 >= r2; r2 += 0.01) {
  38866. for (var n = 0, y = 0, g = 0; e >= g; g++) {
  38867. var i2 = this.getBinomialFactor(e, g), s = Math.pow(r2, g), a = Math.pow(1 - r2, e - g);
  38868. n += i2 * s * a * t2[g][0], y += i2 * s * a * t2[g][1];
  38869. }
  38870. o.push([n, y]);
  38871. }
  38872. return o.push(t2[e]), o;
  38873. }
  38874. getBaseLength(t2) {
  38875. return Math.pow(this.wholeDistance(t2), 0.99);
  38876. }
  38877. wholeDistance(t2) {
  38878. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38879. o += this.distance(t2[e], t2[e + 1]);
  38880. return o;
  38881. }
  38882. getBinomialFactor(t2, o) {
  38883. return this.getFactorial(t2) / (this.getFactorial(o) * this.getFactorial(t2 - o));
  38884. }
  38885. getFactorial(t2) {
  38886. if (1 >= t2)
  38887. return 1;
  38888. if (2 == t2)
  38889. return 2;
  38890. if (3 == t2)
  38891. return 6;
  38892. if (4 == t2)
  38893. return 24;
  38894. if (5 == t2)
  38895. return 120;
  38896. for (var o = 1, e = 1; t2 >= e; e++)
  38897. o *= e;
  38898. return o;
  38899. }
  38900. array2Dto1D(array) {
  38901. var newArray = [];
  38902. array.forEach(function(elt) {
  38903. newArray.push(elt[0]);
  38904. newArray.push(elt[1]);
  38905. });
  38906. return newArray;
  38907. }
  38908. distance(t2, o) {
  38909. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38910. }
  38911. getAngleOfThreePoints(t2, o, e) {
  38912. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38913. return 0 > r2 ? r2 + 2 * Math.PI : r2;
  38914. }
  38915. getAzimuth(t2, o) {
  38916. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38917. 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;
  38918. }
  38919. getThirdPoint(t2, o, e, r2, n) {
  38920. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38921. return [o[0] + s, o[1] + a];
  38922. }
  38923. }
  38924. class DrawGatheringPlace {
  38925. constructor(arg) {
  38926. this.viewer = arg.viewer;
  38927. this.Cesium = arg.Cesium;
  38928. this.tt = 0.4;
  38929. this.floatingPoint = null;
  38930. this.drawHandler = null;
  38931. this.gatheringPlace = null;
  38932. this._gatheringPlaceLast = null;
  38933. this._positions = [];
  38934. this._entities_point = [];
  38935. this._entities_PincerArrow = [];
  38936. this._gatheringPlaceData = null;
  38937. this.DrawStartEvent = new Cesium.Event();
  38938. this.DrawEndEvent = new Cesium.Event();
  38939. this._tooltip = createTooltip(this.viewer.container);
  38940. this._param = {
  38941. id: "DrawStraightArrow",
  38942. polygonColor: "rgba(0,255,0,0.5)",
  38943. outlineColor: "rgba(255, 255, 255, 1)",
  38944. outlineWidth: 1
  38945. };
  38946. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38947. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38948. }
  38949. get PincerArrow() {
  38950. return this._gatheringPlaceLast;
  38951. }
  38952. getData() {
  38953. return this._gatheringPlaceData;
  38954. }
  38955. computePosition(data) {
  38956. var $this = this;
  38957. if (data.length < 3) {
  38958. return;
  38959. }
  38960. var gatheringPlace = [];
  38961. var lonLats = [];
  38962. var res = $this.fineGatheringPlace(data);
  38963. for (var i2 = 0; i2 < res.length; i2++) {
  38964. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  38965. gatheringPlace.push(cart3);
  38966. }
  38967. for (let q2 = 0; q2 < data.length; q2++) {
  38968. lonLats.push($this.cartesianToLatlng(data[q2]));
  38969. }
  38970. this._gatheringPlaceData = lonLats;
  38971. return new $this.Cesium.PolygonHierarchy(gatheringPlace);
  38972. }
  38973. addload(data) {
  38974. var $this = this;
  38975. if (data.length < 3) {
  38976. return;
  38977. }
  38978. var gatheringPlace = [];
  38979. var lnglatArr = [];
  38980. for (var i2 = 0; i2 < data.length; i2++) {
  38981. var lnglat = $this.LatlngTocartesian(data[i2]);
  38982. lnglatArr.push(lnglat);
  38983. }
  38984. var res = $this.fineGatheringPlace(lnglatArr);
  38985. for (var i2 = 0; i2 < res.length; i2++) {
  38986. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  38987. gatheringPlace.push(cart3);
  38988. }
  38989. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  38990. var arrowEntity = $this.viewer.entities.add({
  38991. Type: "DrawGatheringPlace",
  38992. Position: data,
  38993. id: data.id || $this.objId,
  38994. polygon: {
  38995. hierarchy: pHierarchy,
  38996. show: true,
  38997. fill: true,
  38998. clampToGround: true,
  38999. material: $this.polygonMaterial
  39000. }
  39001. });
  39002. return arrowEntity;
  39003. }
  39004. startCreate(drawType) {
  39005. if (isRuntimeApp()) {
  39006. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39007. }
  39008. var $this = this;
  39009. this.drawType = drawType;
  39010. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  39011. this.handler.setInputAction(function(event2) {
  39012. if (isRuntimeApp()) {
  39013. var cartesian = $this.getCatesian3FromPX(event2.position);
  39014. if (!cartesian) {
  39015. return;
  39016. }
  39017. $this.createPoint(cartesian);
  39018. $this._positions.push(cartesian);
  39019. if ($this._positions.length < 3) {
  39020. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39021. }
  39022. if ($this._positions.length === 3) {
  39023. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  39024. $this.destroy();
  39025. if (!$this.Cesium.defined($this.gatheringPlace)) {
  39026. $this.gatheringPlace = $this.createGatheringPlace();
  39027. createOperationMainDom();
  39028. document.getElementById("btnDrawBackout").style.display = "none";
  39029. document.getElementById("btnDrawComplete").onclick = () => {
  39030. $this._gatheringPlaceData = $this._positions.concat();
  39031. $this.viewer.entities.remove($this.gatheringPlace);
  39032. $this.gatheringPlace = null;
  39033. var lnglatArr = [];
  39034. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  39035. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  39036. lnglatArr.push(lnglat);
  39037. }
  39038. $this._gatheringPlaceData = lnglatArr;
  39039. var pincerArrow = $this.addload(lnglatArr);
  39040. $this._entities_PincerArrow.push(pincerArrow);
  39041. $this._gatheringPlaceLast = pincerArrow;
  39042. $this.viewer.entities.remove($this.floatingPoint);
  39043. $this.floatingPoint = null;
  39044. $this.clearPoint();
  39045. $this.destroy();
  39046. let buttonDiv = document.getElementById("drawButtonDiv");
  39047. if (buttonDiv) {
  39048. document.body.removeChild(buttonDiv);
  39049. }
  39050. };
  39051. }
  39052. }
  39053. } else {
  39054. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  39055. clearTimeout($this._timer);
  39056. $this._timer = setTimeout(function() {
  39057. var position2 = event2.position;
  39058. if (!$this.Cesium.defined(position2)) {
  39059. return;
  39060. }
  39061. var ray = $this.viewer.camera.getPickRay(position2);
  39062. if (!$this.Cesium.defined(ray)) {
  39063. return;
  39064. }
  39065. var cartesian2 = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  39066. if (!$this.Cesium.defined(cartesian2)) {
  39067. return;
  39068. }
  39069. if ($this._positions.length == 0) {
  39070. $this._positions.push(cartesian2.clone());
  39071. $this.floatingPoint = $this.createPoint(cartesian2);
  39072. }
  39073. if ($this._positions.length <= 2) {
  39074. $this.createPoint(cartesian2);
  39075. $this._positions.push(cartesian2);
  39076. }
  39077. }, 200);
  39078. }
  39079. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39080. this.handler.setInputAction(function(event2) {
  39081. if (isRuntimeApp())
  39082. return;
  39083. if ($this._positions.length == 0) {
  39084. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39085. } else {
  39086. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39087. }
  39088. if ($this._positions.length < 2) {
  39089. return;
  39090. }
  39091. if ($this._positions.length == 3) {
  39092. $this._tooltip.showAt(event2.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39093. }
  39094. var position2 = event2.endPosition;
  39095. if (!$this.Cesium.defined(position2)) {
  39096. return;
  39097. }
  39098. var ray = $this.viewer.camera.getPickRay(position2);
  39099. if (!$this.Cesium.defined(ray)) {
  39100. return;
  39101. }
  39102. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  39103. if (!$this.Cesium.defined(cartesian)) {
  39104. return;
  39105. }
  39106. if (!$this.Cesium.defined($this.gatheringPlace)) {
  39107. $this.gatheringPlace = $this.createGatheringPlace();
  39108. }
  39109. $this.floatingPoint.position.setValue(cartesian);
  39110. if ($this.gatheringPlace) {
  39111. if ($this._positions.length == 3) {
  39112. $this._positions[1] = cartesian;
  39113. } else {
  39114. $this._positions.pop();
  39115. $this._positions.push(cartesian);
  39116. }
  39117. }
  39118. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39119. this.handler.setInputAction(function(movement) {
  39120. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39121. this.handler.setInputAction(function(movement) {
  39122. if (isRuntimeApp())
  39123. return;
  39124. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39125. clearTimeout($this._timer);
  39126. if ($this._positions.length >= 3) {
  39127. $this._gatheringPlaceData = $this._positions.concat();
  39128. $this.viewer.entities.remove($this.gatheringPlace);
  39129. $this.gatheringPlace = null;
  39130. var lnglatArr = [];
  39131. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  39132. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  39133. lnglatArr.push(lnglat);
  39134. }
  39135. $this._gatheringPlaceData = lnglatArr;
  39136. var pincerArrow = $this.addload(lnglatArr);
  39137. $this._entities_PincerArrow.push(pincerArrow);
  39138. $this._gatheringPlaceLast = pincerArrow;
  39139. $this.viewer.entities.remove($this.floatingPoint);
  39140. $this.floatingPoint = null;
  39141. $this.clearPoint();
  39142. $this.destroy();
  39143. $this._tooltip.setVisible(false);
  39144. }
  39145. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39146. }
  39147. createGatheringPlace() {
  39148. let $this = this;
  39149. var gatheringPlaceEntity = $this.viewer.entities.add({
  39150. polygon: {
  39151. hierarchy: new $this.Cesium.CallbackProperty(function() {
  39152. if ($this._positions.length < 3) {
  39153. return;
  39154. }
  39155. var gatheringPlace = [];
  39156. var res = $this.fineGatheringPlace($this._positions);
  39157. for (var i2 = 0; i2 < res.length; i2++) {
  39158. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  39159. gatheringPlace.push(cart3);
  39160. }
  39161. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  39162. var lonLats = $this.cartesianToLatlng($this._positions);
  39163. pHierarchy.keyPoints = lonLats;
  39164. return pHierarchy;
  39165. }, false),
  39166. show: true,
  39167. fill: true,
  39168. clampToGround: true,
  39169. material: $this.polygonMaterial
  39170. }
  39171. });
  39172. $this._entities_PincerArrow.push(gatheringPlaceEntity);
  39173. return gatheringPlaceEntity;
  39174. }
  39175. createPoint(cartesian) {
  39176. var $this = this;
  39177. var point2 = this.viewer.entities.add({
  39178. position: cartesian,
  39179. point: {
  39180. pixelSize: 10,
  39181. color: $this.Cesium.Color.RED,
  39182. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39183. }
  39184. });
  39185. $this._entities_point.push(point2);
  39186. return point2;
  39187. }
  39188. cartesianToLatlng(cartesian) {
  39189. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39190. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  39191. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  39192. let alt = cartographic.height;
  39193. return [lng, lat, alt];
  39194. }
  39195. destroy() {
  39196. if (this.handler) {
  39197. this.handler.destroy();
  39198. this.handler = null;
  39199. }
  39200. }
  39201. clearPoint() {
  39202. this.DrawEndEvent.raiseEvent(this._gatheringPlaceLast, this._gatheringPlaceData, this.drawType);
  39203. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39204. this.viewer.entities.remove(this._entities_point[i2]);
  39205. }
  39206. this._entities_point = [];
  39207. }
  39208. clear() {
  39209. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39210. this.viewer.entities.remove(this._entities_point[i2]);
  39211. }
  39212. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  39213. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  39214. }
  39215. this.floatingPoint = null;
  39216. this._PincerArrow = null;
  39217. this._PincerArrowLast = null;
  39218. this._positions = [];
  39219. this._entities_point = [];
  39220. this._entities_PincerArrow = [];
  39221. this._PincerArrowData = null;
  39222. }
  39223. getCatesian3FromPX(px) {
  39224. var cartesian;
  39225. var ray = this.viewer.camera.getPickRay(px);
  39226. if (!ray)
  39227. return null;
  39228. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39229. return cartesian;
  39230. }
  39231. _computeTempPositions() {
  39232. var _this = this;
  39233. var pnts = [].concat(_this._positions);
  39234. var num = pnts.length;
  39235. var first = pnts[0];
  39236. var last = pnts[num - 1];
  39237. if (_this._isSimpleXYZ(first, last) == false) {
  39238. pnts.push(first);
  39239. num += 1;
  39240. }
  39241. _this.tempPositions = [];
  39242. for (var i2 = 1; i2 < num; i2++) {
  39243. var p1 = pnts[i2 - 1];
  39244. var p2 = pnts[i2];
  39245. var cp = _this._computeCenterPotition(p1, p2);
  39246. _this.tempPositions.push(p1);
  39247. _this.tempPositions.push(cp);
  39248. }
  39249. }
  39250. _isSimpleXYZ(p1, p2) {
  39251. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  39252. return true;
  39253. }
  39254. return false;
  39255. }
  39256. _computeCenterPotition(p1, p2) {
  39257. var _this = this;
  39258. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  39259. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  39260. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  39261. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  39262. return cp;
  39263. }
  39264. getLonLat(cartesian) {
  39265. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39266. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  39267. var pos = {
  39268. lon: cartographic.longitude,
  39269. lat: cartographic.latitude,
  39270. alt: cartographic.height
  39271. };
  39272. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  39273. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  39274. return pos;
  39275. }
  39276. LatlngTocartesian(latlng) {
  39277. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39278. return cartesian3;
  39279. }
  39280. fineGatheringPlace(gatherPosition) {
  39281. let $this = this;
  39282. let points2 = gatherPosition.length;
  39283. if (points2 < 2) {
  39284. return false;
  39285. } else {
  39286. let pnts = new Array();
  39287. gatherPosition.forEach(function(item) {
  39288. var posLonLat = $this.getLonLat(item);
  39289. pnts.push([posLonLat.lon, posLonLat.lat]);
  39290. });
  39291. if (pnts.length === 2) {
  39292. let mid2 = $this.mid(pnts[0], pnts[1]);
  39293. let d2 = $this.distance(pnts[0], mid2) / 0.9;
  39294. let pnt = $this.getThirdPoint(pnts[0], mid2, Math.PI / 2, d2, true);
  39295. pnts = [pnts[0], pnt, pnts[1]];
  39296. }
  39297. let mid = $this.mid(pnts[0], pnts[2]);
  39298. pnts.push(mid, pnts[0], pnts[1]);
  39299. let [normals, pnt1, pnt2, pnt3, pList] = [
  39300. [],
  39301. void 0,
  39302. void 0,
  39303. void 0,
  39304. []
  39305. ];
  39306. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39307. pnt1 = pnts[i2];
  39308. pnt2 = pnts[i2 + 1];
  39309. pnt3 = pnts[i2 + 2];
  39310. let normalPoints = $this.getBisectorNormals($this.tt, pnt1, pnt2, pnt3);
  39311. normals = normals.concat(normalPoints);
  39312. }
  39313. let count = normals.length;
  39314. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39315. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39316. pnt1 = pnts[i2];
  39317. pnt2 = pnts[i2 + 1];
  39318. pList = pList.concat(pnt1);
  39319. for (let t2 = 0; t2 <= 100; t2++) {
  39320. let pnt = $this.getCubicValue(t2 / 100, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39321. pList = pList.concat(pnt);
  39322. }
  39323. pList = pList.concat(pnt2);
  39324. }
  39325. return Cesium.Cartesian3.fromDegreesArray(pList);
  39326. }
  39327. }
  39328. mid(t2, o) {
  39329. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  39330. }
  39331. distance(t2, o) {
  39332. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  39333. }
  39334. getThirdPoint(t2, o, e, r2, n) {
  39335. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  39336. return [o[0] + s, o[1] + a];
  39337. }
  39338. getAzimuth(t2, o) {
  39339. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  39340. 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;
  39341. }
  39342. getBisectorNormals(t2, o, e, r2) {
  39343. 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);
  39344. if (g > 1e-4)
  39345. if (this.isClockWise(o, e, r2)) {
  39346. var u = t2 * a, c = e[0] - u * s, p = e[1] + u * i2, h2 = [c, p];
  39347. u = t2 * l, c = e[0] + u * s, p = e[1] - u * i2;
  39348. var d2 = [c, p];
  39349. } else
  39350. 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];
  39351. else
  39352. 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];
  39353. return [h2, d2];
  39354. }
  39355. getNormal(t2, o, e) {
  39356. var r2 = t2[0] - o[0], n = t2[1] - o[1], g = Math.sqrt(r2 * r2 + n * n);
  39357. r2 /= g, n /= g;
  39358. var i2 = e[0] - o[0], s = e[1] - o[1], a = Math.sqrt(i2 * i2 + s * s);
  39359. i2 /= a, s /= a;
  39360. var l = r2 + i2, u = n + s;
  39361. return [l, u];
  39362. }
  39363. isClockWise(t2, o, e) {
  39364. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  39365. }
  39366. getCubicValue(t2, o, e, r2, n) {
  39367. t2 = Math.max(Math.min(t2, 1), 0);
  39368. 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];
  39369. return [u, c];
  39370. }
  39371. }
  39372. class DrawClosedCurve {
  39373. constructor(arg) {
  39374. this.viewer = arg.viewer;
  39375. this.Cesium = arg.Cesium;
  39376. this.floatingPoint = null;
  39377. this._ClosedCurve = null;
  39378. this._ClosedCurveLast = null;
  39379. this._positions = [];
  39380. this._entities_point = [];
  39381. this._entities_ClosedCurve = [];
  39382. this._ClosedCurveData = null;
  39383. this.ZERO_TOLERANCE = 1e-4;
  39384. this.FITTING_COUNT = 100;
  39385. this.t = 0.3;
  39386. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  39387. this.DrawStartEvent = new Cesium.Event();
  39388. this.DrawEndEvent = new Cesium.Event();
  39389. this._tooltip = createTooltip(this.viewer.container);
  39390. this._param = {
  39391. id: "DrawStraightArrow",
  39392. polygonColor: "rgba(0,255,0,0.5)",
  39393. outlineColor: "rgba(255, 255, 255, 1)",
  39394. outlineWidth: 1
  39395. };
  39396. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39397. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39398. }
  39399. get ClosedCurve() {
  39400. return this._ClosedCurveLast;
  39401. }
  39402. getData() {
  39403. return this._ClosedCurveData;
  39404. }
  39405. computePosition(data) {
  39406. let $this = this;
  39407. if (data.length < 2)
  39408. return;
  39409. let pnts = [];
  39410. for (let p = 0; p < data.length; p++) {
  39411. pnts.push($this.cartesianToLatlng(data[p]));
  39412. }
  39413. this._ClosedCurveData = Array.from(pnts);
  39414. pnts.push(pnts[0], pnts[1]);
  39415. let [normals, pList] = [
  39416. [],
  39417. []
  39418. ];
  39419. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39420. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39421. normals = normals.concat(normalPoints);
  39422. }
  39423. let count = normals.length;
  39424. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39425. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39426. let pnt1 = pnts[i2];
  39427. let pnt2 = pnts[i2 + 1];
  39428. pList.push($this.LatlngTocartesian(pnt1));
  39429. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39430. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39431. pList.push($this.LatlngTocartesian(pnt));
  39432. }
  39433. pList.push($this.LatlngTocartesian(pnt2));
  39434. }
  39435. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(pList);
  39436. return {
  39437. PolygonHierarchy,
  39438. pList
  39439. };
  39440. }
  39441. addload(data) {
  39442. let $this = this;
  39443. if (data.length < 2)
  39444. return;
  39445. let pnts = Array.from(data);
  39446. pnts.push(pnts[0], pnts[1]);
  39447. let [normals, pList] = [
  39448. [],
  39449. []
  39450. ];
  39451. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39452. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39453. normals = normals.concat(normalPoints);
  39454. }
  39455. let count = normals.length;
  39456. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39457. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39458. let pnt1 = pnts[i2];
  39459. let pnt2 = pnts[i2 + 1];
  39460. pList.push($this.LatlngTocartesian(pnt1));
  39461. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39462. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39463. pList.push($this.LatlngTocartesian(pnt));
  39464. }
  39465. pList.push($this.LatlngTocartesian(pnt2));
  39466. }
  39467. console.log(data, pnts);
  39468. var arrowEntity = $this.viewer.entities.add({
  39469. Type: "DrawClosedCurve",
  39470. Position: data,
  39471. id: data.id || $this.objId,
  39472. polygon: {
  39473. hierarchy: new $this.Cesium.PolygonHierarchy(pList),
  39474. show: true,
  39475. fill: true,
  39476. clampToGround: true,
  39477. material: $this.polygonMaterial
  39478. },
  39479. polyline: {
  39480. positions: pList,
  39481. show: true,
  39482. material: new Cesium.PolylineDashMaterialProperty({
  39483. color: Cesium.Color.YELLOW
  39484. }),
  39485. width: 3,
  39486. clampToGround: true
  39487. }
  39488. });
  39489. return arrowEntity;
  39490. }
  39491. startCreate(drawType) {
  39492. if (isRuntimeApp()) {
  39493. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39494. }
  39495. var $this = this;
  39496. this.drawType = drawType;
  39497. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39498. this.handler.setInputAction(function(evt) {
  39499. if (isRuntimeApp()) {
  39500. var cartesian = $this.getCatesian3FromPX(evt.position);
  39501. if (!cartesian) {
  39502. return;
  39503. }
  39504. $this.createPoint(cartesian);
  39505. $this._positions.push(cartesian);
  39506. if ($this._positions.length > 2) {
  39507. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  39508. if ($this._positions.length === 3) {
  39509. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39510. $this._ClosedCurve = $this.createClosedCurve();
  39511. createOperationMainDom();
  39512. document.getElementById("btnDrawBackout").style.display = "none";
  39513. document.getElementById("btnDrawComplete").onclick = () => {
  39514. $this._ClosedCurveData = $this._positions.concat();
  39515. $this.viewer.entities.remove($this._ClosedCurve);
  39516. $this._ClosedCurve = null;
  39517. $this._positions = [];
  39518. var lnglatArr = [];
  39519. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39520. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39521. lnglatArr.push(lnglat);
  39522. }
  39523. $this._ClosedCurveData = lnglatArr;
  39524. var ClosedCurve = $this.addload(lnglatArr);
  39525. $this._entities_ClosedCurve.push(ClosedCurve);
  39526. $this._ClosedCurveLast = ClosedCurve;
  39527. $this.clearPoint();
  39528. $this.destroy();
  39529. let buttonDiv = document.getElementById("drawButtonDiv");
  39530. if (buttonDiv) {
  39531. document.body.removeChild(buttonDiv);
  39532. }
  39533. };
  39534. }
  39535. }
  39536. } else {
  39537. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39538. }
  39539. } else {
  39540. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  39541. clearTimeout($this._timer);
  39542. $this._timer = setTimeout(function() {
  39543. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  39544. if ($this._positions.length == 0) {
  39545. $this.floatingPoint = $this.createPoint(cartesian2);
  39546. }
  39547. $this._positions.push(cartesian2);
  39548. $this.createPoint(cartesian2);
  39549. }, 200);
  39550. }
  39551. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39552. this.handler.setInputAction(function(evt) {
  39553. if (isRuntimeApp())
  39554. return;
  39555. if ($this._positions.length == 0) {
  39556. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39557. } else {
  39558. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39559. }
  39560. if ($this._positions.length < 2)
  39561. return;
  39562. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39563. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39564. if ($this._positions.length == 2) {
  39565. $this._positions.push(cartesian);
  39566. }
  39567. $this._positions.pop();
  39568. $this._positions.push(cartesian);
  39569. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39570. $this._ClosedCurve = $this.createClosedCurve();
  39571. }
  39572. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39573. this.handler.setInputAction(function(evt) {
  39574. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39575. this.handler.setInputAction(function(evt) {
  39576. if (isRuntimeApp())
  39577. return;
  39578. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39579. clearTimeout($this._timer);
  39580. if (!$this._ClosedCurve)
  39581. return;
  39582. var cartesian = $this.getCatesian3FromPX(evt.position);
  39583. $this._positions.pop();
  39584. $this._positions.push(cartesian);
  39585. $this._ClosedCurveData = $this._positions.concat();
  39586. $this.viewer.entities.remove($this._ClosedCurve);
  39587. $this._ClosedCurve = null;
  39588. $this._positions = [];
  39589. $this.floatingPoint.position.setValue(cartesian);
  39590. var lnglatArr = [];
  39591. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39592. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39593. lnglatArr.push(lnglat);
  39594. }
  39595. $this._ClosedCurveData = lnglatArr;
  39596. var ClosedCurve = $this.addload(lnglatArr);
  39597. $this._entities_ClosedCurve.push(ClosedCurve);
  39598. $this._ClosedCurveLast = ClosedCurve;
  39599. $this.clearPoint();
  39600. $this.destroy();
  39601. $this._tooltip.setVisible(false);
  39602. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39603. }
  39604. createClosedCurve() {
  39605. var $this = this;
  39606. $this.pLists = "";
  39607. var arrowEntity = $this.viewer.entities.add({
  39608. polygon: {
  39609. hierarchy: new $this.Cesium.CallbackProperty(
  39610. function() {
  39611. if ($this._positions.length < 2)
  39612. return;
  39613. let pnts = [];
  39614. for (let p = 0; p < $this._positions.length; p++) {
  39615. pnts.push($this.cartesianToLatlng($this._positions[p]));
  39616. }
  39617. pnts.push(pnts[0], pnts[1]);
  39618. let [normals, pList] = [
  39619. [],
  39620. []
  39621. ];
  39622. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39623. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39624. normals = normals.concat(normalPoints);
  39625. }
  39626. let count = normals.length;
  39627. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39628. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39629. let pnt1 = pnts[i2];
  39630. let pnt2 = pnts[i2 + 1];
  39631. pList.push($this.LatlngTocartesian(pnt1));
  39632. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39633. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39634. pList.push($this.LatlngTocartesian(pnt));
  39635. }
  39636. pList.push($this.LatlngTocartesian(pnt2));
  39637. }
  39638. $this.pLists = pList;
  39639. return new $this.Cesium.PolygonHierarchy(pList);
  39640. },
  39641. false
  39642. ),
  39643. show: true,
  39644. fill: true,
  39645. clampToGround: true,
  39646. material: $this.polygonMaterial
  39647. },
  39648. polyline: {
  39649. positions: new $this.Cesium.CallbackProperty(
  39650. function() {
  39651. return $this.pLists;
  39652. },
  39653. false
  39654. ),
  39655. show: true,
  39656. material: new Cesium.PolylineDashMaterialProperty({
  39657. color: Cesium.Color.YELLOW
  39658. }),
  39659. width: 3,
  39660. clampToGround: true
  39661. }
  39662. });
  39663. $this._entities_ClosedCurve.push(arrowEntity);
  39664. return arrowEntity;
  39665. }
  39666. createPoint(cartesian) {
  39667. var $this = this;
  39668. var point2 = this.viewer.entities.add({
  39669. position: cartesian,
  39670. point: {
  39671. pixelSize: 10,
  39672. color: $this.Cesium.Color.RED,
  39673. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39674. }
  39675. });
  39676. $this._entities_point.push(point2);
  39677. return point2;
  39678. }
  39679. cartesianToLatlng(cartesian) {
  39680. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39681. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  39682. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  39683. return [lng, lat];
  39684. }
  39685. LatlngTocartesian(latlng) {
  39686. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39687. return cartesian3;
  39688. }
  39689. lonLatToMercator(Latlng) {
  39690. var E2 = Latlng[0];
  39691. var N2 = Latlng[1];
  39692. var x = E2 * 2003750834e-2 / 180;
  39693. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  39694. y = y * 2003750834e-2 / 180;
  39695. return [x, y];
  39696. }
  39697. WebMercator2lonLat(mercator) {
  39698. let x = mercator[0] / 2003750834e-2 * 180;
  39699. let ly = mercator[1] / 2003750834e-2 * 180;
  39700. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  39701. return [x, y];
  39702. }
  39703. destroy() {
  39704. if (this.handler) {
  39705. this.handler.destroy();
  39706. this.handler = null;
  39707. }
  39708. }
  39709. clearPoint() {
  39710. this.DrawEndEvent.raiseEvent(this._ClosedCurveLast, this._ClosedCurveData);
  39711. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39712. this.viewer.entities.remove(this._entities_point[i2]);
  39713. }
  39714. this._entities_point = [];
  39715. }
  39716. clear() {
  39717. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39718. this.viewer.entities.remove(this._entities_point[i2]);
  39719. }
  39720. for (var i2 = 0; i2 < this._entities_ClosedCurve.length; i2++) {
  39721. this.viewer.entities.remove(this._entities_ClosedCurve[i2]);
  39722. }
  39723. this.floatingPoint = null;
  39724. this._ClosedCurve = null;
  39725. this._ClosedCurveLast = null;
  39726. this._positions = [];
  39727. this._entities_point = [];
  39728. this._entities_ClosedCurve = [];
  39729. this._ClosedCurveData = null;
  39730. }
  39731. getCatesian3FromPX(px) {
  39732. var cartesian;
  39733. var ray = this.viewer.camera.getPickRay(px);
  39734. if (!ray)
  39735. return null;
  39736. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39737. return cartesian;
  39738. }
  39739. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  39740. let $this = this;
  39741. let normal = $this.getNormal(pnt1, pnt2, pnt3);
  39742. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  39743. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  39744. let uX = normal[0] / dist;
  39745. let uY = normal[1] / dist;
  39746. let d1 = $this.MathDistance(pnt1, pnt2);
  39747. let d2 = $this.MathDistance(pnt2, pnt3);
  39748. if (dist > $this.ZERO_TOLERANCE) {
  39749. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  39750. dt2 = t2 * d1;
  39751. x = pnt2[0] - dt2 * uY;
  39752. y = pnt2[1] + dt2 * uX;
  39753. bisectorNormalRight = [x, y];
  39754. dt2 = t2 * d2;
  39755. x = pnt2[0] + dt2 * uY;
  39756. y = pnt2[1] - dt2 * uX;
  39757. bisectorNormalLeft = [x, y];
  39758. } else {
  39759. dt2 = t2 * d1;
  39760. x = pnt2[0] + dt2 * uY;
  39761. y = pnt2[1] - dt2 * uX;
  39762. bisectorNormalRight = [x, y];
  39763. dt2 = t2 * d2;
  39764. x = pnt2[0] - dt2 * uY;
  39765. y = pnt2[1] + dt2 * uX;
  39766. bisectorNormalLeft = [x, y];
  39767. }
  39768. } else {
  39769. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  39770. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  39771. bisectorNormalRight = [x, y];
  39772. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  39773. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  39774. bisectorNormalLeft = [x, y];
  39775. }
  39776. return [bisectorNormalRight, bisectorNormalLeft];
  39777. }
  39778. getNormal(pnt1, pnt2, pnt3) {
  39779. let dX1 = pnt1[0] - pnt2[0];
  39780. let dY1 = pnt1[1] - pnt2[1];
  39781. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  39782. dX1 /= d1;
  39783. dY1 /= d1;
  39784. let dX2 = pnt3[0] - pnt2[0];
  39785. let dY2 = pnt3[1] - pnt2[1];
  39786. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  39787. dX2 /= d2;
  39788. dY2 /= d2;
  39789. let uX = dX1 + dX2;
  39790. let uY = dY1 + dY2;
  39791. return [uX, uY];
  39792. }
  39793. MathDistance(pnt1, pnt2) {
  39794. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  39795. }
  39796. isClockWise(pnt1, pnt2, pnt3) {
  39797. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  39798. }
  39799. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  39800. t2 = Math.max(Math.min(t2, 1), 0);
  39801. let [tp, t22] = [1 - t2, t2 * t2];
  39802. let t3 = t22 * t2;
  39803. let tp2 = tp * tp;
  39804. let tp3 = tp2 * tp;
  39805. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  39806. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  39807. return [x, y];
  39808. }
  39809. }
  39810. class DrawSector {
  39811. constructor(arg) {
  39812. this.viewer = arg.viewer;
  39813. this.Cesium = arg.Cesium;
  39814. this.floatingPoint = null;
  39815. this._sector = null;
  39816. this._sectorLast = null;
  39817. this._positions = [];
  39818. this._entities_point = [];
  39819. this._entities_sector = [];
  39820. this._sectorData = null;
  39821. this.DrawStartEvent = new Cesium.Event();
  39822. this.DrawEndEvent = new Cesium.Event();
  39823. this._param = {
  39824. id: "DrawStraightArrow",
  39825. polygonColor: "rgba(0,255,0,0.5)",
  39826. outlineColor: "rgba(255, 255, 255, 1)",
  39827. outlineWidth: 1
  39828. };
  39829. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39830. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39831. }
  39832. get sector() {
  39833. return this._sectorLast;
  39834. }
  39835. getData() {
  39836. return this._sectorData;
  39837. }
  39838. computePosition(data) {
  39839. let $this = this;
  39840. let pnts = data;
  39841. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39842. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39843. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39844. var radius = $this.MathDistance(pnt2, center2);
  39845. var startAngle = $this.getAzimuth(pnt2, center2);
  39846. var endAngle = $this.getAzimuth(pnt3, center2);
  39847. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39848. pList.push(pnts[0], pList[0]);
  39849. let arrow = [];
  39850. for (var i2 = 0; i2 < pList.length; i2++) {
  39851. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39852. arrow.push(cart3);
  39853. }
  39854. var lnglatArr = [];
  39855. for (var d2 = 0; d2 < data.length; d2++) {
  39856. lnglatArr.push($this.cartesianToLatlng(data[d2]));
  39857. }
  39858. $this._sectorData = lnglatArr;
  39859. return new $this.Cesium.PolygonHierarchy(arrow);
  39860. }
  39861. addload(data) {
  39862. var $this = this;
  39863. let pnts = data;
  39864. let center2 = $this.lonLatToMercator(pnts[0]);
  39865. let pnt2 = $this.lonLatToMercator(pnts[1]);
  39866. let pnt3 = $this.lonLatToMercator(pnts[2]);
  39867. var radius = $this.MathDistance(pnt2, center2);
  39868. var startAngle = $this.getAzimuth(pnt2, center2);
  39869. var endAngle = $this.getAzimuth(pnt3, center2);
  39870. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39871. let pntsc = $this.Cesium.Cartesian3.fromDegrees(pnts[0][0], pnts[0][1]);
  39872. pList.push(pntsc, pList[0]);
  39873. let arrow = [];
  39874. for (var i2 = 0; i2 < pList.length; i2++) {
  39875. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39876. arrow.push(cart3);
  39877. }
  39878. var arrowEntity = $this.viewer.entities.add({
  39879. Type: "DrawSector",
  39880. Position: data,
  39881. id: data.id || $this.objId,
  39882. polygon: {
  39883. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  39884. show: true,
  39885. fill: true,
  39886. clampToGround: true,
  39887. material: $this.Cesium.Color.AQUA.withAlpha(0.9)
  39888. }
  39889. });
  39890. return arrowEntity;
  39891. }
  39892. startCreate() {
  39893. var $this = this;
  39894. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39895. this.handler.setInputAction(function(evt) {
  39896. var cartesian = $this.getCatesian3FromPX(evt.position);
  39897. if ($this._positions.length < 3) {
  39898. $this.floatingPoint = $this.createPoint(cartesian);
  39899. $this._positions.push(cartesian);
  39900. }
  39901. if (!$this._sector)
  39902. ;
  39903. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39904. this.handler.setInputAction(function(evt) {
  39905. if ($this._positions.length < 2)
  39906. return;
  39907. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39908. if ($this._positions.length == 2) {
  39909. $this._positions.push(cartesian);
  39910. }
  39911. if ($this._positions.length == 3) {
  39912. $this._positions.pop();
  39913. $this._positions.push(cartesian);
  39914. if (!$this.Cesium.defined($this._sector)) {
  39915. $this._sector = $this.createsector();
  39916. }
  39917. }
  39918. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39919. this.handler.setInputAction(function(evt) {
  39920. if (!$this._sector)
  39921. return;
  39922. var cartesian = $this.getCatesian3FromPX(evt.position);
  39923. $this._positions.pop();
  39924. $this._positions.push(cartesian);
  39925. $this._sectorData = $this._positions.concat();
  39926. $this.viewer.entities.remove($this._sector);
  39927. $this._sector = null;
  39928. $this._positions = [];
  39929. $this.floatingPoint.position.setValue(cartesian);
  39930. var lnglatArr = [];
  39931. for (var i2 = 0; i2 < $this._sectorData.length; i2++) {
  39932. var lnglat = $this.cartesianToLatlng($this._sectorData[i2]);
  39933. lnglatArr.push(lnglat);
  39934. }
  39935. $this._sectorData = lnglatArr;
  39936. var sector = $this.addload(lnglatArr);
  39937. $this._entities_sector.push(sector);
  39938. $this._sectorLast = sector;
  39939. $this.clearPoint();
  39940. $this.destroy();
  39941. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39942. }
  39943. createsector() {
  39944. var $this = this;
  39945. var arrowEntity = $this.viewer.entities.add(
  39946. {
  39947. polygon: {
  39948. hierarchy: new $this.Cesium.CallbackProperty(
  39949. function() {
  39950. let pnts = $this._positions;
  39951. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39952. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39953. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39954. var radius = $this.MathDistance(pnt2, center2);
  39955. var startAngle = $this.getAzimuth(pnt2, center2);
  39956. var endAngle = $this.getAzimuth(pnt3, center2);
  39957. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39958. pList.push(pnts[0], pList[0]);
  39959. for (var i2 = 0; i2 < pList.length; i2++) {
  39960. new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39961. }
  39962. return new $this.Cesium.PolygonHierarchy(pList);
  39963. },
  39964. false
  39965. ),
  39966. show: true,
  39967. fill: true,
  39968. clampToGround: true,
  39969. material: $this.Cesium.Color.AQUA.withAlpha(0.5)
  39970. }
  39971. }
  39972. );
  39973. $this._entities_sector.push(arrowEntity);
  39974. return arrowEntity;
  39975. }
  39976. createPoint(cartesian) {
  39977. var $this = this;
  39978. var point2 = this.viewer.entities.add({
  39979. position: cartesian,
  39980. point: {
  39981. pixelSize: 10,
  39982. color: $this.Cesium.Color.RED,
  39983. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39984. }
  39985. });
  39986. $this._entities_point.push(point2);
  39987. return point2;
  39988. }
  39989. cartesianToLatlng(cartesian) {
  39990. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39991. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  39992. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  39993. return [lng, lat];
  39994. }
  39995. lonLatToMercator(Latlng) {
  39996. var E2 = Latlng[0];
  39997. var N2 = Latlng[1];
  39998. var x = E2 * 2003750834e-2 / 180;
  39999. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40000. y = y * 2003750834e-2 / 180;
  40001. return [x, y];
  40002. }
  40003. WebMercator2lonLat(mercator) {
  40004. let x = mercator[0] / 2003750834e-2 * 180;
  40005. let ly = mercator[1] / 2003750834e-2 * 180;
  40006. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40007. return [x, y];
  40008. }
  40009. destroy() {
  40010. if (this.handler) {
  40011. this.handler.destroy();
  40012. this.handler = null;
  40013. }
  40014. }
  40015. clearPoint() {
  40016. this.DrawEndEvent.raiseEvent(this._sectorLast, this._sectorData);
  40017. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40018. this.viewer.entities.remove(this._entities_point[i2]);
  40019. }
  40020. this._entities_point = [];
  40021. }
  40022. clear() {
  40023. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40024. this.viewer.entities.remove(this._entities_point[i2]);
  40025. }
  40026. for (var i2 = 0; i2 < this._entities_sector.length; i2++) {
  40027. this.viewer.entities.remove(this._entities_sector[i2]);
  40028. }
  40029. this.floatingPoint = null;
  40030. this._sector = null;
  40031. this._sectorLast = null;
  40032. this._positions = [];
  40033. this._entities_point = [];
  40034. this._entities_sector = [];
  40035. this._sectorData = null;
  40036. }
  40037. getCatesian3FromPX(px) {
  40038. var cartesian;
  40039. var ray = this.viewer.camera.getPickRay(px);
  40040. if (!ray)
  40041. return null;
  40042. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40043. return cartesian;
  40044. }
  40045. MathDistance(pnt1, pnt2) {
  40046. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40047. }
  40048. getAzimuth(startPoint, endPoint) {
  40049. var azimuth;
  40050. var angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40051. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40052. azimuth = angle + Math.PI;
  40053. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40054. azimuth = Math.PI * 2 - angle;
  40055. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40056. azimuth = angle;
  40057. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40058. azimuth = Math.PI - angle;
  40059. }
  40060. return azimuth;
  40061. }
  40062. getArcPoints(center2, radius, startAngle, endAngle) {
  40063. var x = null, y = null, pnts = [], angleDiff = endAngle - startAngle;
  40064. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40065. for (var i2 = 0; i2 <= 100; i2++) {
  40066. var angle = startAngle + angleDiff * i2 / 100;
  40067. x = center2[0] + radius * Math.cos(angle);
  40068. y = center2[1] + radius * Math.sin(angle);
  40069. let latlon = this.WebMercator2lonLat([x, y]);
  40070. pnts.push(this.Cesium.Cartesian3.fromDegrees(latlon[0], latlon[1]));
  40071. }
  40072. return pnts;
  40073. }
  40074. }
  40075. class DrawBowLine {
  40076. constructor(arg) {
  40077. this.viewer = arg.viewer;
  40078. this.Cesium = arg.Cesium;
  40079. this.tt = 0.4;
  40080. this.floatingPoint = null;
  40081. this.drawHandler = null;
  40082. this.DrawBowLine = null;
  40083. this._DrawBowLineLast = null;
  40084. this._positions = [];
  40085. this._entities_point = [];
  40086. this._entities_PincerArrow = [];
  40087. this._DrawBowLineData = null;
  40088. this.DrawStartEvent = new Cesium.Event();
  40089. this.DrawEndEvent = new Cesium.Event();
  40090. this._param = {
  40091. id: "DrawStraightArrow",
  40092. polygonColor: "rgba(0,255,0,0.5)",
  40093. outlineColor: "rgba(255, 255, 255, 1)",
  40094. outlineWidth: 1
  40095. };
  40096. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40097. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40098. }
  40099. get PincerArrow() {
  40100. return this._DrawBowLineLast;
  40101. }
  40102. getData() {
  40103. return this._DrawBowLineData;
  40104. }
  40105. computePosition(data) {
  40106. var $this = this;
  40107. if (data.length < 3) {
  40108. return;
  40109. }
  40110. var DrawBowLine2 = [];
  40111. let positions = [];
  40112. for (var i2 = 0; i2 < data.length; i2++) {
  40113. positions.push($this.cartesianToLatlng(data[i2]));
  40114. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40115. DrawBowLine2.push(cart3);
  40116. }
  40117. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40118. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40119. let radius = $this.MathDistance(pnt1, center2);
  40120. let angle1 = $this.getAzimuth(pnt1, center2);
  40121. let angle2 = $this.getAzimuth(pnt2, center2);
  40122. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40123. startAngle = angle2;
  40124. endAngle = angle1;
  40125. } else {
  40126. startAngle = angle1;
  40127. endAngle = angle2;
  40128. }
  40129. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40130. let pHierarchy = [];
  40131. for (var l = 0; l < getArcPoint.length; l++) {
  40132. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40133. pHierarchy.push(cart3);
  40134. }
  40135. $this._DrawBowLineData = positions;
  40136. return pHierarchy;
  40137. }
  40138. addload(data) {
  40139. var $this = this;
  40140. if (data.length < 3) {
  40141. return;
  40142. }
  40143. var DrawBowLine2 = [];
  40144. for (var i2 = 0; i2 < data.length; i2++) {
  40145. var cart3 = $this.lonLatToMercator(data[i2]);
  40146. DrawBowLine2.push(cart3);
  40147. }
  40148. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40149. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40150. let radius = $this.MathDistance(pnt1, center2);
  40151. let angle1 = $this.getAzimuth(pnt1, center2);
  40152. let angle2 = $this.getAzimuth(pnt2, center2);
  40153. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40154. startAngle = angle2;
  40155. endAngle = angle1;
  40156. } else {
  40157. startAngle = angle1;
  40158. endAngle = angle2;
  40159. }
  40160. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40161. let pHierarchy = [];
  40162. for (var l = 0; l < getArcPoint.length; l++) {
  40163. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40164. pHierarchy.push(cart3);
  40165. }
  40166. var arrowEntity = $this.viewer.entities.add({
  40167. Type: "DrawBowLine",
  40168. Position: data,
  40169. id: data.id || $this.objId,
  40170. polyline: {
  40171. positions: pHierarchy,
  40172. show: true,
  40173. material: $this.Cesium.Color.YELLOW,
  40174. width: 3,
  40175. clampToGround: true
  40176. }
  40177. });
  40178. return arrowEntity;
  40179. }
  40180. startCreate(drawType) {
  40181. this.drawType = drawType;
  40182. var $this = this;
  40183. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40184. this.handler.setInputAction(function(event2) {
  40185. var position2 = event2.position;
  40186. if (!$this.Cesium.defined(position2)) {
  40187. return;
  40188. }
  40189. var ray = $this.viewer.camera.getPickRay(position2);
  40190. if (!$this.Cesium.defined(ray)) {
  40191. return;
  40192. }
  40193. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40194. if (!$this.Cesium.defined(cartesian)) {
  40195. return;
  40196. }
  40197. if ($this._positions.length == 0) {
  40198. $this._positions.push(cartesian.clone());
  40199. $this.floatingPoint = $this.createPoint(cartesian);
  40200. }
  40201. if ($this._positions.length <= 2) {
  40202. $this.createPoint(cartesian);
  40203. $this._positions.push(cartesian);
  40204. }
  40205. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40206. this.handler.setInputAction(function(event2) {
  40207. if ($this._positions.length < 2) {
  40208. return;
  40209. }
  40210. var position2 = event2.endPosition;
  40211. if (!$this.Cesium.defined(position2)) {
  40212. return;
  40213. }
  40214. var ray = $this.viewer.camera.getPickRay(position2);
  40215. if (!$this.Cesium.defined(ray)) {
  40216. return;
  40217. }
  40218. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40219. if (!$this.Cesium.defined(cartesian)) {
  40220. return;
  40221. }
  40222. if (!$this.Cesium.defined($this.DrawBowLine)) {
  40223. $this.DrawBowLine = $this.createDrawBowLine();
  40224. }
  40225. $this.floatingPoint.position.setValue(cartesian);
  40226. if ($this.DrawBowLine) {
  40227. if ($this._positions.length == 3) {
  40228. $this._positions[1] = cartesian;
  40229. } else {
  40230. $this._positions.pop();
  40231. $this._positions.push(cartesian);
  40232. }
  40233. }
  40234. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40235. this.handler.setInputAction(function(movement) {
  40236. if ($this._positions.length >= 3) {
  40237. $this._DrawBowLineData = $this._positions.concat();
  40238. $this.viewer.entities.remove($this.DrawBowLine);
  40239. $this.DrawBowLine = null;
  40240. var lnglatArr = [];
  40241. for (var i2 = 0; i2 < $this._DrawBowLineData.length; i2++) {
  40242. var lnglat = $this.cartesianToLatlng($this._DrawBowLineData[i2]);
  40243. lnglatArr.push(lnglat);
  40244. }
  40245. $this._DrawBowLineData = lnglatArr;
  40246. var pincerArrow = $this.addload(lnglatArr);
  40247. $this._entities_PincerArrow.push(pincerArrow);
  40248. $this._DrawBowLineLast = pincerArrow;
  40249. $this.viewer.entities.remove($this.floatingPoint);
  40250. $this.floatingPoint = null;
  40251. $this.clearPoint();
  40252. $this.destroy();
  40253. }
  40254. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40255. }
  40256. createDrawBowLine() {
  40257. let $this = this;
  40258. var DrawBowLineEntity = $this.viewer.entities.add({
  40259. polyline: {
  40260. positions: new $this.Cesium.CallbackProperty(function() {
  40261. if ($this._positions.length < 3) {
  40262. return;
  40263. }
  40264. var DrawBowLine2 = [];
  40265. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40266. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40267. DrawBowLine2.push(cart3);
  40268. }
  40269. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40270. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40271. let radius = $this.MathDistance(pnt1, center2);
  40272. let angle1 = $this.getAzimuth(pnt1, center2);
  40273. let angle2 = $this.getAzimuth(pnt2, center2);
  40274. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40275. startAngle = angle2;
  40276. endAngle = angle1;
  40277. } else {
  40278. startAngle = angle1;
  40279. endAngle = angle2;
  40280. }
  40281. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40282. let pHierarchy = [];
  40283. for (var l = 0; l < getArcPoint.length; l++) {
  40284. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40285. pHierarchy.push(cart3);
  40286. }
  40287. return pHierarchy;
  40288. }, false),
  40289. show: true,
  40290. material: $this.Cesium.Color.YELLOW,
  40291. width: 3,
  40292. clampToGround: true
  40293. }
  40294. });
  40295. $this._entities_PincerArrow.push(DrawBowLineEntity);
  40296. return DrawBowLineEntity;
  40297. }
  40298. createPoint(cartesian) {
  40299. var $this = this;
  40300. var point2 = this.viewer.entities.add({
  40301. position: cartesian,
  40302. point: {
  40303. pixelSize: 10,
  40304. color: $this.Cesium.Color.RED,
  40305. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40306. }
  40307. });
  40308. $this._entities_point.push(point2);
  40309. return point2;
  40310. }
  40311. cartesianToLatlng(cartesian) {
  40312. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40313. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40314. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40315. cartographic.height;
  40316. return [lng, lat];
  40317. }
  40318. destroy() {
  40319. if (this.handler) {
  40320. this.handler.destroy();
  40321. this.handler = null;
  40322. }
  40323. }
  40324. clearPoint() {
  40325. this.DrawEndEvent.raiseEvent(this._DrawBowLineLast, this._DrawBowLineData, this.drawType);
  40326. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40327. this.viewer.entities.remove(this._entities_point[i2]);
  40328. }
  40329. this._entities_point = [];
  40330. }
  40331. clear() {
  40332. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40333. this.viewer.entities.remove(this._entities_point[i2]);
  40334. }
  40335. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40336. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40337. }
  40338. this.floatingPoint = null;
  40339. this._PincerArrow = null;
  40340. this._PincerArrowLast = null;
  40341. this._positions = [];
  40342. this._entities_point = [];
  40343. this._entities_PincerArrow = [];
  40344. this._PincerArrowData = null;
  40345. }
  40346. getCatesian3FromPX(px) {
  40347. var cartesian;
  40348. var ray = this.viewer.camera.getPickRay(px);
  40349. if (!ray)
  40350. return null;
  40351. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40352. return cartesian;
  40353. }
  40354. _computeTempPositions() {
  40355. var _this = this;
  40356. var pnts = [].concat(_this._positions);
  40357. var num = pnts.length;
  40358. var first = pnts[0];
  40359. var last = pnts[num - 1];
  40360. if (_this._isSimpleXYZ(first, last) == false) {
  40361. pnts.push(first);
  40362. num += 1;
  40363. }
  40364. _this.tempPositions = [];
  40365. for (var i2 = 1; i2 < num; i2++) {
  40366. var p1 = pnts[i2 - 1];
  40367. var p2 = pnts[i2];
  40368. var cp = _this._computeCenterPotition(p1, p2);
  40369. _this.tempPositions.push(p1);
  40370. _this.tempPositions.push(cp);
  40371. }
  40372. }
  40373. _isSimpleXYZ(p1, p2) {
  40374. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40375. return true;
  40376. }
  40377. return false;
  40378. }
  40379. _computeCenterPotition(p1, p2) {
  40380. var _this = this;
  40381. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40382. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40383. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40384. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40385. return cp;
  40386. }
  40387. getLonLat(cartesian) {
  40388. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40389. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40390. var pos = {
  40391. lon: cartographic.longitude,
  40392. lat: cartographic.latitude,
  40393. alt: cartographic.height
  40394. };
  40395. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40396. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40397. return pos;
  40398. }
  40399. LatlngTocartesian(latlng) {
  40400. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40401. return cartesian3;
  40402. }
  40403. lonLatToMercator(Latlng) {
  40404. var E2 = Latlng[0];
  40405. var N2 = Latlng[1];
  40406. var x = E2 * 2003750834e-2 / 180;
  40407. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40408. y = y * 2003750834e-2 / 180;
  40409. return [x, y];
  40410. }
  40411. WebMercator2lonLat(mercator) {
  40412. let x = mercator[0] / 2003750834e-2 * 180;
  40413. let ly = mercator[1] / 2003750834e-2 * 180;
  40414. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40415. return [x, y];
  40416. }
  40417. getCircleCenterOfThreePoints(point1, point2, point3) {
  40418. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40419. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40420. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40421. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40422. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40423. }
  40424. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40425. if (pntA[1] === pntB[1]) {
  40426. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40427. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40428. let y2 = pntA[1];
  40429. return [x2, y2];
  40430. }
  40431. if (pntC[1] === pntD[1]) {
  40432. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40433. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40434. let y2 = pntC[1];
  40435. return [x2, y2];
  40436. }
  40437. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40438. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40439. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40440. let x = e * y - e * pntA[1] + pntA[0];
  40441. return [x, y];
  40442. }
  40443. MathDistance(pnt1, pnt2) {
  40444. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40445. }
  40446. getAzimuth(startPoint, endPoint) {
  40447. let azimuth;
  40448. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40449. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40450. azimuth = angle + Math.PI;
  40451. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40452. azimuth = Math.PI * 2 - angle;
  40453. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40454. azimuth = angle;
  40455. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40456. azimuth = Math.PI - angle;
  40457. }
  40458. return azimuth;
  40459. }
  40460. isClockWise(pnt1, pnt2, pnt3) {
  40461. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40462. }
  40463. getArcPoints(center2, radius, startAngle, endAngle) {
  40464. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40465. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40466. for (let i2 = 0; i2 <= 100; i2++) {
  40467. let angle = startAngle + angleDiff * i2 / 100;
  40468. x = center2[0] + radius * Math.cos(angle);
  40469. y = center2[1] + radius * Math.sin(angle);
  40470. pnts.push([x, y]);
  40471. }
  40472. return pnts;
  40473. }
  40474. }
  40475. class DrawBowPlane {
  40476. constructor(arg) {
  40477. this.viewer = arg.viewer;
  40478. this.Cesium = arg.Cesium;
  40479. this.tt = 0.4;
  40480. this.floatingPoint = null;
  40481. this.drawHandler = null;
  40482. this.DrawBowPlane = null;
  40483. this._DrawBowPlaneLast = null;
  40484. this._positions = [];
  40485. this._entities_point = [];
  40486. this._entities_PincerArrow = [];
  40487. this._DrawBowPlaneData = null;
  40488. this.DrawStartEvent = new Cesium.Event();
  40489. this.DrawEndEvent = new Cesium.Event();
  40490. this._param = {
  40491. id: "DrawStraightArrow",
  40492. polygonColor: "rgba(0,255,0,0.5)",
  40493. outlineColor: "rgba(255, 255, 255, 1)",
  40494. outlineWidth: 1
  40495. };
  40496. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40497. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40498. }
  40499. get PincerArrow() {
  40500. return this._DrawBowPlaneLast;
  40501. }
  40502. getData() {
  40503. return this._DrawBowPlaneData;
  40504. }
  40505. computePosition(data) {
  40506. var $this = this;
  40507. if (data.length < 3) {
  40508. return;
  40509. }
  40510. var DrawBowPlane2 = [];
  40511. let positions = [];
  40512. for (var i2 = 0; i2 < data.length; i2++) {
  40513. positions.push($this.cartesianToLatlng(data[i2]));
  40514. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40515. DrawBowPlane2.push(cart3);
  40516. }
  40517. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40518. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40519. let radius = $this.MathDistance(pnt1, center2);
  40520. let angle1 = $this.getAzimuth(pnt1, center2);
  40521. let angle2 = $this.getAzimuth(pnt2, center2);
  40522. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40523. startAngle = angle2;
  40524. endAngle = angle1;
  40525. } else {
  40526. startAngle = angle1;
  40527. endAngle = angle2;
  40528. }
  40529. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40530. let pHierarchy = [];
  40531. for (var l = 0; l < getArcPoint.length; l++) {
  40532. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40533. pHierarchy.push(cart3);
  40534. }
  40535. pHierarchy.push(pHierarchy[0]);
  40536. $this._DrawBowPlaneData = positions;
  40537. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40538. }
  40539. addload(data) {
  40540. var $this = this;
  40541. if (data.length < 3) {
  40542. return;
  40543. }
  40544. var DrawBowPlane2 = [];
  40545. for (var i2 = 0; i2 < data.length; i2++) {
  40546. var cart3 = $this.lonLatToMercator(data[i2]);
  40547. DrawBowPlane2.push(cart3);
  40548. }
  40549. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40550. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40551. let radius = $this.MathDistance(pnt1, center2);
  40552. let angle1 = $this.getAzimuth(pnt1, center2);
  40553. let angle2 = $this.getAzimuth(pnt2, center2);
  40554. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40555. startAngle = angle2;
  40556. endAngle = angle1;
  40557. } else {
  40558. startAngle = angle1;
  40559. endAngle = angle2;
  40560. }
  40561. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40562. let pHierarchy = [];
  40563. for (var l = 0; l < getArcPoint.length; l++) {
  40564. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40565. pHierarchy.push(cart3);
  40566. }
  40567. pHierarchy.push(pHierarchy[0]);
  40568. var arrowEntity = $this.viewer.entities.add(
  40569. {
  40570. Type: "DrawBowPlane",
  40571. Position: data,
  40572. id: data.id || $this.objId,
  40573. polygon: {
  40574. hierarchy: new $this.Cesium.PolygonHierarchy(pHierarchy),
  40575. show: true,
  40576. material: $this.Cesium.Color.YELLOW,
  40577. width: 3,
  40578. clampToGround: true,
  40579. outlineWidth: 3,
  40580. outline: true,
  40581. outlineColor: Cesium.Color.MAGENTA
  40582. }
  40583. }
  40584. );
  40585. return arrowEntity;
  40586. }
  40587. startCreate(drawType) {
  40588. this.drawType = drawType;
  40589. var $this = this;
  40590. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40591. this.handler.setInputAction(function(event2) {
  40592. var position2 = event2.position;
  40593. if (!$this.Cesium.defined(position2)) {
  40594. return;
  40595. }
  40596. var ray = $this.viewer.camera.getPickRay(position2);
  40597. if (!$this.Cesium.defined(ray)) {
  40598. return;
  40599. }
  40600. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40601. if (!$this.Cesium.defined(cartesian)) {
  40602. return;
  40603. }
  40604. if ($this._positions.length == 0) {
  40605. $this._positions.push(cartesian.clone());
  40606. $this.floatingPoint = $this.createPoint(cartesian);
  40607. }
  40608. if ($this._positions.length <= 2) {
  40609. $this.createPoint(cartesian);
  40610. $this._positions.push(cartesian);
  40611. }
  40612. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40613. this.handler.setInputAction(function(event2) {
  40614. if ($this._positions.length < 2) {
  40615. return;
  40616. }
  40617. var position2 = event2.endPosition;
  40618. if (!$this.Cesium.defined(position2)) {
  40619. return;
  40620. }
  40621. var ray = $this.viewer.camera.getPickRay(position2);
  40622. if (!$this.Cesium.defined(ray)) {
  40623. return;
  40624. }
  40625. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40626. if (!$this.Cesium.defined(cartesian)) {
  40627. return;
  40628. }
  40629. if (!$this.Cesium.defined($this.DrawBowPlane)) {
  40630. $this.DrawBowPlane = $this.createDrawBowPlane();
  40631. }
  40632. $this.floatingPoint.position.setValue(cartesian);
  40633. if ($this.DrawBowPlane) {
  40634. if ($this._positions.length == 3) {
  40635. $this._positions[1] = cartesian;
  40636. } else {
  40637. $this._positions.pop();
  40638. $this._positions.push(cartesian);
  40639. }
  40640. }
  40641. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40642. this.handler.setInputAction(function(movement) {
  40643. if ($this._positions.length >= 3) {
  40644. $this._DrawBowPlaneData = $this._positions.concat();
  40645. $this.viewer.entities.remove($this.DrawBowPlane);
  40646. $this.DrawBowPlane = null;
  40647. var lnglatArr = [];
  40648. for (var i2 = 0; i2 < $this._DrawBowPlaneData.length; i2++) {
  40649. var lnglat = $this.cartesianToLatlng($this._DrawBowPlaneData[i2]);
  40650. lnglatArr.push(lnglat);
  40651. }
  40652. $this._DrawBowPlaneData = lnglatArr;
  40653. var pincerArrow = $this.addload(lnglatArr);
  40654. $this._entities_PincerArrow.push(pincerArrow);
  40655. $this._DrawBowPlaneLast = pincerArrow;
  40656. $this.viewer.entities.remove($this.floatingPoint);
  40657. $this.floatingPoint = null;
  40658. $this.clearPoint();
  40659. $this.destroy();
  40660. }
  40661. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40662. }
  40663. createDrawBowPlane() {
  40664. let $this = this;
  40665. var DrawBowPlaneEntity = $this.viewer.entities.add(
  40666. {
  40667. polygon: {
  40668. hierarchy: new $this.Cesium.CallbackProperty(function() {
  40669. if ($this._positions.length < 3) {
  40670. return;
  40671. }
  40672. var DrawBowPlane2 = [];
  40673. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40674. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40675. DrawBowPlane2.push(cart3);
  40676. }
  40677. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40678. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40679. let radius = $this.MathDistance(pnt1, center2);
  40680. let angle1 = $this.getAzimuth(pnt1, center2);
  40681. let angle2 = $this.getAzimuth(pnt2, center2);
  40682. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40683. startAngle = angle2;
  40684. endAngle = angle1;
  40685. } else {
  40686. startAngle = angle1;
  40687. endAngle = angle2;
  40688. }
  40689. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40690. let pHierarchy = [];
  40691. for (var l = 0; l < getArcPoint.length; l++) {
  40692. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40693. pHierarchy.push(cart3);
  40694. }
  40695. pHierarchy.push(pHierarchy[0]);
  40696. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40697. }, false),
  40698. show: true,
  40699. material: $this.Cesium.Color.YELLOW,
  40700. clampToGround: true
  40701. }
  40702. }
  40703. );
  40704. $this._entities_PincerArrow.push(DrawBowPlaneEntity);
  40705. return DrawBowPlaneEntity;
  40706. }
  40707. createPoint(cartesian) {
  40708. var $this = this;
  40709. var point2 = this.viewer.entities.add({
  40710. position: cartesian,
  40711. point: {
  40712. pixelSize: 10,
  40713. color: $this.Cesium.Color.RED,
  40714. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40715. }
  40716. });
  40717. $this._entities_point.push(point2);
  40718. return point2;
  40719. }
  40720. cartesianToLatlng(cartesian) {
  40721. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40722. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40723. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40724. cartographic.height;
  40725. return [lng, lat];
  40726. }
  40727. destroy() {
  40728. if (this.handler) {
  40729. this.handler.destroy();
  40730. this.handler = null;
  40731. }
  40732. }
  40733. clearPoint() {
  40734. this.DrawEndEvent.raiseEvent(this._DrawBowPlaneLast, this._DrawBowPlaneData, this.drawType);
  40735. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40736. this.viewer.entities.remove(this._entities_point[i2]);
  40737. }
  40738. this._entities_point = [];
  40739. }
  40740. clear() {
  40741. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40742. this.viewer.entities.remove(this._entities_point[i2]);
  40743. }
  40744. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40745. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40746. }
  40747. this.floatingPoint = null;
  40748. this._PincerArrow = null;
  40749. this._PincerArrowLast = null;
  40750. this._positions = [];
  40751. this._entities_point = [];
  40752. this._entities_PincerArrow = [];
  40753. this._PincerArrowData = null;
  40754. }
  40755. getCatesian3FromPX(px) {
  40756. var cartesian;
  40757. var ray = this.viewer.camera.getPickRay(px);
  40758. if (!ray)
  40759. return null;
  40760. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40761. return cartesian;
  40762. }
  40763. _computeTempPositions() {
  40764. var _this = this;
  40765. var pnts = [].concat(_this._positions);
  40766. var num = pnts.length;
  40767. var first = pnts[0];
  40768. var last = pnts[num - 1];
  40769. if (_this._isSimpleXYZ(first, last) == false) {
  40770. pnts.push(first);
  40771. num += 1;
  40772. }
  40773. _this.tempPositions = [];
  40774. for (var i2 = 1; i2 < num; i2++) {
  40775. var p1 = pnts[i2 - 1];
  40776. var p2 = pnts[i2];
  40777. var cp = _this._computeCenterPotition(p1, p2);
  40778. _this.tempPositions.push(p1);
  40779. _this.tempPositions.push(cp);
  40780. }
  40781. }
  40782. _isSimpleXYZ(p1, p2) {
  40783. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40784. return true;
  40785. }
  40786. return false;
  40787. }
  40788. _computeCenterPotition(p1, p2) {
  40789. var _this = this;
  40790. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40791. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40792. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40793. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40794. return cp;
  40795. }
  40796. getLonLat(cartesian) {
  40797. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40798. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40799. var pos = {
  40800. lon: cartographic.longitude,
  40801. lat: cartographic.latitude,
  40802. alt: cartographic.height
  40803. };
  40804. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40805. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40806. return pos;
  40807. }
  40808. LatlngTocartesian(latlng) {
  40809. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40810. return cartesian3;
  40811. }
  40812. lonLatToMercator(Latlng) {
  40813. var E2 = Latlng[0];
  40814. var N2 = Latlng[1];
  40815. var x = E2 * 2003750834e-2 / 180;
  40816. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40817. y = y * 2003750834e-2 / 180;
  40818. return [x, y];
  40819. }
  40820. WebMercator2lonLat(mercator) {
  40821. let x = mercator[0] / 2003750834e-2 * 180;
  40822. let ly = mercator[1] / 2003750834e-2 * 180;
  40823. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40824. return [x, y];
  40825. }
  40826. getCircleCenterOfThreePoints(point1, point2, point3) {
  40827. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40828. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40829. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40830. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40831. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40832. }
  40833. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40834. if (pntA[1] === pntB[1]) {
  40835. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40836. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40837. let y2 = pntA[1];
  40838. return [x2, y2];
  40839. }
  40840. if (pntC[1] === pntD[1]) {
  40841. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40842. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40843. let y2 = pntC[1];
  40844. return [x2, y2];
  40845. }
  40846. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40847. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40848. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40849. let x = e * y - e * pntA[1] + pntA[0];
  40850. return [x, y];
  40851. }
  40852. MathDistance(pnt1, pnt2) {
  40853. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40854. }
  40855. getAzimuth(startPoint, endPoint) {
  40856. let azimuth;
  40857. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40858. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40859. azimuth = angle + Math.PI;
  40860. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40861. azimuth = Math.PI * 2 - angle;
  40862. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40863. azimuth = angle;
  40864. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40865. azimuth = Math.PI - angle;
  40866. }
  40867. return azimuth;
  40868. }
  40869. isClockWise(pnt1, pnt2, pnt3) {
  40870. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40871. }
  40872. getArcPoints(center2, radius, startAngle, endAngle) {
  40873. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40874. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40875. for (let i2 = 0; i2 <= 100; i2++) {
  40876. let angle = startAngle + angleDiff * i2 / 100;
  40877. x = center2[0] + radius * Math.cos(angle);
  40878. y = center2[1] + radius * Math.sin(angle);
  40879. pnts.push([x, y]);
  40880. }
  40881. return pnts;
  40882. }
  40883. }
  40884. class DrawCurve {
  40885. constructor(arg) {
  40886. this.viewer = arg.viewer;
  40887. this.Cesium = arg.Cesium;
  40888. this.floatingPoint = null;
  40889. this._curveline = null;
  40890. this._curvelineLast = null;
  40891. this._positions = [];
  40892. this._entities_point = [];
  40893. this._entities_line = [];
  40894. this._curvelineData = null;
  40895. this.DrawStartEvent = new Cesium.Event();
  40896. this.DrawEndEvent = new Cesium.Event();
  40897. this.ZERO_TOLERANCE = 1e-4;
  40898. this.FITTING_COUNT = 100;
  40899. this.t = 0.3;
  40900. this._param = {
  40901. id: "DrawStraightArrow",
  40902. polygonColor: "rgba(0,255,0,0.5)",
  40903. outlineColor: "rgba(255, 255, 255, 1)",
  40904. outlineWidth: 1
  40905. };
  40906. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40907. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40908. }
  40909. get curveline() {
  40910. return this._curvelineLast;
  40911. }
  40912. getData() {
  40913. return this._curvelineData;
  40914. }
  40915. addload(data) {
  40916. var $this = this;
  40917. let pnts = [];
  40918. for (let p = 0; p < data.length; p++) {
  40919. pnts.push($this.lonLatToMercator(data[p]));
  40920. }
  40921. let CurvePoints = $this.getCurvePoints(pnts);
  40922. let point2 = [];
  40923. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40924. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  40925. }
  40926. var polyline = this.viewer.entities.add({
  40927. Type: "DrawCurve",
  40928. Position: data,
  40929. id: data.id || $this.objId,
  40930. polyline: {
  40931. positions: point2,
  40932. show: true,
  40933. material: $this.Cesium.Color.YELLOW,
  40934. width: 3,
  40935. clampToGround: true
  40936. }
  40937. });
  40938. return polyline;
  40939. }
  40940. computePosition(data) {
  40941. let pnts = [];
  40942. let position2 = [];
  40943. for (let p = 0; p < data.length; p++) {
  40944. position2.push(this.cartesianToLatlng(data[p]));
  40945. pnts.push(this.lonLatToMercator(this.cartesianToLatlng(data[p])));
  40946. }
  40947. this._curvelineData = position2;
  40948. let CurvePoints = this.getCurvePoints(pnts);
  40949. let point2 = [];
  40950. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40951. point2.push(this.LatlngTocartesian(this.WebMercator2lonLat(CurvePoints[i2])));
  40952. }
  40953. return point2;
  40954. }
  40955. startCreate(drawType) {
  40956. this.drawType = drawType;
  40957. var $this = this;
  40958. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  40959. this.handler.setInputAction(function(evt) {
  40960. var cartesian = $this.getCatesian3FromPX(evt.position);
  40961. if ($this._positions.length == 0) {
  40962. $this._positions.push(cartesian.clone());
  40963. $this.floatingPoint = $this.createPoint(cartesian);
  40964. $this.createPoint(cartesian);
  40965. }
  40966. $this._positions.push(cartesian);
  40967. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40968. this.handler.setInputAction(function(evt) {
  40969. if ($this._positions.length < 3)
  40970. return;
  40971. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  40972. if (!$this.Cesium.defined($this._curveline)) {
  40973. $this._curveline = $this.createCurveline();
  40974. }
  40975. $this.floatingPoint.position.setValue(cartesian);
  40976. if ($this._curveline) {
  40977. $this._positions.pop();
  40978. $this._positions.push(cartesian);
  40979. }
  40980. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40981. this.handler.setInputAction(function(evt) {
  40982. if (!$this._curveline)
  40983. return;
  40984. var cartesian = $this.getCatesian3FromPX(evt.position);
  40985. $this._positions.pop();
  40986. $this._positions.push(cartesian);
  40987. $this.createPoint(cartesian);
  40988. $this._curvelineData = $this._positions.concat();
  40989. $this.viewer.entities.remove($this._curveline);
  40990. $this._curveline = null;
  40991. $this._positions = [];
  40992. $this.floatingPoint.position.setValue(cartesian);
  40993. let lnglatArr = [];
  40994. for (var i2 = 0; i2 < $this._curvelineData.length; i2++) {
  40995. var lnglat = $this.cartesianToLatlng($this._curvelineData[i2]);
  40996. lnglatArr.push(lnglat);
  40997. }
  40998. $this._curvelineData = lnglatArr;
  40999. var line = $this.addload($this._curvelineData);
  41000. $this._entities_line.push(line);
  41001. $this._curvelineLast = line;
  41002. $this.clearPoint();
  41003. $this.destroy();
  41004. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41005. }
  41006. createPoint(cartesian) {
  41007. var $this = this;
  41008. var point2 = this.viewer.entities.add({
  41009. position: cartesian,
  41010. point: {
  41011. pixelSize: 10,
  41012. color: $this.Cesium.Color.RED,
  41013. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41014. }
  41015. });
  41016. $this._entities_point.push(point2);
  41017. return point2;
  41018. }
  41019. createCurveline() {
  41020. var $this = this;
  41021. var polyline = this.viewer.entities.add({
  41022. polyline: {
  41023. positions: new $this.Cesium.CallbackProperty(function() {
  41024. let pnts = [];
  41025. for (let p = 0; p < $this._positions.length; p++) {
  41026. pnts.push($this.lonLatToMercator($this.cartesianToLatlng($this._positions[p])));
  41027. }
  41028. let CurvePoints = $this.getCurvePoints(pnts);
  41029. let point2 = [];
  41030. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  41031. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  41032. }
  41033. return point2;
  41034. }, false),
  41035. show: true,
  41036. material: $this.Cesium.Color.YELLOW,
  41037. width: 3,
  41038. clampToGround: true
  41039. }
  41040. });
  41041. $this._entities_line.push(polyline);
  41042. return polyline;
  41043. }
  41044. clearPoint() {
  41045. this.DrawEndEvent.raiseEvent(this._curvelineLast, this._curvelineData, this.drawType);
  41046. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  41047. this.viewer.entities.remove(this._entities_point[i2]);
  41048. }
  41049. this._entities_point = [];
  41050. }
  41051. destroy() {
  41052. if (this.handler) {
  41053. this.handler.destroy();
  41054. this.handler = null;
  41055. }
  41056. }
  41057. clear() {
  41058. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  41059. this.viewer.entities.remove(this._entities_point[i2]);
  41060. }
  41061. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  41062. this.viewer.entities.remove(this._entities_line[i2]);
  41063. }
  41064. this.floatingPoint = null;
  41065. this._curveline = null;
  41066. this._curvelineLast = null;
  41067. this._positions = [];
  41068. this._entities_point = [];
  41069. this._entities_line = [];
  41070. this._curvelineData = null;
  41071. }
  41072. getCatesian3FromPX(px) {
  41073. var cartesian;
  41074. var ray = this.viewer.camera.getPickRay(px);
  41075. if (!ray)
  41076. return null;
  41077. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41078. return cartesian;
  41079. }
  41080. cartesianToLatlng(cartesian) {
  41081. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41082. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41083. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41084. return [lng, lat];
  41085. }
  41086. LatlngTocartesian(latlng) {
  41087. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41088. return cartesian3;
  41089. }
  41090. lonLatToMercator(Latlng) {
  41091. var E2 = Latlng[0];
  41092. var N2 = Latlng[1];
  41093. var x = E2 * 2003750834e-2 / 180;
  41094. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  41095. y = y * 2003750834e-2 / 180;
  41096. return [x, y];
  41097. }
  41098. WebMercator2lonLat(mercator) {
  41099. let x = mercator[0] / 2003750834e-2 * 180;
  41100. let ly = mercator[1] / 2003750834e-2 * 180;
  41101. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  41102. return [x, y];
  41103. }
  41104. getCurvePoints(controlPoints) {
  41105. let leftControl = this.getLeftMostControlPoint(controlPoints, this.t);
  41106. let [pnt1, pnt2, pnt3, normals, points2] = [null, null, null, [leftControl], []];
  41107. for (let i2 = 0; i2 < controlPoints.length - 2; i2++) {
  41108. [pnt1, pnt2, pnt3] = [controlPoints[i2], controlPoints[i2 + 1], controlPoints[i2 + 2]];
  41109. let normalPoints = this.getBisectorNormals(this.t, pnt1, pnt2, pnt3);
  41110. normals = normals.concat(normalPoints);
  41111. }
  41112. let rightControl = this.getRightMostControlPoint(controlPoints, this.t);
  41113. if (rightControl) {
  41114. normals.push(rightControl);
  41115. }
  41116. for (let i2 = 0; i2 < controlPoints.length - 1; i2++) {
  41117. pnt1 = controlPoints[i2];
  41118. pnt2 = controlPoints[i2 + 1];
  41119. points2.push(pnt1);
  41120. for (let t2 = 0; t2 < this.FITTING_COUNT; t2++) {
  41121. let pnt = this.getCubicValue(t2 / this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  41122. points2.push(pnt);
  41123. }
  41124. points2.push(pnt2);
  41125. }
  41126. return points2;
  41127. }
  41128. getLeftMostControlPoint(controlPoints, t2) {
  41129. let [pnt1, pnt2, pnt3, controlX, controlY] = [controlPoints[0], controlPoints[1], controlPoints[2], null, null];
  41130. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41131. let normalRight = pnts[0];
  41132. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41133. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41134. if (dist > this.ZERO_TOLERANCE) {
  41135. let mid = this.Mid(pnt1, pnt2);
  41136. let pX = pnt1[0] - mid[0];
  41137. let pY = pnt1[1] - mid[1];
  41138. let d1 = this.MathDistance(pnt1, pnt2);
  41139. let n = 2 / d1;
  41140. let nX = -n * pY;
  41141. let nY = n * pX;
  41142. let a11 = nX * nX - nY * nY;
  41143. let a12 = 2 * nX * nY;
  41144. let a22 = nY * nY - nX * nX;
  41145. let dX = normalRight[0] - mid[0];
  41146. let dY = normalRight[1] - mid[1];
  41147. controlX = mid[0] + a11 * dX + a12 * dY;
  41148. controlY = mid[1] + a12 * dX + a22 * dY;
  41149. } else {
  41150. controlX = pnt1[0] + t2 * (pnt2[0] - pnt1[0]);
  41151. controlY = pnt1[1] + t2 * (pnt2[1] - pnt1[1]);
  41152. }
  41153. return [controlX, controlY];
  41154. }
  41155. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  41156. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41157. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  41158. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41159. let uX = normal[0] / dist;
  41160. let uY = normal[1] / dist;
  41161. let d1 = this.MathDistance(pnt1, pnt2);
  41162. let d2 = this.MathDistance(pnt2, pnt3);
  41163. if (dist > this.ZERO_TOLERANCE) {
  41164. if (this.isClockWise(pnt1, pnt2, pnt3)) {
  41165. dt2 = t2 * d1;
  41166. x = pnt2[0] - dt2 * uY;
  41167. y = pnt2[1] + dt2 * uX;
  41168. bisectorNormalRight = [x, y];
  41169. dt2 = t2 * d2;
  41170. x = pnt2[0] + dt2 * uY;
  41171. y = pnt2[1] - dt2 * uX;
  41172. bisectorNormalLeft = [x, y];
  41173. } else {
  41174. dt2 = t2 * d1;
  41175. x = pnt2[0] + dt2 * uY;
  41176. y = pnt2[1] - dt2 * uX;
  41177. bisectorNormalRight = [x, y];
  41178. dt2 = t2 * d2;
  41179. x = pnt2[0] - dt2 * uY;
  41180. y = pnt2[1] + dt2 * uX;
  41181. bisectorNormalLeft = [x, y];
  41182. }
  41183. } else {
  41184. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  41185. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  41186. bisectorNormalRight = [x, y];
  41187. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  41188. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  41189. bisectorNormalLeft = [x, y];
  41190. }
  41191. return [bisectorNormalRight, bisectorNormalLeft];
  41192. }
  41193. getNormal(pnt1, pnt2, pnt3) {
  41194. let dX1 = pnt1[0] - pnt2[0];
  41195. let dY1 = pnt1[1] - pnt2[1];
  41196. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  41197. dX1 /= d1;
  41198. dY1 /= d1;
  41199. let dX2 = pnt3[0] - pnt2[0];
  41200. let dY2 = pnt3[1] - pnt2[1];
  41201. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  41202. dX2 /= d2;
  41203. dY2 /= d2;
  41204. let uX = dX1 + dX2;
  41205. let uY = dY1 + dY2;
  41206. return [uX, uY];
  41207. }
  41208. isClockWise(pnt1, pnt2, pnt3) {
  41209. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  41210. }
  41211. Mid(point1, point2) {
  41212. return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  41213. }
  41214. MathDistance(pnt1, pnt2) {
  41215. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  41216. }
  41217. getRightMostControlPoint(controlPoints, t2) {
  41218. let count = controlPoints.length;
  41219. let pnt1 = controlPoints[count - 3];
  41220. let pnt2 = controlPoints[count - 2];
  41221. let pnt3 = controlPoints[count - 1];
  41222. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41223. let normalLeft = pnts[1];
  41224. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41225. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41226. let [controlX, controlY] = [null, null];
  41227. if (dist > this.ZERO_TOLERANCE) {
  41228. let mid = this.Mid(pnt2, pnt3);
  41229. let pX = pnt3[0] - mid[0];
  41230. let pY = pnt3[1] - mid[1];
  41231. let d1 = this.MathDistance(pnt2, pnt3);
  41232. let n = 2 / d1;
  41233. let nX = -n * pY;
  41234. let nY = n * pX;
  41235. let a11 = nX * nX - nY * nY;
  41236. let a12 = 2 * nX * nY;
  41237. let a22 = nY * nY - nX * nX;
  41238. let dX = normalLeft[0] - mid[0];
  41239. let dY = normalLeft[1] - mid[1];
  41240. controlX = mid[0] + a11 * dX + a12 * dY;
  41241. controlY = mid[1] + a12 * dX + a22 * dY;
  41242. } else {
  41243. controlX = pnt3[0] + t2 * (pnt2[0] - pnt3[0]);
  41244. controlY = pnt3[1] + t2 * (pnt2[1] - pnt3[1]);
  41245. }
  41246. return [controlX, controlY];
  41247. }
  41248. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  41249. t2 = Math.max(Math.min(t2, 1), 0);
  41250. let [tp, t22] = [1 - t2, t2 * t2];
  41251. let t3 = t22 * t2;
  41252. let tp2 = tp * tp;
  41253. let tp3 = tp2 * tp;
  41254. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  41255. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  41256. return [x, y];
  41257. }
  41258. }
  41259. class DrawCurveFlag {
  41260. constructor(arg) {
  41261. this.viewer = arg.viewer;
  41262. this.Cesium = arg.Cesium;
  41263. this.identificationPoint = null;
  41264. this.CurveFlag = null;
  41265. this.CurveFlagLast = null;
  41266. this.positions = [];
  41267. this.entitiesPoint = [];
  41268. this.entitiesCurveFlag = [];
  41269. this.CurveFlagData = null;
  41270. this.DrawStartEvent = new Cesium.Event();
  41271. this.DrawEndEvent = new Cesium.Event();
  41272. this._param = {
  41273. id: "DrawStraightArrow",
  41274. polygonColor: "rgba(0,255,0,0.5)",
  41275. outlineColor: "rgba(255, 255, 255, 1)",
  41276. outlineWidth: 1
  41277. };
  41278. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41279. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41280. }
  41281. getData() {
  41282. return this.CurveFlagData;
  41283. }
  41284. computePosition(data) {
  41285. let $this = this;
  41286. var lnglatArr = [];
  41287. for (var i2 = 0; i2 < data.length; i2++) {
  41288. var lnglat = $this.cartesianToLatlng(data[i2]);
  41289. lnglatArr.push(lnglat);
  41290. }
  41291. let startPoint = lnglatArr[0];
  41292. let endPoint = lnglatArr[lnglatArr.length - 1];
  41293. let point1 = startPoint;
  41294. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41295. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41296. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41297. let point5 = [endPoint[0], startPoint[1]];
  41298. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41299. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41300. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41301. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41302. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41303. let point11 = [startPoint[0], endPoint[1]];
  41304. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41305. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41306. let componentspolygon = [];
  41307. componentspolygon = curve1.concat(curve2);
  41308. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41309. let componentspolyline = [];
  41310. componentspolyline = curve1.concat(curve2);
  41311. componentspolyline.push($this.LatlngTocartesian(point1));
  41312. componentspolyline.push($this.LatlngTocartesian(point11));
  41313. $this.CurveFlagData = lnglatArr;
  41314. return [PolygonHierarchy, componentspolyline];
  41315. }
  41316. addload(data) {
  41317. var $this = this;
  41318. if (data.length < 2)
  41319. return;
  41320. let startPoint = data[0];
  41321. let endPoint = data[data.length - 1];
  41322. let point1 = startPoint;
  41323. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41324. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41325. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41326. let point5 = [endPoint[0], startPoint[1]];
  41327. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41328. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41329. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41330. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41331. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41332. let point11 = [startPoint[0], endPoint[1]];
  41333. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41334. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41335. let componentspolygon = [];
  41336. componentspolygon = curve1.concat(curve2);
  41337. let componentspolyline = [];
  41338. componentspolyline = curve1.concat(curve2);
  41339. componentspolyline.push($this.LatlngTocartesian(point1));
  41340. componentspolyline.push($this.LatlngTocartesian(point11));
  41341. var shape = this.viewer.entities.add({
  41342. Type: "DrawCurveFlag",
  41343. Position: data,
  41344. id: data.id || $this.objId,
  41345. polygon: {
  41346. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41347. extrudedHeight: 1,
  41348. material: $this.Cesium.Color.RED
  41349. },
  41350. polyline: {
  41351. positions: componentspolyline,
  41352. show: true,
  41353. material: $this.Cesium.Color.YELLOW,
  41354. width: 5,
  41355. clampToGround: true
  41356. }
  41357. });
  41358. $this.entitiesCurveFlag.push(shape);
  41359. return shape;
  41360. }
  41361. startCreate(drawType) {
  41362. this.drawType = drawType;
  41363. var $this = this;
  41364. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41365. this.handler.setInputAction(function(evt) {
  41366. var cartesian = $this.getCatesian3FromPX(evt.position);
  41367. if ($this.positions.length == 0) {
  41368. $this.positions.push(cartesian.clone());
  41369. $this.identificationPoint = $this.createPoint(cartesian);
  41370. $this.createPoint(cartesian);
  41371. $this.positions.push(cartesian);
  41372. }
  41373. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41374. this.handler.setInputAction(function(evt) {
  41375. if ($this.positions.length < 2)
  41376. return;
  41377. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41378. if (!$this.Cesium.defined($this.CurveFlag)) {
  41379. $this.CurveFlag = $this.createCurveFlag();
  41380. }
  41381. $this.identificationPoint.position.setValue(cartesian);
  41382. if ($this.CurveFlag) {
  41383. $this.positions.pop();
  41384. $this.positions.push(cartesian);
  41385. }
  41386. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41387. this.handler.setInputAction(function(evt) {
  41388. if (!$this.CurveFlag)
  41389. return;
  41390. var cartesian = $this.getCatesian3FromPX(evt.position);
  41391. $this.positions.pop();
  41392. $this.positions.push(cartesian);
  41393. $this.createPoint(cartesian);
  41394. $this.CurveFlagData = $this.positions.concat();
  41395. $this.viewer.entities.remove($this.CurveFlag);
  41396. $this.CurveFlag = null;
  41397. $this.positions = [];
  41398. $this.identificationPoint.position.setValue(cartesian);
  41399. var lnglatArr = [];
  41400. for (var i2 = 0; i2 < $this.CurveFlagData.length; i2++) {
  41401. var lnglat = $this.cartesianToLatlng($this.CurveFlagData[i2]);
  41402. lnglatArr.push(lnglat);
  41403. }
  41404. $this.CurveFlagData = lnglatArr;
  41405. var CurveFlag = $this.addload([$this.CurveFlagData[0], $this.CurveFlagData[$this.CurveFlagData.length - 1]]);
  41406. $this.entitiesCurveFlag.push(CurveFlag);
  41407. $this.CurveFlagLast = CurveFlag;
  41408. $this.clearPoint();
  41409. $this.destroy();
  41410. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41411. }
  41412. createPoint(cartesian) {
  41413. var $this = this;
  41414. var point2 = this.viewer.entities.add({
  41415. position: cartesian,
  41416. point: {
  41417. pixelSize: 10,
  41418. color: $this.Cesium.Color.RED,
  41419. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41420. }
  41421. });
  41422. $this.entitiesPoint.push(point2);
  41423. return point2;
  41424. }
  41425. createCurveFlag() {
  41426. var $this = this;
  41427. var polygon2 = this.viewer.entities.add({
  41428. polygon: {
  41429. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41430. if ($this.positions.length < 2)
  41431. return;
  41432. let lonlat = [];
  41433. let components = [];
  41434. let length = $this.positions.length;
  41435. for (let i2 = 0; i2 < length; i2++) {
  41436. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41437. }
  41438. let startPoint = lonlat[0];
  41439. let endPoint = lonlat[lonlat.length - 1];
  41440. let point1 = startPoint;
  41441. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41442. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41443. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41444. let point5 = [endPoint[0], startPoint[1]];
  41445. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41446. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41447. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41448. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41449. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41450. [startPoint[0], endPoint[1]];
  41451. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41452. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41453. components = curve1.concat(curve2);
  41454. return new $this.Cesium.PolygonHierarchy(components);
  41455. }, false),
  41456. extrudedHeight: 1,
  41457. material: $this.Cesium.Color.RED
  41458. },
  41459. polyline: {
  41460. positions: new $this.Cesium.CallbackProperty(function() {
  41461. if ($this.positions.length < 2)
  41462. return;
  41463. let lonlat = [];
  41464. let components = [];
  41465. let length = $this.positions.length;
  41466. for (let i2 = 0; i2 < length; i2++) {
  41467. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41468. }
  41469. let startPoint = lonlat[0];
  41470. let endPoint = lonlat[lonlat.length - 1];
  41471. let point1 = startPoint;
  41472. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41473. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41474. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41475. let point5 = [endPoint[0], startPoint[1]];
  41476. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41477. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41478. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41479. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41480. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41481. let point11 = [startPoint[0], endPoint[1]];
  41482. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41483. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41484. components = curve1.concat(curve2);
  41485. components.push($this.LatlngTocartesian(point1));
  41486. components.push($this.LatlngTocartesian(point11));
  41487. return components;
  41488. }, false),
  41489. show: true,
  41490. material: $this.Cesium.Color.YELLOW,
  41491. width: 5,
  41492. clampToGround: true
  41493. }
  41494. });
  41495. $this.entitiesCurveFlag.push(polygon2);
  41496. return polygon2;
  41497. }
  41498. cartesianToLatlng(cartesian) {
  41499. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41500. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41501. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41502. return [lng, lat];
  41503. }
  41504. LatlngTocartesian(latlng) {
  41505. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41506. return cartesian3;
  41507. }
  41508. clearPoint() {
  41509. this.DrawEndEvent.raiseEvent(this.CurveFlagLast, [this.CurveFlagData[0], this.CurveFlagData[this.CurveFlagData.length - 1]], this.drawType);
  41510. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41511. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41512. }
  41513. this.entitiesPoint = [];
  41514. }
  41515. destroy() {
  41516. if (this.handler) {
  41517. this.handler.destroy();
  41518. this.handler = null;
  41519. }
  41520. }
  41521. clear() {
  41522. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41523. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41524. }
  41525. for (var i2 = 0; i2 < this.entitiesCurveFlag.length; i2++) {
  41526. this.viewer.entities.remove(this.entitiesCurveFlag[i2]);
  41527. }
  41528. this.identificationPoint = null;
  41529. this.CurveFlag = null;
  41530. this.CurveFlagLast = null;
  41531. this.positions = [];
  41532. this.entitiesPoint = [];
  41533. this.entitiesCurveFlag = [];
  41534. this.CurveFlagData = null;
  41535. }
  41536. getCatesian3FromPX(px) {
  41537. var cartesian;
  41538. var ray = this.viewer.camera.getPickRay(px);
  41539. if (!ray)
  41540. return null;
  41541. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41542. return cartesian;
  41543. }
  41544. getBezierPoints(points2) {
  41545. let $this = this;
  41546. if (points2.length <= 2) {
  41547. return points2;
  41548. } else {
  41549. let bezierPoints = [];
  41550. let n = points2.length - 1;
  41551. for (let t2 = 0; t2 <= 1; t2 += 0.01) {
  41552. let [x, y] = [0, 0];
  41553. for (let index2 = 0; index2 <= n; index2++) {
  41554. let factor = $this.getBinomialFactor(n, index2);
  41555. let a = Math.pow(t2, index2);
  41556. let b = Math.pow(1 - t2, n - index2);
  41557. x += factor * a * b * points2[index2][0];
  41558. y += factor * a * b * points2[index2][1];
  41559. }
  41560. bezierPoints.push($this.LatlngTocartesian([x, y]));
  41561. }
  41562. bezierPoints.push($this.LatlngTocartesian(points2[n]));
  41563. return bezierPoints;
  41564. }
  41565. }
  41566. getBinomialFactor(n, index2) {
  41567. return this.getFactorial(n) / (this.getFactorial(index2) * this.getFactorial(n - index2));
  41568. }
  41569. getFactorial(n) {
  41570. let result = 1;
  41571. switch (n) {
  41572. case n <= 1:
  41573. result = 1;
  41574. break;
  41575. case n === 2:
  41576. result = 2;
  41577. break;
  41578. case n === 3:
  41579. result = 6;
  41580. break;
  41581. case n === 24:
  41582. result = 24;
  41583. break;
  41584. case n === 5:
  41585. result = 120;
  41586. break;
  41587. default:
  41588. for (let i2 = 1; i2 <= n; i2++) {
  41589. result *= i2;
  41590. }
  41591. break;
  41592. }
  41593. return result;
  41594. }
  41595. }
  41596. class DrawRectFlag {
  41597. constructor(arg) {
  41598. this.viewer = arg.viewer;
  41599. this.Cesium = arg.Cesium;
  41600. this.identificationPoint = null;
  41601. this.RectFlag = null;
  41602. this.RectFlagLast = null;
  41603. this.positions = [];
  41604. this.entitiesPoint = [];
  41605. this.entitiesRectFlag = [];
  41606. this.RectFlagData = null;
  41607. this.DrawStartEvent = new Cesium.Event();
  41608. this.DrawEndEvent = new Cesium.Event();
  41609. this._param = {
  41610. id: "DrawStraightArrow",
  41611. polygonColor: "rgba(0,255,0,0.5)",
  41612. outlineColor: "rgba(255, 255, 255, 1)",
  41613. outlineWidth: 1
  41614. };
  41615. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41616. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41617. }
  41618. getData() {
  41619. return this.RectFlagData;
  41620. }
  41621. computePosition(data) {
  41622. let $this = this;
  41623. var lnglatArr = [];
  41624. for (var i2 = 0; i2 < data.length; i2++) {
  41625. var lnglat = $this.cartesianToLatlng(data[i2]);
  41626. lnglatArr.push(lnglat);
  41627. }
  41628. let startPoint = lnglatArr[0];
  41629. let endPoint = lnglatArr[lnglatArr.length - 1];
  41630. let point0 = lnglatArr[0];
  41631. var point1 = [endPoint[0], startPoint[1]];
  41632. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41633. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41634. var point4 = [startPoint[0], endPoint[1]];
  41635. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41636. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41637. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41638. $this.RectFlagData = lnglatArr;
  41639. console.log([PolygonHierarchy, componentspolyline]);
  41640. return [PolygonHierarchy, componentspolyline];
  41641. }
  41642. addload(data) {
  41643. var $this = this;
  41644. if (data.length < 2)
  41645. return;
  41646. let startPoint = data[0];
  41647. let endPoint = data[data.length - 1];
  41648. let point0 = data[0];
  41649. var point1 = [endPoint[0], startPoint[1]];
  41650. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41651. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41652. var point4 = [startPoint[0], endPoint[1]];
  41653. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41654. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41655. var shape = this.viewer.entities.add({
  41656. Type: "DrawRectFlag",
  41657. Position: data,
  41658. id: data.id || $this.objId,
  41659. polygon: {
  41660. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41661. extrudedHeight: 1,
  41662. material: $this.Cesium.Color.RED
  41663. },
  41664. polyline: {
  41665. positions: componentspolyline,
  41666. show: true,
  41667. material: $this.Cesium.Color.YELLOW,
  41668. width: 5,
  41669. clampToGround: true
  41670. }
  41671. });
  41672. $this.entitiesRectFlag.push(shape);
  41673. return shape;
  41674. }
  41675. startCreate(drawType) {
  41676. this.drawType = drawType;
  41677. var $this = this;
  41678. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41679. this.handler.setInputAction(function(evt) {
  41680. var cartesian = $this.getCatesian3FromPX(evt.position);
  41681. if ($this.positions.length == 0) {
  41682. $this.positions.push(cartesian.clone());
  41683. $this.identificationPoint = $this.createPoint(cartesian);
  41684. $this.createPoint(cartesian);
  41685. $this.positions.push(cartesian);
  41686. }
  41687. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41688. this.handler.setInputAction(function(evt) {
  41689. if ($this.positions.length < 2)
  41690. return;
  41691. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41692. if (!$this.Cesium.defined($this.RectFlag)) {
  41693. $this.RectFlag = $this.createRectFlag();
  41694. }
  41695. $this.identificationPoint.position.setValue(cartesian);
  41696. if ($this.RectFlag) {
  41697. $this.positions.pop();
  41698. $this.positions.push(cartesian);
  41699. }
  41700. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41701. this.handler.setInputAction(function(evt) {
  41702. if (!$this.RectFlag)
  41703. return;
  41704. var cartesian = $this.getCatesian3FromPX(evt.position);
  41705. $this.positions.pop();
  41706. $this.positions.push(cartesian);
  41707. $this.createPoint(cartesian);
  41708. $this.RectFlagData = $this.positions.concat();
  41709. $this.viewer.entities.remove($this.RectFlag);
  41710. $this.RectFlag = null;
  41711. $this.positions = [];
  41712. $this.identificationPoint.position.setValue(cartesian);
  41713. var lnglatArr = [];
  41714. for (var i2 = 0; i2 < $this.RectFlagData.length; i2++) {
  41715. var lnglat = $this.cartesianToLatlng($this.RectFlagData[i2]);
  41716. lnglatArr.push(lnglat);
  41717. }
  41718. $this.RectFlagData = lnglatArr;
  41719. var RectFlag = $this.addload([$this.RectFlagData[0], $this.RectFlagData[$this.RectFlagData.length - 1]]);
  41720. $this.entitiesRectFlag.push(RectFlag);
  41721. $this.RectFlagLast = RectFlag;
  41722. $this.clearPoint();
  41723. $this.destroy();
  41724. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41725. }
  41726. createPoint(cartesian) {
  41727. var $this = this;
  41728. var point2 = this.viewer.entities.add({
  41729. position: cartesian,
  41730. point: {
  41731. pixelSize: 10,
  41732. color: $this.Cesium.Color.RED,
  41733. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41734. }
  41735. });
  41736. $this.entitiesPoint.push(point2);
  41737. return point2;
  41738. }
  41739. createRectFlag() {
  41740. console.log("232323");
  41741. var $this = this;
  41742. var polygon2 = this.viewer.entities.add({
  41743. polygon: {
  41744. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41745. if ($this.positions.length < 2)
  41746. return;
  41747. let lonlat = [];
  41748. let length = $this.positions.length;
  41749. for (let i2 = 0; i2 < length; i2++) {
  41750. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41751. }
  41752. let startPoint = lonlat[0];
  41753. let endPoint = lonlat[lonlat.length - 1];
  41754. let point0 = lonlat[0];
  41755. var point1 = [endPoint[0], startPoint[1]];
  41756. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41757. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41758. [startPoint[0], endPoint[1]];
  41759. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41760. return new $this.Cesium.PolygonHierarchy(components);
  41761. }, false),
  41762. extrudedHeight: 1,
  41763. material: $this.Cesium.Color.RED
  41764. },
  41765. polyline: {
  41766. positions: new $this.Cesium.CallbackProperty(function() {
  41767. if ($this.positions.length < 2)
  41768. return;
  41769. let lonlat = [];
  41770. let length = $this.positions.length;
  41771. for (let i2 = 0; i2 < length; i2++) {
  41772. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41773. }
  41774. let startPoint = lonlat[0];
  41775. let endPoint = lonlat[lonlat.length - 1];
  41776. let point0 = lonlat[0];
  41777. var point1 = [endPoint[0], startPoint[1]];
  41778. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41779. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41780. var point4 = [startPoint[0], endPoint[1]];
  41781. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41782. return components;
  41783. }, false),
  41784. show: true,
  41785. material: $this.Cesium.Color.YELLOW,
  41786. width: 5,
  41787. clampToGround: true
  41788. }
  41789. });
  41790. $this.entitiesRectFlag.push(polygon2);
  41791. return polygon2;
  41792. }
  41793. cartesianToLatlng(cartesian) {
  41794. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41795. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41796. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41797. return [lng, lat];
  41798. }
  41799. LatlngTocartesian(latlng) {
  41800. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41801. return cartesian3;
  41802. }
  41803. clearPoint() {
  41804. this.DrawEndEvent.raiseEvent(this.RectFlagLast, [this.RectFlagData[0], this.RectFlagData[this.RectFlagData.length - 1]], this.drawType);
  41805. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41806. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41807. }
  41808. this.entitiesPoint = [];
  41809. }
  41810. destroy() {
  41811. if (this.handler) {
  41812. this.handler.destroy();
  41813. this.handler = null;
  41814. }
  41815. }
  41816. clear() {
  41817. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41818. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41819. }
  41820. for (var i2 = 0; i2 < this.entitiesRectFlag.length; i2++) {
  41821. this.viewer.entities.remove(this.entitiesRectFlag[i2]);
  41822. }
  41823. this.identificationPoint = null;
  41824. this.RectFlag = null;
  41825. this.RectFlagLast = null;
  41826. this.positions = [];
  41827. this.entitiesPoint = [];
  41828. this.entitiesRectFlag = [];
  41829. this.RectFlagData = null;
  41830. }
  41831. getCatesian3FromPX(px) {
  41832. var cartesian;
  41833. var ray = this.viewer.camera.getPickRay(px);
  41834. if (!ray)
  41835. return null;
  41836. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41837. return cartesian;
  41838. }
  41839. }
  41840. class DrawTriangleFlag {
  41841. constructor(arg) {
  41842. this.viewer = arg.viewer;
  41843. this.Cesium = arg.Cesium;
  41844. this.identificationPoint = null;
  41845. this.TriangleFlag = null;
  41846. this.TriangleFlagLast = null;
  41847. this.positions = [];
  41848. this.entitiesPoint = [];
  41849. this.entitiesTriangleFlag = [];
  41850. this.TriangleFlagData = null;
  41851. this.DrawStartEvent = new Cesium.Event();
  41852. this.DrawEndEvent = new Cesium.Event();
  41853. this._param = {
  41854. id: "DrawStraightArrow",
  41855. polygonColor: "rgba(0,255,0,0.5)",
  41856. outlineColor: "rgba(255, 255, 255, 1)",
  41857. outlineWidth: 1
  41858. };
  41859. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41860. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41861. }
  41862. getData() {
  41863. return this.TriangleFlagData;
  41864. }
  41865. computePosition(data) {
  41866. let $this = this;
  41867. var lnglatArr = [];
  41868. for (var i2 = 0; i2 < data.length; i2++) {
  41869. var lnglat = $this.cartesianToLatlng(data[i2]);
  41870. lnglatArr.push(lnglat);
  41871. }
  41872. let startPoint = lnglatArr[0];
  41873. let endPoint = lnglatArr[lnglatArr.length - 1];
  41874. let point0 = lnglatArr[0];
  41875. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41876. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41877. var point3 = [startPoint[0], endPoint[1]];
  41878. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41879. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41880. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41881. $this.TriangleFlagData = lnglatArr;
  41882. console.log([PolygonHierarchy, componentspolyline]);
  41883. return [PolygonHierarchy, componentspolyline];
  41884. }
  41885. addload(data) {
  41886. var $this = this;
  41887. if (data.length < 2)
  41888. return;
  41889. let startPoint = data[0];
  41890. let endPoint = data[data.length - 1];
  41891. let point0 = data[0];
  41892. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41893. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41894. var point3 = [startPoint[0], endPoint[1]];
  41895. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41896. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41897. var shape = this.viewer.entities.add({
  41898. Type: "DrawTriangleFlag",
  41899. Position: data,
  41900. id: data.id || $this.objId,
  41901. polygon: {
  41902. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41903. extrudedHeight: 1,
  41904. material: $this.Cesium.Color.RED
  41905. },
  41906. polyline: {
  41907. positions: componentspolyline,
  41908. show: true,
  41909. material: $this.Cesium.Color.YELLOW,
  41910. width: 5,
  41911. clampToGround: true
  41912. }
  41913. });
  41914. $this.entitiesTriangleFlag.push(shape);
  41915. return shape;
  41916. }
  41917. startCreate(drawType) {
  41918. this.drawType = drawType;
  41919. var $this = this;
  41920. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41921. this.handler.setInputAction(function(evt) {
  41922. var cartesian = $this.getCatesian3FromPX(evt.position);
  41923. if ($this.positions.length == 0) {
  41924. $this.positions.push(cartesian.clone());
  41925. $this.identificationPoint = $this.createPoint(cartesian);
  41926. $this.createPoint(cartesian);
  41927. $this.positions.push(cartesian);
  41928. }
  41929. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41930. this.handler.setInputAction(function(evt) {
  41931. if ($this.positions.length < 2)
  41932. return;
  41933. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41934. if (!$this.Cesium.defined($this.TriangleFlag)) {
  41935. $this.TriangleFlag = $this.createTriangleFlag();
  41936. }
  41937. $this.identificationPoint.position.setValue(cartesian);
  41938. if ($this.TriangleFlag) {
  41939. $this.positions.pop();
  41940. $this.positions.push(cartesian);
  41941. }
  41942. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41943. this.handler.setInputAction(function(evt) {
  41944. if (!$this.TriangleFlag)
  41945. return;
  41946. var cartesian = $this.getCatesian3FromPX(evt.position);
  41947. $this.positions.pop();
  41948. $this.positions.push(cartesian);
  41949. $this.createPoint(cartesian);
  41950. $this.TriangleFlagData = $this.positions.concat();
  41951. $this.viewer.entities.remove($this.TriangleFlag);
  41952. $this.TriangleFlag = null;
  41953. $this.positions = [];
  41954. $this.identificationPoint.position.setValue(cartesian);
  41955. var lnglatArr = [];
  41956. for (var i2 = 0; i2 < $this.TriangleFlagData.length; i2++) {
  41957. var lnglat = $this.cartesianToLatlng($this.TriangleFlagData[i2]);
  41958. lnglatArr.push(lnglat);
  41959. }
  41960. $this.TriangleFlagData = lnglatArr;
  41961. var TriangleFlag = $this.addload([$this.TriangleFlagData[0], $this.TriangleFlagData[$this.TriangleFlagData.length - 1]]);
  41962. $this.entitiesTriangleFlag.push(TriangleFlag);
  41963. $this.TriangleFlagLast = TriangleFlag;
  41964. $this.clearPoint();
  41965. $this.destroy();
  41966. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41967. }
  41968. createPoint(cartesian) {
  41969. var $this = this;
  41970. var point2 = this.viewer.entities.add({
  41971. position: cartesian,
  41972. point: {
  41973. pixelSize: 10,
  41974. color: $this.Cesium.Color.RED,
  41975. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41976. }
  41977. });
  41978. $this.entitiesPoint.push(point2);
  41979. return point2;
  41980. }
  41981. createTriangleFlag() {
  41982. console.log("232323");
  41983. var $this = this;
  41984. var polygon2 = this.viewer.entities.add({
  41985. polygon: {
  41986. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41987. if ($this.positions.length < 2)
  41988. return;
  41989. let lonlat = [];
  41990. let length = $this.positions.length;
  41991. for (let i2 = 0; i2 < length; i2++) {
  41992. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41993. }
  41994. let startPoint = lonlat[0];
  41995. let endPoint = lonlat[lonlat.length - 1];
  41996. let point0 = lonlat[0];
  41997. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41998. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41999. [startPoint[0], endPoint[1]];
  42000. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  42001. return new $this.Cesium.PolygonHierarchy(components);
  42002. }, false),
  42003. extrudedHeight: 1,
  42004. material: $this.Cesium.Color.RED
  42005. },
  42006. polyline: {
  42007. positions: new $this.Cesium.CallbackProperty(function() {
  42008. if ($this.positions.length < 2)
  42009. return;
  42010. let lonlat = [];
  42011. let length = $this.positions.length;
  42012. for (let i2 = 0; i2 < length; i2++) {
  42013. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  42014. }
  42015. let startPoint = lonlat[0];
  42016. let endPoint = lonlat[lonlat.length - 1];
  42017. let point0 = lonlat[0];
  42018. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42019. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42020. var point3 = [startPoint[0], endPoint[1]];
  42021. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  42022. return components;
  42023. }, false),
  42024. show: true,
  42025. material: $this.Cesium.Color.YELLOW,
  42026. width: 5,
  42027. clampToGround: true
  42028. }
  42029. });
  42030. $this.entitiesTriangleFlag.push(polygon2);
  42031. return polygon2;
  42032. }
  42033. cartesianToLatlng(cartesian) {
  42034. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42035. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42036. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42037. return [lng, lat];
  42038. }
  42039. LatlngTocartesian(latlng) {
  42040. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42041. return cartesian3;
  42042. }
  42043. clearPoint() {
  42044. this.DrawEndEvent.raiseEvent(this.TriangleFlagLast, [this.TriangleFlagData[0], this.TriangleFlagData[this.TriangleFlagData.length - 1]], this.drawType);
  42045. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  42046. this.viewer.entities.remove(this.entitiesPoint[i2]);
  42047. }
  42048. this.entitiesPoint = [];
  42049. }
  42050. destroy() {
  42051. if (this.handler) {
  42052. this.handler.destroy();
  42053. this.handler = null;
  42054. }
  42055. }
  42056. clear() {
  42057. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  42058. this.viewer.entities.remove(this.entitiesPoint[i2]);
  42059. }
  42060. for (var i2 = 0; i2 < this.entitiesTriangleFlag.length; i2++) {
  42061. this.viewer.entities.remove(this.entitiesTriangleFlag[i2]);
  42062. }
  42063. this.identificationPoint = null;
  42064. this.TriangleFlag = null;
  42065. this.TriangleFlagLast = null;
  42066. this.positions = [];
  42067. this.entitiesPoint = [];
  42068. this.entitiesTriangleFlag = [];
  42069. this.TriangleFlagData = null;
  42070. }
  42071. getCatesian3FromPX(px) {
  42072. var cartesian;
  42073. var ray = this.viewer.camera.getPickRay(px);
  42074. if (!ray)
  42075. return null;
  42076. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42077. return cartesian;
  42078. }
  42079. }
  42080. class DrawPoint$1 {
  42081. constructor(arg) {
  42082. this.viewer = arg.viewer;
  42083. this.Cesium = arg.Cesium;
  42084. this._point = null;
  42085. this._pointData = null;
  42086. this._entities = [];
  42087. this.DrawStartEvent = new Cesium.Event();
  42088. this.DrawEndEvent = new Cesium.Event();
  42089. this._param = {
  42090. id: "DrawStraightArrow",
  42091. polygonColor: "rgba(0,255,0,0.5)",
  42092. outlineColor: "rgba(255, 255, 255, 1)",
  42093. outlineWidth: 1
  42094. };
  42095. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42096. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42097. }
  42098. get point() {
  42099. return this._point;
  42100. }
  42101. addload(data) {
  42102. return this.createPoint(data);
  42103. }
  42104. getData() {
  42105. return this._pointData;
  42106. }
  42107. computePosition(data) {
  42108. let $this = this;
  42109. var lnglatArr = [];
  42110. for (var i2 = 0; i2 < data.length; i2++) {
  42111. var lnglat = $this.cartesianToLatlng(data[i2]);
  42112. lnglatArr.push(lnglat);
  42113. }
  42114. $this._pointData = lnglatArr;
  42115. let point2 = lnglatArr[0];
  42116. return $this.Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  42117. }
  42118. startCreate(drawType) {
  42119. this.drawType = drawType;
  42120. var $this = this;
  42121. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42122. this.handler.setInputAction(function(evt) {
  42123. var cartesian = $this.getCatesian3FromPX(evt.position);
  42124. if (!cartesian)
  42125. return;
  42126. let latlon = $this.cartesianToLatlng(cartesian);
  42127. var point2 = $this.createPoint(latlon);
  42128. $this._pointData = cartesian;
  42129. $this._point = point2;
  42130. $this.DrawEndEvent.raiseEvent($this._point, latlon, $this.drawType);
  42131. $this.destroy();
  42132. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42133. }
  42134. createPoint(cartesian) {
  42135. var $this = this;
  42136. var point2 = this.viewer.entities.add({
  42137. Type: "DrawPoint",
  42138. Position: [cartesian],
  42139. position: $this.Cesium.Cartesian3.fromDegrees(cartesian[0], cartesian[1]),
  42140. id: cartesian.id || $this.objId,
  42141. billboard: {
  42142. image: "./static/poi2.png",
  42143. verticalOrigin: Cesium.VerticalOrigin.BOTTOM
  42144. }
  42145. });
  42146. $this._entities.push(point2);
  42147. return point2;
  42148. }
  42149. cartesianToLatlng(cartesian) {
  42150. let ellipsoid = this.viewer.scene.globe.ellipsoid;
  42151. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  42152. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  42153. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  42154. return [lng, lat];
  42155. }
  42156. destroy() {
  42157. if (this.handler) {
  42158. this.handler.destroy();
  42159. this.handler = null;
  42160. }
  42161. }
  42162. clear() {
  42163. for (var i2 = 0; i2 < this._entities.length; i2++) {
  42164. this.viewer.entities.remove(this._entities[i2]);
  42165. }
  42166. this._entities = [];
  42167. this._point = null;
  42168. }
  42169. getCatesian3FromPX(px) {
  42170. var cartesian;
  42171. var ray = this.viewer.camera.getPickRay(px);
  42172. if (!ray)
  42173. return null;
  42174. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42175. return cartesian;
  42176. }
  42177. }
  42178. class DrawPolyline {
  42179. constructor(arg) {
  42180. this.viewer = arg.viewer;
  42181. this.Cesium = arg.Cesium;
  42182. this._polyline = null;
  42183. this._polylineLast = null;
  42184. this._positions = [];
  42185. this._entities_point = [];
  42186. this._entities_line = [];
  42187. this._polylineData = null;
  42188. this.DrawStartEvent = new Cesium.Event();
  42189. this.DrawEndEvent = new Cesium.Event();
  42190. this._param = {
  42191. id: "DrawStraightArrow",
  42192. polygonColor: "rgba(0,255,0,0.5)",
  42193. outlineColor: "rgba(255, 255, 255, 1)",
  42194. outlineWidth: 1
  42195. };
  42196. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42197. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42198. }
  42199. get line() {
  42200. return this._polylineLast;
  42201. }
  42202. getData() {
  42203. return this._polylineData;
  42204. }
  42205. computePosition(data) {
  42206. let $this = this;
  42207. var lnglatArr = [];
  42208. for (var i2 = 0; i2 < data.length; i2++) {
  42209. var lnglat = $this.cartesianToLatlng(data[i2]);
  42210. lnglatArr.push(lnglat);
  42211. }
  42212. $this._polylineData = lnglatArr;
  42213. return data;
  42214. }
  42215. addload(data) {
  42216. var $this = this;
  42217. var lnglatArr = [];
  42218. for (var i2 = 0; i2 < data.length; i2++) {
  42219. var lnglat = $this.LatlngTocartesian(data[i2]);
  42220. lnglatArr.push(lnglat);
  42221. }
  42222. var polyline = this.viewer.entities.add({
  42223. Type: "DrawPolyline",
  42224. Position: data,
  42225. id: data.id || $this.objId,
  42226. polyline: {
  42227. positions: lnglatArr,
  42228. show: true,
  42229. material: $this.Cesium.Color.RED,
  42230. width: 3,
  42231. clampToGround: true
  42232. }
  42233. });
  42234. return polyline;
  42235. }
  42236. startCreate(drawType) {
  42237. this.drawType = drawType;
  42238. var $this = this;
  42239. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42240. this.handler.setInputAction(function(evt) {
  42241. var cartesian = $this.getCatesian3FromPX(evt.position);
  42242. if ($this._positions.length == 0) {
  42243. $this._positions.push(cartesian.clone());
  42244. }
  42245. $this._positions.push(cartesian);
  42246. $this.createPoint(cartesian);
  42247. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42248. this.handler.setInputAction(function(evt) {
  42249. if ($this._positions.length < 1)
  42250. return;
  42251. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42252. if (!$this.Cesium.defined($this._polyline)) {
  42253. $this._polyline = $this.createPolyline();
  42254. }
  42255. if ($this._polyline) {
  42256. $this._positions.pop();
  42257. $this._positions.push(cartesian);
  42258. }
  42259. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42260. this.handler.setInputAction(function(evt) {
  42261. if (!$this._polyline)
  42262. return;
  42263. var cartesian = $this.getCatesian3FromPX(evt.position);
  42264. $this._positions.pop();
  42265. $this.createPoint(cartesian);
  42266. $this._polylineData = $this._positions.concat();
  42267. $this.viewer.entities.remove($this._polyline);
  42268. $this._polyline = null;
  42269. $this._positions = [];
  42270. var lnglatArr = [];
  42271. for (var i2 = 0; i2 < $this._polylineData.length; i2++) {
  42272. var lnglat = $this.cartesianToLatlng($this._polylineData[i2]);
  42273. lnglatArr.push(lnglat);
  42274. }
  42275. $this._polylineData = lnglatArr;
  42276. var line = $this.addload($this._polylineData);
  42277. $this._entities_line.push(line);
  42278. $this._polylineLast = line;
  42279. $this.clearPoint();
  42280. $this.destroy();
  42281. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42282. }
  42283. createPoint(cartesian) {
  42284. var $this = this;
  42285. var point2 = this.viewer.entities.add({
  42286. position: cartesian,
  42287. point: {
  42288. pixelSize: 10,
  42289. color: $this.Cesium.Color.RED,
  42290. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42291. }
  42292. });
  42293. $this._entities_point.push(point2);
  42294. return point2;
  42295. }
  42296. createPolyline() {
  42297. var $this = this;
  42298. var polyline = this.viewer.entities.add({
  42299. polyline: {
  42300. positions: new $this.Cesium.CallbackProperty(function() {
  42301. return $this._positions;
  42302. }, false),
  42303. show: true,
  42304. material: $this.Cesium.Color.RED,
  42305. width: 3,
  42306. clampToGround: true
  42307. }
  42308. });
  42309. $this._entities_line.push(polyline);
  42310. return polyline;
  42311. }
  42312. cartesianToLatlng(cartesian) {
  42313. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42314. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42315. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42316. return [lng, lat];
  42317. }
  42318. LatlngTocartesian(latlng) {
  42319. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42320. return cartesian3;
  42321. }
  42322. clearPoint() {
  42323. this.DrawEndEvent.raiseEvent(this._polylineLast, this._polylineData, this.drawType);
  42324. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42325. this.viewer.entities.remove(this._entities_point[i2]);
  42326. }
  42327. this._entities_point = [];
  42328. }
  42329. destroy() {
  42330. if (this.handler) {
  42331. this.handler.destroy();
  42332. this.handler = null;
  42333. }
  42334. }
  42335. clear() {
  42336. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42337. this.viewer.entities.remove(this._entities_point[i2]);
  42338. }
  42339. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  42340. this.viewer.entities.remove(this._entities_line[i2]);
  42341. }
  42342. this._polyline = null;
  42343. this._positions = [];
  42344. this._entities_point = [];
  42345. this._entities_line = [];
  42346. this._polylineData = null;
  42347. this._polylineLast = null;
  42348. }
  42349. getCatesian3FromPX(px) {
  42350. var cartesian;
  42351. var ray = this.viewer.camera.getPickRay(px);
  42352. if (!ray)
  42353. return null;
  42354. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42355. return cartesian;
  42356. }
  42357. }
  42358. class DrawPolygon {
  42359. constructor(arg) {
  42360. this.viewer = arg.viewer;
  42361. this.Cesium = arg.Cesium;
  42362. this._polygon = null;
  42363. this._polygonLast = null;
  42364. this._positions = [];
  42365. this._entities_point = [];
  42366. this._entities_polygon = [];
  42367. this._polygonData = null;
  42368. this.DrawStartEvent = new Cesium.Event();
  42369. this.DrawEndEvent = new Cesium.Event();
  42370. this._param = {
  42371. id: "DrawStraightArrow",
  42372. polygonColor: "rgba(0,255,0,0.5)",
  42373. outlineColor: "rgba(255, 255, 255, 1)",
  42374. outlineWidth: 1
  42375. };
  42376. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42377. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42378. }
  42379. get polygon() {
  42380. return this._polygonLast;
  42381. }
  42382. getData() {
  42383. return this._polygonData;
  42384. }
  42385. computePosition(data) {
  42386. let $this = this;
  42387. var lnglatArr = [];
  42388. for (var i2 = 0; i2 < data.length; i2++) {
  42389. var lnglat = $this.cartesianToLatlng(data[i2]);
  42390. lnglatArr.push(lnglat);
  42391. }
  42392. $this._polygonData = lnglatArr;
  42393. return new $this.Cesium.PolygonHierarchy(data);
  42394. }
  42395. addload(data) {
  42396. var $this = this;
  42397. var lnglatArr = [];
  42398. for (var i2 = 0; i2 < data.length; i2++) {
  42399. var lnglat = $this.LatlngTocartesian(data[i2]);
  42400. lnglatArr.push(lnglat);
  42401. }
  42402. return this.viewer.entities.add({
  42403. Type: "DrawPolygon",
  42404. Position: data,
  42405. id: data.id || $this.objId,
  42406. polygon: {
  42407. hierarchy: new $this.Cesium.PolygonHierarchy(lnglatArr),
  42408. clampToGround: true,
  42409. show: true,
  42410. fill: true,
  42411. material: $this.Cesium.Color.RED.withAlpha(0.9),
  42412. width: 3,
  42413. outlineColor: $this.Cesium.Color.BLACK,
  42414. outlineWidth: 1,
  42415. outline: false
  42416. }
  42417. });
  42418. }
  42419. startCreate(drawType) {
  42420. this.drawType = drawType;
  42421. var $this = this;
  42422. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42423. this.handler.setInputAction(function(evt) {
  42424. var cartesian = $this.getCatesian3FromPX(evt.position);
  42425. if ($this._positions.length == 0) {
  42426. $this._positions.push(cartesian.clone());
  42427. }
  42428. $this.createPoint(cartesian);
  42429. $this._positions.push(cartesian);
  42430. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42431. this.handler.setInputAction(function(evt) {
  42432. if ($this._positions.length < 1)
  42433. return;
  42434. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42435. if ($this._positions.length == 3) {
  42436. if (!$this.Cesium.defined($this._polygon)) {
  42437. $this._polygon = $this.createPolygon();
  42438. }
  42439. }
  42440. $this._positions.pop();
  42441. $this._positions.push(cartesian);
  42442. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42443. this.handler.setInputAction(function(evt) {
  42444. if (!$this._polygon)
  42445. return;
  42446. var cartesian = $this.getCatesian3FromPX(evt.position);
  42447. $this._positions.pop();
  42448. $this.createPoint(cartesian);
  42449. $this._polygonData = $this._positions.concat();
  42450. $this.viewer.entities.remove($this._positions);
  42451. $this._positions = null;
  42452. $this._positions = [];
  42453. var lnglatArr = [];
  42454. for (var i2 = 0; i2 < $this._polygonData.length; i2++) {
  42455. var lnglat = $this.cartesianToLatlng($this._polygonData[i2]);
  42456. lnglatArr.push(lnglat);
  42457. }
  42458. $this._polygonData = lnglatArr;
  42459. var Polygon = $this.addload($this._polygonData);
  42460. $this._entities_polygon.push(Polygon);
  42461. $this._polygonLast = Polygon;
  42462. $this.clearPoint();
  42463. $this.destroy();
  42464. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42465. }
  42466. createPolygon() {
  42467. var $this = this;
  42468. var polygon2 = this.viewer.entities.add({
  42469. polygon: {
  42470. hierarchy: new $this.Cesium.CallbackProperty(function() {
  42471. return new $this.Cesium.PolygonHierarchy($this._positions);
  42472. }, false),
  42473. clampToGround: true,
  42474. show: true,
  42475. fill: true,
  42476. material: $this.Cesium.Color.RED.withAlpha(0.5),
  42477. width: 3,
  42478. outlineColor: $this.Cesium.Color.BLACK,
  42479. outlineWidth: 1,
  42480. outline: false
  42481. }
  42482. });
  42483. $this._entities_polygon.push(polygon2);
  42484. return polygon2;
  42485. }
  42486. cartesianToLatlng(cartesian) {
  42487. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42488. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42489. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42490. return [lng, lat];
  42491. }
  42492. LatlngTocartesian(latlng) {
  42493. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42494. return cartesian3;
  42495. }
  42496. clearPoint() {
  42497. this.DrawEndEvent.raiseEvent(this._polygonLast, this._polygonData, this.drawType);
  42498. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42499. this.viewer.entities.remove(this._entities_point[i2]);
  42500. }
  42501. this._entities_point = [];
  42502. }
  42503. createPoint(cartesian) {
  42504. var $this = this;
  42505. var point2 = this.viewer.entities.add({
  42506. position: cartesian,
  42507. point: {
  42508. pixelSize: 10,
  42509. color: $this.Cesium.Color.RED,
  42510. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42511. }
  42512. });
  42513. $this._entities_point.push(point2);
  42514. return point2;
  42515. }
  42516. destroy() {
  42517. if (this.handler) {
  42518. this.handler.destroy();
  42519. this.handler = null;
  42520. }
  42521. }
  42522. clear() {
  42523. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42524. this.viewer.entities.remove(this._entities_point[i2]);
  42525. }
  42526. for (var i2 = 0; i2 < this._entities_polygon.length; i2++) {
  42527. this.viewer.entities.remove(this._entities_polygon[i2]);
  42528. }
  42529. this._polygon = null;
  42530. this._polygonLast = null;
  42531. this._positions = [];
  42532. this._entities_point = [];
  42533. this._entities_polygon = [];
  42534. this._polygonData = null;
  42535. }
  42536. getCatesian3FromPX(px) {
  42537. var cartesian;
  42538. var ray = this.viewer.camera.getPickRay(px);
  42539. if (!ray)
  42540. return null;
  42541. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42542. return cartesian;
  42543. }
  42544. }
  42545. class DrawRectangle {
  42546. constructor(arg) {
  42547. this.viewer = arg.viewer;
  42548. this.Cesium = arg.Cesium;
  42549. this.floatingPoint = null;
  42550. this._rectangle = null;
  42551. this._rectangleLast = null;
  42552. this._positions = [];
  42553. this._entities_point = [];
  42554. this._entities_rectangle = [];
  42555. this._rectangleData = null;
  42556. this.DrawStartEvent = new Cesium.Event();
  42557. this.DrawEndEvent = new Cesium.Event();
  42558. this._param = {
  42559. id: "DrawStraightArrow",
  42560. polygonColor: "rgba(0,255,0,0.5)",
  42561. outlineColor: "rgba(255, 255, 255, 1)",
  42562. outlineWidth: 1
  42563. };
  42564. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42565. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42566. }
  42567. get line() {
  42568. return this._rectangleLast;
  42569. }
  42570. getData() {
  42571. return this._rectangleData;
  42572. }
  42573. computePosition(data) {
  42574. let $this = this;
  42575. var lnglatArr = [];
  42576. for (var i2 = 0; i2 < data.length; i2++) {
  42577. var lnglat = $this.cartesianToLatlng(data[i2]);
  42578. lnglatArr.push(lnglat);
  42579. }
  42580. $this._rectangleData = lnglatArr;
  42581. return new $this.Cesium.Rectangle.fromCartesianArray(data);
  42582. }
  42583. addload(data) {
  42584. var $this = this;
  42585. var lnglatArr = [];
  42586. for (var i2 = 0; i2 < data.length; i2++) {
  42587. var lnglat = $this.LatlngTocartesian(data[i2]);
  42588. lnglatArr.push(lnglat);
  42589. }
  42590. var shape = this.viewer.entities.add({
  42591. Type: "DrawRectangle",
  42592. Position: data,
  42593. id: data.id || $this.objId,
  42594. rectangle: {
  42595. coordinates: $this.Cesium.Rectangle.fromCartesianArray(lnglatArr),
  42596. material: $this.Cesium.Color.RED.withAlpha(0.9)
  42597. }
  42598. });
  42599. $this._entities_rectangle.push(shape);
  42600. return shape;
  42601. }
  42602. startCreate(drawType) {
  42603. this.drawType = drawType;
  42604. var $this = this;
  42605. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42606. this.handler.setInputAction(function(evt) {
  42607. var cartesian = $this.getCatesian3FromPX(evt.position);
  42608. if ($this._positions.length == 0) {
  42609. $this._positions.push(cartesian.clone());
  42610. $this.floatingPoint = $this.createPoint(cartesian);
  42611. $this.createPoint(cartesian);
  42612. $this._positions.push(cartesian);
  42613. }
  42614. if ($this._positions.length == 2) {
  42615. $this._positions.push(cartesian);
  42616. }
  42617. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42618. this.handler.setInputAction(function(evt) {
  42619. if ($this._positions.length < 3)
  42620. return;
  42621. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42622. if (!$this.Cesium.defined($this._rectangle)) {
  42623. $this._rectangle = $this.createRectangle();
  42624. }
  42625. $this.floatingPoint.position.setValue(cartesian);
  42626. if ($this._rectangle) {
  42627. $this._positions.pop();
  42628. $this._positions.push(cartesian);
  42629. }
  42630. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42631. this.handler.setInputAction(function(evt) {
  42632. if (!$this._rectangle)
  42633. return;
  42634. var cartesian = $this.getCatesian3FromPX(evt.position);
  42635. $this._positions.pop();
  42636. $this._positions.push(cartesian);
  42637. $this.createPoint(cartesian);
  42638. $this._rectangleData = $this._positions.concat();
  42639. $this.viewer.entities.remove($this._rectangle);
  42640. $this._rectangle = null;
  42641. $this._positions = [];
  42642. $this.floatingPoint.position.setValue(cartesian);
  42643. var lnglatArr = [];
  42644. for (var i2 = 0; i2 < $this._rectangleData.length; i2++) {
  42645. var lnglat = $this.cartesianToLatlng($this._rectangleData[i2]);
  42646. lnglatArr.push(lnglat);
  42647. }
  42648. $this._rectangleData = lnglatArr;
  42649. var rectangle = $this.addload([$this._rectangleData[0], $this._rectangleData[$this._rectangleData.length - 1]]);
  42650. $this._entities_rectangle.push(rectangle);
  42651. $this._rectangleLast = rectangle;
  42652. $this.clearPoint();
  42653. $this.destroy();
  42654. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42655. }
  42656. createPoint(cartesian) {
  42657. var $this = this;
  42658. var point2 = this.viewer.entities.add({
  42659. position: cartesian,
  42660. point: {
  42661. pixelSize: 10,
  42662. color: $this.Cesium.Color.RED,
  42663. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42664. }
  42665. });
  42666. $this._entities_point.push(point2);
  42667. return point2;
  42668. }
  42669. createRectangle() {
  42670. var $this = this;
  42671. var shape = this.viewer.entities.add({
  42672. name: "rectangle",
  42673. rectangle: {
  42674. coordinates: new $this.Cesium.CallbackProperty(function() {
  42675. var obj = $this.Cesium.Rectangle.fromCartesianArray($this._positions);
  42676. return obj;
  42677. }, false),
  42678. material: $this.Cesium.Color.RED.withAlpha(0.5)
  42679. }
  42680. });
  42681. $this._entities_rectangle.push(shape);
  42682. return shape;
  42683. }
  42684. cartesianToLatlng(cartesian) {
  42685. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42686. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42687. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42688. return [lng, lat];
  42689. }
  42690. LatlngTocartesian(latlng) {
  42691. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42692. return cartesian3;
  42693. }
  42694. clearPoint() {
  42695. this.DrawEndEvent.raiseEvent(this._rectangleLast, [this._rectangleData[0], this._rectangleData[this._rectangleData.length - 1]], this.drawType);
  42696. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42697. this.viewer.entities.remove(this._entities_point[i2]);
  42698. }
  42699. this._entities_point = [];
  42700. }
  42701. destroy() {
  42702. if (this.handler) {
  42703. this.handler.destroy();
  42704. this.handler = null;
  42705. }
  42706. }
  42707. clear() {
  42708. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42709. this.viewer.entities.remove(this._entities_point[i2]);
  42710. }
  42711. for (var i2 = 0; i2 < this._entities_rectangle.length; i2++) {
  42712. this.viewer.entities.remove(this._entities_rectangle[i2]);
  42713. }
  42714. this.floatingPoint = null;
  42715. this._rectangle = null;
  42716. this._rectangleLast = null;
  42717. this._positions = [];
  42718. this._entities_point = [];
  42719. this._entities_rectangle = [];
  42720. this._rectangleData = null;
  42721. }
  42722. getCatesian3FromPX(px) {
  42723. var cartesian;
  42724. var ray = this.viewer.camera.getPickRay(px);
  42725. if (!ray)
  42726. return null;
  42727. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42728. return cartesian;
  42729. }
  42730. }
  42731. class DrawCircle {
  42732. constructor(arg) {
  42733. this.viewer = arg.viewer;
  42734. this.Cesium = arg.Cesium;
  42735. this._cicle = null;
  42736. this.floatingPoint = null;
  42737. this._cicleLast = null;
  42738. this._positions = [];
  42739. this._entities_point = [];
  42740. this._entities_cicle = [];
  42741. this._cicleData = null;
  42742. this.DrawStartEvent = new Cesium.Event();
  42743. this.DrawEndEvent = new Cesium.Event();
  42744. this._param = {
  42745. id: "DrawStraightArrow",
  42746. polygonColor: "rgba(0,255,0,0.5)",
  42747. outlineColor: "rgba(255, 255, 255, 1)",
  42748. outlineWidth: 1
  42749. };
  42750. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42751. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42752. }
  42753. get cicle() {
  42754. return this._cicleLast;
  42755. }
  42756. addload(data) {
  42757. var that = this;
  42758. let lnglatArr = [];
  42759. for (var i2 = 0; i2 < data.length; i2++) {
  42760. var lnglat = that.LatlngTocartesian(data[i2]);
  42761. lnglatArr.push(lnglat);
  42762. }
  42763. var value = lnglatArr;
  42764. var r2 = Math.sqrt(
  42765. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42766. );
  42767. var position2 = value[0];
  42768. var shape = that.viewer.entities.add({
  42769. Type: "DrawCircle",
  42770. Position: [data[0], data[data.length - 1]],
  42771. position: position2,
  42772. id: data.id || that.objId,
  42773. ellipse: {
  42774. semiMinorAxis: r2,
  42775. semiMajorAxis: r2,
  42776. material: that.Cesium.Color.RED.withAlpha(0.9),
  42777. show: true,
  42778. clampToGround: true
  42779. }
  42780. });
  42781. return shape;
  42782. }
  42783. getData() {
  42784. return this._cicleData;
  42785. }
  42786. computePosition(data) {
  42787. var that = this;
  42788. let lnglatArr = [];
  42789. for (var i2 = 0; i2 < data.length; i2++) {
  42790. var lnglat = that.cartesianToLatlng(data[i2]);
  42791. lnglatArr.push(lnglat);
  42792. }
  42793. that._cicleData = lnglatArr;
  42794. var value = data;
  42795. var r2 = Math.sqrt(
  42796. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42797. );
  42798. var position2 = value[0];
  42799. return { position: position2, r: r2 };
  42800. }
  42801. startCreate(drawType) {
  42802. this.drawType = drawType;
  42803. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42804. this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42805. var $this = this;
  42806. this.handler.setInputAction(function(evt) {
  42807. $this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42808. var cartesian = $this.getCatesian3FromPX(evt.position);
  42809. if ($this._positions.length == 0) {
  42810. $this._positions.push(cartesian.clone());
  42811. $this.floatingPoint = $this.createPoint(cartesian);
  42812. $this._positions.push(cartesian);
  42813. }
  42814. if (!$this._cicle) {
  42815. $this.createPoint(cartesian);
  42816. }
  42817. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42818. this.handler.setInputAction(function(evt) {
  42819. if ($this._positions.length < 1)
  42820. return;
  42821. var cartesian = $this.viewer.scene.pickPosition(evt.endPosition);
  42822. if (!$this.Cesium.defined($this._cicle)) {
  42823. $this._cicle = $this.createCicle();
  42824. }
  42825. $this.floatingPoint.position.setValue(cartesian);
  42826. if ($this._cicle) {
  42827. $this._positions.pop();
  42828. $this._positions.push(cartesian);
  42829. }
  42830. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42831. this.handler.setInputAction(function(evt) {
  42832. if (!$this._cicle)
  42833. return;
  42834. $this.viewer.scene.globe.depthTestAgainstTerrain = false;
  42835. var cartesian = $this.viewer.scene.pickPosition(evt.position);
  42836. $this._positions.pop();
  42837. $this._positions.push(cartesian);
  42838. $this._cicleData = $this._positions.concat();
  42839. $this.viewer.entities.remove($this._cicle);
  42840. $this._cicle = null;
  42841. $this._positions = [];
  42842. $this.floatingPoint.position.setValue(cartesian);
  42843. let lnglatArr = [];
  42844. for (var i2 = 0; i2 < $this._cicleData.length; i2++) {
  42845. var lnglat = $this.cartesianToLatlng($this._cicleData[i2]);
  42846. lnglatArr.push(lnglat);
  42847. }
  42848. $this._cicleData = lnglatArr;
  42849. var cicle = $this.addload($this._cicleData);
  42850. $this._entities_cicle.push(cicle);
  42851. $this._cicleLast = cicle;
  42852. $this.clearPoint();
  42853. $this.destroy();
  42854. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42855. }
  42856. createCicle() {
  42857. var that = this;
  42858. var shape = this.viewer.entities.add({
  42859. position: that._positions[0],
  42860. ellipse: {
  42861. semiMinorAxis: new that.Cesium.CallbackProperty(function() {
  42862. var r2 = Math.sqrt(
  42863. 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)
  42864. );
  42865. return r2 ? r2 : r2 + 1;
  42866. }, false),
  42867. semiMajorAxis: new that.Cesium.CallbackProperty(function() {
  42868. var r2 = Math.sqrt(
  42869. 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)
  42870. );
  42871. return r2 ? r2 : r2 + 1;
  42872. }, false),
  42873. material: that.Cesium.Color.RED.withAlpha(0.5),
  42874. outline: true
  42875. }
  42876. });
  42877. that._entities_cicle.push(shape);
  42878. return shape;
  42879. }
  42880. createPoint(cartesian) {
  42881. var $this = this;
  42882. var point2 = this.viewer.entities.add({
  42883. position: cartesian,
  42884. point: {
  42885. pixelSize: 10,
  42886. color: $this.Cesium.Color.RED,
  42887. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42888. }
  42889. });
  42890. $this._entities_point.push(point2);
  42891. return point2;
  42892. }
  42893. getCatesian3FromPX(px) {
  42894. var cartesian;
  42895. var ray = this.viewer.camera.getPickRay(px);
  42896. if (!ray)
  42897. return null;
  42898. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42899. return cartesian;
  42900. }
  42901. cartesianToLatlng(cartesian) {
  42902. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42903. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  42904. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  42905. cartographic.height;
  42906. return [lng, lat];
  42907. }
  42908. LatlngTocartesian(latlng) {
  42909. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1], 0);
  42910. return cartesian3;
  42911. }
  42912. destroy() {
  42913. if (this.handler) {
  42914. this.handler.destroy();
  42915. this.handler = null;
  42916. }
  42917. }
  42918. clearPoint() {
  42919. this.DrawEndEvent.raiseEvent(this._cicleLast, this._cicleData, this.drawType);
  42920. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42921. this.viewer.entities.remove(this._entities_point[i2]);
  42922. }
  42923. this._entities_point = [];
  42924. }
  42925. clear() {
  42926. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42927. this.viewer.entities.remove(this._entities_point[i2]);
  42928. }
  42929. for (var i2 = 0; i2 < this._entities_cicle.length; i2++) {
  42930. this.viewer.entities.remove(this._entities_cicle[i2]);
  42931. }
  42932. this._cicle = null;
  42933. this.floatingPoint = null;
  42934. this._cicleLast = null;
  42935. this._positions = [];
  42936. this._entities_point = [];
  42937. this._entities_cicle = [];
  42938. this._cicleData = null;
  42939. }
  42940. }
  42941. let MilitaryPlot = {
  42942. DrawStraightArrow,
  42943. DrawAttackArrow,
  42944. DrawPincerArrow,
  42945. DrawGatheringPlace,
  42946. DrawClosedCurve,
  42947. DrawSector,
  42948. DrawBowLine,
  42949. DrawBowPlane,
  42950. DrawCurve,
  42951. DrawCurveFlag,
  42952. DrawRectFlag,
  42953. DrawTriangleFlag,
  42954. DrawPoint: DrawPoint$1,
  42955. DrawPolyline,
  42956. DrawPolygon,
  42957. DrawRectangle,
  42958. DrawCircle
  42959. };
  42960. class EntityEdit {
  42961. constructor(viewer2) {
  42962. this.viewer = viewer2;
  42963. this.DrawExample = "";
  42964. this.midVertexEntities = [];
  42965. this.initEventHandler();
  42966. }
  42967. initEventHandler() {
  42968. this.eventHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42969. this.EditEndEvent = new Cesium.Event();
  42970. this.EditEndEntity = new Cesium.Event();
  42971. }
  42972. activate() {
  42973. this.deactivate();
  42974. this.initLeftClickEventHandler();
  42975. }
  42976. deactivate() {
  42977. this.DrawExample = "";
  42978. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42979. this.unRegisterEvents();
  42980. this.clearAllEditVertex();
  42981. }
  42982. clearAllEditVertex() {
  42983. this.clearEditVertex();
  42984. this.clearMidVertex();
  42985. }
  42986. initLeftClickEventHandler() {
  42987. this.eventHandler.setInputAction((e) => {
  42988. let id = this.viewer.scene.pick(e.position);
  42989. if (!id || !id.id) {
  42990. this.handleEditEntity();
  42991. return;
  42992. }
  42993. if (!id.id || !id.id.Type)
  42994. return;
  42995. if (this.editEntity && this.editEntity.id == id.id.id)
  42996. return;
  42997. this.handleEditEntity();
  42998. this.handlePickEditEntity(id.id);
  42999. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43000. }
  43001. handleEditEntity() {
  43002. this.unRegisterEvents();
  43003. this.clearAllEditVertex();
  43004. let editEntity = this.editEntity;
  43005. if (!editEntity)
  43006. return;
  43007. this.closeEntityEditMode();
  43008. this.editEntity = void 0;
  43009. if (!this.isEdited)
  43010. return;
  43011. this.EditEndEvent.raiseEvent(editEntity);
  43012. this.isEdited = false;
  43013. this.isEditing = false;
  43014. }
  43015. handlePickEditEntity(pickId) {
  43016. const EditableTypes = ["DrawAttackArrow", "DrawCircle", "DrawCurve", "DrawPincerArrow", "DrawPoint", "DrawPolygon", "DrawPolyline", "DrawRectangle", "DrawStraightArrow", "DrawGatheringPlace", "DrawSector", "DrawClosedCurve", "DrawBowLine", "DrawBowPlane", "DrawRectFlag", "DrawTriangleFlag", "DrawCurveFlag"];
  43017. if (EditableTypes.indexOf(pickId.Type) == -1)
  43018. return;
  43019. this.editEntity = pickId;
  43020. this.EditEndEntity.raiseEvent(this.editEntity);
  43021. this.isEditing = false;
  43022. this.isEdited = false;
  43023. this.editPositions = this.getEditEntityPositions();
  43024. this.EditMoveCenterPositoin = this.getCenterPosition();
  43025. this.openEntityEditModel();
  43026. this.clearAllEditVertex();
  43027. this.unRegisterEvents();
  43028. this.createEditVertex();
  43029. this.createMidVertex();
  43030. this.registerEvents();
  43031. }
  43032. openEntityEditModel() {
  43033. if (this.DrawExample == "")
  43034. return;
  43035. switch (this.editEntity.Type) {
  43036. case "DrawStraightArrow":
  43037. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43038. return this.DrawExample.computePosition(this.editPositions);
  43039. }, false);
  43040. break;
  43041. case "DrawAttackArrow":
  43042. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43043. return this.DrawExample.computePosition(this.editPositions);
  43044. }, false);
  43045. break;
  43046. case "DrawPincerArrow":
  43047. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43048. return this.DrawExample.computePosition(this.editPositions);
  43049. }, false);
  43050. break;
  43051. case "DrawGatheringPlace":
  43052. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43053. return this.DrawExample.computePosition(this.editPositions);
  43054. }, false);
  43055. break;
  43056. case "DrawClosedCurve":
  43057. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43058. return this.DrawExample.computePosition(this.editPositions).PolygonHierarchy;
  43059. }, false);
  43060. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43061. return this.DrawExample.computePosition(this.editPositions).pList;
  43062. }, false);
  43063. break;
  43064. case "DrawCircle":
  43065. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  43066. return this.DrawExample.computePosition(this.editPositions).position;
  43067. }, false);
  43068. this.editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty((e) => {
  43069. return this.DrawExample.computePosition(this.editPositions).r;
  43070. }, false);
  43071. this.editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty((e) => {
  43072. return this.DrawExample.computePosition(this.editPositions).r;
  43073. }, false);
  43074. break;
  43075. case "DrawCurve":
  43076. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43077. return this.DrawExample.computePosition(this.editPositions);
  43078. }, false);
  43079. break;
  43080. case "DrawPoint":
  43081. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  43082. return this.editPositions[0];
  43083. }, false);
  43084. break;
  43085. case "DrawPolygon":
  43086. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43087. return this.DrawExample.computePosition(this.editPositions);
  43088. }, false);
  43089. break;
  43090. case "DrawPolyline":
  43091. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43092. return this.DrawExample.computePosition(this.editPositions);
  43093. }, false);
  43094. break;
  43095. case "DrawRectangle":
  43096. this.editEntity.rectangle.coordinates = new Cesium.CallbackProperty((e) => {
  43097. return this.DrawExample.computePosition(this.editPositions);
  43098. }, false);
  43099. break;
  43100. case "DrawSector":
  43101. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43102. return this.DrawExample.computePosition(this.editPositions);
  43103. }, false);
  43104. break;
  43105. case "DrawBowLine":
  43106. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43107. return this.DrawExample.computePosition(this.editPositions);
  43108. }, false);
  43109. break;
  43110. case "DrawBowPlane":
  43111. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43112. return this.DrawExample.computePosition(this.editPositions);
  43113. }, false);
  43114. break;
  43115. case "DrawRectFlag":
  43116. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43117. return this.DrawExample.computePosition(this.editPositions)[0];
  43118. }, false);
  43119. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43120. return this.DrawExample.computePosition(this.editPositions)[1];
  43121. }, false);
  43122. break;
  43123. case "DrawTriangleFlag":
  43124. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43125. return this.DrawExample.computePosition(this.editPositions)[0];
  43126. }, false);
  43127. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43128. return this.DrawExample.computePosition(this.editPositions)[1];
  43129. }, false);
  43130. break;
  43131. case "DrawCurveFlag":
  43132. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43133. return this.DrawExample.computePosition(this.editPositions)[0];
  43134. }, false);
  43135. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43136. return this.DrawExample.computePosition(this.editPositions)[1];
  43137. }, false);
  43138. break;
  43139. }
  43140. }
  43141. closeEntityEditMode() {
  43142. if (this.DrawExample == "")
  43143. return;
  43144. let position2 = "";
  43145. switch (this.editEntity.Type) {
  43146. case "DrawStraightArrow":
  43147. position2 = this.DrawExample.computePosition(this.editPositions);
  43148. this.editEntity.polygon.hierarchy = position2;
  43149. this.editEntity.Position = this.DrawExample.getData();
  43150. break;
  43151. case "DrawAttackArrow":
  43152. position2 = this.DrawExample.computePosition(this.editPositions);
  43153. this.editEntity.polygon.hierarchy = position2;
  43154. this.editEntity.Position = this.DrawExample.getData();
  43155. break;
  43156. case "DrawPincerArrow":
  43157. position2 = this.DrawExample.computePosition(this.editPositions);
  43158. this.editEntity.polygon.hierarchy = position2;
  43159. this.editEntity.Position = this.DrawExample.getData();
  43160. break;
  43161. case "DrawGatheringPlace":
  43162. position2 = this.DrawExample.computePosition(this.editPositions);
  43163. this.editEntity.polygon.hierarchy = position2;
  43164. this.editEntity.Position = this.DrawExample.getData();
  43165. break;
  43166. case "DrawClosedCurve":
  43167. position2 = this.DrawExample.computePosition(this.editPositions);
  43168. this.editEntity.polygon.hierarchy = position2.PolygonHierarchy;
  43169. this.editEntity.polyline.positions = position2.pList;
  43170. this.editEntity.Position = this.DrawExample.getData();
  43171. break;
  43172. case "DrawCircle":
  43173. position2 = this.DrawExample.computePosition(this.editPositions);
  43174. this.editEntity.position = position2.position;
  43175. this.editEntity.ellipse.semiMinorAxis = position2.r;
  43176. this.editEntity.ellipse.semiMajorAxis = position2.r;
  43177. this.editEntity.Position = this.DrawExample.getData();
  43178. break;
  43179. case "DrawCurve":
  43180. position2 = this.DrawExample.computePosition(this.editPositions);
  43181. this.editEntity.polyline.positions = position2;
  43182. this.editEntity.Position = this.DrawExample.getData();
  43183. break;
  43184. case "DrawPoint":
  43185. position2 = this.DrawExample.computePosition(this.editPositions);
  43186. this.editEntity.position = position2;
  43187. this.editEntity.Position = this.DrawExample.getData();
  43188. break;
  43189. case "DrawPolygon":
  43190. position2 = this.DrawExample.computePosition(this.editPositions);
  43191. this.editEntity.polygon.hierarchy = position2;
  43192. this.editEntity.Position = this.DrawExample.getData();
  43193. break;
  43194. case "DrawPolyline":
  43195. position2 = this.DrawExample.computePosition(this.editPositions);
  43196. this.editEntity.polyline.positions = position2;
  43197. this.editEntity.Position = this.DrawExample.getData();
  43198. break;
  43199. case "DrawRectangle":
  43200. position2 = this.DrawExample.computePosition(this.editPositions);
  43201. this.editEntity.rectangle.coordinates = position2;
  43202. this.editEntity.Position = this.DrawExample.getData();
  43203. break;
  43204. case "DrawSector":
  43205. position2 = this.DrawExample.computePosition(this.editPositions);
  43206. this.editEntity.polygon.hierarchy = position2;
  43207. this.editEntity.Position = this.DrawExample.getData();
  43208. break;
  43209. case "DrawBowLine":
  43210. position2 = this.DrawExample.computePosition(this.editPositions);
  43211. this.editEntity.polyline.positions = position2;
  43212. this.editEntity.Position = this.DrawExample.getData();
  43213. break;
  43214. case "DrawBowPlane":
  43215. position2 = this.DrawExample.computePosition(this.editPositions);
  43216. this.editEntity.polygon.hierarchy = position2;
  43217. this.editEntity.Position = this.DrawExample.getData();
  43218. break;
  43219. case "DrawRectFlag":
  43220. position2 = this.DrawExample.computePosition(this.editPositions);
  43221. this.editEntity.polygon.hierarchy = position2[0];
  43222. this.editEntity.polyline.positions = position2[1];
  43223. this.editEntity.Position = this.DrawExample.getData();
  43224. break;
  43225. case "DrawTriangleFlag":
  43226. position2 = this.DrawExample.computePosition(this.editPositions);
  43227. this.editEntity.polygon.hierarchy = position2[0];
  43228. this.editEntity.polyline.positions = position2[1];
  43229. this.editEntity.Position = this.DrawExample.getData();
  43230. break;
  43231. case "DrawCurveFlag":
  43232. position2 = this.DrawExample.computePosition(this.editPositions);
  43233. this.editEntity.polygon.hierarchy = position2[0];
  43234. this.editEntity.polyline.positions = position2[1];
  43235. this.editEntity.Position = this.DrawExample.getData();
  43236. break;
  43237. }
  43238. }
  43239. getEditEntityPositions() {
  43240. let position2 = this.editEntity.Position;
  43241. let positionArr = [];
  43242. switch (this.editEntity.Type) {
  43243. case "DrawAttackArrow":
  43244. for (let i2 = 0; i2 < position2.length; i2++) {
  43245. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43246. }
  43247. return positionArr;
  43248. case "DrawCircle":
  43249. for (let i2 = 0; i2 < position2.length; i2++) {
  43250. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43251. }
  43252. return positionArr;
  43253. case "DrawCurve":
  43254. for (let i2 = 0; i2 < position2.length; i2++) {
  43255. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43256. }
  43257. return positionArr;
  43258. case "DrawPincerArrow":
  43259. for (let i2 = 0; i2 < position2.length; i2++) {
  43260. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43261. }
  43262. return positionArr;
  43263. case "DrawPoint":
  43264. for (let i2 = 0; i2 < position2.length; i2++) {
  43265. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43266. }
  43267. return positionArr;
  43268. case "DrawPolygon":
  43269. for (let i2 = 0; i2 < position2.length; i2++) {
  43270. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43271. }
  43272. return positionArr;
  43273. case "DrawPolyline":
  43274. for (let i2 = 0; i2 < position2.length; i2++) {
  43275. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43276. }
  43277. return positionArr;
  43278. case "DrawRectangle":
  43279. for (let i2 = 0; i2 < position2.length; i2++) {
  43280. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43281. }
  43282. return positionArr;
  43283. case "DrawStraightArrow":
  43284. for (let i2 = 0; i2 < position2.length; i2++) {
  43285. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43286. }
  43287. return positionArr;
  43288. case "DrawGatheringPlace":
  43289. for (let i2 = 0; i2 < position2.length; i2++) {
  43290. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43291. }
  43292. return positionArr;
  43293. case "DrawSector":
  43294. for (let i2 = 0; i2 < position2.length; i2++) {
  43295. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43296. }
  43297. return positionArr;
  43298. case "DrawClosedCurve":
  43299. for (let i2 = 0; i2 < position2.length; i2++) {
  43300. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43301. }
  43302. return positionArr;
  43303. case "DrawBowLine":
  43304. for (let i2 = 0; i2 < position2.length; i2++) {
  43305. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43306. }
  43307. return positionArr;
  43308. case "DrawBowPlane":
  43309. for (let i2 = 0; i2 < position2.length; i2++) {
  43310. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43311. }
  43312. return positionArr;
  43313. case "DrawRectFlag":
  43314. for (let i2 = 0; i2 < position2.length; i2++) {
  43315. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43316. }
  43317. return positionArr;
  43318. case "DrawTriangleFlag":
  43319. for (let i2 = 0; i2 < position2.length; i2++) {
  43320. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43321. }
  43322. return positionArr;
  43323. case "DrawCurveFlag":
  43324. for (let i2 = 0; i2 < position2.length; i2++) {
  43325. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43326. }
  43327. return positionArr;
  43328. }
  43329. }
  43330. registerEvents() {
  43331. this.initLeftDownEventHandler();
  43332. this.initMouseMoveEventHandler();
  43333. this.initLeftUpEventHandler();
  43334. }
  43335. unRegisterEvents() {
  43336. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43337. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  43338. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43339. }
  43340. initLeftDownEventHandler() {
  43341. this.eventHandler.setInputAction((e) => {
  43342. let id = this.viewer.scene.pick(e.position);
  43343. if (!id || !id.id || !id.id.type)
  43344. return;
  43345. if (id.id.type == "EditVertex" || id.id.type == "EditMove") {
  43346. this.isEditing = true;
  43347. this.viewer.scene.screenSpaceCameraController.enableRotate = false;
  43348. this.viewer.enableCursorStyle = false;
  43349. this.viewer._element.style.cursor = "";
  43350. document.body.style.cursor = "move";
  43351. this.editVertext = id.id;
  43352. this.editVertext.show = false;
  43353. this.clearMidVertex();
  43354. } else if (id.id.type == "EditMidVertex") {
  43355. this.editPositions.splice(id.id.vertexIndex, 0, id.id.position._value);
  43356. this.clearAllEditVertex();
  43357. this.createEditVertex();
  43358. this.createMidVertex();
  43359. this.isEdited = true;
  43360. } else {
  43361. return;
  43362. }
  43363. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43364. }
  43365. initLeftUpEventHandler() {
  43366. this.eventHandler.setInputAction((e) => {
  43367. if (!this.isEditing)
  43368. return;
  43369. this.viewer.enableCursorStyle = true;
  43370. document.body.style.cursor = "default";
  43371. this.viewer.scene.screenSpaceCameraController.enableRotate = true;
  43372. this.editVertext.show = true;
  43373. this.isEditing = false;
  43374. this.clearMidVertex();
  43375. this.createMidVertex();
  43376. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  43377. }
  43378. initMouseMoveEventHandler() {
  43379. this.eventHandler.setInputAction((e) => {
  43380. var position2 = e.endPosition;
  43381. var ray = this.viewer.scene.camera.getPickRay(position2);
  43382. var cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  43383. if (!cartesian)
  43384. return;
  43385. if (!this.isEditing)
  43386. return;
  43387. if (this.editVertext.type == "EditMove") {
  43388. let startPosition = this.EditMoveCenterPositoin;
  43389. if (!startPosition)
  43390. return;
  43391. this.moveEntityByOffset(startPosition, cartesian);
  43392. } else if (this.editVertext.type == "EditVertex" || this.editVertext.type == "EditMidVertex") {
  43393. this.editPositions[this.editVertext.vertexIndex] = cartesian;
  43394. }
  43395. this.isEdited = true;
  43396. this.EditMoveCenterPositoin = this.getCenterPosition();
  43397. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43398. }
  43399. getCenterPosition() {
  43400. let points2 = [];
  43401. let maxHeight = 0;
  43402. if (this.editEntity.Type == "DrawCircle" || this.editEntity.Type == "DrawPoint" || this.editEntity.Type == "DrawSector") {
  43403. return this.editPositions[0];
  43404. }
  43405. this.editPositions.forEach((position2) => {
  43406. const point3d = this.cartesian3ToPoint3D(position2);
  43407. points2.push([point3d.x, point3d.y]);
  43408. if (maxHeight < point3d.z)
  43409. maxHeight = point3d.z;
  43410. });
  43411. let geo = lineString(points2);
  43412. let bbox2 = bbox$1(geo);
  43413. let bboxPolygon$1 = bboxPolygon(bbox2);
  43414. let pointOnFeature = center(bboxPolygon$1);
  43415. let lonLat = pointOnFeature.geometry.coordinates;
  43416. return Cesium.Cartesian3.fromDegrees(lonLat[0], lonLat[1], maxHeight);
  43417. }
  43418. moveEntityByOffset(startPosition, endPosition) {
  43419. let startPoint3d = this.cartesian3ToPoint3D(startPosition);
  43420. let endPoint3d = this.cartesian3ToPoint3D(endPosition);
  43421. let offsetX = endPoint3d.x - startPoint3d.x;
  43422. let offsetY = endPoint3d.y - startPoint3d.y;
  43423. let element;
  43424. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43425. element = this.cartesian3ToPoint3D(this.editPositions[i2]);
  43426. element.x += offsetX;
  43427. element.y += offsetY;
  43428. this.editPositions[i2] = Cesium.Cartesian3.fromDegrees(element.x, element.y, element.z);
  43429. }
  43430. }
  43431. createEditVertex() {
  43432. this.vertexEntities = [];
  43433. this.editPositions.forEach((p, index2) => {
  43434. const entity = this.viewer.entities.add({
  43435. position: new Cesium.CallbackProperty((e) => {
  43436. return this.editPositions[index2];
  43437. }, false),
  43438. type: "EditVertex",
  43439. vertexIndex: index2,
  43440. point: {
  43441. show: true,
  43442. pixelSize: 10,
  43443. color: new Cesium.Color(0, 0, 1, 1),
  43444. outlineWidth: 1,
  43445. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43446. disableDepthTestDistance: 15e11,
  43447. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43448. }
  43449. });
  43450. this.vertexEntities.push(entity);
  43451. });
  43452. if (this.editEntity.Type == "DrawCircle") {
  43453. this.vertexEntities[0].show = false;
  43454. }
  43455. if (this.editPositions.length == 1) {
  43456. return;
  43457. }
  43458. this.createEditMoveCenterEntity();
  43459. }
  43460. createEditMoveCenterEntity() {
  43461. this.EditMoveCenterEntity = this.viewer.entities.add({
  43462. position: new Cesium.CallbackProperty((e) => {
  43463. return this.EditMoveCenterPositoin;
  43464. }, false),
  43465. type: "EditMove",
  43466. point: {
  43467. show: true,
  43468. pixelSize: 12,
  43469. color: new Cesium.Color(0, 1, 0, 0.1),
  43470. outlineWidth: 2,
  43471. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43472. disableDepthTestDistance: 15e11,
  43473. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43474. }
  43475. });
  43476. }
  43477. clearEditVertex() {
  43478. if (this.vertexEntities) {
  43479. this.vertexEntities.forEach((item) => {
  43480. this.viewer.entities.remove(item);
  43481. });
  43482. }
  43483. this.vertexEntities = [];
  43484. this.viewer.entities.remove(this.EditMoveCenterEntity);
  43485. }
  43486. createMidVertex() {
  43487. 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") {
  43488. return;
  43489. }
  43490. this.midVertexEntities = [];
  43491. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43492. const p1 = this.editPositions[i2];
  43493. const p2 = this.editPositions[i2 + 1];
  43494. let mideP = this.midPosition(p1, p2);
  43495. const entity = this.viewer.entities.add({
  43496. position: mideP,
  43497. type: "EditMidVertex",
  43498. vertexIndex: i2 + 1,
  43499. point: {
  43500. show: true,
  43501. pixelSize: 10,
  43502. color: new Cesium.Color(0, 1, 0, 1),
  43503. outlineWidth: 1,
  43504. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43505. disableDepthTestDistance: 15e11,
  43506. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43507. }
  43508. });
  43509. this.midVertexEntities.push(entity);
  43510. }
  43511. }
  43512. clearMidVertex() {
  43513. if (this.midVertexEntities) {
  43514. this.midVertexEntities.forEach((item) => {
  43515. this.viewer.entities.remove(item);
  43516. });
  43517. }
  43518. this.midVertexEntities = [];
  43519. }
  43520. cartesian3ToPoint3D(position2) {
  43521. const cartographic = Cesium.Cartographic.fromCartesian(position2);
  43522. const lon = Cesium.Math.toDegrees(cartographic.longitude);
  43523. const lat = Cesium.Math.toDegrees(cartographic.latitude);
  43524. return {
  43525. x: lon,
  43526. y: lat,
  43527. z: cartographic.height
  43528. };
  43529. }
  43530. midPosition(first, second) {
  43531. if (!first || !second)
  43532. return null;
  43533. let point3d1 = this.cartesian3ToPoint3D(first);
  43534. let point3d2 = this.cartesian3ToPoint3D(second);
  43535. let midLonLat = {
  43536. x: (point3d1.x + point3d2.x) / 2,
  43537. y: (point3d1.y + point3d2.y) / 2,
  43538. z: (point3d1.z + point3d2.z) / 2
  43539. };
  43540. return Cesium.Cartesian3.fromDegrees(midLonLat.x, midLonLat.y, midLonLat.z);
  43541. }
  43542. cartesianToLatlng(cartesian) {
  43543. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  43544. let lat = new Cesium.Math.toDegrees(cartographic.latitude);
  43545. let lng = new Cesium.Math.toDegrees(cartographic.longitude);
  43546. cartographic.height;
  43547. return [lng, lat];
  43548. }
  43549. LatlngTocartesian(latlng) {
  43550. let cartesian3 = new Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  43551. return cartesian3;
  43552. }
  43553. }
  43554. 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}
  43555. `;
  43556. const _hoisted_1$1 = { class: "jt-drawing-dialog" };
  43557. const _hoisted_2$1 = {
  43558. slot: "title",
  43559. class: "header-title"
  43560. };
  43561. const _hoisted_3$1 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  43562. const _hoisted_4$1 = { class: "odin-dialog__content" };
  43563. const _hoisted_5$1 = { class: "jt-drawing-row" };
  43564. const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  43565. const _hoisted_7$1 = { class: "col-main" };
  43566. const _hoisted_8$1 = { class: "el-body-foot" };
  43567. const _sfc_main$1 = {
  43568. __name: "CrEditProperty_MilitaryPlot.ce",
  43569. props: {
  43570. params: {
  43571. id: {
  43572. type: String,
  43573. default: () => void 0
  43574. },
  43575. color: {
  43576. type: String,
  43577. default: () => "255,255,0,0.9"
  43578. },
  43579. outlineWidth: {
  43580. type: Number,
  43581. default: () => 0
  43582. },
  43583. outlineColor: {
  43584. type: String,
  43585. default: () => "255,255,0,0.9"
  43586. }
  43587. },
  43588. showDialog: {
  43589. type: Boolean,
  43590. default: () => false
  43591. }
  43592. },
  43593. emits: ["submit", "update:showDialog", "update:params", "remove"],
  43594. setup(__props, { expose: __expose, emit }) {
  43595. const props = __props;
  43596. const language = ref("zh-cn");
  43597. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  43598. const {
  43599. proxy
  43600. } = getCurrentInstance();
  43601. const predefineColors = ref([
  43602. "#ff4500",
  43603. "#ff8c00",
  43604. "#ffd700",
  43605. "#90ee90",
  43606. "#00ced1",
  43607. "#1e90ff",
  43608. "#c71585",
  43609. "rgba(255, 69, 0, 0.68)",
  43610. "rgb(255, 120, 0)",
  43611. "hsv(51, 100, 98)",
  43612. "hsva(120, 40, 94, 0.5)",
  43613. "hsl(181, 100%, 37%)",
  43614. "hsla(209, 100%, 56%, 0.73)",
  43615. "#c7158577"
  43616. ]);
  43617. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  43618. const dialogVisible = ref(props.showDialog);
  43619. ref(false);
  43620. const color2 = ref(props.params.color);
  43621. const outlineWidth = ref(0);
  43622. const outlineColor = ref(props.params.outlineColor);
  43623. updateParams(props.params);
  43624. function updateParams(params) {
  43625. proxy._params = params;
  43626. switch (params.id) {
  43627. case "DrawStraightArrow":
  43628. title.value = "\u7ED8\u5236\u76F4\u7EBF\u7BAD\u5934";
  43629. break;
  43630. case "DrawAttackArrow":
  43631. title.value = "\u7ED8\u5236\u653B\u51FB\u7BAD\u5934";
  43632. break;
  43633. case "DrawPincerArrow":
  43634. title.value = "\u7ED8\u5236\u94B3\u51FB\u7BAD\u5934";
  43635. break;
  43636. case "DrawGatheringPlace":
  43637. title.value = "\u7ED8\u5236\u96C6\u7ED3\u5730";
  43638. break;
  43639. case "DrawClosedCurve":
  43640. title.value = "\u7ED8\u5236\u95ED\u5408\u66F2\u9762";
  43641. break;
  43642. case "DrawSector":
  43643. title.value = "\u7ED8\u5236\u6247\u5F62";
  43644. break;
  43645. case "DrawBowLine":
  43646. title.value = "\u7ED8\u5236\u5F13\u5F62\u7EBF";
  43647. break;
  43648. case "DrawLune":
  43649. title.value = "\u7ED8\u5236\u5F13\u5F62\u9762";
  43650. break;
  43651. case "DrawCurve":
  43652. title.value = "\u7ED8\u5236\u66F2\u7EBF";
  43653. break;
  43654. case "DrawCurveFlag":
  43655. title.value = "\u7ED8\u5236\u66F2\u7EBF\u65D7\u5E1C";
  43656. break;
  43657. case "DrawRectFlag":
  43658. title.value = "\u7ED8\u5236\u77E9\u5F62\u76F4\u89D2\u65D7\u5E1C";
  43659. break;
  43660. case "DrawTriangleFlag":
  43661. title.value = "\u7ED8\u5236\u4E09\u89D2\u65D7\u5E1C";
  43662. break;
  43663. }
  43664. color2.value = params.color;
  43665. outlineColor.value = params.outlineColor;
  43666. outlineWidth.value = params.outlineWidth;
  43667. }
  43668. __expose({});
  43669. function submit() {
  43670. let outParam = proxy._params;
  43671. outParam.color = color2.value;
  43672. outParam.outlineColor = outlineColor.value;
  43673. outParam.outlineWidth = outlineWidth.value;
  43674. emit("submit", outParam);
  43675. }
  43676. function close() {
  43677. dialogVisible.value = false;
  43678. }
  43679. function remove2() {
  43680. emit("remove", {});
  43681. dialogVisible.value = false;
  43682. }
  43683. function closeDialog() {
  43684. emit("update:showDialog", false);
  43685. }
  43686. function openDialog() {
  43687. updateParams(props.params);
  43688. }
  43689. return (_ctx, _cache) => {
  43690. return openBlock(), createElementBlock("div", _hoisted_1$1, [
  43691. createVNode(unref(ElDialog), {
  43692. modal: false,
  43693. "destroy-on-close": false,
  43694. modelValue: dialogVisible.value,
  43695. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dialogVisible.value = $event),
  43696. title: title.value,
  43697. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  43698. onClose: closeDialog,
  43699. onOpen: openDialog,
  43700. "show-close": false
  43701. }, {
  43702. header: withCtx(() => [
  43703. createElementVNode("div", _hoisted_2$1, [
  43704. createElementVNode("span", _hoisted_3$1, toDisplayString(title.value), 1)
  43705. ])
  43706. ]),
  43707. default: withCtx(() => [
  43708. createElementVNode("div", _hoisted_4$1, [
  43709. createElementVNode("div", _hoisted_5$1, [
  43710. _hoisted_6$1,
  43711. createElementVNode("div", _hoisted_7$1, [
  43712. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  43713. default: withCtx(() => [
  43714. createVNode(unref(ElColorPicker), {
  43715. modelValue: color2.value,
  43716. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => color2.value = $event),
  43717. "show-alpha": "",
  43718. predefine: predefineColors.value,
  43719. label: "12"
  43720. }, null, 8, ["modelValue", "predefine"])
  43721. ]),
  43722. _: 1
  43723. }, 8, ["locale"])
  43724. ])
  43725. ]),
  43726. createElementVNode("div", _hoisted_8$1, [
  43727. createVNode(unref(ElButtonGroup), null, {
  43728. default: withCtx(() => [
  43729. createVNode(unref(ElButton), {
  43730. type: "primary",
  43731. icon: unref(edit_default),
  43732. onClick: _cache[1] || (_cache[1] = ($event) => submit())
  43733. }, {
  43734. default: withCtx(() => [
  43735. createTextVNode("\u4FEE\u6539")
  43736. ]),
  43737. _: 1
  43738. }, 8, ["icon"]),
  43739. createVNode(unref(ElButton), {
  43740. type: "primary",
  43741. style: { "background-color": "rgb(222, 146, 47)" },
  43742. icon: unref(delete_default),
  43743. onClick: _cache[2] || (_cache[2] = ($event) => remove2())
  43744. }, {
  43745. default: withCtx(() => [
  43746. createTextVNode("\u5220\u9664")
  43747. ]),
  43748. _: 1
  43749. }, 8, ["icon"]),
  43750. createVNode(unref(ElButton), {
  43751. type: "primary",
  43752. style: { "background-color": "rgb(126, 128, 135)" },
  43753. icon: unref(close_default),
  43754. onClick: _cache[3] || (_cache[3] = ($event) => close())
  43755. }, {
  43756. default: withCtx(() => [
  43757. createTextVNode("\u5173\u95ED")
  43758. ]),
  43759. _: 1
  43760. }, 8, ["icon"])
  43761. ]),
  43762. _: 1
  43763. })
  43764. ])
  43765. ])
  43766. ]),
  43767. _: 1
  43768. }, 8, ["modelValue", "title", "style"])
  43769. ]);
  43770. };
  43771. }
  43772. };
  43773. var DialogEditProperty$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["styles", [_style_0$1]]]);
  43774. Cesium.Entity.prototype.setParams = function(params) {
  43775. this._params = params;
  43776. };
  43777. Cesium.Entity.prototype.getParams = function() {
  43778. return this._params;
  43779. };
  43780. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  43781. this._isEdit = isEdit;
  43782. };
  43783. Cesium.Entity.prototype.getIsEdit = function() {
  43784. return this._isEdit;
  43785. };
  43786. class DrawMilitaryPlot {
  43787. constructor(options2) {
  43788. if (!options2.viewer)
  43789. throw new DeveloperError("no options.viewer object!");
  43790. if (!options2.Cesium)
  43791. throw new DeveloperError("no options.Cesium object!");
  43792. this._viewer = options2.viewer;
  43793. this.cesium = options2.Cesium;
  43794. this.drawArr = [];
  43795. this.Draw = "";
  43796. this.edit = new EntityEdit(this._viewer);
  43797. this.edit.activate();
  43798. this.edit.EditEndEntity.addEventListener((result) => {
  43799. if (result.Type) {
  43800. this.handleFirstPosition(result.Type);
  43801. this.edit.DrawExample = this.Draw;
  43802. }
  43803. this._editEntity = result;
  43804. });
  43805. }
  43806. static initEditPropertyParams() {
  43807. return {
  43808. id: void 0,
  43809. color: "rgba(0,255,0,0.75)",
  43810. outlineWidth: 0,
  43811. outlineColor: "rgba(255,255,255,1)"
  43812. };
  43813. }
  43814. editActivate() {
  43815. return this.edit;
  43816. }
  43817. handleFirstPosition(type2) {
  43818. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  43819. switch (type2) {
  43820. case "DrawStraightArrow":
  43821. this.Draw = new MilitaryPlot.DrawStraightArrow({
  43822. viewer: this._viewer,
  43823. Cesium: this.cesium
  43824. });
  43825. break;
  43826. case "DrawAttackArrow":
  43827. this.Draw = new MilitaryPlot.DrawAttackArrow({
  43828. viewer: this._viewer,
  43829. Cesium: this.cesium
  43830. });
  43831. break;
  43832. case "DrawPincerArrow":
  43833. this.Draw = new MilitaryPlot.DrawPincerArrow({
  43834. viewer: this._viewer,
  43835. Cesium: this.cesium
  43836. });
  43837. break;
  43838. case "DrawGatheringPlace":
  43839. this.Draw = new MilitaryPlot.DrawGatheringPlace({
  43840. viewer: this._viewer,
  43841. Cesium: this.cesium
  43842. });
  43843. break;
  43844. case "DrawClosedCurve":
  43845. this.Draw = new MilitaryPlot.DrawClosedCurve({
  43846. viewer: this._viewer,
  43847. Cesium: this.cesium
  43848. });
  43849. break;
  43850. case "DrawSector":
  43851. this.Draw = new MilitaryPlot.DrawSector({
  43852. viewer: this._viewer,
  43853. Cesium: this.cesium
  43854. });
  43855. break;
  43856. case "DrawBowLine":
  43857. this.Draw = new MilitaryPlot.DrawBowLine({
  43858. viewer: this._viewer,
  43859. Cesium: this.cesium
  43860. });
  43861. break;
  43862. case "DrawBowPlane":
  43863. this.Draw = new MilitaryPlot.DrawBowPlane({
  43864. viewer: this._viewer,
  43865. Cesium: this.cesium
  43866. });
  43867. break;
  43868. case "DrawCurve":
  43869. this.Draw = new MilitaryPlot.DrawCurve({
  43870. viewer: this._viewer,
  43871. Cesium: this.cesium
  43872. });
  43873. break;
  43874. case "DrawCurveFlag":
  43875. this.Draw = new MilitaryPlot.DrawCurveFlag({
  43876. viewer: this._viewer,
  43877. Cesium: this.cesium
  43878. });
  43879. break;
  43880. case "DrawRectFlag":
  43881. this.Draw = new MilitaryPlot.DrawRectFlag({
  43882. viewer: this._viewer,
  43883. Cesium: this.cesium
  43884. });
  43885. break;
  43886. case "DrawTriangleFlag":
  43887. this.Draw = new MilitaryPlot.DrawTriangleFlag({
  43888. viewer: this._viewer,
  43889. Cesium: this.cesium
  43890. });
  43891. break;
  43892. case "DrawPoint":
  43893. this.Draw = new MilitaryPlot.DrawPoint({
  43894. viewer: this._viewer,
  43895. Cesium: this.cesium
  43896. });
  43897. break;
  43898. case "DrawPolyline":
  43899. this.Draw = new MilitaryPlot.DrawPolyline({
  43900. viewer: this._viewer,
  43901. Cesium: this.cesium
  43902. });
  43903. break;
  43904. case "DrawPolygon":
  43905. this.Draw = new MilitaryPlot.DrawPolygon({
  43906. viewer: this._viewer,
  43907. Cesium: this.cesium
  43908. });
  43909. break;
  43910. case "DrawRectangle":
  43911. this.Draw = new MilitaryPlot.DrawRectangle({
  43912. viewer: this._viewer,
  43913. Cesium: this.cesium
  43914. });
  43915. break;
  43916. case "DrawCircle":
  43917. this.Draw = new MilitaryPlot.DrawCircle({
  43918. viewer: this._viewer,
  43919. Cesium: this.cesium
  43920. });
  43921. break;
  43922. }
  43923. }
  43924. addEntity(data) {
  43925. this.handleFirstPosition(data.type);
  43926. if (this.Draw) {
  43927. let entity = this.Draw.addload(data.position);
  43928. entity._id = data.id;
  43929. return entity;
  43930. }
  43931. }
  43932. }
  43933. Object.assign(DrawMilitaryPlot.prototype, {
  43934. _setMousePointerStyle() {
  43935. document.querySelector("body").style.cursor = "crosshair";
  43936. },
  43937. _setMouseDefaultStyle() {
  43938. document.querySelector("body").style.cursor = "default";
  43939. },
  43940. _registerLeftClickEvent(handler, callChange) {
  43941. let _self = this;
  43942. if (!handler)
  43943. return;
  43944. handler.setInputAction(function(event2) {
  43945. _self._lock = true;
  43946. clearTimeout(_self._timer);
  43947. _self._timer = setTimeout(function() {
  43948. if (callChange)
  43949. callChange(event2);
  43950. _self._lock = false;
  43951. }, 200);
  43952. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43953. },
  43954. _registerMouseMoveEvent(handler, callChange) {
  43955. let _self = this;
  43956. if (!handler)
  43957. return;
  43958. handler.setInputAction(function(event2) {
  43959. if (_self._lock === void 0 || _self._lock === false) {
  43960. if (callChange)
  43961. callChange(event2);
  43962. }
  43963. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43964. },
  43965. _registerLeftDownEvent(handler, callChange) {
  43966. if (!handler)
  43967. return;
  43968. handler.setInputAction(function(event2) {
  43969. if (callChange)
  43970. callChange(event2);
  43971. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43972. },
  43973. _registerLeftUpEvent(handler, callChange) {
  43974. if (!handler)
  43975. return;
  43976. handler.setInputAction(function(event2) {
  43977. if (callChange)
  43978. callChange(event2);
  43979. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  43980. },
  43981. _clearEvent(handler) {
  43982. if (!handler)
  43983. return;
  43984. handler.destroy();
  43985. handler = null;
  43986. }
  43987. });
  43988. Object.assign(DrawMilitaryPlot.prototype, {
  43989. _setEntityIsEdit(entity) {
  43990. let _self = this;
  43991. this._closePropertyEditDialog();
  43992. entity.setIsEdit(true);
  43993. this.edit.handlePickEditEntity(entity);
  43994. this._sendShowPropertyDialog(entity);
  43995. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  43996. this._registerLeftClickEvent(handler, function(event2) {
  43997. _self._closePropertyEditDialog();
  43998. let feature2 = _self._viewer.scene.pick(event2.position);
  43999. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  44000. let editEntity = feature2.id;
  44001. 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") {
  44002. _self._sendShowPropertyDialog(feature2.id);
  44003. }
  44004. }
  44005. });
  44006. },
  44007. _sendShowPropertyDialog(entity) {
  44008. let _self = this;
  44009. let editEntityType = entity.Type;
  44010. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  44011. return;
  44012. }
  44013. let editProperty = entity.getParams();
  44014. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  44015. editProperty.id = editEntityType;
  44016. _self._openPropertyEditDialog(
  44017. editProperty,
  44018. function(params) {
  44019. _self.updateEditEntityProperty(params);
  44020. },
  44021. function() {
  44022. _self._viewer.entities.remove(entity);
  44023. _self.edit.clearAllEditVertex();
  44024. }
  44025. );
  44026. }
  44027. },
  44028. updateEditEntityProperty: function(params) {
  44029. if (this._editEntity === void 0)
  44030. return;
  44031. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  44032. return;
  44033. let editEntityType = this._editEntity.Type;
  44034. if (editEntityType === void 0)
  44035. return;
  44036. let material = this._editEntity.polygon.material;
  44037. if (material instanceof Cesium.ColorMaterialProperty) {
  44038. let newMaterial = this._materialColorProperty({
  44039. color: params.color
  44040. });
  44041. this._editEntity.polygon.material = newMaterial;
  44042. }
  44043. if (this._editEntity.polyline !== void 0) {
  44044. let newMaterial = this._materialColorProperty({
  44045. color: params.outlineColor
  44046. });
  44047. this._editEntity.polyline.material = newMaterial;
  44048. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  44049. }
  44050. this._editEntity.setParams(params);
  44051. },
  44052. _materialColorProperty(options2) {
  44053. let mColor = "rgba(0,255,0,1)";
  44054. if (options2 !== void 0 && options2.color !== void 0)
  44055. mColor = options2.color;
  44056. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  44057. colorMaterial._param = {
  44058. color: mColor
  44059. };
  44060. return colorMaterial;
  44061. }
  44062. });
  44063. Object.assign(DrawMilitaryPlot.prototype, {
  44064. drawActivate(type2) {
  44065. this._setMousePointerStyle();
  44066. this.handleFirstPosition(type2);
  44067. this.Draw.startCreate(type2);
  44068. this.Draw.DrawEndEvent.addEventListener((entity, positions, drawType) => {
  44069. console.log({
  44070. entity,
  44071. positions,
  44072. drawType
  44073. });
  44074. this._setMouseDefaultStyle();
  44075. if (entity) {
  44076. let entityParam = DrawMilitaryPlot.initEditPropertyParams();
  44077. entity.setParams(entityParam);
  44078. this._setEntityIsEdit(entity);
  44079. }
  44080. });
  44081. this.drawArr.push(this.Draw);
  44082. return this.Draw;
  44083. },
  44084. clearOne: function() {
  44085. this.Draw.clear();
  44086. },
  44087. clearAll: function() {
  44088. for (var i2 = 0; i2 < this.drawArr.length; i2++) {
  44089. this.drawArr[i2].clear();
  44090. }
  44091. this.edit.deactivate();
  44092. this._closePropertyEditDialog();
  44093. let buttonDiv = document.getElementById("drawButtonDiv");
  44094. if (buttonDiv) {
  44095. document.body.removeChild(buttonDiv);
  44096. }
  44097. }
  44098. });
  44099. Object.assign(DrawMilitaryPlot.prototype, {
  44100. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  44101. this._editPropertyDialogDomId = "dialog-property-dom-militaryplot";
  44102. this._registerDOMPropertyEdit = "dialog-edit-property-militaryplot";
  44103. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  44104. if (PropertyEditComponent === void 0) {
  44105. PropertyEditComponent = defineCustomElement(DialogEditProperty$1);
  44106. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  44107. }
  44108. this._closePropertyEditDialog();
  44109. let dialogPropertyElement = new PropertyEditComponent({
  44110. params
  44111. });
  44112. dialogPropertyElement.id = this._editPropertyDialogDomId;
  44113. dialogPropertyElement.showDialog = true;
  44114. document.body.appendChild(dialogPropertyElement);
  44115. dialogPropertyElement.addEventListener(
  44116. "submit",
  44117. (e) => {
  44118. if (callEdit)
  44119. callEdit(e.detail[0]);
  44120. },
  44121. false
  44122. );
  44123. dialogPropertyElement.addEventListener(
  44124. "remove",
  44125. (e) => {
  44126. if (callRemove)
  44127. callRemove();
  44128. },
  44129. false
  44130. );
  44131. },
  44132. _closePropertyEditDialog() {
  44133. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  44134. if (dom2 !== null && dom2 !== void 0) {
  44135. document.body.removeChild(dom2);
  44136. }
  44137. }
  44138. });
  44139. 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}
  44140. `;
  44141. const _hoisted_1 = { class: "jt-drawing-dialog" };
  44142. const _hoisted_2 = {
  44143. slot: "title",
  44144. class: "header-title"
  44145. };
  44146. const _hoisted_3 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  44147. const _hoisted_4 = { class: "content" };
  44148. const _hoisted_5 = {
  44149. class: "jt-drawing-row",
  44150. style: { "height": "60rem" }
  44151. };
  44152. const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5185\u5BB9", -1);
  44153. const _hoisted_7 = { class: "col-main" };
  44154. const _hoisted_8 = { class: "jt-drawing-row" };
  44155. const _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53", -1);
  44156. const _hoisted_10 = { class: "col-main" };
  44157. const _hoisted_11 = { class: "jt-drawing-row" };
  44158. const _hoisted_12 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53\u5927\u5C0F", -1);
  44159. const _hoisted_13 = { class: "col-main" };
  44160. const _hoisted_14 = { class: "jt-drawing-row" };
  44161. const _hoisted_15 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u52A0\u7C97", -1);
  44162. const _hoisted_16 = { class: "col-main" };
  44163. const _hoisted_17 = { class: "jt-drawing-row" };
  44164. const _hoisted_18 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u659C\u4F53", -1);
  44165. const _hoisted_19 = { class: "col-main" };
  44166. const _hoisted_20 = { class: "jt-drawing-row" };
  44167. const _hoisted_21 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44168. const _hoisted_22 = { class: "col-main" };
  44169. const _hoisted_23 = { class: "jt-drawing-row" };
  44170. const _hoisted_24 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44171. const _hoisted_25 = { class: "col-main" };
  44172. const _hoisted_26 = { class: "jt-drawing-row" };
  44173. const _hoisted_27 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44174. const _hoisted_28 = { class: "col-main" };
  44175. const _hoisted_29 = { class: "jt-drawing-row" };
  44176. const _hoisted_30 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44177. const _hoisted_31 = { class: "col-main" };
  44178. const _hoisted_32 = { class: "jt-drawing-row" };
  44179. const _hoisted_33 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u80CC\u666F", -1);
  44180. const _hoisted_34 = { class: "col-main" };
  44181. const _hoisted_35 = { class: "jt-drawing-row" };
  44182. const _hoisted_36 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u989C\u8272", -1);
  44183. const _hoisted_37 = { class: "col-main" };
  44184. const _hoisted_38 = { class: "jt-drawing-row" };
  44185. const _hoisted_39 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u5185\u8FB9\u8DDD", -1);
  44186. const _hoisted_40 = { class: "col-main" };
  44187. const _hoisted_41 = { class: "jt-drawing-row" };
  44188. const _hoisted_42 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A2A\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44189. const _hoisted_43 = { class: "col-main" };
  44190. const _hoisted_44 = { class: "jt-drawing-row" };
  44191. const _hoisted_45 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EB5\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44192. const _hoisted_46 = { class: "col-main" };
  44193. const _hoisted_47 = { class: "jt-drawing-row" };
  44194. const _hoisted_48 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u50CF\u7D20\u5927\u5C0F", -1);
  44195. const _hoisted_49 = { class: "col-main" };
  44196. const _hoisted_50 = { class: "jt-drawing-row" };
  44197. const _hoisted_51 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44198. const _hoisted_52 = { class: "col-main" };
  44199. const _hoisted_53 = { class: "jt-drawing-row" };
  44200. const _hoisted_54 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44201. const _hoisted_55 = { class: "col-main" };
  44202. const _hoisted_56 = { class: "jt-drawing-row" };
  44203. const _hoisted_57 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44204. const _hoisted_58 = { class: "col-main" };
  44205. const _hoisted_59 = { class: "jt-drawing-row" };
  44206. const _hoisted_60 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44207. const _hoisted_61 = { class: "col-main" };
  44208. const _hoisted_62 = {
  44209. class: "jt-drawing-row",
  44210. style: { "height": "60rem" }
  44211. };
  44212. const _hoisted_63 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u56FE\u6807", -1);
  44213. const _hoisted_64 = { class: "col-main" };
  44214. const _hoisted_65 = { class: "jt-drawing-row" };
  44215. const _hoisted_66 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5927\u5C0F\u6BD4\u4F8B", -1);
  44216. const _hoisted_67 = { class: "col-main" };
  44217. const _hoisted_68 = {
  44218. class: "jt-drawing-row",
  44219. style: { "height": "60rem" }
  44220. };
  44221. const _hoisted_69 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A21\u578B\u8DEF\u5F84", -1);
  44222. const _hoisted_70 = { class: "col-main" };
  44223. const _hoisted_71 = { class: "jt-drawing-row" };
  44224. const _hoisted_72 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u900F\u660E\u5EA6", -1);
  44225. const _hoisted_73 = { class: "col-main" };
  44226. const _hoisted_74 = { class: "jt-drawing-row" };
  44227. const _hoisted_75 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6700\u5C0F\u50CF\u7D20\u5927\u5C0F", -1);
  44228. const _hoisted_76 = { class: "col-main" };
  44229. const _hoisted_77 = { class: "jt-drawing-row" };
  44230. const _hoisted_78 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44231. const _hoisted_79 = { class: "col-main" };
  44232. const _hoisted_80 = { class: "jt-drawing-row" };
  44233. const _hoisted_81 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44234. const _hoisted_82 = { class: "col-main" };
  44235. const _hoisted_83 = { class: "jt-drawing-row" };
  44236. const _hoisted_84 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44237. const _hoisted_85 = { class: "col-main" };
  44238. const _hoisted_86 = { class: "el-body-foot" };
  44239. const _sfc_main = {
  44240. __name: "CrEditProperty_Point.ce",
  44241. props: {
  44242. params: {
  44243. id: {
  44244. type: String,
  44245. default: () => void 0
  44246. },
  44247. text: {
  44248. type: String,
  44249. default: () => ""
  44250. },
  44251. font: {
  44252. type: String,
  44253. default: () => ""
  44254. },
  44255. fontSize: {
  44256. type: Number,
  44257. default: () => 24
  44258. },
  44259. color: {
  44260. type: String,
  44261. default: () => "255,255,0,0.9"
  44262. }
  44263. },
  44264. showDialog: {
  44265. type: Boolean,
  44266. default: () => false
  44267. }
  44268. },
  44269. emits: ["submit", "update:showDialog", "update:params", "remove"],
  44270. setup(__props, { emit }) {
  44271. const props = __props;
  44272. const language = ref("zh-cn");
  44273. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  44274. const {
  44275. proxy
  44276. } = getCurrentInstance();
  44277. const predefineColors = ref([
  44278. "#ff4500",
  44279. "#ff8c00",
  44280. "#ffd700",
  44281. "#90ee90",
  44282. "#00ced1",
  44283. "#1e90ff",
  44284. "#c71585",
  44285. "rgba(255, 69, 0, 0.68)",
  44286. "rgb(255, 120, 0)",
  44287. "hsv(51, 100, 98)",
  44288. "hsva(120, 40, 94, 0.5)",
  44289. "hsl(181, 100%, 37%)",
  44290. "hsla(209, 100%, 56%, 0.73)",
  44291. "#c7158577"
  44292. ]);
  44293. const selectOptionsFont = [
  44294. {
  44295. value: "Helvetica",
  44296. label: "\u9ED8\u8BA4\u5B57\u4F53"
  44297. },
  44298. {
  44299. value: "Microsoft YaHei",
  44300. label: "\u5FAE\u8F6F\u96C5\u9ED1"
  44301. },
  44302. {
  44303. value: "\u5B8B\u4F53",
  44304. label: "\u5B8B\u4F53"
  44305. },
  44306. {
  44307. value: "\u6977\u4F53",
  44308. label: "\u6977\u4F53"
  44309. },
  44310. {
  44311. value: "\u96B6\u4E66",
  44312. label: "\u96B6\u4E66"
  44313. },
  44314. {
  44315. value: "\u9ED1\u4F53",
  44316. label: "\u9ED1\u4F53"
  44317. }
  44318. ];
  44319. const activeNames = ref(["1"]);
  44320. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  44321. const dialogVisible = ref(props.showDialog);
  44322. const isShowLabelStyle = ref(false);
  44323. const isShowPointStyle = ref(false);
  44324. const isShowBillboardStyle = ref(false);
  44325. const isShowModelStyle = ref(false);
  44326. const label2 = ref({
  44327. content: "",
  44328. font: "",
  44329. fontSize: 0,
  44330. bolder: false,
  44331. italic: false,
  44332. fillColor: "",
  44333. showOutline: false,
  44334. outlineColor: "",
  44335. outlineWidth: 0,
  44336. showBackground: false,
  44337. backgroundColor: "",
  44338. backgroundPadding: 0,
  44339. pixelOffsetX: 0,
  44340. pixelOffsetY: 0
  44341. });
  44342. const point2 = ref({
  44343. color: "",
  44344. pixelSize: 10,
  44345. showOutline: false,
  44346. outlineColor: "",
  44347. outlineWidth: 0
  44348. });
  44349. const billboard = ref({
  44350. imgUrl: "",
  44351. alpha: 1,
  44352. scale: 1
  44353. });
  44354. const model = ref({
  44355. url: "",
  44356. alpha: 1,
  44357. showSilhouette: false,
  44358. silhouetteSize: 0,
  44359. silhouetteColor: "rgba(255,255,255,1)",
  44360. minimumPixelSize: 1,
  44361. maximumScale: 1,
  44362. heading: 0,
  44363. pitch: 0,
  44364. roll: 0
  44365. });
  44366. updateParams(props.params);
  44367. function updateParams(params) {
  44368. proxy._params = params;
  44369. _setShowControls(false);
  44370. if (params.id === DrawPoint.DrawType.Label) {
  44371. title.value = "\u6587\u5B57\u7F16\u8F91";
  44372. activeNames.value = ["\u6807\u6CE8\u6837\u5F0F"];
  44373. isShowLabelStyle.value = true;
  44374. label2.value.content = params.label.text;
  44375. label2.value.font = params.label.font;
  44376. label2.value.fontSize = params.label.fontSize;
  44377. label2.value.fillColor = params.label.fillColor;
  44378. label2.value.showOutline = params.label.showOutline;
  44379. label2.value.outlineColor = params.label.outlineColor;
  44380. label2.value.outlineWidth = params.label.outlineWidth;
  44381. label2.value.showBackground = params.label.showBackground;
  44382. label2.value.backgroundColor = params.label.backgroundColor;
  44383. label2.value.backgroundPadding = params.label.backgroundPadding;
  44384. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44385. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44386. } else if (params.id === DrawPoint.DrawType.Point) {
  44387. title.value = "\u70B9\u7F16\u8F91";
  44388. activeNames.value = ["\u70B9\u6837\u5F0F"];
  44389. isShowPointStyle.value = true;
  44390. point2.value.color = params.point.color;
  44391. point2.value.pixelSize = params.point.pixelSize;
  44392. point2.value.showOutline = params.point.showOutline;
  44393. point2.value.outlineColor = params.point.outlineColor;
  44394. point2.value.outlineWidth = params.point.outlineWidth;
  44395. } else if (params.id === DrawPoint.DrawType.Point2Label) {
  44396. title.value = "\u70B9\u53CA\u6587\u5B57\u7F16\u8F91";
  44397. activeNames.value = ["\u70B9\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44398. isShowPointStyle.value = true;
  44399. isShowLabelStyle.value = true;
  44400. point2.value.color = params.point.color;
  44401. point2.value.pixelSize = params.point.pixelSize;
  44402. point2.value.showOutline = params.point.showOutline;
  44403. point2.value.outlineColor = params.point.outlineColor;
  44404. point2.value.outlineWidth = params.point.outlineWidth;
  44405. label2.value.content = params.label.text;
  44406. label2.value.font = params.label.font;
  44407. label2.value.fontSize = params.label.fontSize;
  44408. label2.value.fillColor = params.label.fillColor;
  44409. label2.value.showOutline = params.label.showOutline;
  44410. label2.value.outlineColor = params.label.outlineColor;
  44411. label2.value.outlineWidth = params.label.outlineWidth;
  44412. label2.value.showBackground = params.label.showBackground;
  44413. label2.value.backgroundColor = params.label.backgroundColor;
  44414. label2.value.backgroundPadding = params.label.backgroundPadding;
  44415. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44416. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44417. } else if (params.id === DrawPoint.DrawType.Billboard) {
  44418. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  44419. activeNames.value = ["\u56FE\u7247\u6837\u5F0F"];
  44420. isShowBillboardStyle.value = true;
  44421. billboard.value.imgUrl = params.billboard.imgUrl;
  44422. billboard.value.alpha = params.billboard.alpha;
  44423. billboard.value.scale = params.billboard.scale;
  44424. } else if (params.id === DrawPoint.DrawType.Billboard2Label) {
  44425. title.value = "\u5E7F\u544A\u724C\u53CA\u6587\u5B57\u5706\u7F16\u8F91";
  44426. activeNames.value = ["\u56FE\u7247\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44427. isShowBillboardStyle.value = true;
  44428. isShowLabelStyle.value = true;
  44429. billboard.value.imgUrl = params.billboard.imgUrl;
  44430. billboard.value.alpha = params.billboard.alpha;
  44431. billboard.value.scale = params.billboard.scale;
  44432. label2.value.content = params.label.text;
  44433. label2.value.font = params.label.font;
  44434. label2.value.fontSize = params.label.fontSize;
  44435. label2.value.fillColor = params.label.fillColor;
  44436. label2.value.showOutline = params.label.showOutline;
  44437. label2.value.outlineColor = params.label.outlineColor;
  44438. label2.value.outlineWidth = params.label.outlineWidth;
  44439. label2.value.showBackground = params.label.showBackground;
  44440. label2.value.backgroundColor = params.label.backgroundColor;
  44441. label2.value.backgroundPadding = params.label.backgroundPadding;
  44442. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44443. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44444. } else if (params.id === DrawPoint.DrawType.Model) {
  44445. title.value = "\u5C0F\u6A21\u578B\u7F16\u8F91";
  44446. activeNames.value = ["\u5C0F\u6A21\u578B\u6837\u5F0F"];
  44447. isShowModelStyle.value = true;
  44448. model.value.url = params.model.url;
  44449. model.value.alpha = params.model.alpha;
  44450. model.value.showSilhouette = params.model.showSilhouette;
  44451. model.value.silhouetteColor = params.model.silhouetteColor;
  44452. model.value.silhouetteSize = params.model.silhouetteSize;
  44453. model.value.minimumPixelSize = params.model.minimumPixelSize;
  44454. model.value.maximumScale = params.model.maximumScale;
  44455. model.value.heading = params.model.heading;
  44456. model.value.pitch = params.model.pitch;
  44457. model.value.roll = params.model.roll;
  44458. }
  44459. }
  44460. function _setShowControls(isShow) {
  44461. isShowLabelStyle.value = isShow;
  44462. isShowPointStyle.value = isShow;
  44463. isShowBillboardStyle.value = isShow;
  44464. isShowModelStyle.value = isShow;
  44465. }
  44466. function submit() {
  44467. let outParam = proxy._params;
  44468. outParam = {
  44469. id: outParam.id,
  44470. label: {
  44471. text: label2.value.content,
  44472. font: label2.value.font,
  44473. fontSize: label2.value.fontSize,
  44474. bolder: label2.value.bolder,
  44475. italic: label2.value.italic,
  44476. fillColor: label2.value.fillColor,
  44477. showOutline: label2.value.showOutline,
  44478. outlineWidth: label2.value.outlineWidth,
  44479. outlineColor: label2.value.outlineColor,
  44480. showBackground: label2.value.showBackground,
  44481. backgroundColor: label2.value.backgroundColor,
  44482. backgroundPadding: label2.value.backgroundPadding,
  44483. pixelOffsetX: label2.value.pixelOffsetX,
  44484. pixelOffsetY: label2.value.pixelOffsetY
  44485. },
  44486. point: {
  44487. color: point2.value.color,
  44488. pixelSize: point2.value.pixelSize,
  44489. showOutline: point2.value.showOutline,
  44490. outlineWidth: point2.value.outlineWidth,
  44491. outlineColor: point2.value.outlineColor
  44492. },
  44493. billboard: {
  44494. imgUrl: billboard.value.imgUrl,
  44495. alpha: billboard.value.alpha,
  44496. scale: billboard.value.scale
  44497. },
  44498. model: {
  44499. url: model.value.url,
  44500. alpha: model.value.alpha,
  44501. showSilhouette: model.value.showSilhouette,
  44502. silhouetteColor: model.value.silhouetteColor,
  44503. silhouetteSize: model.value.silhouetteSize,
  44504. minimumPixelSize: model.value.minimumPixelSize,
  44505. maximumScale: model.value.maximumScale,
  44506. heading: model.value.heading,
  44507. pitch: model.value.pitch,
  44508. roll: model.value.roll
  44509. }
  44510. };
  44511. emit("submit", outParam);
  44512. }
  44513. function close() {
  44514. dialogVisible.value = false;
  44515. }
  44516. function remove2() {
  44517. emit("remove", {});
  44518. dialogVisible.value = false;
  44519. }
  44520. function closeDialog() {
  44521. emit("update:showDialog", false);
  44522. }
  44523. function openDialog() {
  44524. updateParams(props.params);
  44525. }
  44526. return (_ctx, _cache) => {
  44527. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  44528. return openBlock(), createElementBlock("div", _hoisted_1, [
  44529. createVNode(unref(ElDialog), {
  44530. modal: false,
  44531. "destroy-on-close": false,
  44532. modelValue: dialogVisible.value,
  44533. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => dialogVisible.value = $event),
  44534. title: title.value,
  44535. onClose: closeDialog,
  44536. onOpen: openDialog,
  44537. "show-close": false
  44538. }, {
  44539. header: withCtx(() => [
  44540. createElementVNode("div", _hoisted_2, [
  44541. createElementVNode("span", _hoisted_3, toDisplayString(title.value), 1)
  44542. ])
  44543. ]),
  44544. default: withCtx(() => [
  44545. createVNode(_component_el_scrollbar, null, {
  44546. default: withCtx(() => [
  44547. createElementVNode("div", _hoisted_4, [
  44548. createVNode(unref(ElCollapse), {
  44549. modelValue: activeNames.value,
  44550. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => activeNames.value = $event)
  44551. }, {
  44552. default: withCtx(() => [
  44553. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u6807\u6CE8\u6837\u5F0F" }, {
  44554. title: withCtx(() => [
  44555. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44556. default: withCtx(() => [
  44557. createVNode(unref(setting_default))
  44558. ]),
  44559. _: 1
  44560. }),
  44561. createTextVNode("\u6807\u6CE8\u6837\u5F0F ")
  44562. ]),
  44563. default: withCtx(() => [
  44564. createElementVNode("div", _hoisted_5, [
  44565. _hoisted_6,
  44566. createElementVNode("div", _hoisted_7, [
  44567. createVNode(unref(ElInput), {
  44568. modelValue: label2.value.content,
  44569. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => label2.value.content = $event),
  44570. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  44571. clearable: "",
  44572. type: "textarea",
  44573. rows: 2
  44574. }, null, 8, ["modelValue"])
  44575. ])
  44576. ]),
  44577. createElementVNode("div", _hoisted_8, [
  44578. _hoisted_9,
  44579. createElementVNode("div", _hoisted_10, [
  44580. createVNode(unref(ElSelect), {
  44581. modelValue: label2.value.font,
  44582. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => label2.value.font = $event),
  44583. placeholder: "\u8BF7\u9009\u62E9"
  44584. }, {
  44585. default: withCtx(() => [
  44586. (openBlock(), createElementBlock(Fragment, null, renderList(selectOptionsFont, (item) => {
  44587. return createVNode(unref(ElOption), {
  44588. key: item.value,
  44589. label: item.label,
  44590. value: item.value
  44591. }, null, 8, ["label", "value"]);
  44592. }), 64))
  44593. ]),
  44594. _: 1
  44595. }, 8, ["modelValue"])
  44596. ])
  44597. ]),
  44598. createElementVNode("div", _hoisted_11, [
  44599. _hoisted_12,
  44600. createElementVNode("div", _hoisted_13, [
  44601. createVNode(unref(ElInputNumber), {
  44602. modelValue: label2.value.fontSize,
  44603. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => label2.value.fontSize = $event),
  44604. min: 0,
  44605. max: 100
  44606. }, null, 8, ["modelValue"])
  44607. ])
  44608. ]),
  44609. createElementVNode("div", _hoisted_14, [
  44610. _hoisted_15,
  44611. createElementVNode("div", _hoisted_16, [
  44612. createVNode(unref(ElSwitch), {
  44613. modelValue: label2.value.bolder,
  44614. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => label2.value.bolder = $event)
  44615. }, null, 8, ["modelValue"])
  44616. ])
  44617. ]),
  44618. createElementVNode("div", _hoisted_17, [
  44619. _hoisted_18,
  44620. createElementVNode("div", _hoisted_19, [
  44621. createVNode(unref(ElSwitch), {
  44622. modelValue: label2.value.italic,
  44623. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => label2.value.italic = $event)
  44624. }, null, 8, ["modelValue"])
  44625. ])
  44626. ]),
  44627. createElementVNode("div", _hoisted_20, [
  44628. _hoisted_21,
  44629. createElementVNode("div", _hoisted_22, [
  44630. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44631. default: withCtx(() => [
  44632. createVNode(unref(ElColorPicker), {
  44633. modelValue: label2.value.fillColor,
  44634. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => label2.value.fillColor = $event),
  44635. "show-alpha": "",
  44636. predefine: predefineColors.value,
  44637. label: "12"
  44638. }, null, 8, ["modelValue", "predefine"])
  44639. ]),
  44640. _: 1
  44641. }, 8, ["locale"])
  44642. ])
  44643. ]),
  44644. createElementVNode("div", _hoisted_23, [
  44645. _hoisted_24,
  44646. createElementVNode("div", _hoisted_25, [
  44647. createVNode(unref(ElSwitch), {
  44648. modelValue: label2.value.showOutline,
  44649. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => label2.value.showOutline = $event)
  44650. }, null, 8, ["modelValue"])
  44651. ])
  44652. ]),
  44653. withDirectives(createElementVNode("div", _hoisted_26, [
  44654. _hoisted_27,
  44655. createElementVNode("div", _hoisted_28, [
  44656. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44657. default: withCtx(() => [
  44658. createVNode(unref(ElColorPicker), {
  44659. modelValue: label2.value.outlineColor,
  44660. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => label2.value.outlineColor = $event),
  44661. "show-alpha": "",
  44662. predefine: predefineColors.value,
  44663. label: "12"
  44664. }, null, 8, ["modelValue", "predefine"])
  44665. ]),
  44666. _: 1
  44667. }, 8, ["locale"])
  44668. ])
  44669. ], 512), [
  44670. [vShow, label2.value.showOutline]
  44671. ]),
  44672. withDirectives(createElementVNode("div", _hoisted_29, [
  44673. _hoisted_30,
  44674. createElementVNode("div", _hoisted_31, [
  44675. createVNode(unref(ElInputNumber), {
  44676. modelValue: label2.value.outlineWidth,
  44677. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => label2.value.outlineWidth = $event),
  44678. min: 0,
  44679. max: 100
  44680. }, null, 8, ["modelValue"])
  44681. ])
  44682. ], 512), [
  44683. [vShow, label2.value.showOutline]
  44684. ]),
  44685. createElementVNode("div", _hoisted_32, [
  44686. _hoisted_33,
  44687. createElementVNode("div", _hoisted_34, [
  44688. createVNode(unref(ElSwitch), {
  44689. modelValue: label2.value.showBackground,
  44690. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => label2.value.showBackground = $event)
  44691. }, null, 8, ["modelValue"])
  44692. ])
  44693. ]),
  44694. withDirectives(createElementVNode("div", _hoisted_35, [
  44695. _hoisted_36,
  44696. createElementVNode("div", _hoisted_37, [
  44697. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44698. default: withCtx(() => [
  44699. createVNode(unref(ElColorPicker), {
  44700. modelValue: label2.value.backgroundColor,
  44701. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => label2.value.backgroundColor = $event),
  44702. "show-alpha": "",
  44703. predefine: predefineColors.value,
  44704. label: "12"
  44705. }, null, 8, ["modelValue", "predefine"])
  44706. ]),
  44707. _: 1
  44708. }, 8, ["locale"])
  44709. ])
  44710. ], 512), [
  44711. [vShow, label2.value.showBackground]
  44712. ]),
  44713. withDirectives(createElementVNode("div", _hoisted_38, [
  44714. _hoisted_39,
  44715. createElementVNode("div", _hoisted_40, [
  44716. createVNode(unref(ElInputNumber), {
  44717. modelValue: label2.value.backgroundPadding,
  44718. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => label2.value.backgroundPadding = $event),
  44719. min: -100,
  44720. max: 100
  44721. }, null, 8, ["modelValue"])
  44722. ])
  44723. ], 512), [
  44724. [vShow, label2.value.showBackground]
  44725. ]),
  44726. createElementVNode("div", _hoisted_41, [
  44727. _hoisted_42,
  44728. createElementVNode("div", _hoisted_43, [
  44729. createVNode(unref(ElInputNumber), {
  44730. modelValue: label2.value.pixelOffsetX,
  44731. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => label2.value.pixelOffsetX = $event),
  44732. min: -100,
  44733. max: 100
  44734. }, null, 8, ["modelValue"])
  44735. ])
  44736. ]),
  44737. createElementVNode("div", _hoisted_44, [
  44738. _hoisted_45,
  44739. createElementVNode("div", _hoisted_46, [
  44740. createVNode(unref(ElInputNumber), {
  44741. modelValue: label2.value.pixelOffsetY,
  44742. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => label2.value.pixelOffsetY = $event),
  44743. min: -100,
  44744. max: 100
  44745. }, null, 8, ["modelValue"])
  44746. ])
  44747. ])
  44748. ]),
  44749. _: 1
  44750. }, 512), [
  44751. [vShow, isShowLabelStyle.value]
  44752. ]),
  44753. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u70B9\u6837\u5F0F" }, {
  44754. title: withCtx(() => [
  44755. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44756. default: withCtx(() => [
  44757. createVNode(unref(setting_default))
  44758. ]),
  44759. _: 1
  44760. }),
  44761. createTextVNode("\u70B9\u6837\u5F0F ")
  44762. ]),
  44763. default: withCtx(() => [
  44764. createElementVNode("div", _hoisted_47, [
  44765. _hoisted_48,
  44766. createElementVNode("div", _hoisted_49, [
  44767. createVNode(unref(ElInputNumber), {
  44768. modelValue: point2.value.pixelSize,
  44769. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => point2.value.pixelSize = $event),
  44770. min: 0,
  44771. max: 100
  44772. }, null, 8, ["modelValue"])
  44773. ])
  44774. ]),
  44775. createElementVNode("div", _hoisted_50, [
  44776. _hoisted_51,
  44777. createElementVNode("div", _hoisted_52, [
  44778. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44779. default: withCtx(() => [
  44780. createVNode(unref(ElColorPicker), {
  44781. modelValue: point2.value.color,
  44782. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => point2.value.color = $event),
  44783. "show-alpha": "",
  44784. predefine: predefineColors.value,
  44785. label: "12"
  44786. }, null, 8, ["modelValue", "predefine"])
  44787. ]),
  44788. _: 1
  44789. }, 8, ["locale"])
  44790. ])
  44791. ]),
  44792. createElementVNode("div", _hoisted_53, [
  44793. _hoisted_54,
  44794. createElementVNode("div", _hoisted_55, [
  44795. createVNode(unref(ElSwitch), {
  44796. modelValue: point2.value.showOutline,
  44797. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => point2.value.showOutline = $event)
  44798. }, null, 8, ["modelValue"])
  44799. ])
  44800. ]),
  44801. withDirectives(createElementVNode("div", _hoisted_56, [
  44802. _hoisted_57,
  44803. createElementVNode("div", _hoisted_58, [
  44804. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44805. default: withCtx(() => [
  44806. createVNode(unref(ElColorPicker), {
  44807. modelValue: point2.value.outlineColor,
  44808. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => point2.value.outlineColor = $event),
  44809. "show-alpha": "",
  44810. predefine: predefineColors.value,
  44811. label: "12"
  44812. }, null, 8, ["modelValue", "predefine"])
  44813. ]),
  44814. _: 1
  44815. }, 8, ["locale"])
  44816. ])
  44817. ], 512), [
  44818. [vShow, point2.value.showOutline]
  44819. ]),
  44820. withDirectives(createElementVNode("div", _hoisted_59, [
  44821. _hoisted_60,
  44822. createElementVNode("div", _hoisted_61, [
  44823. createVNode(unref(ElInputNumber), {
  44824. modelValue: point2.value.outlineWidth,
  44825. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => point2.value.outlineWidth = $event),
  44826. min: 0,
  44827. max: 100
  44828. }, null, 8, ["modelValue"])
  44829. ])
  44830. ], 512), [
  44831. [vShow, point2.value.showOutline]
  44832. ])
  44833. ]),
  44834. _: 1
  44835. }, 512), [
  44836. [vShow, isShowPointStyle.value]
  44837. ]),
  44838. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u56FE\u7247\u6837\u5F0F" }, {
  44839. title: withCtx(() => [
  44840. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44841. default: withCtx(() => [
  44842. createVNode(unref(setting_default))
  44843. ]),
  44844. _: 1
  44845. }),
  44846. createTextVNode("\u56FE\u7247\u6837\u5F0F ")
  44847. ]),
  44848. default: withCtx(() => [
  44849. createElementVNode("div", _hoisted_62, [
  44850. _hoisted_63,
  44851. createElementVNode("div", _hoisted_64, [
  44852. createVNode(unref(ElInput), {
  44853. modelValue: billboard.value.imgUrl,
  44854. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => billboard.value.imgUrl = $event),
  44855. placeholder: "\u8F93\u5165\u56FE\u6807\u8DEF\u5F84",
  44856. clearable: "",
  44857. type: "textarea",
  44858. rows: 2
  44859. }, null, 8, ["modelValue"])
  44860. ])
  44861. ]),
  44862. createElementVNode("div", _hoisted_65, [
  44863. _hoisted_66,
  44864. createElementVNode("div", _hoisted_67, [
  44865. createVNode(unref(ElInputNumber), {
  44866. modelValue: billboard.value.scale,
  44867. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => billboard.value.scale = $event),
  44868. min: 1,
  44869. max: 100
  44870. }, null, 8, ["modelValue"])
  44871. ])
  44872. ])
  44873. ]),
  44874. _: 1
  44875. }, 512), [
  44876. [vShow, isShowBillboardStyle.value]
  44877. ]),
  44878. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u5C0F\u6A21\u578B\u6837\u5F0F" }, {
  44879. title: withCtx(() => [
  44880. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44881. default: withCtx(() => [
  44882. createVNode(unref(setting_default))
  44883. ]),
  44884. _: 1
  44885. }),
  44886. createTextVNode("\u5C0F\u6A21\u578B\u6837\u5F0F ")
  44887. ]),
  44888. default: withCtx(() => [
  44889. createElementVNode("div", _hoisted_68, [
  44890. _hoisted_69,
  44891. createElementVNode("div", _hoisted_70, [
  44892. createVNode(unref(ElInput), {
  44893. modelValue: model.value.url,
  44894. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => model.value.url = $event),
  44895. placeholder: "\u8F93\u5165\u6A21\u578B\u8DEF\u5F84",
  44896. clearable: "",
  44897. type: "textarea",
  44898. rows: 2
  44899. }, null, 8, ["modelValue"])
  44900. ])
  44901. ]),
  44902. createElementVNode("div", _hoisted_71, [
  44903. _hoisted_72,
  44904. createElementVNode("div", _hoisted_73, [
  44905. createVNode(unref(ElInputNumber), {
  44906. modelValue: model.value.alpha,
  44907. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => model.value.alpha = $event),
  44908. step: 0.1,
  44909. min: 0,
  44910. max: 1
  44911. }, null, 8, ["modelValue"])
  44912. ])
  44913. ]),
  44914. createElementVNode("div", _hoisted_74, [
  44915. _hoisted_75,
  44916. createElementVNode("div", _hoisted_76, [
  44917. createVNode(unref(ElInputNumber), {
  44918. modelValue: model.value.minimumPixelSize,
  44919. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => model.value.minimumPixelSize = $event),
  44920. step: 1,
  44921. min: 0,
  44922. max: 2e4
  44923. }, null, 8, ["modelValue"])
  44924. ])
  44925. ]),
  44926. createElementVNode("div", _hoisted_77, [
  44927. _hoisted_78,
  44928. createElementVNode("div", _hoisted_79, [
  44929. createVNode(unref(ElSwitch), {
  44930. modelValue: model.value.showSilhouette,
  44931. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => model.value.showSilhouette = $event)
  44932. }, null, 8, ["modelValue"])
  44933. ])
  44934. ]),
  44935. withDirectives(createElementVNode("div", _hoisted_80, [
  44936. _hoisted_81,
  44937. createElementVNode("div", _hoisted_82, [
  44938. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44939. default: withCtx(() => [
  44940. createVNode(unref(ElColorPicker), {
  44941. modelValue: model.value.silhouetteColor,
  44942. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => model.value.silhouetteColor = $event),
  44943. "show-alpha": "",
  44944. predefine: predefineColors.value,
  44945. label: "12"
  44946. }, null, 8, ["modelValue", "predefine"])
  44947. ]),
  44948. _: 1
  44949. }, 8, ["locale"])
  44950. ])
  44951. ], 512), [
  44952. [vShow, model.value.showSilhouette]
  44953. ]),
  44954. withDirectives(createElementVNode("div", _hoisted_83, [
  44955. _hoisted_84,
  44956. createElementVNode("div", _hoisted_85, [
  44957. createVNode(unref(ElInputNumber), {
  44958. modelValue: model.value.silhouetteSize,
  44959. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => model.value.silhouetteSize = $event),
  44960. step: 1,
  44961. min: 0,
  44962. max: 100
  44963. }, null, 8, ["modelValue"])
  44964. ])
  44965. ], 512), [
  44966. [vShow, model.value.showSilhouette]
  44967. ])
  44968. ]),
  44969. _: 1
  44970. }, 512), [
  44971. [vShow, isShowModelStyle.value]
  44972. ])
  44973. ]),
  44974. _: 1
  44975. }, 8, ["modelValue"])
  44976. ]),
  44977. createElementVNode("div", _hoisted_86, [
  44978. createVNode(unref(ElButtonGroup), null, {
  44979. default: withCtx(() => [
  44980. createVNode(unref(ElButton), {
  44981. type: "primary",
  44982. icon: unref(edit_default),
  44983. onClick: _cache[28] || (_cache[28] = ($event) => submit())
  44984. }, {
  44985. default: withCtx(() => [
  44986. createTextVNode("\u4FEE\u6539")
  44987. ]),
  44988. _: 1
  44989. }, 8, ["icon"]),
  44990. createVNode(unref(ElButton), {
  44991. type: "primary",
  44992. style: { "background-color": "rgb(222, 146, 47)" },
  44993. icon: unref(delete_default),
  44994. onClick: _cache[29] || (_cache[29] = ($event) => remove2())
  44995. }, {
  44996. default: withCtx(() => [
  44997. createTextVNode("\u5220\u9664")
  44998. ]),
  44999. _: 1
  45000. }, 8, ["icon"]),
  45001. createVNode(unref(ElButton), {
  45002. type: "primary",
  45003. style: { "background-color": "rgb(126, 128, 135)" },
  45004. icon: unref(close_default),
  45005. onClick: _cache[30] || (_cache[30] = ($event) => close())
  45006. }, {
  45007. default: withCtx(() => [
  45008. createTextVNode("\u5173\u95ED")
  45009. ]),
  45010. _: 1
  45011. }, 8, ["icon"])
  45012. ]),
  45013. _: 1
  45014. })
  45015. ])
  45016. ]),
  45017. _: 1
  45018. })
  45019. ]),
  45020. _: 1
  45021. }, 8, ["modelValue", "title"])
  45022. ]);
  45023. };
  45024. }
  45025. };
  45026. var DialogEditProperty = /* @__PURE__ */ _export_sfc(_sfc_main, [["styles", [_style_0]]]);
  45027. Cesium.Entity.prototype.setParams = function(params) {
  45028. this._params = params;
  45029. };
  45030. Cesium.Entity.prototype.getParams = function() {
  45031. return this._params;
  45032. };
  45033. Cesium.Entity.prototype.setEntityType = function(entityType) {
  45034. this._entityType = entityType;
  45035. };
  45036. Cesium.Entity.prototype.getEntityType = function(entityType) {
  45037. return this._entityType;
  45038. };
  45039. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  45040. this._isEdit = isEdit;
  45041. };
  45042. Cesium.Entity.prototype.getIsEdit = function() {
  45043. return this._isEdit;
  45044. };
  45045. class DrawPoint {
  45046. constructor(viewer2) {
  45047. if (!viewer2)
  45048. throw new Cesium.DeveloperError("no viewer object!");
  45049. this._viewer = viewer2;
  45050. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  45051. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  45052. this._entities = [];
  45053. this._pointObject = new PointObject(viewer2);
  45054. }
  45055. static initEditPropertyParams() {
  45056. return {
  45057. id: void 0,
  45058. label: {
  45059. text: "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0",
  45060. font: "Helvetica",
  45061. fontSize: 24,
  45062. bolder: false,
  45063. italic: false,
  45064. fillColor: "rgba(0,255,0,0.75)",
  45065. showOutline: false,
  45066. outlineWidth: 0,
  45067. outlineColor: "rgba(255,255,255,1)",
  45068. showBackground: false,
  45069. backgroundPadding: 0,
  45070. backgroundColor: "rgba(255,255,255,1)",
  45071. pixelOffsetX: 0,
  45072. pixelOffsetY: 0
  45073. },
  45074. point: {
  45075. color: "rgba(0,255,0,0.75)",
  45076. pixelSize: 10,
  45077. showOutline: false,
  45078. outlineWidth: 0,
  45079. outlineColor: "rgba(255,255,255,1)"
  45080. },
  45081. billboard: {
  45082. imgUrl: "jt3dSDK/imgs/point/point3.png",
  45083. alpha: 1,
  45084. scale: 1
  45085. },
  45086. model: {
  45087. url: "jt3dSDK/gltf/pyramid.glb",
  45088. alpha: 1,
  45089. showSilhouette: false,
  45090. silhouetteColor: "rgba(255,255,255,1)",
  45091. silhouetteSize: 0,
  45092. minimumPixelSize: 128,
  45093. maximumScale: 2e4,
  45094. heading: 0,
  45095. pitch: 0,
  45096. roll: 0
  45097. }
  45098. };
  45099. }
  45100. _cartesian3ToGeo(position2) {
  45101. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45102. return {
  45103. longitude: Cesium.Math.toDegrees(g.longitude),
  45104. latitude: Cesium.Math.toDegrees(g.latitude),
  45105. height: g.height
  45106. };
  45107. }
  45108. _arcToDegree(arc) {
  45109. return arc / Math.PI * 180;
  45110. }
  45111. _getScreenClickPositionAndHeight(screenPoint) {
  45112. var lng = void 0, lat = void 0, height2 = void 0;
  45113. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  45114. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  45115. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45116. var feature2 = this._viewer.scene.pick(screenPoint);
  45117. if (feature2 == void 0) {
  45118. lng = this._arcToDegree(cartographic.longitude);
  45119. lat = this._arcToDegree(cartographic.latitude);
  45120. height2 = cartographic.height;
  45121. } else {
  45122. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  45123. if (Cesium.defined(cartesian)) {
  45124. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  45125. lng = this._arcToDegree(cartographic.longitude);
  45126. lat = this._arcToDegree(cartographic.latitude);
  45127. height2 = cartographic.height;
  45128. }
  45129. }
  45130. return {
  45131. lng,
  45132. lat,
  45133. height: height2
  45134. };
  45135. }
  45136. _transfromFromScreenPoint(screenPosition) {
  45137. let location = this._getScreenClickPositionAndHeight(screenPosition);
  45138. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  45139. return {
  45140. gLocation: location,
  45141. sLocation: cartesian
  45142. };
  45143. }
  45144. }
  45145. Object.assign(DrawPoint.prototype, {
  45146. _setMousePointerStyle() {
  45147. document.querySelector("body").style.cursor = "crosshair";
  45148. },
  45149. _setMouseDefaultStyle() {
  45150. document.querySelector("body").style.cursor = "default";
  45151. },
  45152. _registerLeftClickEvent(handler, callChange) {
  45153. let _self = this;
  45154. if (!handler)
  45155. return;
  45156. handler.setInputAction(function(event2) {
  45157. _self._lock = true;
  45158. clearTimeout(_self._timer);
  45159. _self._timer = setTimeout(function() {
  45160. if (callChange)
  45161. callChange(event2);
  45162. _self._lock = false;
  45163. }, 200);
  45164. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  45165. },
  45166. _registerMouseMoveEvent(handler, callChange) {
  45167. let _self = this;
  45168. if (!handler)
  45169. return;
  45170. handler.setInputAction(function(event2) {
  45171. if (_self._lock === void 0 || _self._lock === false) {
  45172. if (callChange)
  45173. callChange(event2);
  45174. }
  45175. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45176. },
  45177. _registerLeftDownEvent(handler, callChange) {
  45178. if (!handler)
  45179. return;
  45180. handler.setInputAction(function(event2) {
  45181. if (callChange)
  45182. callChange(event2);
  45183. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45184. },
  45185. _registerLeftUpEvent(handler, callChange) {
  45186. if (!handler)
  45187. return;
  45188. handler.setInputAction(function(event2) {
  45189. if (callChange)
  45190. callChange(event2);
  45191. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  45192. },
  45193. _clearEvent(handler) {
  45194. if (!handler)
  45195. return;
  45196. handler.destroy();
  45197. handler = null;
  45198. }
  45199. });
  45200. Object.assign(DrawPoint.prototype, {
  45201. draw: function(type2, options2) {
  45202. let _self = this;
  45203. _self._unActivateEdit();
  45204. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45205. this._drawType = type2;
  45206. switch (type2) {
  45207. case DrawPoint.DrawType.Model:
  45208. _self._sketchDrawModel(_self._drawEventHandler, options2);
  45209. break;
  45210. case DrawPoint.DrawType.Label:
  45211. _self._sketchDrawLabel(_self._drawEventHandler, options2);
  45212. break;
  45213. case DrawPoint.DrawType.Point:
  45214. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  45215. break;
  45216. case DrawPoint.DrawType.Point2Label:
  45217. _self._sketchDrawPoint2Label(_self._drawEventHandler, options2);
  45218. break;
  45219. case DrawPoint.DrawType.Billboard:
  45220. _self._sketchDrawBillboard(_self._drawEventHandler, options2);
  45221. break;
  45222. case DrawPoint.DrawType.Billboard2Label:
  45223. _self._sketchDrawBillboard2Label(_self._drawEventHandler, options2);
  45224. break;
  45225. }
  45226. },
  45227. clearAll() {
  45228. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45229. var getById = viewer.entities.getById(this._entities[i2]);
  45230. if (getById) {
  45231. this._viewer.entities.remove(getById);
  45232. }
  45233. }
  45234. this._closePropertyEditDialog();
  45235. },
  45236. _sketchDrawLabel(handler, options2) {
  45237. let _self = this;
  45238. this._registerLeftClickEvent(handler, function(event2) {
  45239. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45240. if (!Cesium.defined(loc2.sLocation))
  45241. return;
  45242. let entityParam = DrawPoint.initEditPropertyParams();
  45243. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45244. entityParam.label.pixelOffset = {
  45245. x: entityParam.label.pixelOffsetX,
  45246. y: entityParam.label.pixelOffsetY
  45247. };
  45248. _self._pointObject.addLabel(loc2.sLocation, {
  45249. label: entityParam.label
  45250. }).then((entity) => {
  45251. _self._viewer.entities.add(entity);
  45252. _self._entities.push(entity.id);
  45253. entityParam = DrawPoint.initEditPropertyParams();
  45254. _self._drawEntity = entity;
  45255. _self._drawEntity.setParams(entityParam);
  45256. _self._drawEntity.setEntityType(DrawPoint.DrawType.Label);
  45257. _self._setEntityIsEdit(_self._drawEntity);
  45258. _self._clearEvent(handler);
  45259. if (options2.onComplete)
  45260. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45261. });
  45262. });
  45263. },
  45264. _sketchDrawPoint(handler, options2) {
  45265. let _self = this;
  45266. this._registerLeftClickEvent(handler, function(event2) {
  45267. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45268. if (!Cesium.defined(loc2.sLocation))
  45269. return;
  45270. let entityParam = DrawPoint.initEditPropertyParams();
  45271. _self._pointObject.addPoint(loc2.sLocation, {
  45272. point: entityParam.point
  45273. }).then((entity) => {
  45274. _self._viewer.entities.add(entity);
  45275. _self._entities.push(entity.id);
  45276. entityParam = DrawPoint.initEditPropertyParams();
  45277. _self._drawEntity = entity;
  45278. _self._drawEntity.setParams(entityParam);
  45279. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point);
  45280. _self._setEntityIsEdit(_self._drawEntity);
  45281. _self._clearEvent(handler);
  45282. if (options2.onComplete)
  45283. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45284. });
  45285. });
  45286. },
  45287. _sketchDrawPoint2Label(handler, options2) {
  45288. let _self = this;
  45289. this._registerLeftClickEvent(handler, function(event2) {
  45290. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45291. if (!Cesium.defined(loc2.sLocation))
  45292. return;
  45293. let entityParam = DrawPoint.initEditPropertyParams();
  45294. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45295. entityParam.label.pixelOffset = {
  45296. x: entityParam.label.pixelOffsetX,
  45297. y: entityParam.label.pixelOffsetY - 10
  45298. };
  45299. _self._pointObject.addPoint(loc2.sLocation, {
  45300. point: entityParam.point,
  45301. label: entityParam.label
  45302. }).then((entity) => {
  45303. _self._viewer.entities.add(entity);
  45304. _self._entities.push(entity.id);
  45305. entityParam = DrawPoint.initEditPropertyParams();
  45306. entityParam.label.pixelOffsetY = -10;
  45307. _self._drawEntity = entity;
  45308. _self._drawEntity.setParams(entityParam);
  45309. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point2Label);
  45310. _self._setEntityIsEdit(_self._drawEntity);
  45311. _self._clearEvent(handler);
  45312. if (options2.onComplete)
  45313. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45314. });
  45315. });
  45316. },
  45317. _sketchDrawBillboard(handler, options2) {
  45318. let _self = this;
  45319. this._registerLeftClickEvent(handler, function(event2) {
  45320. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45321. if (!Cesium.defined(loc2.sLocation))
  45322. return;
  45323. let entityParam = DrawPoint.initEditPropertyParams();
  45324. _self._pointObject.addBillboard(loc2.sLocation, {
  45325. billboard: entityParam.billboard
  45326. }).then((entity) => {
  45327. _self._viewer.entities.add(entity);
  45328. _self._entities.push(entity.id);
  45329. entityParam = DrawPoint.initEditPropertyParams();
  45330. entityParam.label.pixelOffsetY = -50;
  45331. _self._drawEntity = entity;
  45332. _self._drawEntity.setParams(entityParam);
  45333. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard);
  45334. _self._setEntityIsEdit(_self._drawEntity);
  45335. _self._clearEvent(handler);
  45336. if (options2.onComplete)
  45337. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45338. });
  45339. });
  45340. },
  45341. _sketchDrawBillboard2Label(handler, options2) {
  45342. let _self = this;
  45343. this._registerLeftClickEvent(handler, function(event2) {
  45344. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45345. if (!Cesium.defined(loc2.sLocation))
  45346. return;
  45347. let entityParam = DrawPoint.initEditPropertyParams();
  45348. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45349. entityParam.label.pixelOffset = {
  45350. x: entityParam.label.pixelOffsetX,
  45351. y: entityParam.label.pixelOffsetY - 50
  45352. };
  45353. _self._pointObject.addBillboard(loc2.sLocation, {
  45354. billboard: entityParam.billboard,
  45355. label: entityParam.label
  45356. }).then((entity) => {
  45357. _self._viewer.entities.add(entity);
  45358. _self._entities.push(entity.id);
  45359. entityParam = DrawPoint.initEditPropertyParams();
  45360. _self._drawEntity = entity;
  45361. _self._drawEntity.setParams(entityParam);
  45362. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard2Label);
  45363. _self._setEntityIsEdit(_self._drawEntity);
  45364. _self._clearEvent(handler);
  45365. if (options2.onComplete)
  45366. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45367. });
  45368. });
  45369. },
  45370. _sketchDrawModel(handler, options2) {
  45371. let _self = this;
  45372. this._registerLeftClickEvent(handler, function(event2) {
  45373. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45374. if (!Cesium.defined(loc2.sLocation))
  45375. return;
  45376. let entityParam = DrawPoint.initEditPropertyParams();
  45377. _self._pointObject.addModel(loc2.sLocation, {
  45378. model: entityParam.model
  45379. }).then((entity) => {
  45380. _self._viewer.entities.add(entity);
  45381. _self._entities.push(entity.id);
  45382. entityParam = DrawPoint.initEditPropertyParams();
  45383. _self._drawEntity = entity;
  45384. _self._drawEntity.setParams(entityParam);
  45385. _self._drawEntity.setEntityType(DrawPoint.DrawType.Model);
  45386. _self._setEntityIsEdit(_self._drawEntity);
  45387. _self._clearEvent(handler);
  45388. if (options2.onComplete)
  45389. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45390. });
  45391. });
  45392. },
  45393. updateEditEntityProperty: function(params) {
  45394. if (this._editEntity === void 0)
  45395. return;
  45396. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  45397. return;
  45398. let editEntityType = this._editEntity.getEntityType();
  45399. if (editEntityType === void 0)
  45400. return;
  45401. if (editEntityType === DrawPoint.DrawType.Label) {
  45402. this._updateLabelProperty(params);
  45403. } else if (editEntityType === DrawPoint.DrawType.Point) {
  45404. this._updatePointProperty(params);
  45405. } else if (editEntityType === DrawPoint.DrawType.Point2Label) {
  45406. this._updatePoint2LabelProperty(params);
  45407. } else if (editEntityType === DrawPoint.DrawType.Billboard) {
  45408. this._updateBillboardProperty(params);
  45409. } else if (editEntityType === DrawPoint.DrawType.Billboard2Label) {
  45410. this._updateBillboard2LabelProperty(params);
  45411. } else if (editEntityType === DrawPoint.DrawType.Model) {
  45412. this._updateModelProperty(params);
  45413. }
  45414. },
  45415. _updateLabelProperty(params) {
  45416. let label2 = params.label;
  45417. this._editEntity.label.text = label2.text;
  45418. let font = "";
  45419. if (label2.italic) {
  45420. font += "italic ";
  45421. }
  45422. if (label2.bolder) {
  45423. font += " bolder ";
  45424. }
  45425. font += label2.fontSize + "px " + label2.font;
  45426. this._editEntity.label.font = font;
  45427. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45428. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45429. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45430. this._editEntity.label.showBackground = label2.showBackground;
  45431. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45432. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45433. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label2.pixelOffsetX), parseFloat(label2.pixelOffsetY));
  45434. this._editEntity.setParams(params);
  45435. },
  45436. _updatePointProperty(params) {
  45437. let point2 = params.point;
  45438. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45439. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45440. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45441. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45442. this._editEntity.setParams(params);
  45443. },
  45444. _updatePoint2LabelProperty(params) {
  45445. let label2 = params.label;
  45446. this._editEntity.label.text = label2.text;
  45447. let font = "";
  45448. if (label2.italic) {
  45449. font += "italic ";
  45450. }
  45451. if (label2.bolder) {
  45452. font += " bolder ";
  45453. }
  45454. font += label2.fontSize + "px " + label2.font;
  45455. this._editEntity.label.font = font;
  45456. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45457. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45458. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45459. this._editEntity.label.showBackground = label2.showBackground;
  45460. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45461. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45462. let point2 = params.point;
  45463. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45464. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45465. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45466. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45467. this._editEntity.setParams(params);
  45468. },
  45469. _updateBillboardProperty(params) {
  45470. let billboard = params.billboard;
  45471. this._editEntity.billboard.image = billboard.imgUrl;
  45472. this._editEntity.billboard.scale = billboard.scale;
  45473. this._editEntity.setParams(params);
  45474. },
  45475. _updateBillboard2LabelProperty(params) {
  45476. let label2 = params.label;
  45477. this._editEntity.label.text = label2.text;
  45478. let font = "";
  45479. if (label2.italic) {
  45480. font += "italic ";
  45481. }
  45482. if (label2.bolder) {
  45483. font += " bolder ";
  45484. }
  45485. font += label2.fontSize + "px " + label2.font;
  45486. this._editEntity.label.font = font;
  45487. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45488. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45489. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45490. this._editEntity.label.showBackground = label2.showBackground;
  45491. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45492. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45493. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label2.pixelOffsetX), parseFloat(label2.pixelOffsetY));
  45494. let billboard = params.billboard;
  45495. this._editEntity.billboard.image = billboard.imgUrl;
  45496. this._editEntity.billboard.scale = billboard.scale;
  45497. this._editEntity.setParams(params);
  45498. }
  45499. });
  45500. Object.assign(DrawPoint.prototype, {
  45501. _setEntityIsEdit(entity) {
  45502. let _self = this;
  45503. this._unActivateEdit();
  45504. entity.setIsEdit(true);
  45505. this._sendShowPropertyDialog(entity);
  45506. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45507. this._registerLeftClickEvent(handler, function(event2) {
  45508. _self._unActivateEdit();
  45509. let feature2 = _self._viewer.scene.pick(event2.position);
  45510. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45511. let editEntityType = feature2.id.getEntityType();
  45512. 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) {
  45513. feature2.id.setIsEdit(true);
  45514. _self._sendShowPropertyDialog(feature2.id);
  45515. }
  45516. }
  45517. });
  45518. this._registerMouseMoveEvent(handler, function(event2) {
  45519. let toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45520. let feature2 = _self._viewer.scene.pick(event2.endPosition);
  45521. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45522. let editEntityType = feature2.id.getEntityType();
  45523. 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) {
  45524. if (feature2.id.getIsEdit()) {
  45525. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45526. CreateRemindertip(toolTip, event2.endPosition, true);
  45527. } else {
  45528. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027";
  45529. CreateRemindertip(toolTip, event2.endPosition, true);
  45530. }
  45531. }
  45532. } else {
  45533. CreateRemindertip(toolTip, event2.endPosition, false);
  45534. }
  45535. });
  45536. },
  45537. _unActivateEdit: function() {
  45538. if (this._sketchEditHandler != void 0) {
  45539. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45540. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45541. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45542. }
  45543. this._editEntity = void 0;
  45544. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45545. var getById = this._viewer.entities.getById(this._entities[i2]);
  45546. if (getById) {
  45547. getById.setIsEdit(false);
  45548. }
  45549. }
  45550. this._closePropertyEditDialog();
  45551. },
  45552. _sendShowPropertyDialog(entity) {
  45553. let _self = this;
  45554. let editEntityType = entity.getEntityType();
  45555. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  45556. this._unActivateEdit();
  45557. return;
  45558. }
  45559. let editProperty = entity.getParams();
  45560. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  45561. editProperty.id = editEntityType;
  45562. _self._openPropertyEditDialog(
  45563. editProperty,
  45564. function(params) {
  45565. _self.updateEditEntityProperty(params);
  45566. },
  45567. function() {
  45568. _self._viewer.entities.remove(entity);
  45569. _self._editEntity = void 0;
  45570. }
  45571. );
  45572. }
  45573. this._activeteNormalEdit(entity);
  45574. },
  45575. _activeteNormalEdit: function(editEntity) {
  45576. let _self = this;
  45577. editEntity.getEntityType();
  45578. this._editEntity = editEntity;
  45579. if (this._sketchEditHandler === void 0) {
  45580. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45581. }
  45582. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  45583. const pickInfo = _self._viewer.scene.pick(event2.position);
  45584. console.log(pickInfo);
  45585. if (!pickInfo) {
  45586. return;
  45587. }
  45588. console.log("\u6309\u4E0B");
  45589. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  45590. _self._registerMouseMoveEvent(_self._sketchEditHandler, function(event3) {
  45591. console.log("\u79FB\u52A8");
  45592. const position2 = event3.endPosition;
  45593. const cartesian = _self._viewer.scene.globe.pick(_self._viewer.camera.getPickRay(position2), _self._viewer.scene);
  45594. const selectedEntity = _self._editEntity;
  45595. if (!selectedEntity) {
  45596. return false;
  45597. }
  45598. selectedEntity.position = cartesian;
  45599. });
  45600. _self._registerLeftUpEvent(_self._sketchEditHandler, function(event3) {
  45601. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45602. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45603. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  45604. console.log("\u62AC\u8D77");
  45605. });
  45606. });
  45607. },
  45608. _updateModelProperty(params) {
  45609. let model = params.model;
  45610. this._editEntity.model.uri = model.url;
  45611. this._editEntity.model.color = Cesium.Color.WHITE.withAlpha(model.alpha);
  45612. this._editEntity.model.minimumPixelSize = model.minimumPixelSize;
  45613. this._editEntity.model.maximumScale = model.maximumScale;
  45614. this._editEntity.model.silhouetteSize = model.silhouetteSize;
  45615. this._editEntity.model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  45616. var heading = Cesium.Math.toRadians(model.heading);
  45617. var pitch = model.pitch;
  45618. var roll = model.roll;
  45619. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  45620. this._editEntity.setParams(params);
  45621. }
  45622. });
  45623. Object.assign(DrawPoint.prototype, {
  45624. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  45625. this._editPropertyDialogDomId = "dialog-property-dom-point";
  45626. this._registerDOMPropertyEdit = "dialog-edit-property-point";
  45627. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  45628. if (PropertyEditComponent === void 0) {
  45629. PropertyEditComponent = defineCustomElement(DialogEditProperty);
  45630. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  45631. }
  45632. this._closePropertyEditDialog();
  45633. let dialogPropertyElement = new PropertyEditComponent({
  45634. params
  45635. });
  45636. dialogPropertyElement.id = this._editPropertyDialogDomId;
  45637. dialogPropertyElement.showDialog = true;
  45638. document.body.appendChild(dialogPropertyElement);
  45639. dialogPropertyElement.addEventListener(
  45640. "submit",
  45641. (e) => {
  45642. if (callEdit)
  45643. callEdit(e.detail[0]);
  45644. },
  45645. false
  45646. );
  45647. dialogPropertyElement.addEventListener(
  45648. "remove",
  45649. (e) => {
  45650. if (callRemove)
  45651. callRemove();
  45652. },
  45653. false
  45654. );
  45655. },
  45656. _closePropertyEditDialog() {
  45657. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  45658. if (dom2 !== null && dom2 !== void 0) {
  45659. document.body.removeChild(dom2);
  45660. }
  45661. }
  45662. });
  45663. DrawPoint.DrawType = Object.freeze({
  45664. Model: "model",
  45665. Label: "label",
  45666. Point: "point",
  45667. Point2Label: "point2Label",
  45668. Billboard: "billboard",
  45669. Billboard2Label: "billboard2Label"
  45670. });
  45671. var MultiFieldAdaptWindow$1 = "";
  45672. class MultiFieldAdaptWindow {
  45673. constructor(viewer2, position2, title, properties, offsetHeight) {
  45674. if (!viewer2)
  45675. throw new Cesium.DeveloperError("no viewer object!");
  45676. if (!position2)
  45677. throw new Cesium.DeveloperError("no position object!");
  45678. this.viewer = viewer2;
  45679. this.position = position2;
  45680. this.offsetHeight = offsetHeight;
  45681. if (position2 instanceof Cesium.Cartesian3) {
  45682. this.position = position2;
  45683. } else {
  45684. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  45685. }
  45686. if (document.getElementsByClassName("MultiField-popup").length > 0) {
  45687. document.getElementsByClassName("MultiField-popup")[0].remove();
  45688. viewer2.entities.remove(viewer2.entities.getById("MultiFieldPopupPoint"));
  45689. }
  45690. this.id = "popup_" + getGuid();
  45691. this.popupDiv = document.createElement("div");
  45692. this.popupDiv.classList.add("MultiField-popup");
  45693. this.popupDiv.id = this.id;
  45694. this.viewer.container.append(this.popupDiv);
  45695. this.popupDiv.innerHTML = this._createHtml(title, properties);
  45696. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  45697. this.initPoint();
  45698. document.getElementsByClassName("leaflet-popup-close-button")[0].onclick = () => {
  45699. this.close();
  45700. };
  45701. }
  45702. postRender() {
  45703. this.viewer.scene.canvas.height;
  45704. const windowPosition = new Cesium.Cartesian2();
  45705. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  45706. this.viewer.scene,
  45707. this.position,
  45708. windowPosition
  45709. );
  45710. let elWidth = this.popupDiv.offsetWidth;
  45711. let elHeight = this.popupDiv.offsetHeight;
  45712. if (!!this.offsetHeight) {
  45713. elHeight += this.offsetHeight;
  45714. }
  45715. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  45716. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  45717. const camerPosition = this.viewer.camera.position;
  45718. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  45719. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  45720. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  45721. this.popupDiv.style.display = "block";
  45722. } else {
  45723. this.popupDiv.style.display = "none";
  45724. }
  45725. }
  45726. _createHtml(header, content) {
  45727. let html = `
  45728. <div class="MultiField-popup-header">
  45729. ` + header + `
  45730. <span class="leaflet-popup-close-button">\xD7</span>
  45731. </div>
  45732. <div class="MultiField-popup-content">
  45733. ` + this._createTable(content) + `
  45734. </div>
  45735. <div class="MultiField-popup-tip">
  45736. </div>
  45737. `;
  45738. return html;
  45739. }
  45740. _createTable(content) {
  45741. let html = '<table class="table-popup">';
  45742. for (let key in content) {
  45743. html += `<tr><td class="title-popup">${key}</td>
  45744. <td class="value-popup">${content[key]}</td></tr>`;
  45745. }
  45746. html += "</table>";
  45747. return html;
  45748. }
  45749. initPoint() {
  45750. this.billboard = new Cesium.Entity({
  45751. id: "MultiFieldPopupPoint",
  45752. name: "popupPoint",
  45753. position: this.position,
  45754. billboard: {
  45755. image: "jt3dSDK/imgs/point/point.png",
  45756. horizontalOrigin: Cesium.HorizontalOrigin.center,
  45757. verticalOrigin: Cesium.VerticalOrigin.bottom,
  45758. scale: 1,
  45759. pixelOffset: new Cesium.Cartesian2(0, 0),
  45760. disableDepthTestDistance: Number.POSITIVE_INFINITY
  45761. }
  45762. });
  45763. this.viewer.entities.add(this.billboard);
  45764. }
  45765. }
  45766. Object.assign(MultiFieldAdaptWindow.prototype, {
  45767. close() {
  45768. this.popupDiv.remove();
  45769. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  45770. this.viewer.entities.remove(this.billboard);
  45771. }
  45772. });
  45773. var win;
  45774. if (typeof window !== "undefined") {
  45775. win = window;
  45776. } else if (typeof commonjsGlobal !== "undefined") {
  45777. win = commonjsGlobal;
  45778. } else if (typeof self !== "undefined") {
  45779. win = self;
  45780. } else {
  45781. win = {};
  45782. }
  45783. var window_1 = win;
  45784. var __viteBrowserExternal = {};
  45785. var __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45786. __proto__: null,
  45787. "default": __viteBrowserExternal
  45788. }, Symbol.toStringTag, { value: "Module" }));
  45789. var require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
  45790. var topLevel = typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : {};
  45791. var minDoc = require$$0;
  45792. var doccy;
  45793. if (typeof document !== "undefined") {
  45794. doccy = document;
  45795. } else {
  45796. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"];
  45797. if (!doccy) {
  45798. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"] = minDoc;
  45799. }
  45800. }
  45801. var document_1 = doccy;
  45802. var keycode$1 = { exports: {} };
  45803. (function(module2, exports2) {
  45804. function keyCode(searchInput) {
  45805. if (searchInput && "object" === typeof searchInput) {
  45806. var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode;
  45807. if (hasKeyCode)
  45808. searchInput = hasKeyCode;
  45809. }
  45810. if ("number" === typeof searchInput)
  45811. return names2[searchInput];
  45812. var search = String(searchInput);
  45813. var foundNamedKey = codes[search.toLowerCase()];
  45814. if (foundNamedKey)
  45815. return foundNamedKey;
  45816. var foundNamedKey = aliases[search.toLowerCase()];
  45817. if (foundNamedKey)
  45818. return foundNamedKey;
  45819. if (search.length === 1)
  45820. return search.charCodeAt(0);
  45821. return void 0;
  45822. }
  45823. keyCode.isEventKey = function isEventKey(event2, nameOrCode) {
  45824. if (event2 && "object" === typeof event2) {
  45825. var keyCode2 = event2.which || event2.keyCode || event2.charCode;
  45826. if (keyCode2 === null || keyCode2 === void 0) {
  45827. return false;
  45828. }
  45829. if (typeof nameOrCode === "string") {
  45830. var foundNamedKey = codes[nameOrCode.toLowerCase()];
  45831. if (foundNamedKey) {
  45832. return foundNamedKey === keyCode2;
  45833. }
  45834. var foundNamedKey = aliases[nameOrCode.toLowerCase()];
  45835. if (foundNamedKey) {
  45836. return foundNamedKey === keyCode2;
  45837. }
  45838. } else if (typeof nameOrCode === "number") {
  45839. return nameOrCode === keyCode2;
  45840. }
  45841. return false;
  45842. }
  45843. };
  45844. exports2 = module2.exports = keyCode;
  45845. var codes = exports2.code = exports2.codes = {
  45846. "backspace": 8,
  45847. "tab": 9,
  45848. "enter": 13,
  45849. "shift": 16,
  45850. "ctrl": 17,
  45851. "alt": 18,
  45852. "pause/break": 19,
  45853. "caps lock": 20,
  45854. "esc": 27,
  45855. "space": 32,
  45856. "page up": 33,
  45857. "page down": 34,
  45858. "end": 35,
  45859. "home": 36,
  45860. "left": 37,
  45861. "up": 38,
  45862. "right": 39,
  45863. "down": 40,
  45864. "insert": 45,
  45865. "delete": 46,
  45866. "command": 91,
  45867. "left command": 91,
  45868. "right command": 93,
  45869. "numpad *": 106,
  45870. "numpad +": 107,
  45871. "numpad -": 109,
  45872. "numpad .": 110,
  45873. "numpad /": 111,
  45874. "num lock": 144,
  45875. "scroll lock": 145,
  45876. "my computer": 182,
  45877. "my calculator": 183,
  45878. ";": 186,
  45879. "=": 187,
  45880. ",": 188,
  45881. "-": 189,
  45882. ".": 190,
  45883. "/": 191,
  45884. "`": 192,
  45885. "[": 219,
  45886. "\\": 220,
  45887. "]": 221,
  45888. "'": 222
  45889. };
  45890. var aliases = exports2.aliases = {
  45891. "windows": 91,
  45892. "\u21E7": 16,
  45893. "\u2325": 18,
  45894. "\u2303": 17,
  45895. "\u2318": 91,
  45896. "ctl": 17,
  45897. "control": 17,
  45898. "option": 18,
  45899. "pause": 19,
  45900. "break": 19,
  45901. "caps": 20,
  45902. "return": 13,
  45903. "escape": 27,
  45904. "spc": 32,
  45905. "spacebar": 32,
  45906. "pgup": 33,
  45907. "pgdn": 34,
  45908. "ins": 45,
  45909. "del": 46,
  45910. "cmd": 91
  45911. };
  45912. /*!
  45913. * Programatically add the following
  45914. */
  45915. for (i2 = 97; i2 < 123; i2++)
  45916. codes[String.fromCharCode(i2)] = i2 - 32;
  45917. for (var i2 = 48; i2 < 58; i2++)
  45918. codes[i2 - 48] = i2;
  45919. for (i2 = 1; i2 < 13; i2++)
  45920. codes["f" + i2] = i2 + 111;
  45921. for (i2 = 0; i2 < 10; i2++)
  45922. codes["numpad " + i2] = i2 + 96;
  45923. var names2 = exports2.names = exports2.title = {};
  45924. for (i2 in codes)
  45925. names2[codes[i2]] = i2;
  45926. for (var alias in aliases) {
  45927. codes[alias] = aliases[alias];
  45928. }
  45929. })(keycode$1, keycode$1.exports);
  45930. var keycode = keycode$1.exports;
  45931. var tuple = SafeParseTuple;
  45932. function SafeParseTuple(obj, reviver) {
  45933. var json;
  45934. var error = null;
  45935. try {
  45936. json = JSON.parse(obj, reviver);
  45937. } catch (err) {
  45938. error = err;
  45939. }
  45940. return [error, json];
  45941. }
  45942. var lib = { exports: {} };
  45943. function _extends$2() {
  45944. _extends$2 = Object.assign ? Object.assign.bind() : function(target) {
  45945. for (var i2 = 1; i2 < arguments.length; i2++) {
  45946. var source = arguments[i2];
  45947. for (var key in source) {
  45948. if (Object.prototype.hasOwnProperty.call(source, key)) {
  45949. target[key] = source[key];
  45950. }
  45951. }
  45952. }
  45953. return target;
  45954. };
  45955. return _extends$2.apply(this, arguments);
  45956. }
  45957. var _extends$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45958. __proto__: null,
  45959. "default": _extends$2
  45960. }, Symbol.toStringTag, { value: "Module" }));
  45961. var require$$1 = /* @__PURE__ */ getAugmentedNamespace(_extends$3);
  45962. var isFunction_1 = isFunction$1;
  45963. var toString$2 = Object.prototype.toString;
  45964. function isFunction$1(fn2) {
  45965. if (!fn2) {
  45966. return false;
  45967. }
  45968. var string = toString$2.call(fn2);
  45969. 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);
  45970. }
  45971. var window$3 = window_1;
  45972. var httpResponseHandler = function httpResponseHandler2(callback2, decodeResponseBody) {
  45973. if (decodeResponseBody === void 0) {
  45974. decodeResponseBody = false;
  45975. }
  45976. return function(err, response, responseBody) {
  45977. if (err) {
  45978. callback2(err);
  45979. return;
  45980. }
  45981. if (response.statusCode >= 400 && response.statusCode <= 599) {
  45982. var cause = responseBody;
  45983. if (decodeResponseBody) {
  45984. if (window$3.TextDecoder) {
  45985. var charset = getCharset(response.headers && response.headers["content-type"]);
  45986. try {
  45987. cause = new TextDecoder(charset).decode(responseBody);
  45988. } catch (e) {
  45989. }
  45990. } else {
  45991. cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));
  45992. }
  45993. }
  45994. callback2({
  45995. cause
  45996. });
  45997. return;
  45998. }
  45999. callback2(null, responseBody);
  46000. };
  46001. };
  46002. function getCharset(contentTypeHeader) {
  46003. if (contentTypeHeader === void 0) {
  46004. contentTypeHeader = "";
  46005. }
  46006. return contentTypeHeader.toLowerCase().split(";").reduce(function(charset, contentType) {
  46007. var _contentType$split = contentType.split("="), type2 = _contentType$split[0], value = _contentType$split[1];
  46008. if (type2.trim() === "charset") {
  46009. return value.trim();
  46010. }
  46011. return charset;
  46012. }, "utf-8");
  46013. }
  46014. var httpHandler = httpResponseHandler;
  46015. var window$2 = window_1;
  46016. var _extends$1 = require$$1;
  46017. var isFunction = isFunction_1;
  46018. createXHR.httpHandler = httpHandler;
  46019. /**
  46020. * @license
  46021. * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
  46022. * Copyright (c) 2014 David Björklund
  46023. * Available under the MIT license
  46024. * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
  46025. */
  46026. var parseHeaders = function parseHeaders2(headers) {
  46027. var result = {};
  46028. if (!headers) {
  46029. return result;
  46030. }
  46031. headers.trim().split("\n").forEach(function(row) {
  46032. var index2 = row.indexOf(":");
  46033. var key = row.slice(0, index2).trim().toLowerCase();
  46034. var value = row.slice(index2 + 1).trim();
  46035. if (typeof result[key] === "undefined") {
  46036. result[key] = value;
  46037. } else if (Array.isArray(result[key])) {
  46038. result[key].push(value);
  46039. } else {
  46040. result[key] = [result[key], value];
  46041. }
  46042. });
  46043. return result;
  46044. };
  46045. lib.exports = createXHR;
  46046. lib.exports.default = createXHR;
  46047. createXHR.XMLHttpRequest = window$2.XMLHttpRequest || noop$2;
  46048. createXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window$2.XDomainRequest;
  46049. forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) {
  46050. createXHR[method === "delete" ? "del" : method] = function(uri, options2, callback2) {
  46051. options2 = initParams(uri, options2, callback2);
  46052. options2.method = method.toUpperCase();
  46053. return _createXHR(options2);
  46054. };
  46055. });
  46056. function forEachArray(array, iterator) {
  46057. for (var i2 = 0; i2 < array.length; i2++) {
  46058. iterator(array[i2]);
  46059. }
  46060. }
  46061. function isEmpty(obj) {
  46062. for (var i2 in obj) {
  46063. if (obj.hasOwnProperty(i2))
  46064. return false;
  46065. }
  46066. return true;
  46067. }
  46068. function initParams(uri, options2, callback2) {
  46069. var params = uri;
  46070. if (isFunction(options2)) {
  46071. callback2 = options2;
  46072. if (typeof uri === "string") {
  46073. params = {
  46074. uri
  46075. };
  46076. }
  46077. } else {
  46078. params = _extends$1({}, options2, {
  46079. uri
  46080. });
  46081. }
  46082. params.callback = callback2;
  46083. return params;
  46084. }
  46085. function createXHR(uri, options2, callback2) {
  46086. options2 = initParams(uri, options2, callback2);
  46087. return _createXHR(options2);
  46088. }
  46089. function _createXHR(options2) {
  46090. if (typeof options2.callback === "undefined") {
  46091. throw new Error("callback argument missing");
  46092. }
  46093. var called = false;
  46094. var callback2 = function cbOnce(err, response, body2) {
  46095. if (!called) {
  46096. called = true;
  46097. options2.callback(err, response, body2);
  46098. }
  46099. };
  46100. function readystatechange() {
  46101. if (xhr.readyState === 4) {
  46102. setTimeout(loadFunc, 0);
  46103. }
  46104. }
  46105. function getBody() {
  46106. var body2 = void 0;
  46107. if (xhr.response) {
  46108. body2 = xhr.response;
  46109. } else {
  46110. body2 = xhr.responseText || getXml(xhr);
  46111. }
  46112. if (isJson) {
  46113. try {
  46114. body2 = JSON.parse(body2);
  46115. } catch (e) {
  46116. }
  46117. }
  46118. return body2;
  46119. }
  46120. function errorFunc(evt) {
  46121. clearTimeout(timeoutTimer);
  46122. if (!(evt instanceof Error)) {
  46123. evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"));
  46124. }
  46125. evt.statusCode = 0;
  46126. return callback2(evt, failureResponse);
  46127. }
  46128. function loadFunc() {
  46129. if (aborted)
  46130. return;
  46131. var status;
  46132. clearTimeout(timeoutTimer);
  46133. if (options2.useXDR && xhr.status === void 0) {
  46134. status = 200;
  46135. } else {
  46136. status = xhr.status === 1223 ? 204 : xhr.status;
  46137. }
  46138. var response = failureResponse;
  46139. var err = null;
  46140. if (status !== 0) {
  46141. response = {
  46142. body: getBody(),
  46143. statusCode: status,
  46144. method,
  46145. headers: {},
  46146. url: uri,
  46147. rawRequest: xhr
  46148. };
  46149. if (xhr.getAllResponseHeaders) {
  46150. response.headers = parseHeaders(xhr.getAllResponseHeaders());
  46151. }
  46152. } else {
  46153. err = new Error("Internal XMLHttpRequest Error");
  46154. }
  46155. return callback2(err, response, response.body);
  46156. }
  46157. var xhr = options2.xhr || null;
  46158. if (!xhr) {
  46159. if (options2.cors || options2.useXDR) {
  46160. xhr = new createXHR.XDomainRequest();
  46161. } else {
  46162. xhr = new createXHR.XMLHttpRequest();
  46163. }
  46164. }
  46165. var key;
  46166. var aborted;
  46167. var uri = xhr.url = options2.uri || options2.url;
  46168. var method = xhr.method = options2.method || "GET";
  46169. var body = options2.body || options2.data;
  46170. var headers = xhr.headers = options2.headers || {};
  46171. var sync = !!options2.sync;
  46172. var isJson = false;
  46173. var timeoutTimer;
  46174. var failureResponse = {
  46175. body: void 0,
  46176. headers: {},
  46177. statusCode: 0,
  46178. method,
  46179. url: uri,
  46180. rawRequest: xhr
  46181. };
  46182. if ("json" in options2 && options2.json !== false) {
  46183. isJson = true;
  46184. headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json");
  46185. if (method !== "GET" && method !== "HEAD") {
  46186. headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json");
  46187. body = JSON.stringify(options2.json === true ? body : options2.json);
  46188. }
  46189. }
  46190. xhr.onreadystatechange = readystatechange;
  46191. xhr.onload = loadFunc;
  46192. xhr.onerror = errorFunc;
  46193. xhr.onprogress = function() {
  46194. };
  46195. xhr.onabort = function() {
  46196. aborted = true;
  46197. };
  46198. xhr.ontimeout = errorFunc;
  46199. xhr.open(method, uri, !sync, options2.username, options2.password);
  46200. if (!sync) {
  46201. xhr.withCredentials = !!options2.withCredentials;
  46202. }
  46203. if (!sync && options2.timeout > 0) {
  46204. timeoutTimer = setTimeout(function() {
  46205. if (aborted)
  46206. return;
  46207. aborted = true;
  46208. xhr.abort("timeout");
  46209. var e = new Error("XMLHttpRequest timeout");
  46210. e.code = "ETIMEDOUT";
  46211. errorFunc(e);
  46212. }, options2.timeout);
  46213. }
  46214. if (xhr.setRequestHeader) {
  46215. for (key in headers) {
  46216. if (headers.hasOwnProperty(key)) {
  46217. xhr.setRequestHeader(key, headers[key]);
  46218. }
  46219. }
  46220. } else if (options2.headers && !isEmpty(options2.headers)) {
  46221. throw new Error("Headers cannot be set on an XDomainRequest object");
  46222. }
  46223. if ("responseType" in options2) {
  46224. xhr.responseType = options2.responseType;
  46225. }
  46226. if ("beforeSend" in options2 && typeof options2.beforeSend === "function") {
  46227. options2.beforeSend(xhr);
  46228. }
  46229. xhr.send(body || null);
  46230. return xhr;
  46231. }
  46232. function getXml(xhr) {
  46233. try {
  46234. if (xhr.responseType === "document") {
  46235. return xhr.responseXML;
  46236. }
  46237. var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";
  46238. if (xhr.responseType === "" && !firefoxBugTakenEffect) {
  46239. return xhr.responseXML;
  46240. }
  46241. } catch (e) {
  46242. }
  46243. return null;
  46244. }
  46245. function noop$2() {
  46246. }
  46247. var XHR = lib.exports;
  46248. var browserIndex = { exports: {} };
  46249. var document$1 = document_1;
  46250. var _objCreate = Object.create || function() {
  46251. function F() {
  46252. }
  46253. return function(o) {
  46254. if (arguments.length !== 1) {
  46255. throw new Error("Object.create shim only accepts one parameter.");
  46256. }
  46257. F.prototype = o;
  46258. return new F();
  46259. };
  46260. }();
  46261. function ParsingError(errorData, message) {
  46262. this.name = "ParsingError";
  46263. this.code = errorData.code;
  46264. this.message = message || errorData.message;
  46265. }
  46266. ParsingError.prototype = _objCreate(Error.prototype);
  46267. ParsingError.prototype.constructor = ParsingError;
  46268. ParsingError.Errors = {
  46269. BadSignature: {
  46270. code: 0,
  46271. message: "Malformed WebVTT signature."
  46272. },
  46273. BadTimeStamp: {
  46274. code: 1,
  46275. message: "Malformed time stamp."
  46276. }
  46277. };
  46278. function parseTimeStamp(input) {
  46279. function computeSeconds(h2, m2, s, f) {
  46280. return (h2 | 0) * 3600 + (m2 | 0) * 60 + (s | 0) + (f | 0) / 1e3;
  46281. }
  46282. var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
  46283. if (!m) {
  46284. return null;
  46285. }
  46286. if (m[3]) {
  46287. return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);
  46288. } else if (m[1] > 59) {
  46289. return computeSeconds(m[1], m[2], 0, m[4]);
  46290. } else {
  46291. return computeSeconds(0, m[1], m[2], m[4]);
  46292. }
  46293. }
  46294. function Settings() {
  46295. this.values = _objCreate(null);
  46296. }
  46297. Settings.prototype = {
  46298. set: function(k, v) {
  46299. if (!this.get(k) && v !== "") {
  46300. this.values[k] = v;
  46301. }
  46302. },
  46303. get: function(k, dflt, defaultKey) {
  46304. if (defaultKey) {
  46305. return this.has(k) ? this.values[k] : dflt[defaultKey];
  46306. }
  46307. return this.has(k) ? this.values[k] : dflt;
  46308. },
  46309. has: function(k) {
  46310. return k in this.values;
  46311. },
  46312. alt: function(k, v, a) {
  46313. for (var n = 0; n < a.length; ++n) {
  46314. if (v === a[n]) {
  46315. this.set(k, v);
  46316. break;
  46317. }
  46318. }
  46319. },
  46320. integer: function(k, v) {
  46321. if (/^-?\d+$/.test(v)) {
  46322. this.set(k, parseInt(v, 10));
  46323. }
  46324. },
  46325. percent: function(k, v) {
  46326. if (v.match(/^([\d]{1,3})(\.[\d]*)?%$/)) {
  46327. v = parseFloat(v);
  46328. if (v >= 0 && v <= 100) {
  46329. this.set(k, v);
  46330. return true;
  46331. }
  46332. }
  46333. return false;
  46334. }
  46335. };
  46336. function parseOptions(input, callback2, keyValueDelim, groupDelim) {
  46337. var groups = groupDelim ? input.split(groupDelim) : [input];
  46338. for (var i2 in groups) {
  46339. if (typeof groups[i2] !== "string") {
  46340. continue;
  46341. }
  46342. var kv = groups[i2].split(keyValueDelim);
  46343. if (kv.length !== 2) {
  46344. continue;
  46345. }
  46346. var k = kv[0].trim();
  46347. var v = kv[1].trim();
  46348. callback2(k, v);
  46349. }
  46350. }
  46351. function parseCue(input, cue, regionList) {
  46352. var oInput = input;
  46353. function consumeTimeStamp() {
  46354. var ts3 = parseTimeStamp(input);
  46355. if (ts3 === null) {
  46356. throw new ParsingError(
  46357. ParsingError.Errors.BadTimeStamp,
  46358. "Malformed timestamp: " + oInput
  46359. );
  46360. }
  46361. input = input.replace(/^[^\sa-zA-Z-]+/, "");
  46362. return ts3;
  46363. }
  46364. function consumeCueSettings(input2, cue2) {
  46365. var settings = new Settings();
  46366. parseOptions(input2, function(k, v) {
  46367. switch (k) {
  46368. case "region":
  46369. for (var i2 = regionList.length - 1; i2 >= 0; i2--) {
  46370. if (regionList[i2].id === v) {
  46371. settings.set(k, regionList[i2].region);
  46372. break;
  46373. }
  46374. }
  46375. break;
  46376. case "vertical":
  46377. settings.alt(k, v, ["rl", "lr"]);
  46378. break;
  46379. case "line":
  46380. var vals = v.split(","), vals0 = vals[0];
  46381. settings.integer(k, vals0);
  46382. settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;
  46383. settings.alt(k, vals0, ["auto"]);
  46384. if (vals.length === 2) {
  46385. settings.alt("lineAlign", vals[1], ["start", "center", "end"]);
  46386. }
  46387. break;
  46388. case "position":
  46389. vals = v.split(",");
  46390. settings.percent(k, vals[0]);
  46391. if (vals.length === 2) {
  46392. settings.alt("positionAlign", vals[1], ["start", "center", "end"]);
  46393. }
  46394. break;
  46395. case "size":
  46396. settings.percent(k, v);
  46397. break;
  46398. case "align":
  46399. settings.alt(k, v, ["start", "center", "end", "left", "right"]);
  46400. break;
  46401. }
  46402. }, /:/, /\s/);
  46403. cue2.region = settings.get("region", null);
  46404. cue2.vertical = settings.get("vertical", "");
  46405. try {
  46406. cue2.line = settings.get("line", "auto");
  46407. } catch (e) {
  46408. }
  46409. cue2.lineAlign = settings.get("lineAlign", "start");
  46410. cue2.snapToLines = settings.get("snapToLines", true);
  46411. cue2.size = settings.get("size", 100);
  46412. try {
  46413. cue2.align = settings.get("align", "center");
  46414. } catch (e) {
  46415. cue2.align = settings.get("align", "middle");
  46416. }
  46417. try {
  46418. cue2.position = settings.get("position", "auto");
  46419. } catch (e) {
  46420. cue2.position = settings.get("position", {
  46421. start: 0,
  46422. left: 0,
  46423. center: 50,
  46424. middle: 50,
  46425. end: 100,
  46426. right: 100
  46427. }, cue2.align);
  46428. }
  46429. cue2.positionAlign = settings.get("positionAlign", {
  46430. start: "start",
  46431. left: "start",
  46432. center: "center",
  46433. middle: "center",
  46434. end: "end",
  46435. right: "end"
  46436. }, cue2.align);
  46437. }
  46438. function skipWhitespace() {
  46439. input = input.replace(/^\s+/, "");
  46440. }
  46441. skipWhitespace();
  46442. cue.startTime = consumeTimeStamp();
  46443. skipWhitespace();
  46444. if (input.substr(0, 3) !== "-->") {
  46445. throw new ParsingError(
  46446. ParsingError.Errors.BadTimeStamp,
  46447. "Malformed time stamp (time stamps must be separated by '-->'): " + oInput
  46448. );
  46449. }
  46450. input = input.substr(3);
  46451. skipWhitespace();
  46452. cue.endTime = consumeTimeStamp();
  46453. skipWhitespace();
  46454. consumeCueSettings(input, cue);
  46455. }
  46456. var TEXTAREA_ELEMENT = document$1.createElement && document$1.createElement("textarea");
  46457. var TAG_NAME = {
  46458. c: "span",
  46459. i: "i",
  46460. b: "b",
  46461. u: "u",
  46462. ruby: "ruby",
  46463. rt: "rt",
  46464. v: "span",
  46465. lang: "span"
  46466. };
  46467. var DEFAULT_COLOR_CLASS = {
  46468. white: "rgba(255,255,255,1)",
  46469. lime: "rgba(0,255,0,1)",
  46470. cyan: "rgba(0,255,255,1)",
  46471. red: "rgba(255,0,0,1)",
  46472. yellow: "rgba(255,255,0,1)",
  46473. magenta: "rgba(255,0,255,1)",
  46474. blue: "rgba(0,0,255,1)",
  46475. black: "rgba(0,0,0,1)"
  46476. };
  46477. var TAG_ANNOTATION = {
  46478. v: "title",
  46479. lang: "lang"
  46480. };
  46481. var NEEDS_PARENT = {
  46482. rt: "ruby"
  46483. };
  46484. function parseContent(window2, input) {
  46485. function nextToken() {
  46486. if (!input) {
  46487. return null;
  46488. }
  46489. function consume(result) {
  46490. input = input.substr(result.length);
  46491. return result;
  46492. }
  46493. var m2 = input.match(/^([^<]*)(<[^>]*>?)?/);
  46494. return consume(m2[1] ? m2[1] : m2[2]);
  46495. }
  46496. function unescape2(s) {
  46497. TEXTAREA_ELEMENT.innerHTML = s;
  46498. s = TEXTAREA_ELEMENT.textContent;
  46499. TEXTAREA_ELEMENT.textContent = "";
  46500. return s;
  46501. }
  46502. function shouldAdd(current2, element) {
  46503. return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current2.localName;
  46504. }
  46505. function createElement(type2, annotation) {
  46506. var tagName = TAG_NAME[type2];
  46507. if (!tagName) {
  46508. return null;
  46509. }
  46510. var element = window2.document.createElement(tagName);
  46511. var name = TAG_ANNOTATION[type2];
  46512. if (name && annotation) {
  46513. element[name] = annotation.trim();
  46514. }
  46515. return element;
  46516. }
  46517. var rootDiv = window2.document.createElement("div"), current = rootDiv, t2, tagStack = [];
  46518. while ((t2 = nextToken()) !== null) {
  46519. if (t2[0] === "<") {
  46520. if (t2[1] === "/") {
  46521. if (tagStack.length && tagStack[tagStack.length - 1] === t2.substr(2).replace(">", "")) {
  46522. tagStack.pop();
  46523. current = current.parentNode;
  46524. }
  46525. continue;
  46526. }
  46527. var ts3 = parseTimeStamp(t2.substr(1, t2.length - 2));
  46528. var node;
  46529. if (ts3) {
  46530. node = window2.document.createProcessingInstruction("timestamp", ts3);
  46531. current.appendChild(node);
  46532. continue;
  46533. }
  46534. var m = t2.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
  46535. if (!m) {
  46536. continue;
  46537. }
  46538. node = createElement(m[1], m[3]);
  46539. if (!node) {
  46540. continue;
  46541. }
  46542. if (!shouldAdd(current, node)) {
  46543. continue;
  46544. }
  46545. if (m[2]) {
  46546. var classes = m[2].split(".");
  46547. classes.forEach(function(cl) {
  46548. var bgColor = /^bg_/.test(cl);
  46549. var colorName = bgColor ? cl.slice(3) : cl;
  46550. if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) {
  46551. var propName = bgColor ? "background-color" : "color";
  46552. var propValue = DEFAULT_COLOR_CLASS[colorName];
  46553. node.style[propName] = propValue;
  46554. }
  46555. });
  46556. node.className = classes.join(" ");
  46557. }
  46558. tagStack.push(m[1]);
  46559. current.appendChild(node);
  46560. current = node;
  46561. continue;
  46562. }
  46563. current.appendChild(window2.document.createTextNode(unescape2(t2)));
  46564. }
  46565. return rootDiv;
  46566. }
  46567. var strongRTLRanges = [
  46568. [1470, 1470],
  46569. [1472, 1472],
  46570. [1475, 1475],
  46571. [1478, 1478],
  46572. [1488, 1514],
  46573. [1520, 1524],
  46574. [1544, 1544],
  46575. [1547, 1547],
  46576. [1549, 1549],
  46577. [1563, 1563],
  46578. [1566, 1610],
  46579. [1645, 1647],
  46580. [1649, 1749],
  46581. [1765, 1766],
  46582. [1774, 1775],
  46583. [1786, 1805],
  46584. [1807, 1808],
  46585. [1810, 1839],
  46586. [1869, 1957],
  46587. [1969, 1969],
  46588. [1984, 2026],
  46589. [2036, 2037],
  46590. [2042, 2042],
  46591. [2048, 2069],
  46592. [2074, 2074],
  46593. [2084, 2084],
  46594. [2088, 2088],
  46595. [2096, 2110],
  46596. [2112, 2136],
  46597. [2142, 2142],
  46598. [2208, 2208],
  46599. [2210, 2220],
  46600. [8207, 8207],
  46601. [64285, 64285],
  46602. [64287, 64296],
  46603. [64298, 64310],
  46604. [64312, 64316],
  46605. [64318, 64318],
  46606. [64320, 64321],
  46607. [64323, 64324],
  46608. [64326, 64449],
  46609. [64467, 64829],
  46610. [64848, 64911],
  46611. [64914, 64967],
  46612. [65008, 65020],
  46613. [65136, 65140],
  46614. [65142, 65276],
  46615. [67584, 67589],
  46616. [67592, 67592],
  46617. [67594, 67637],
  46618. [67639, 67640],
  46619. [67644, 67644],
  46620. [67647, 67669],
  46621. [67671, 67679],
  46622. [67840, 67867],
  46623. [67872, 67897],
  46624. [67903, 67903],
  46625. [67968, 68023],
  46626. [68030, 68031],
  46627. [68096, 68096],
  46628. [68112, 68115],
  46629. [68117, 68119],
  46630. [68121, 68147],
  46631. [68160, 68167],
  46632. [68176, 68184],
  46633. [68192, 68223],
  46634. [68352, 68405],
  46635. [68416, 68437],
  46636. [68440, 68466],
  46637. [68472, 68479],
  46638. [68608, 68680],
  46639. [126464, 126467],
  46640. [126469, 126495],
  46641. [126497, 126498],
  46642. [126500, 126500],
  46643. [126503, 126503],
  46644. [126505, 126514],
  46645. [126516, 126519],
  46646. [126521, 126521],
  46647. [126523, 126523],
  46648. [126530, 126530],
  46649. [126535, 126535],
  46650. [126537, 126537],
  46651. [126539, 126539],
  46652. [126541, 126543],
  46653. [126545, 126546],
  46654. [126548, 126548],
  46655. [126551, 126551],
  46656. [126553, 126553],
  46657. [126555, 126555],
  46658. [126557, 126557],
  46659. [126559, 126559],
  46660. [126561, 126562],
  46661. [126564, 126564],
  46662. [126567, 126570],
  46663. [126572, 126578],
  46664. [126580, 126583],
  46665. [126585, 126588],
  46666. [126590, 126590],
  46667. [126592, 126601],
  46668. [126603, 126619],
  46669. [126625, 126627],
  46670. [126629, 126633],
  46671. [126635, 126651],
  46672. [1114109, 1114109]
  46673. ];
  46674. function isStrongRTLChar(charCode) {
  46675. for (var i2 = 0; i2 < strongRTLRanges.length; i2++) {
  46676. var currentRange = strongRTLRanges[i2];
  46677. if (charCode >= currentRange[0] && charCode <= currentRange[1]) {
  46678. return true;
  46679. }
  46680. }
  46681. return false;
  46682. }
  46683. function determineBidi(cueDiv) {
  46684. var nodeStack = [], text = "", charCode;
  46685. if (!cueDiv || !cueDiv.childNodes) {
  46686. return "ltr";
  46687. }
  46688. function pushNodes(nodeStack2, node) {
  46689. for (var i3 = node.childNodes.length - 1; i3 >= 0; i3--) {
  46690. nodeStack2.push(node.childNodes[i3]);
  46691. }
  46692. }
  46693. function nextTextNode(nodeStack2) {
  46694. if (!nodeStack2 || !nodeStack2.length) {
  46695. return null;
  46696. }
  46697. var node = nodeStack2.pop(), text2 = node.textContent || node.innerText;
  46698. if (text2) {
  46699. var m = text2.match(/^.*(\n|\r)/);
  46700. if (m) {
  46701. nodeStack2.length = 0;
  46702. return m[0];
  46703. }
  46704. return text2;
  46705. }
  46706. if (node.tagName === "ruby") {
  46707. return nextTextNode(nodeStack2);
  46708. }
  46709. if (node.childNodes) {
  46710. pushNodes(nodeStack2, node);
  46711. return nextTextNode(nodeStack2);
  46712. }
  46713. }
  46714. pushNodes(nodeStack, cueDiv);
  46715. while (text = nextTextNode(nodeStack)) {
  46716. for (var i2 = 0; i2 < text.length; i2++) {
  46717. charCode = text.charCodeAt(i2);
  46718. if (isStrongRTLChar(charCode)) {
  46719. return "rtl";
  46720. }
  46721. }
  46722. }
  46723. return "ltr";
  46724. }
  46725. function computeLinePos(cue) {
  46726. if (typeof cue.line === "number" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {
  46727. return cue.line;
  46728. }
  46729. if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {
  46730. return -1;
  46731. }
  46732. var track = cue.track, trackList = track.textTrackList, count = 0;
  46733. for (var i2 = 0; i2 < trackList.length && trackList[i2] !== track; i2++) {
  46734. if (trackList[i2].mode === "showing") {
  46735. count++;
  46736. }
  46737. }
  46738. return ++count * -1;
  46739. }
  46740. function StyleBox() {
  46741. }
  46742. StyleBox.prototype.applyStyles = function(styles, div) {
  46743. div = div || this.div;
  46744. for (var prop in styles) {
  46745. if (styles.hasOwnProperty(prop)) {
  46746. div.style[prop] = styles[prop];
  46747. }
  46748. }
  46749. };
  46750. StyleBox.prototype.formatStyle = function(val, unit) {
  46751. return val === 0 ? 0 : val + unit;
  46752. };
  46753. function CueStyleBox(window2, cue, styleOptions) {
  46754. StyleBox.call(this);
  46755. this.cue = cue;
  46756. this.cueDiv = parseContent(window2, cue.text);
  46757. var styles = {
  46758. color: "rgba(255, 255, 255, 1)",
  46759. backgroundColor: "rgba(0, 0, 0, 0.8)",
  46760. position: "relative",
  46761. left: 0,
  46762. right: 0,
  46763. top: 0,
  46764. bottom: 0,
  46765. display: "inline",
  46766. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46767. unicodeBidi: "plaintext"
  46768. };
  46769. this.applyStyles(styles, this.cueDiv);
  46770. this.div = window2.document.createElement("div");
  46771. styles = {
  46772. direction: determineBidi(this.cueDiv),
  46773. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46774. unicodeBidi: "plaintext",
  46775. textAlign: cue.align === "middle" ? "center" : cue.align,
  46776. font: styleOptions.font,
  46777. whiteSpace: "pre-line",
  46778. position: "absolute"
  46779. };
  46780. this.applyStyles(styles);
  46781. this.div.appendChild(this.cueDiv);
  46782. var textPos = 0;
  46783. switch (cue.positionAlign) {
  46784. case "start":
  46785. textPos = cue.position;
  46786. break;
  46787. case "center":
  46788. textPos = cue.position - cue.size / 2;
  46789. break;
  46790. case "end":
  46791. textPos = cue.position - cue.size;
  46792. break;
  46793. }
  46794. if (cue.vertical === "") {
  46795. this.applyStyles({
  46796. left: this.formatStyle(textPos, "%"),
  46797. width: this.formatStyle(cue.size, "%")
  46798. });
  46799. } else {
  46800. this.applyStyles({
  46801. top: this.formatStyle(textPos, "%"),
  46802. height: this.formatStyle(cue.size, "%")
  46803. });
  46804. }
  46805. this.move = function(box) {
  46806. this.applyStyles({
  46807. top: this.formatStyle(box.top, "px"),
  46808. bottom: this.formatStyle(box.bottom, "px"),
  46809. left: this.formatStyle(box.left, "px"),
  46810. right: this.formatStyle(box.right, "px"),
  46811. height: this.formatStyle(box.height, "px"),
  46812. width: this.formatStyle(box.width, "px")
  46813. });
  46814. };
  46815. }
  46816. CueStyleBox.prototype = _objCreate(StyleBox.prototype);
  46817. CueStyleBox.prototype.constructor = CueStyleBox;
  46818. function BoxPosition(obj) {
  46819. var lh, height2, width2, top;
  46820. if (obj.div) {
  46821. height2 = obj.div.offsetHeight;
  46822. width2 = obj.div.offsetWidth;
  46823. top = obj.div.offsetTop;
  46824. var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();
  46825. obj = obj.div.getBoundingClientRect();
  46826. lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;
  46827. }
  46828. this.left = obj.left;
  46829. this.right = obj.right;
  46830. this.top = obj.top || top;
  46831. this.height = obj.height || height2;
  46832. this.bottom = obj.bottom || top + (obj.height || height2);
  46833. this.width = obj.width || width2;
  46834. this.lineHeight = lh !== void 0 ? lh : obj.lineHeight;
  46835. }
  46836. BoxPosition.prototype.move = function(axis, toMove) {
  46837. toMove = toMove !== void 0 ? toMove : this.lineHeight;
  46838. switch (axis) {
  46839. case "+x":
  46840. this.left += toMove;
  46841. this.right += toMove;
  46842. break;
  46843. case "-x":
  46844. this.left -= toMove;
  46845. this.right -= toMove;
  46846. break;
  46847. case "+y":
  46848. this.top += toMove;
  46849. this.bottom += toMove;
  46850. break;
  46851. case "-y":
  46852. this.top -= toMove;
  46853. this.bottom -= toMove;
  46854. break;
  46855. }
  46856. };
  46857. BoxPosition.prototype.overlaps = function(b2) {
  46858. return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
  46859. };
  46860. BoxPosition.prototype.overlapsAny = function(boxes) {
  46861. for (var i2 = 0; i2 < boxes.length; i2++) {
  46862. if (this.overlaps(boxes[i2])) {
  46863. return true;
  46864. }
  46865. }
  46866. return false;
  46867. };
  46868. BoxPosition.prototype.within = function(container) {
  46869. return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;
  46870. };
  46871. BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {
  46872. switch (axis) {
  46873. case "+x":
  46874. return this.left < container.left;
  46875. case "-x":
  46876. return this.right > container.right;
  46877. case "+y":
  46878. return this.top < container.top;
  46879. case "-y":
  46880. return this.bottom > container.bottom;
  46881. }
  46882. };
  46883. BoxPosition.prototype.intersectPercentage = function(b2) {
  46884. 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;
  46885. return intersectArea / (this.height * this.width);
  46886. };
  46887. BoxPosition.prototype.toCSSCompatValues = function(reference) {
  46888. return {
  46889. top: this.top - reference.top,
  46890. bottom: reference.bottom - this.bottom,
  46891. left: this.left - reference.left,
  46892. right: reference.right - this.right,
  46893. height: this.height,
  46894. width: this.width
  46895. };
  46896. };
  46897. BoxPosition.getSimpleBoxPosition = function(obj) {
  46898. var height2 = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;
  46899. var width2 = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;
  46900. var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;
  46901. obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;
  46902. var ret = {
  46903. left: obj.left,
  46904. right: obj.right,
  46905. top: obj.top || top,
  46906. height: obj.height || height2,
  46907. bottom: obj.bottom || top + (obj.height || height2),
  46908. width: obj.width || width2
  46909. };
  46910. return ret;
  46911. };
  46912. function moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions) {
  46913. function findBestPosition(b, axis2) {
  46914. var bestPosition2, specifiedPosition = new BoxPosition(b), percentage = 1;
  46915. for (var i2 = 0; i2 < axis2.length; i2++) {
  46916. while (b.overlapsOppositeAxis(containerBox, axis2[i2]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {
  46917. b.move(axis2[i2]);
  46918. }
  46919. if (b.within(containerBox)) {
  46920. return b;
  46921. }
  46922. var p = b.intersectPercentage(containerBox);
  46923. if (percentage > p) {
  46924. bestPosition2 = new BoxPosition(b);
  46925. percentage = p;
  46926. }
  46927. b = new BoxPosition(specifiedPosition);
  46928. }
  46929. return bestPosition2 || specifiedPosition;
  46930. }
  46931. var boxPosition = new BoxPosition(styleBox), cue = styleBox.cue, linePos = computeLinePos(cue), axis = [];
  46932. if (cue.snapToLines) {
  46933. var size;
  46934. switch (cue.vertical) {
  46935. case "":
  46936. axis = ["+y", "-y"];
  46937. size = "height";
  46938. break;
  46939. case "rl":
  46940. axis = ["+x", "-x"];
  46941. size = "width";
  46942. break;
  46943. case "lr":
  46944. axis = ["-x", "+x"];
  46945. size = "width";
  46946. break;
  46947. }
  46948. var step = boxPosition.lineHeight, position2 = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis[0];
  46949. if (Math.abs(position2) > maxPosition) {
  46950. position2 = position2 < 0 ? -1 : 1;
  46951. position2 *= Math.ceil(maxPosition / step) * step;
  46952. }
  46953. if (linePos < 0) {
  46954. position2 += cue.vertical === "" ? containerBox.height : containerBox.width;
  46955. axis = axis.reverse();
  46956. }
  46957. boxPosition.move(initialAxis, position2);
  46958. } else {
  46959. var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;
  46960. switch (cue.lineAlign) {
  46961. case "center":
  46962. linePos -= calculatedPercentage / 2;
  46963. break;
  46964. case "end":
  46965. linePos -= calculatedPercentage;
  46966. break;
  46967. }
  46968. switch (cue.vertical) {
  46969. case "":
  46970. styleBox.applyStyles({
  46971. top: styleBox.formatStyle(linePos, "%")
  46972. });
  46973. break;
  46974. case "rl":
  46975. styleBox.applyStyles({
  46976. left: styleBox.formatStyle(linePos, "%")
  46977. });
  46978. break;
  46979. case "lr":
  46980. styleBox.applyStyles({
  46981. right: styleBox.formatStyle(linePos, "%")
  46982. });
  46983. break;
  46984. }
  46985. axis = ["+y", "-x", "+x", "-y"];
  46986. boxPosition = new BoxPosition(styleBox);
  46987. }
  46988. var bestPosition = findBestPosition(boxPosition, axis);
  46989. styleBox.move(bestPosition.toCSSCompatValues(containerBox));
  46990. }
  46991. function WebVTT$1() {
  46992. }
  46993. WebVTT$1.StringDecoder = function() {
  46994. return {
  46995. decode: function(data) {
  46996. if (!data) {
  46997. return "";
  46998. }
  46999. if (typeof data !== "string") {
  47000. throw new Error("Error - expected string data.");
  47001. }
  47002. return decodeURIComponent(encodeURIComponent(data));
  47003. }
  47004. };
  47005. };
  47006. WebVTT$1.convertCueToDOMTree = function(window2, cuetext) {
  47007. if (!window2 || !cuetext) {
  47008. return null;
  47009. }
  47010. return parseContent(window2, cuetext);
  47011. };
  47012. var FONT_SIZE_PERCENT = 0.05;
  47013. var FONT_STYLE = "sans-serif";
  47014. var CUE_BACKGROUND_PADDING = "1.5%";
  47015. WebVTT$1.processCues = function(window2, cues, overlay) {
  47016. if (!window2 || !cues || !overlay) {
  47017. return null;
  47018. }
  47019. while (overlay.firstChild) {
  47020. overlay.removeChild(overlay.firstChild);
  47021. }
  47022. var paddedOverlay = window2.document.createElement("div");
  47023. paddedOverlay.style.position = "absolute";
  47024. paddedOverlay.style.left = "0";
  47025. paddedOverlay.style.right = "0";
  47026. paddedOverlay.style.top = "0";
  47027. paddedOverlay.style.bottom = "0";
  47028. paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;
  47029. overlay.appendChild(paddedOverlay);
  47030. function shouldCompute(cues2) {
  47031. for (var i3 = 0; i3 < cues2.length; i3++) {
  47032. if (cues2[i3].hasBeenReset || !cues2[i3].displayState) {
  47033. return true;
  47034. }
  47035. }
  47036. return false;
  47037. }
  47038. if (!shouldCompute(cues)) {
  47039. for (var i2 = 0; i2 < cues.length; i2++) {
  47040. paddedOverlay.appendChild(cues[i2].displayState);
  47041. }
  47042. return;
  47043. }
  47044. var boxPositions = [], containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay), fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
  47045. var styleOptions = {
  47046. font: fontSize + "px " + FONT_STYLE
  47047. };
  47048. (function() {
  47049. var styleBox, cue;
  47050. for (var i3 = 0; i3 < cues.length; i3++) {
  47051. cue = cues[i3];
  47052. styleBox = new CueStyleBox(window2, cue, styleOptions);
  47053. paddedOverlay.appendChild(styleBox.div);
  47054. moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions);
  47055. cue.displayState = styleBox.div;
  47056. boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));
  47057. }
  47058. })();
  47059. };
  47060. WebVTT$1.Parser = function(window2, vttjs2, decoder) {
  47061. if (!decoder) {
  47062. decoder = vttjs2;
  47063. vttjs2 = {};
  47064. }
  47065. if (!vttjs2) {
  47066. vttjs2 = {};
  47067. }
  47068. this.window = window2;
  47069. this.vttjs = vttjs2;
  47070. this.state = "INITIAL";
  47071. this.buffer = "";
  47072. this.decoder = decoder || new TextDecoder("utf8");
  47073. this.regionList = [];
  47074. };
  47075. WebVTT$1.Parser.prototype = {
  47076. reportOrThrowError: function(e) {
  47077. if (e instanceof ParsingError) {
  47078. this.onparsingerror && this.onparsingerror(e);
  47079. } else {
  47080. throw e;
  47081. }
  47082. },
  47083. parse: function(data) {
  47084. var self2 = this;
  47085. if (data) {
  47086. self2.buffer += self2.decoder.decode(data, { stream: true });
  47087. }
  47088. function collectNextLine() {
  47089. var buffer = self2.buffer;
  47090. var pos = 0;
  47091. while (pos < buffer.length && buffer[pos] !== "\r" && buffer[pos] !== "\n") {
  47092. ++pos;
  47093. }
  47094. var line2 = buffer.substr(0, pos);
  47095. if (buffer[pos] === "\r") {
  47096. ++pos;
  47097. }
  47098. if (buffer[pos] === "\n") {
  47099. ++pos;
  47100. }
  47101. self2.buffer = buffer.substr(pos);
  47102. return line2;
  47103. }
  47104. function parseRegion(input) {
  47105. var settings = new Settings();
  47106. parseOptions(input, function(k, v) {
  47107. switch (k) {
  47108. case "id":
  47109. settings.set(k, v);
  47110. break;
  47111. case "width":
  47112. settings.percent(k, v);
  47113. break;
  47114. case "lines":
  47115. settings.integer(k, v);
  47116. break;
  47117. case "regionanchor":
  47118. case "viewportanchor":
  47119. var xy = v.split(",");
  47120. if (xy.length !== 2) {
  47121. break;
  47122. }
  47123. var anchor = new Settings();
  47124. anchor.percent("x", xy[0]);
  47125. anchor.percent("y", xy[1]);
  47126. if (!anchor.has("x") || !anchor.has("y")) {
  47127. break;
  47128. }
  47129. settings.set(k + "X", anchor.get("x"));
  47130. settings.set(k + "Y", anchor.get("y"));
  47131. break;
  47132. case "scroll":
  47133. settings.alt(k, v, ["up"]);
  47134. break;
  47135. }
  47136. }, /=/, /\s/);
  47137. if (settings.has("id")) {
  47138. var region = new (self2.vttjs.VTTRegion || self2.window.VTTRegion)();
  47139. region.width = settings.get("width", 100);
  47140. region.lines = settings.get("lines", 3);
  47141. region.regionAnchorX = settings.get("regionanchorX", 0);
  47142. region.regionAnchorY = settings.get("regionanchorY", 100);
  47143. region.viewportAnchorX = settings.get("viewportanchorX", 0);
  47144. region.viewportAnchorY = settings.get("viewportanchorY", 100);
  47145. region.scroll = settings.get("scroll", "");
  47146. self2.onregion && self2.onregion(region);
  47147. self2.regionList.push({
  47148. id: settings.get("id"),
  47149. region
  47150. });
  47151. }
  47152. }
  47153. function parseTimestampMap(input) {
  47154. var settings = new Settings();
  47155. parseOptions(input, function(k, v) {
  47156. switch (k) {
  47157. case "MPEGT":
  47158. settings.integer(k + "S", v);
  47159. break;
  47160. case "LOCA":
  47161. settings.set(k + "L", parseTimeStamp(v));
  47162. break;
  47163. }
  47164. }, /[^\d]:/, /,/);
  47165. self2.ontimestampmap && self2.ontimestampmap({
  47166. "MPEGTS": settings.get("MPEGTS"),
  47167. "LOCAL": settings.get("LOCAL")
  47168. });
  47169. }
  47170. function parseHeader(input) {
  47171. if (input.match(/X-TIMESTAMP-MAP/)) {
  47172. parseOptions(input, function(k, v) {
  47173. switch (k) {
  47174. case "X-TIMESTAMP-MAP":
  47175. parseTimestampMap(v);
  47176. break;
  47177. }
  47178. }, /=/);
  47179. } else {
  47180. parseOptions(input, function(k, v) {
  47181. switch (k) {
  47182. case "Region":
  47183. parseRegion(v);
  47184. break;
  47185. }
  47186. }, /:/);
  47187. }
  47188. }
  47189. try {
  47190. var line;
  47191. if (self2.state === "INITIAL") {
  47192. if (!/\r\n|\n/.test(self2.buffer)) {
  47193. return this;
  47194. }
  47195. line = collectNextLine();
  47196. var m = line.match(/^WEBVTT([ \t].*)?$/);
  47197. if (!m || !m[0]) {
  47198. throw new ParsingError(ParsingError.Errors.BadSignature);
  47199. }
  47200. self2.state = "HEADER";
  47201. }
  47202. var alreadyCollectedLine = false;
  47203. while (self2.buffer) {
  47204. if (!/\r\n|\n/.test(self2.buffer)) {
  47205. return this;
  47206. }
  47207. if (!alreadyCollectedLine) {
  47208. line = collectNextLine();
  47209. } else {
  47210. alreadyCollectedLine = false;
  47211. }
  47212. switch (self2.state) {
  47213. case "HEADER":
  47214. if (/:/.test(line)) {
  47215. parseHeader(line);
  47216. } else if (!line) {
  47217. self2.state = "ID";
  47218. }
  47219. continue;
  47220. case "NOTE":
  47221. if (!line) {
  47222. self2.state = "ID";
  47223. }
  47224. continue;
  47225. case "ID":
  47226. if (/^NOTE($|[ \t])/.test(line)) {
  47227. self2.state = "NOTE";
  47228. break;
  47229. }
  47230. if (!line) {
  47231. continue;
  47232. }
  47233. self2.cue = new (self2.vttjs.VTTCue || self2.window.VTTCue)(0, 0, "");
  47234. try {
  47235. self2.cue.align = "center";
  47236. } catch (e) {
  47237. self2.cue.align = "middle";
  47238. }
  47239. self2.state = "CUE";
  47240. if (line.indexOf("-->") === -1) {
  47241. self2.cue.id = line;
  47242. continue;
  47243. }
  47244. case "CUE":
  47245. try {
  47246. parseCue(line, self2.cue, self2.regionList);
  47247. } catch (e) {
  47248. self2.reportOrThrowError(e);
  47249. self2.cue = null;
  47250. self2.state = "BADCUE";
  47251. continue;
  47252. }
  47253. self2.state = "CUETEXT";
  47254. continue;
  47255. case "CUETEXT":
  47256. var hasSubstring = line.indexOf("-->") !== -1;
  47257. if (!line || hasSubstring && (alreadyCollectedLine = true)) {
  47258. self2.oncue && self2.oncue(self2.cue);
  47259. self2.cue = null;
  47260. self2.state = "ID";
  47261. continue;
  47262. }
  47263. if (self2.cue.text) {
  47264. self2.cue.text += "\n";
  47265. }
  47266. self2.cue.text += line.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
  47267. continue;
  47268. case "BADCUE":
  47269. if (!line) {
  47270. self2.state = "ID";
  47271. }
  47272. continue;
  47273. }
  47274. }
  47275. } catch (e) {
  47276. self2.reportOrThrowError(e);
  47277. if (self2.state === "CUETEXT" && self2.cue && self2.oncue) {
  47278. self2.oncue(self2.cue);
  47279. }
  47280. self2.cue = null;
  47281. self2.state = self2.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
  47282. }
  47283. return this;
  47284. },
  47285. flush: function() {
  47286. var self2 = this;
  47287. try {
  47288. self2.buffer += self2.decoder.decode();
  47289. if (self2.cue || self2.state === "HEADER") {
  47290. self2.buffer += "\n\n";
  47291. self2.parse();
  47292. }
  47293. if (self2.state === "INITIAL") {
  47294. throw new ParsingError(ParsingError.Errors.BadSignature);
  47295. }
  47296. } catch (e) {
  47297. self2.reportOrThrowError(e);
  47298. }
  47299. self2.onflush && self2.onflush();
  47300. return this;
  47301. }
  47302. };
  47303. var vtt$1 = WebVTT$1;
  47304. var autoKeyword = "auto";
  47305. var directionSetting = {
  47306. "": 1,
  47307. "lr": 1,
  47308. "rl": 1
  47309. };
  47310. var alignSetting = {
  47311. "start": 1,
  47312. "center": 1,
  47313. "end": 1,
  47314. "left": 1,
  47315. "right": 1,
  47316. "auto": 1,
  47317. "line-left": 1,
  47318. "line-right": 1
  47319. };
  47320. function findDirectionSetting(value) {
  47321. if (typeof value !== "string") {
  47322. return false;
  47323. }
  47324. var dir = directionSetting[value.toLowerCase()];
  47325. return dir ? value.toLowerCase() : false;
  47326. }
  47327. function findAlignSetting(value) {
  47328. if (typeof value !== "string") {
  47329. return false;
  47330. }
  47331. var align = alignSetting[value.toLowerCase()];
  47332. return align ? value.toLowerCase() : false;
  47333. }
  47334. function VTTCue(startTime, endTime, text) {
  47335. this.hasBeenReset = false;
  47336. var _id = "";
  47337. var _pauseOnExit = false;
  47338. var _startTime = startTime;
  47339. var _endTime = endTime;
  47340. var _text = text;
  47341. var _region = null;
  47342. var _vertical = "";
  47343. var _snapToLines = true;
  47344. var _line = "auto";
  47345. var _lineAlign = "start";
  47346. var _position = "auto";
  47347. var _positionAlign = "auto";
  47348. var _size = 100;
  47349. var _align = "center";
  47350. Object.defineProperties(this, {
  47351. "id": {
  47352. enumerable: true,
  47353. get: function() {
  47354. return _id;
  47355. },
  47356. set: function(value) {
  47357. _id = "" + value;
  47358. }
  47359. },
  47360. "pauseOnExit": {
  47361. enumerable: true,
  47362. get: function() {
  47363. return _pauseOnExit;
  47364. },
  47365. set: function(value) {
  47366. _pauseOnExit = !!value;
  47367. }
  47368. },
  47369. "startTime": {
  47370. enumerable: true,
  47371. get: function() {
  47372. return _startTime;
  47373. },
  47374. set: function(value) {
  47375. if (typeof value !== "number") {
  47376. throw new TypeError("Start time must be set to a number.");
  47377. }
  47378. _startTime = value;
  47379. this.hasBeenReset = true;
  47380. }
  47381. },
  47382. "endTime": {
  47383. enumerable: true,
  47384. get: function() {
  47385. return _endTime;
  47386. },
  47387. set: function(value) {
  47388. if (typeof value !== "number") {
  47389. throw new TypeError("End time must be set to a number.");
  47390. }
  47391. _endTime = value;
  47392. this.hasBeenReset = true;
  47393. }
  47394. },
  47395. "text": {
  47396. enumerable: true,
  47397. get: function() {
  47398. return _text;
  47399. },
  47400. set: function(value) {
  47401. _text = "" + value;
  47402. this.hasBeenReset = true;
  47403. }
  47404. },
  47405. "region": {
  47406. enumerable: true,
  47407. get: function() {
  47408. return _region;
  47409. },
  47410. set: function(value) {
  47411. _region = value;
  47412. this.hasBeenReset = true;
  47413. }
  47414. },
  47415. "vertical": {
  47416. enumerable: true,
  47417. get: function() {
  47418. return _vertical;
  47419. },
  47420. set: function(value) {
  47421. var setting = findDirectionSetting(value);
  47422. if (setting === false) {
  47423. throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
  47424. }
  47425. _vertical = setting;
  47426. this.hasBeenReset = true;
  47427. }
  47428. },
  47429. "snapToLines": {
  47430. enumerable: true,
  47431. get: function() {
  47432. return _snapToLines;
  47433. },
  47434. set: function(value) {
  47435. _snapToLines = !!value;
  47436. this.hasBeenReset = true;
  47437. }
  47438. },
  47439. "line": {
  47440. enumerable: true,
  47441. get: function() {
  47442. return _line;
  47443. },
  47444. set: function(value) {
  47445. if (typeof value !== "number" && value !== autoKeyword) {
  47446. throw new SyntaxError("Line: an invalid number or illegal string was specified.");
  47447. }
  47448. _line = value;
  47449. this.hasBeenReset = true;
  47450. }
  47451. },
  47452. "lineAlign": {
  47453. enumerable: true,
  47454. get: function() {
  47455. return _lineAlign;
  47456. },
  47457. set: function(value) {
  47458. var setting = findAlignSetting(value);
  47459. if (!setting) {
  47460. console.warn("lineAlign: an invalid or illegal string was specified.");
  47461. } else {
  47462. _lineAlign = setting;
  47463. this.hasBeenReset = true;
  47464. }
  47465. }
  47466. },
  47467. "position": {
  47468. enumerable: true,
  47469. get: function() {
  47470. return _position;
  47471. },
  47472. set: function(value) {
  47473. if (value < 0 || value > 100) {
  47474. throw new Error("Position must be between 0 and 100.");
  47475. }
  47476. _position = value;
  47477. this.hasBeenReset = true;
  47478. }
  47479. },
  47480. "positionAlign": {
  47481. enumerable: true,
  47482. get: function() {
  47483. return _positionAlign;
  47484. },
  47485. set: function(value) {
  47486. var setting = findAlignSetting(value);
  47487. if (!setting) {
  47488. console.warn("positionAlign: an invalid or illegal string was specified.");
  47489. } else {
  47490. _positionAlign = setting;
  47491. this.hasBeenReset = true;
  47492. }
  47493. }
  47494. },
  47495. "size": {
  47496. enumerable: true,
  47497. get: function() {
  47498. return _size;
  47499. },
  47500. set: function(value) {
  47501. if (value < 0 || value > 100) {
  47502. throw new Error("Size must be between 0 and 100.");
  47503. }
  47504. _size = value;
  47505. this.hasBeenReset = true;
  47506. }
  47507. },
  47508. "align": {
  47509. enumerable: true,
  47510. get: function() {
  47511. return _align;
  47512. },
  47513. set: function(value) {
  47514. var setting = findAlignSetting(value);
  47515. if (!setting) {
  47516. throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
  47517. }
  47518. _align = setting;
  47519. this.hasBeenReset = true;
  47520. }
  47521. }
  47522. });
  47523. this.displayState = void 0;
  47524. }
  47525. VTTCue.prototype.getCueAsHTML = function() {
  47526. return WebVTT.convertCueToDOMTree(window, this.text);
  47527. };
  47528. var vttcue = VTTCue;
  47529. var scrollSetting = {
  47530. "": true,
  47531. "up": true
  47532. };
  47533. function findScrollSetting(value) {
  47534. if (typeof value !== "string") {
  47535. return false;
  47536. }
  47537. var scroll = scrollSetting[value.toLowerCase()];
  47538. return scroll ? value.toLowerCase() : false;
  47539. }
  47540. function isValidPercentValue(value) {
  47541. return typeof value === "number" && (value >= 0 && value <= 100);
  47542. }
  47543. function VTTRegion() {
  47544. var _width = 100;
  47545. var _lines = 3;
  47546. var _regionAnchorX = 0;
  47547. var _regionAnchorY = 100;
  47548. var _viewportAnchorX = 0;
  47549. var _viewportAnchorY = 100;
  47550. var _scroll = "";
  47551. Object.defineProperties(this, {
  47552. "width": {
  47553. enumerable: true,
  47554. get: function() {
  47555. return _width;
  47556. },
  47557. set: function(value) {
  47558. if (!isValidPercentValue(value)) {
  47559. throw new Error("Width must be between 0 and 100.");
  47560. }
  47561. _width = value;
  47562. }
  47563. },
  47564. "lines": {
  47565. enumerable: true,
  47566. get: function() {
  47567. return _lines;
  47568. },
  47569. set: function(value) {
  47570. if (typeof value !== "number") {
  47571. throw new TypeError("Lines must be set to a number.");
  47572. }
  47573. _lines = value;
  47574. }
  47575. },
  47576. "regionAnchorY": {
  47577. enumerable: true,
  47578. get: function() {
  47579. return _regionAnchorY;
  47580. },
  47581. set: function(value) {
  47582. if (!isValidPercentValue(value)) {
  47583. throw new Error("RegionAnchorX must be between 0 and 100.");
  47584. }
  47585. _regionAnchorY = value;
  47586. }
  47587. },
  47588. "regionAnchorX": {
  47589. enumerable: true,
  47590. get: function() {
  47591. return _regionAnchorX;
  47592. },
  47593. set: function(value) {
  47594. if (!isValidPercentValue(value)) {
  47595. throw new Error("RegionAnchorY must be between 0 and 100.");
  47596. }
  47597. _regionAnchorX = value;
  47598. }
  47599. },
  47600. "viewportAnchorY": {
  47601. enumerable: true,
  47602. get: function() {
  47603. return _viewportAnchorY;
  47604. },
  47605. set: function(value) {
  47606. if (!isValidPercentValue(value)) {
  47607. throw new Error("ViewportAnchorY must be between 0 and 100.");
  47608. }
  47609. _viewportAnchorY = value;
  47610. }
  47611. },
  47612. "viewportAnchorX": {
  47613. enumerable: true,
  47614. get: function() {
  47615. return _viewportAnchorX;
  47616. },
  47617. set: function(value) {
  47618. if (!isValidPercentValue(value)) {
  47619. throw new Error("ViewportAnchorX must be between 0 and 100.");
  47620. }
  47621. _viewportAnchorX = value;
  47622. }
  47623. },
  47624. "scroll": {
  47625. enumerable: true,
  47626. get: function() {
  47627. return _scroll;
  47628. },
  47629. set: function(value) {
  47630. var setting = findScrollSetting(value);
  47631. if (setting === false) {
  47632. console.warn("Scroll: an invalid or illegal string was specified.");
  47633. } else {
  47634. _scroll = setting;
  47635. }
  47636. }
  47637. }
  47638. });
  47639. }
  47640. var vttregion = VTTRegion;
  47641. var window$1 = window_1;
  47642. var vttjs = browserIndex.exports = {
  47643. WebVTT: vtt$1,
  47644. VTTCue: vttcue,
  47645. VTTRegion: vttregion
  47646. };
  47647. window$1.vttjs = vttjs;
  47648. window$1.WebVTT = vttjs.WebVTT;
  47649. var cueShim = vttjs.VTTCue;
  47650. var regionShim = vttjs.VTTRegion;
  47651. var nativeVTTCue = window$1.VTTCue;
  47652. var nativeVTTRegion = window$1.VTTRegion;
  47653. vttjs.shim = function() {
  47654. window$1.VTTCue = cueShim;
  47655. window$1.VTTRegion = regionShim;
  47656. };
  47657. vttjs.restore = function() {
  47658. window$1.VTTCue = nativeVTTCue;
  47659. window$1.VTTRegion = nativeVTTRegion;
  47660. };
  47661. if (!window$1.VTTCue) {
  47662. vttjs.shim();
  47663. }
  47664. var vtt = browserIndex.exports;
  47665. var urlToolkit = { exports: {} };
  47666. (function(module2, exports2) {
  47667. (function(root2) {
  47668. var URL_REGEX = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;
  47669. var FIRST_SEGMENT_REGEX = /^(?=([^\/?#]*))\1([^]*)$/;
  47670. var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
  47671. var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;
  47672. var URLToolkit2 = {
  47673. buildAbsoluteURL: function(baseURL, relativeURL, opts) {
  47674. opts = opts || {};
  47675. baseURL = baseURL.trim();
  47676. relativeURL = relativeURL.trim();
  47677. if (!relativeURL) {
  47678. if (!opts.alwaysNormalize) {
  47679. return baseURL;
  47680. }
  47681. var basePartsForNormalise = URLToolkit2.parseURL(baseURL);
  47682. if (!basePartsForNormalise) {
  47683. throw new Error("Error trying to parse base URL.");
  47684. }
  47685. basePartsForNormalise.path = URLToolkit2.normalizePath(
  47686. basePartsForNormalise.path
  47687. );
  47688. return URLToolkit2.buildURLFromParts(basePartsForNormalise);
  47689. }
  47690. var relativeParts = URLToolkit2.parseURL(relativeURL);
  47691. if (!relativeParts) {
  47692. throw new Error("Error trying to parse relative URL.");
  47693. }
  47694. if (relativeParts.scheme) {
  47695. if (!opts.alwaysNormalize) {
  47696. return relativeURL;
  47697. }
  47698. relativeParts.path = URLToolkit2.normalizePath(relativeParts.path);
  47699. return URLToolkit2.buildURLFromParts(relativeParts);
  47700. }
  47701. var baseParts = URLToolkit2.parseURL(baseURL);
  47702. if (!baseParts) {
  47703. throw new Error("Error trying to parse base URL.");
  47704. }
  47705. if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== "/") {
  47706. var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);
  47707. baseParts.netLoc = pathParts[1];
  47708. baseParts.path = pathParts[2];
  47709. }
  47710. if (baseParts.netLoc && !baseParts.path) {
  47711. baseParts.path = "/";
  47712. }
  47713. var builtParts = {
  47714. scheme: baseParts.scheme,
  47715. netLoc: relativeParts.netLoc,
  47716. path: null,
  47717. params: relativeParts.params,
  47718. query: relativeParts.query,
  47719. fragment: relativeParts.fragment
  47720. };
  47721. if (!relativeParts.netLoc) {
  47722. builtParts.netLoc = baseParts.netLoc;
  47723. if (relativeParts.path[0] !== "/") {
  47724. if (!relativeParts.path) {
  47725. builtParts.path = baseParts.path;
  47726. if (!relativeParts.params) {
  47727. builtParts.params = baseParts.params;
  47728. if (!relativeParts.query) {
  47729. builtParts.query = baseParts.query;
  47730. }
  47731. }
  47732. } else {
  47733. var baseURLPath = baseParts.path;
  47734. var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf("/") + 1) + relativeParts.path;
  47735. builtParts.path = URLToolkit2.normalizePath(newPath);
  47736. }
  47737. }
  47738. }
  47739. if (builtParts.path === null) {
  47740. builtParts.path = opts.alwaysNormalize ? URLToolkit2.normalizePath(relativeParts.path) : relativeParts.path;
  47741. }
  47742. return URLToolkit2.buildURLFromParts(builtParts);
  47743. },
  47744. parseURL: function(url) {
  47745. var parts = URL_REGEX.exec(url);
  47746. if (!parts) {
  47747. return null;
  47748. }
  47749. return {
  47750. scheme: parts[1] || "",
  47751. netLoc: parts[2] || "",
  47752. path: parts[3] || "",
  47753. params: parts[4] || "",
  47754. query: parts[5] || "",
  47755. fragment: parts[6] || ""
  47756. };
  47757. },
  47758. normalizePath: function(path) {
  47759. path = path.split("").reverse().join("").replace(SLASH_DOT_REGEX, "");
  47760. while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, "")).length) {
  47761. }
  47762. return path.split("").reverse().join("");
  47763. },
  47764. buildURLFromParts: function(parts) {
  47765. return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;
  47766. }
  47767. };
  47768. module2.exports = URLToolkit2;
  47769. })();
  47770. })(urlToolkit);
  47771. var URLToolkit = urlToolkit.exports;
  47772. var DEFAULT_LOCATION$2 = "http://example.com";
  47773. var resolveUrl$4 = function resolveUrl(baseUrl, relativeUrl) {
  47774. if (/^[a-z]+:/i.test(relativeUrl)) {
  47775. return relativeUrl;
  47776. }
  47777. if (/^data:/.test(baseUrl)) {
  47778. baseUrl = window_1.location && window_1.location.href || "";
  47779. }
  47780. var nativeURL = typeof window_1.URL === "function";
  47781. var protocolLess = /^\/\//.test(baseUrl);
  47782. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  47783. if (nativeURL) {
  47784. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$2);
  47785. } else if (!/\/\//i.test(baseUrl)) {
  47786. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  47787. }
  47788. if (nativeURL) {
  47789. var newUrl = new URL(relativeUrl, baseUrl);
  47790. if (removeLocation) {
  47791. return newUrl.href.slice(DEFAULT_LOCATION$2.length);
  47792. } else if (protocolLess) {
  47793. return newUrl.href.slice(newUrl.protocol.length);
  47794. }
  47795. return newUrl.href;
  47796. }
  47797. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  47798. };
  47799. var Stream$1 = /* @__PURE__ */ function() {
  47800. function Stream2() {
  47801. this.listeners = {};
  47802. }
  47803. var _proto = Stream2.prototype;
  47804. _proto.on = function on3(type2, listener) {
  47805. if (!this.listeners[type2]) {
  47806. this.listeners[type2] = [];
  47807. }
  47808. this.listeners[type2].push(listener);
  47809. };
  47810. _proto.off = function off2(type2, listener) {
  47811. if (!this.listeners[type2]) {
  47812. return false;
  47813. }
  47814. var index2 = this.listeners[type2].indexOf(listener);
  47815. this.listeners[type2] = this.listeners[type2].slice(0);
  47816. this.listeners[type2].splice(index2, 1);
  47817. return index2 > -1;
  47818. };
  47819. _proto.trigger = function trigger2(type2) {
  47820. var callbacks = this.listeners[type2];
  47821. if (!callbacks) {
  47822. return;
  47823. }
  47824. if (arguments.length === 2) {
  47825. var length = callbacks.length;
  47826. for (var i2 = 0; i2 < length; ++i2) {
  47827. callbacks[i2].call(this, arguments[1]);
  47828. }
  47829. } else {
  47830. var args = Array.prototype.slice.call(arguments, 1);
  47831. var _length = callbacks.length;
  47832. for (var _i = 0; _i < _length; ++_i) {
  47833. callbacks[_i].apply(this, args);
  47834. }
  47835. }
  47836. };
  47837. _proto.dispose = function dispose() {
  47838. this.listeners = {};
  47839. };
  47840. _proto.pipe = function pipe(destination2) {
  47841. this.on("data", function(data) {
  47842. destination2.push(data);
  47843. });
  47844. };
  47845. return Stream2;
  47846. }();
  47847. var atob$2 = function atob(s) {
  47848. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  47849. };
  47850. function decodeB64ToUint8Array$2(b64Text) {
  47851. var decodedString = atob$2(b64Text);
  47852. var array = new Uint8Array(decodedString.length);
  47853. for (var i2 = 0; i2 < decodedString.length; i2++) {
  47854. array[i2] = decodedString.charCodeAt(i2);
  47855. }
  47856. return array;
  47857. }
  47858. /*! @name m3u8-parser @version 6.1.0 @license Apache-2.0 */
  47859. class LineStream$1 extends Stream$1 {
  47860. constructor() {
  47861. super();
  47862. this.buffer = "";
  47863. }
  47864. push(data) {
  47865. let nextNewline;
  47866. this.buffer += data;
  47867. nextNewline = this.buffer.indexOf("\n");
  47868. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  47869. this.trigger("data", this.buffer.substring(0, nextNewline));
  47870. this.buffer = this.buffer.substring(nextNewline + 1);
  47871. }
  47872. }
  47873. }
  47874. const TAB$1 = String.fromCharCode(9);
  47875. const parseByterange$1 = function(byterangeString) {
  47876. const match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  47877. const result = {};
  47878. if (match[1]) {
  47879. result.length = parseInt(match[1], 10);
  47880. }
  47881. if (match[2]) {
  47882. result.offset = parseInt(match[2], 10);
  47883. }
  47884. return result;
  47885. };
  47886. const attributeSeparator$1 = function() {
  47887. const key = "[^=]*";
  47888. const value = '"[^"]*"|[^,]*';
  47889. const keyvalue = "(?:" + key + ")=(?:" + value + ")";
  47890. return new RegExp("(?:^|,)(" + keyvalue + ")");
  47891. };
  47892. const parseAttributes$3 = function(attributes) {
  47893. const result = {};
  47894. if (!attributes) {
  47895. return result;
  47896. }
  47897. const attrs = attributes.split(attributeSeparator$1());
  47898. let i2 = attrs.length;
  47899. let attr;
  47900. while (i2--) {
  47901. if (attrs[i2] === "") {
  47902. continue;
  47903. }
  47904. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  47905. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  47906. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  47907. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  47908. result[attr[0]] = attr[1];
  47909. }
  47910. return result;
  47911. };
  47912. class ParseStream$1 extends Stream$1 {
  47913. constructor() {
  47914. super();
  47915. this.customParsers = [];
  47916. this.tagMappers = [];
  47917. }
  47918. push(line) {
  47919. let match;
  47920. let event2;
  47921. line = line.trim();
  47922. if (line.length === 0) {
  47923. return;
  47924. }
  47925. if (line[0] !== "#") {
  47926. this.trigger("data", {
  47927. type: "uri",
  47928. uri: line
  47929. });
  47930. return;
  47931. }
  47932. const newLines = this.tagMappers.reduce((acc, mapper) => {
  47933. const mappedLine = mapper(line);
  47934. if (mappedLine === line) {
  47935. return acc;
  47936. }
  47937. return acc.concat([mappedLine]);
  47938. }, [line]);
  47939. newLines.forEach((newLine) => {
  47940. for (let i2 = 0; i2 < this.customParsers.length; i2++) {
  47941. if (this.customParsers[i2].call(this, newLine)) {
  47942. return;
  47943. }
  47944. }
  47945. if (newLine.indexOf("#EXT") !== 0) {
  47946. this.trigger("data", {
  47947. type: "comment",
  47948. text: newLine.slice(1)
  47949. });
  47950. return;
  47951. }
  47952. newLine = newLine.replace("\r", "");
  47953. match = /^#EXTM3U/.exec(newLine);
  47954. if (match) {
  47955. this.trigger("data", {
  47956. type: "tag",
  47957. tagType: "m3u"
  47958. });
  47959. return;
  47960. }
  47961. match = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(newLine);
  47962. if (match) {
  47963. event2 = {
  47964. type: "tag",
  47965. tagType: "inf"
  47966. };
  47967. if (match[1]) {
  47968. event2.duration = parseFloat(match[1]);
  47969. }
  47970. if (match[2]) {
  47971. event2.title = match[2];
  47972. }
  47973. this.trigger("data", event2);
  47974. return;
  47975. }
  47976. match = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(newLine);
  47977. if (match) {
  47978. event2 = {
  47979. type: "tag",
  47980. tagType: "targetduration"
  47981. };
  47982. if (match[1]) {
  47983. event2.duration = parseInt(match[1], 10);
  47984. }
  47985. this.trigger("data", event2);
  47986. return;
  47987. }
  47988. match = /^#EXT-X-VERSION:([0-9.]*)?/.exec(newLine);
  47989. if (match) {
  47990. event2 = {
  47991. type: "tag",
  47992. tagType: "version"
  47993. };
  47994. if (match[1]) {
  47995. event2.version = parseInt(match[1], 10);
  47996. }
  47997. this.trigger("data", event2);
  47998. return;
  47999. }
  48000. match = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  48001. if (match) {
  48002. event2 = {
  48003. type: "tag",
  48004. tagType: "media-sequence"
  48005. };
  48006. if (match[1]) {
  48007. event2.number = parseInt(match[1], 10);
  48008. }
  48009. this.trigger("data", event2);
  48010. return;
  48011. }
  48012. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  48013. if (match) {
  48014. event2 = {
  48015. type: "tag",
  48016. tagType: "discontinuity-sequence"
  48017. };
  48018. if (match[1]) {
  48019. event2.number = parseInt(match[1], 10);
  48020. }
  48021. this.trigger("data", event2);
  48022. return;
  48023. }
  48024. match = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(newLine);
  48025. if (match) {
  48026. event2 = {
  48027. type: "tag",
  48028. tagType: "playlist-type"
  48029. };
  48030. if (match[1]) {
  48031. event2.playlistType = match[1];
  48032. }
  48033. this.trigger("data", event2);
  48034. return;
  48035. }
  48036. match = /^#EXT-X-BYTERANGE:(.*)?$/.exec(newLine);
  48037. if (match) {
  48038. event2 = _extends$2(parseByterange$1(match[1]), {
  48039. type: "tag",
  48040. tagType: "byterange"
  48041. });
  48042. this.trigger("data", event2);
  48043. return;
  48044. }
  48045. match = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(newLine);
  48046. if (match) {
  48047. event2 = {
  48048. type: "tag",
  48049. tagType: "allow-cache"
  48050. };
  48051. if (match[1]) {
  48052. event2.allowed = !/NO/.test(match[1]);
  48053. }
  48054. this.trigger("data", event2);
  48055. return;
  48056. }
  48057. match = /^#EXT-X-MAP:(.*)$/.exec(newLine);
  48058. if (match) {
  48059. event2 = {
  48060. type: "tag",
  48061. tagType: "map"
  48062. };
  48063. if (match[1]) {
  48064. const attributes = parseAttributes$3(match[1]);
  48065. if (attributes.URI) {
  48066. event2.uri = attributes.URI;
  48067. }
  48068. if (attributes.BYTERANGE) {
  48069. event2.byterange = parseByterange$1(attributes.BYTERANGE);
  48070. }
  48071. }
  48072. this.trigger("data", event2);
  48073. return;
  48074. }
  48075. match = /^#EXT-X-STREAM-INF:(.*)$/.exec(newLine);
  48076. if (match) {
  48077. event2 = {
  48078. type: "tag",
  48079. tagType: "stream-inf"
  48080. };
  48081. if (match[1]) {
  48082. event2.attributes = parseAttributes$3(match[1]);
  48083. if (event2.attributes.RESOLUTION) {
  48084. const split2 = event2.attributes.RESOLUTION.split("x");
  48085. const resolution = {};
  48086. if (split2[0]) {
  48087. resolution.width = parseInt(split2[0], 10);
  48088. }
  48089. if (split2[1]) {
  48090. resolution.height = parseInt(split2[1], 10);
  48091. }
  48092. event2.attributes.RESOLUTION = resolution;
  48093. }
  48094. if (event2.attributes.BANDWIDTH) {
  48095. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  48096. }
  48097. if (event2.attributes["FRAME-RATE"]) {
  48098. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  48099. }
  48100. if (event2.attributes["PROGRAM-ID"]) {
  48101. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  48102. }
  48103. }
  48104. this.trigger("data", event2);
  48105. return;
  48106. }
  48107. match = /^#EXT-X-MEDIA:(.*)$/.exec(newLine);
  48108. if (match) {
  48109. event2 = {
  48110. type: "tag",
  48111. tagType: "media"
  48112. };
  48113. if (match[1]) {
  48114. event2.attributes = parseAttributes$3(match[1]);
  48115. }
  48116. this.trigger("data", event2);
  48117. return;
  48118. }
  48119. match = /^#EXT-X-ENDLIST/.exec(newLine);
  48120. if (match) {
  48121. this.trigger("data", {
  48122. type: "tag",
  48123. tagType: "endlist"
  48124. });
  48125. return;
  48126. }
  48127. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  48128. if (match) {
  48129. this.trigger("data", {
  48130. type: "tag",
  48131. tagType: "discontinuity"
  48132. });
  48133. return;
  48134. }
  48135. match = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(newLine);
  48136. if (match) {
  48137. event2 = {
  48138. type: "tag",
  48139. tagType: "program-date-time"
  48140. };
  48141. if (match[1]) {
  48142. event2.dateTimeString = match[1];
  48143. event2.dateTimeObject = new Date(match[1]);
  48144. }
  48145. this.trigger("data", event2);
  48146. return;
  48147. }
  48148. match = /^#EXT-X-KEY:(.*)$/.exec(newLine);
  48149. if (match) {
  48150. event2 = {
  48151. type: "tag",
  48152. tagType: "key"
  48153. };
  48154. if (match[1]) {
  48155. event2.attributes = parseAttributes$3(match[1]);
  48156. if (event2.attributes.IV) {
  48157. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  48158. event2.attributes.IV = event2.attributes.IV.substring(2);
  48159. }
  48160. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  48161. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  48162. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  48163. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  48164. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  48165. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  48166. }
  48167. }
  48168. this.trigger("data", event2);
  48169. return;
  48170. }
  48171. match = /^#EXT-X-START:(.*)$/.exec(newLine);
  48172. if (match) {
  48173. event2 = {
  48174. type: "tag",
  48175. tagType: "start"
  48176. };
  48177. if (match[1]) {
  48178. event2.attributes = parseAttributes$3(match[1]);
  48179. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  48180. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  48181. }
  48182. this.trigger("data", event2);
  48183. return;
  48184. }
  48185. match = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(newLine);
  48186. if (match) {
  48187. event2 = {
  48188. type: "tag",
  48189. tagType: "cue-out-cont"
  48190. };
  48191. if (match[1]) {
  48192. event2.data = match[1];
  48193. } else {
  48194. event2.data = "";
  48195. }
  48196. this.trigger("data", event2);
  48197. return;
  48198. }
  48199. match = /^#EXT-X-CUE-OUT:(.*)?$/.exec(newLine);
  48200. if (match) {
  48201. event2 = {
  48202. type: "tag",
  48203. tagType: "cue-out"
  48204. };
  48205. if (match[1]) {
  48206. event2.data = match[1];
  48207. } else {
  48208. event2.data = "";
  48209. }
  48210. this.trigger("data", event2);
  48211. return;
  48212. }
  48213. match = /^#EXT-X-CUE-IN:(.*)?$/.exec(newLine);
  48214. if (match) {
  48215. event2 = {
  48216. type: "tag",
  48217. tagType: "cue-in"
  48218. };
  48219. if (match[1]) {
  48220. event2.data = match[1];
  48221. } else {
  48222. event2.data = "";
  48223. }
  48224. this.trigger("data", event2);
  48225. return;
  48226. }
  48227. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  48228. if (match && match[1]) {
  48229. event2 = {
  48230. type: "tag",
  48231. tagType: "skip"
  48232. };
  48233. event2.attributes = parseAttributes$3(match[1]);
  48234. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  48235. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  48236. }
  48237. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  48238. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB$1);
  48239. }
  48240. this.trigger("data", event2);
  48241. return;
  48242. }
  48243. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  48244. if (match && match[1]) {
  48245. event2 = {
  48246. type: "tag",
  48247. tagType: "part"
  48248. };
  48249. event2.attributes = parseAttributes$3(match[1]);
  48250. ["DURATION"].forEach(function(key) {
  48251. if (event2.attributes.hasOwnProperty(key)) {
  48252. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48253. }
  48254. });
  48255. ["INDEPENDENT", "GAP"].forEach(function(key) {
  48256. if (event2.attributes.hasOwnProperty(key)) {
  48257. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48258. }
  48259. });
  48260. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  48261. event2.attributes.byterange = parseByterange$1(event2.attributes.BYTERANGE);
  48262. }
  48263. this.trigger("data", event2);
  48264. return;
  48265. }
  48266. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  48267. if (match && match[1]) {
  48268. event2 = {
  48269. type: "tag",
  48270. tagType: "server-control"
  48271. };
  48272. event2.attributes = parseAttributes$3(match[1]);
  48273. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  48274. if (event2.attributes.hasOwnProperty(key)) {
  48275. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48276. }
  48277. });
  48278. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  48279. if (event2.attributes.hasOwnProperty(key)) {
  48280. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48281. }
  48282. });
  48283. this.trigger("data", event2);
  48284. return;
  48285. }
  48286. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  48287. if (match && match[1]) {
  48288. event2 = {
  48289. type: "tag",
  48290. tagType: "part-inf"
  48291. };
  48292. event2.attributes = parseAttributes$3(match[1]);
  48293. ["PART-TARGET"].forEach(function(key) {
  48294. if (event2.attributes.hasOwnProperty(key)) {
  48295. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48296. }
  48297. });
  48298. this.trigger("data", event2);
  48299. return;
  48300. }
  48301. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  48302. if (match && match[1]) {
  48303. event2 = {
  48304. type: "tag",
  48305. tagType: "preload-hint"
  48306. };
  48307. event2.attributes = parseAttributes$3(match[1]);
  48308. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  48309. if (event2.attributes.hasOwnProperty(key)) {
  48310. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48311. const subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  48312. event2.attributes.byterange = event2.attributes.byterange || {};
  48313. event2.attributes.byterange[subkey] = event2.attributes[key];
  48314. delete event2.attributes[key];
  48315. }
  48316. });
  48317. this.trigger("data", event2);
  48318. return;
  48319. }
  48320. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  48321. if (match && match[1]) {
  48322. event2 = {
  48323. type: "tag",
  48324. tagType: "rendition-report"
  48325. };
  48326. event2.attributes = parseAttributes$3(match[1]);
  48327. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  48328. if (event2.attributes.hasOwnProperty(key)) {
  48329. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48330. }
  48331. });
  48332. this.trigger("data", event2);
  48333. return;
  48334. }
  48335. match = /^#EXT-X-DATERANGE:(.*)$/.exec(newLine);
  48336. if (match && match[1]) {
  48337. event2 = {
  48338. type: "tag",
  48339. tagType: "daterange"
  48340. };
  48341. event2.attributes = parseAttributes$3(match[1]);
  48342. ["ID", "CLASS"].forEach(function(key) {
  48343. if (event2.attributes.hasOwnProperty(key)) {
  48344. event2.attributes[key] = String(event2.attributes[key]);
  48345. }
  48346. });
  48347. ["START-DATE", "END-DATE"].forEach(function(key) {
  48348. if (event2.attributes.hasOwnProperty(key)) {
  48349. event2.attributes[key] = new Date(event2.attributes[key]);
  48350. }
  48351. });
  48352. ["DURATION", "PLANNED-DURATION"].forEach(function(key) {
  48353. if (event2.attributes.hasOwnProperty(key)) {
  48354. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48355. }
  48356. });
  48357. ["END-ON-NEXT"].forEach(function(key) {
  48358. if (event2.attributes.hasOwnProperty(key)) {
  48359. event2.attributes[key] = /YES/i.test(event2.attributes[key]);
  48360. }
  48361. });
  48362. ["SCTE35-CMD", " SCTE35-OUT", "SCTE35-IN"].forEach(function(key) {
  48363. if (event2.attributes.hasOwnProperty(key)) {
  48364. event2.attributes[key] = event2.attributes[key].toString(16);
  48365. }
  48366. });
  48367. const clientAttributePattern = /^X-([A-Z]+-)+[A-Z]+$/;
  48368. for (const key in event2.attributes) {
  48369. if (!clientAttributePattern.test(key)) {
  48370. continue;
  48371. }
  48372. const isHexaDecimal = /[0-9A-Fa-f]{6}/g.test(event2.attributes[key]);
  48373. const isDecimalFloating = /^\d+(\.\d+)?$/.test(event2.attributes[key]);
  48374. event2.attributes[key] = isHexaDecimal ? event2.attributes[key].toString(16) : isDecimalFloating ? parseFloat(event2.attributes[key]) : String(event2.attributes[key]);
  48375. }
  48376. this.trigger("data", event2);
  48377. return;
  48378. }
  48379. this.trigger("data", {
  48380. type: "tag",
  48381. data: newLine.slice(4)
  48382. });
  48383. });
  48384. }
  48385. addParser({
  48386. expression,
  48387. customType,
  48388. dataParser,
  48389. segment
  48390. }) {
  48391. if (typeof dataParser !== "function") {
  48392. dataParser = (line) => line;
  48393. }
  48394. this.customParsers.push((line) => {
  48395. const match = expression.exec(line);
  48396. if (match) {
  48397. this.trigger("data", {
  48398. type: "custom",
  48399. data: dataParser(line),
  48400. customType,
  48401. segment
  48402. });
  48403. return true;
  48404. }
  48405. });
  48406. }
  48407. addTagMapper({
  48408. expression,
  48409. map
  48410. }) {
  48411. const mapFn = (line) => {
  48412. if (expression.test(line)) {
  48413. return map(line);
  48414. }
  48415. return line;
  48416. };
  48417. this.tagMappers.push(mapFn);
  48418. }
  48419. }
  48420. const camelCase$1 = (str) => str.toLowerCase().replace(/-(\w)/g, (a) => a[1].toUpperCase());
  48421. const camelCaseKeys$1 = function(attributes) {
  48422. const result = {};
  48423. Object.keys(attributes).forEach(function(key) {
  48424. result[camelCase$1(key)] = attributes[key];
  48425. });
  48426. return result;
  48427. };
  48428. const setHoldBack$1 = function(manifest) {
  48429. const {
  48430. serverControl,
  48431. targetDuration,
  48432. partTargetDuration
  48433. } = manifest;
  48434. if (!serverControl) {
  48435. return;
  48436. }
  48437. const tag = "#EXT-X-SERVER-CONTROL";
  48438. const hb = "holdBack";
  48439. const phb = "partHoldBack";
  48440. const minTargetDuration = targetDuration && targetDuration * 3;
  48441. const minPartDuration = partTargetDuration && partTargetDuration * 2;
  48442. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  48443. serverControl[hb] = minTargetDuration;
  48444. this.trigger("info", {
  48445. message: `${tag} defaulting HOLD-BACK to targetDuration * 3 (${minTargetDuration}).`
  48446. });
  48447. }
  48448. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  48449. this.trigger("warn", {
  48450. message: `${tag} clamping HOLD-BACK (${serverControl[hb]}) to targetDuration * 3 (${minTargetDuration})`
  48451. });
  48452. serverControl[hb] = minTargetDuration;
  48453. }
  48454. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  48455. serverControl[phb] = partTargetDuration * 3;
  48456. this.trigger("info", {
  48457. message: `${tag} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${serverControl[phb]}).`
  48458. });
  48459. }
  48460. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  48461. this.trigger("warn", {
  48462. message: `${tag} clamping PART-HOLD-BACK (${serverControl[phb]}) to partTargetDuration * 2 (${minPartDuration}).`
  48463. });
  48464. serverControl[phb] = minPartDuration;
  48465. }
  48466. };
  48467. class Parser$1 extends Stream$1 {
  48468. constructor() {
  48469. super();
  48470. this.lineStream = new LineStream$1();
  48471. this.parseStream = new ParseStream$1();
  48472. this.lineStream.pipe(this.parseStream);
  48473. const self2 = this;
  48474. const uris = [];
  48475. let currentUri = {};
  48476. let currentMap;
  48477. let key;
  48478. let hasParts = false;
  48479. const noop2 = function() {
  48480. };
  48481. const defaultMediaGroups = {
  48482. "AUDIO": {},
  48483. "VIDEO": {},
  48484. "CLOSED-CAPTIONS": {},
  48485. "SUBTITLES": {}
  48486. };
  48487. const widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  48488. let currentTimeline = 0;
  48489. this.manifest = {
  48490. allowCache: true,
  48491. discontinuityStarts: [],
  48492. segments: []
  48493. };
  48494. let lastByterangeEnd = 0;
  48495. let lastPartByterangeEnd = 0;
  48496. const daterangeTags = {};
  48497. this.on("end", () => {
  48498. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  48499. return;
  48500. }
  48501. if (!currentUri.map && currentMap) {
  48502. currentUri.map = currentMap;
  48503. }
  48504. if (!currentUri.key && key) {
  48505. currentUri.key = key;
  48506. }
  48507. if (!currentUri.timeline && typeof currentTimeline === "number") {
  48508. currentUri.timeline = currentTimeline;
  48509. }
  48510. this.manifest.preloadSegment = currentUri;
  48511. });
  48512. this.parseStream.on("data", function(entry) {
  48513. let mediaGroup;
  48514. let rendition;
  48515. ({
  48516. tag() {
  48517. ({
  48518. version() {
  48519. if (entry.version) {
  48520. this.manifest.version = entry.version;
  48521. }
  48522. },
  48523. "allow-cache"() {
  48524. this.manifest.allowCache = entry.allowed;
  48525. if (!("allowed" in entry)) {
  48526. this.trigger("info", {
  48527. message: "defaulting allowCache to YES"
  48528. });
  48529. this.manifest.allowCache = true;
  48530. }
  48531. },
  48532. byterange() {
  48533. const byterange = {};
  48534. if ("length" in entry) {
  48535. currentUri.byterange = byterange;
  48536. byterange.length = entry.length;
  48537. if (!("offset" in entry)) {
  48538. entry.offset = lastByterangeEnd;
  48539. }
  48540. }
  48541. if ("offset" in entry) {
  48542. currentUri.byterange = byterange;
  48543. byterange.offset = entry.offset;
  48544. }
  48545. lastByterangeEnd = byterange.offset + byterange.length;
  48546. },
  48547. endlist() {
  48548. this.manifest.endList = true;
  48549. },
  48550. inf() {
  48551. if (!("mediaSequence" in this.manifest)) {
  48552. this.manifest.mediaSequence = 0;
  48553. this.trigger("info", {
  48554. message: "defaulting media sequence to zero"
  48555. });
  48556. }
  48557. if (!("discontinuitySequence" in this.manifest)) {
  48558. this.manifest.discontinuitySequence = 0;
  48559. this.trigger("info", {
  48560. message: "defaulting discontinuity sequence to zero"
  48561. });
  48562. }
  48563. if (entry.duration > 0) {
  48564. currentUri.duration = entry.duration;
  48565. }
  48566. if (entry.duration === 0) {
  48567. currentUri.duration = 0.01;
  48568. this.trigger("info", {
  48569. message: "updating zero segment duration to a small value"
  48570. });
  48571. }
  48572. this.manifest.segments = uris;
  48573. },
  48574. key() {
  48575. if (!entry.attributes) {
  48576. this.trigger("warn", {
  48577. message: "ignoring key declaration without attribute list"
  48578. });
  48579. return;
  48580. }
  48581. if (entry.attributes.METHOD === "NONE") {
  48582. key = null;
  48583. return;
  48584. }
  48585. if (!entry.attributes.URI) {
  48586. this.trigger("warn", {
  48587. message: "ignoring key declaration without URI"
  48588. });
  48589. return;
  48590. }
  48591. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  48592. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48593. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  48594. attributes: entry.attributes
  48595. };
  48596. return;
  48597. }
  48598. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  48599. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48600. this.manifest.contentProtection["com.microsoft.playready"] = {
  48601. uri: entry.attributes.URI
  48602. };
  48603. return;
  48604. }
  48605. if (entry.attributes.KEYFORMAT === widevineUuid) {
  48606. const VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  48607. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  48608. this.trigger("warn", {
  48609. message: "invalid key method provided for Widevine"
  48610. });
  48611. return;
  48612. }
  48613. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  48614. this.trigger("warn", {
  48615. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  48616. });
  48617. }
  48618. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  48619. this.trigger("warn", {
  48620. message: "invalid key URI provided for Widevine"
  48621. });
  48622. return;
  48623. }
  48624. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  48625. this.trigger("warn", {
  48626. message: "invalid key ID provided for Widevine"
  48627. });
  48628. return;
  48629. }
  48630. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48631. this.manifest.contentProtection["com.widevine.alpha"] = {
  48632. attributes: {
  48633. schemeIdUri: entry.attributes.KEYFORMAT,
  48634. keyId: entry.attributes.KEYID.substring(2)
  48635. },
  48636. pssh: decodeB64ToUint8Array$2(entry.attributes.URI.split(",")[1])
  48637. };
  48638. return;
  48639. }
  48640. if (!entry.attributes.METHOD) {
  48641. this.trigger("warn", {
  48642. message: "defaulting key method to AES-128"
  48643. });
  48644. }
  48645. key = {
  48646. method: entry.attributes.METHOD || "AES-128",
  48647. uri: entry.attributes.URI
  48648. };
  48649. if (typeof entry.attributes.IV !== "undefined") {
  48650. key.iv = entry.attributes.IV;
  48651. }
  48652. },
  48653. "media-sequence"() {
  48654. if (!isFinite(entry.number)) {
  48655. this.trigger("warn", {
  48656. message: "ignoring invalid media sequence: " + entry.number
  48657. });
  48658. return;
  48659. }
  48660. this.manifest.mediaSequence = entry.number;
  48661. },
  48662. "discontinuity-sequence"() {
  48663. if (!isFinite(entry.number)) {
  48664. this.trigger("warn", {
  48665. message: "ignoring invalid discontinuity sequence: " + entry.number
  48666. });
  48667. return;
  48668. }
  48669. this.manifest.discontinuitySequence = entry.number;
  48670. currentTimeline = entry.number;
  48671. },
  48672. "playlist-type"() {
  48673. if (!/VOD|EVENT/.test(entry.playlistType)) {
  48674. this.trigger("warn", {
  48675. message: "ignoring unknown playlist type: " + entry.playlist
  48676. });
  48677. return;
  48678. }
  48679. this.manifest.playlistType = entry.playlistType;
  48680. },
  48681. map() {
  48682. currentMap = {};
  48683. if (entry.uri) {
  48684. currentMap.uri = entry.uri;
  48685. }
  48686. if (entry.byterange) {
  48687. currentMap.byterange = entry.byterange;
  48688. }
  48689. if (key) {
  48690. currentMap.key = key;
  48691. }
  48692. },
  48693. "stream-inf"() {
  48694. this.manifest.playlists = uris;
  48695. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48696. if (!entry.attributes) {
  48697. this.trigger("warn", {
  48698. message: "ignoring empty stream-inf attributes"
  48699. });
  48700. return;
  48701. }
  48702. if (!currentUri.attributes) {
  48703. currentUri.attributes = {};
  48704. }
  48705. _extends$2(currentUri.attributes, entry.attributes);
  48706. },
  48707. media() {
  48708. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48709. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  48710. this.trigger("warn", {
  48711. message: "ignoring incomplete or missing media group"
  48712. });
  48713. return;
  48714. }
  48715. const mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  48716. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  48717. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  48718. rendition = {
  48719. default: /yes/i.test(entry.attributes.DEFAULT)
  48720. };
  48721. if (rendition.default) {
  48722. rendition.autoselect = true;
  48723. } else {
  48724. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  48725. }
  48726. if (entry.attributes.LANGUAGE) {
  48727. rendition.language = entry.attributes.LANGUAGE;
  48728. }
  48729. if (entry.attributes.URI) {
  48730. rendition.uri = entry.attributes.URI;
  48731. }
  48732. if (entry.attributes["INSTREAM-ID"]) {
  48733. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  48734. }
  48735. if (entry.attributes.CHARACTERISTICS) {
  48736. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  48737. }
  48738. if (entry.attributes.FORCED) {
  48739. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  48740. }
  48741. mediaGroup[entry.attributes.NAME] = rendition;
  48742. },
  48743. discontinuity() {
  48744. currentTimeline += 1;
  48745. currentUri.discontinuity = true;
  48746. this.manifest.discontinuityStarts.push(uris.length);
  48747. },
  48748. "program-date-time"() {
  48749. if (typeof this.manifest.dateTimeString === "undefined") {
  48750. this.manifest.dateTimeString = entry.dateTimeString;
  48751. this.manifest.dateTimeObject = entry.dateTimeObject;
  48752. }
  48753. currentUri.dateTimeString = entry.dateTimeString;
  48754. currentUri.dateTimeObject = entry.dateTimeObject;
  48755. },
  48756. targetduration() {
  48757. if (!isFinite(entry.duration) || entry.duration < 0) {
  48758. this.trigger("warn", {
  48759. message: "ignoring invalid target duration: " + entry.duration
  48760. });
  48761. return;
  48762. }
  48763. this.manifest.targetDuration = entry.duration;
  48764. setHoldBack$1.call(this, this.manifest);
  48765. },
  48766. start() {
  48767. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  48768. this.trigger("warn", {
  48769. message: "ignoring start declaration without appropriate attribute list"
  48770. });
  48771. return;
  48772. }
  48773. this.manifest.start = {
  48774. timeOffset: entry.attributes["TIME-OFFSET"],
  48775. precise: entry.attributes.PRECISE
  48776. };
  48777. },
  48778. "cue-out"() {
  48779. currentUri.cueOut = entry.data;
  48780. },
  48781. "cue-out-cont"() {
  48782. currentUri.cueOutCont = entry.data;
  48783. },
  48784. "cue-in"() {
  48785. currentUri.cueIn = entry.data;
  48786. },
  48787. "skip"() {
  48788. this.manifest.skip = camelCaseKeys$1(entry.attributes);
  48789. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  48790. },
  48791. "part"() {
  48792. hasParts = true;
  48793. const segmentIndex = this.manifest.segments.length;
  48794. const part = camelCaseKeys$1(entry.attributes);
  48795. currentUri.parts = currentUri.parts || [];
  48796. currentUri.parts.push(part);
  48797. if (part.byterange) {
  48798. if (!part.byterange.hasOwnProperty("offset")) {
  48799. part.byterange.offset = lastPartByterangeEnd;
  48800. }
  48801. lastPartByterangeEnd = part.byterange.offset + part.byterange.length;
  48802. }
  48803. const partIndex = currentUri.parts.length - 1;
  48804. this.warnOnMissingAttributes_(`#EXT-X-PART #${partIndex} for segment #${segmentIndex}`, entry.attributes, ["URI", "DURATION"]);
  48805. if (this.manifest.renditionReports) {
  48806. this.manifest.renditionReports.forEach((r2, i2) => {
  48807. if (!r2.hasOwnProperty("lastPart")) {
  48808. this.trigger("warn", {
  48809. message: `#EXT-X-RENDITION-REPORT #${i2} lacks required attribute(s): LAST-PART`
  48810. });
  48811. }
  48812. });
  48813. }
  48814. },
  48815. "server-control"() {
  48816. const attrs = this.manifest.serverControl = camelCaseKeys$1(entry.attributes);
  48817. if (!attrs.hasOwnProperty("canBlockReload")) {
  48818. attrs.canBlockReload = false;
  48819. this.trigger("info", {
  48820. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  48821. });
  48822. }
  48823. setHoldBack$1.call(this, this.manifest);
  48824. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  48825. this.trigger("warn", {
  48826. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  48827. });
  48828. }
  48829. },
  48830. "preload-hint"() {
  48831. const segmentIndex = this.manifest.segments.length;
  48832. const hint = camelCaseKeys$1(entry.attributes);
  48833. const isPart = hint.type && hint.type === "PART";
  48834. currentUri.preloadHints = currentUri.preloadHints || [];
  48835. currentUri.preloadHints.push(hint);
  48836. if (hint.byterange) {
  48837. if (!hint.byterange.hasOwnProperty("offset")) {
  48838. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  48839. if (isPart) {
  48840. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  48841. }
  48842. }
  48843. }
  48844. const index2 = currentUri.preloadHints.length - 1;
  48845. this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex}`, entry.attributes, ["TYPE", "URI"]);
  48846. if (!hint.type) {
  48847. return;
  48848. }
  48849. for (let i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  48850. const otherHint = currentUri.preloadHints[i2];
  48851. if (!otherHint.type) {
  48852. continue;
  48853. }
  48854. if (otherHint.type === hint.type) {
  48855. this.trigger("warn", {
  48856. message: `#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex} has the same TYPE ${hint.type} as preload hint #${i2}`
  48857. });
  48858. }
  48859. }
  48860. },
  48861. "rendition-report"() {
  48862. const report = camelCaseKeys$1(entry.attributes);
  48863. this.manifest.renditionReports = this.manifest.renditionReports || [];
  48864. this.manifest.renditionReports.push(report);
  48865. const index2 = this.manifest.renditionReports.length - 1;
  48866. const required = ["LAST-MSN", "URI"];
  48867. if (hasParts) {
  48868. required.push("LAST-PART");
  48869. }
  48870. this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${index2}`, entry.attributes, required);
  48871. },
  48872. "part-inf"() {
  48873. this.manifest.partInf = camelCaseKeys$1(entry.attributes);
  48874. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  48875. if (this.manifest.partInf.partTarget) {
  48876. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  48877. }
  48878. setHoldBack$1.call(this, this.manifest);
  48879. },
  48880. "daterange"() {
  48881. this.manifest.daterange = this.manifest.daterange || [];
  48882. this.manifest.daterange.push(camelCaseKeys$1(entry.attributes));
  48883. const index2 = this.manifest.daterange.length - 1;
  48884. this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${index2}`, entry.attributes, ["ID", "START-DATE"]);
  48885. const daterange = this.manifest.daterange[index2];
  48886. if (daterange.endDate && daterange.startDate && new Date(daterange.endDate) < new Date(daterange.startDate)) {
  48887. this.trigger("warn", {
  48888. message: "EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"
  48889. });
  48890. }
  48891. if (daterange.duration && daterange.duration < 0) {
  48892. this.trigger("warn", {
  48893. message: "EXT-X-DATERANGE DURATION must not be negative"
  48894. });
  48895. }
  48896. if (daterange.plannedDuration && daterange.plannedDuration < 0) {
  48897. this.trigger("warn", {
  48898. message: "EXT-X-DATERANGE PLANNED-DURATION must not be negative"
  48899. });
  48900. }
  48901. const endOnNextYes = !!daterange.endOnNext;
  48902. if (endOnNextYes && !daterange.class) {
  48903. this.trigger("warn", {
  48904. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"
  48905. });
  48906. }
  48907. if (endOnNextYes && (daterange.duration || daterange.endDate)) {
  48908. this.trigger("warn", {
  48909. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"
  48910. });
  48911. }
  48912. if (daterange.duration && daterange.endDate) {
  48913. const startDate = daterange.startDate;
  48914. const newDateInSeconds = startDate.setSeconds(startDate.getSeconds() + daterange.duration);
  48915. this.manifest.daterange[index2].endDate = new Date(newDateInSeconds);
  48916. }
  48917. if (daterange && !this.manifest.dateTimeString) {
  48918. this.trigger("warn", {
  48919. message: "A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"
  48920. });
  48921. }
  48922. if (!daterangeTags[daterange.id]) {
  48923. daterangeTags[daterange.id] = daterange;
  48924. } else {
  48925. for (const attribute in daterangeTags[daterange.id]) {
  48926. if (daterangeTags[daterange.id][attribute] !== daterange[attribute]) {
  48927. this.trigger("warn", {
  48928. message: "EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes and same attribute values"
  48929. });
  48930. break;
  48931. }
  48932. }
  48933. }
  48934. }
  48935. }[entry.tagType] || noop2).call(self2);
  48936. },
  48937. uri() {
  48938. currentUri.uri = entry.uri;
  48939. uris.push(currentUri);
  48940. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  48941. this.trigger("warn", {
  48942. message: "defaulting segment duration to the target duration"
  48943. });
  48944. currentUri.duration = this.manifest.targetDuration;
  48945. }
  48946. if (key) {
  48947. currentUri.key = key;
  48948. }
  48949. currentUri.timeline = currentTimeline;
  48950. if (currentMap) {
  48951. currentUri.map = currentMap;
  48952. }
  48953. lastPartByterangeEnd = 0;
  48954. currentUri = {};
  48955. },
  48956. comment() {
  48957. },
  48958. custom() {
  48959. if (entry.segment) {
  48960. currentUri.custom = currentUri.custom || {};
  48961. currentUri.custom[entry.customType] = entry.data;
  48962. } else {
  48963. this.manifest.custom = this.manifest.custom || {};
  48964. this.manifest.custom[entry.customType] = entry.data;
  48965. }
  48966. }
  48967. })[entry.type].call(self2);
  48968. });
  48969. }
  48970. warnOnMissingAttributes_(identifier, attributes, required) {
  48971. const missing = [];
  48972. required.forEach(function(key) {
  48973. if (!attributes.hasOwnProperty(key)) {
  48974. missing.push(key);
  48975. }
  48976. });
  48977. if (missing.length) {
  48978. this.trigger("warn", {
  48979. message: `${identifier} lacks required attribute(s): ${missing.join(", ")}`
  48980. });
  48981. }
  48982. }
  48983. push(chunk) {
  48984. this.lineStream.push(chunk);
  48985. }
  48986. end() {
  48987. this.lineStream.push("\n");
  48988. this.trigger("end");
  48989. }
  48990. addParser(options2) {
  48991. this.parseStream.addParser(options2);
  48992. }
  48993. addTagMapper(options2) {
  48994. this.parseStream.addTagMapper(options2);
  48995. }
  48996. }
  48997. var regexs$1 = {
  48998. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  48999. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  49000. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  49001. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  49002. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  49003. text: /^(stpp.ttml.im1t)/,
  49004. muxerVideo: /^(avc0?1)/,
  49005. muxerAudio: /^(mp4a)/,
  49006. muxerText: /a^/
  49007. };
  49008. var mediaTypes$1 = ["video", "audio", "text"];
  49009. var upperMediaTypes$1 = ["Video", "Audio", "Text"];
  49010. var translateLegacyCodec$1 = function translateLegacyCodec(codec) {
  49011. if (!codec) {
  49012. return codec;
  49013. }
  49014. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  49015. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  49016. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  49017. return "avc1." + profileHex + "00" + avcLevelHex;
  49018. });
  49019. };
  49020. var parseCodecs$1 = function parseCodecs(codecString) {
  49021. if (codecString === void 0) {
  49022. codecString = "";
  49023. }
  49024. var codecs = codecString.split(",");
  49025. var result = [];
  49026. codecs.forEach(function(codec) {
  49027. codec = codec.trim();
  49028. var codecType;
  49029. mediaTypes$1.forEach(function(name) {
  49030. var match = regexs$1[name].exec(codec.toLowerCase());
  49031. if (!match || match.length <= 1) {
  49032. return;
  49033. }
  49034. codecType = name;
  49035. var type2 = codec.substring(0, match[1].length);
  49036. var details = codec.replace(type2, "");
  49037. result.push({
  49038. type: type2,
  49039. details,
  49040. mediaType: name
  49041. });
  49042. });
  49043. if (!codecType) {
  49044. result.push({
  49045. type: codec,
  49046. details: "",
  49047. mediaType: "unknown"
  49048. });
  49049. }
  49050. });
  49051. return result;
  49052. };
  49053. var codecsFromDefault$1 = function codecsFromDefault(master, audioGroupId) {
  49054. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  49055. return null;
  49056. }
  49057. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  49058. if (!audioGroup) {
  49059. return null;
  49060. }
  49061. for (var name in audioGroup) {
  49062. var audioType = audioGroup[name];
  49063. if (audioType.default && audioType.playlists) {
  49064. return parseCodecs$1(audioType.playlists[0].attributes.CODECS);
  49065. }
  49066. }
  49067. return null;
  49068. };
  49069. var isAudioCodec$1 = function isAudioCodec(codec) {
  49070. if (codec === void 0) {
  49071. codec = "";
  49072. }
  49073. return regexs$1.audio.test(codec.trim().toLowerCase());
  49074. };
  49075. var isTextCodec$1 = function isTextCodec(codec) {
  49076. if (codec === void 0) {
  49077. codec = "";
  49078. }
  49079. return regexs$1.text.test(codec.trim().toLowerCase());
  49080. };
  49081. var getMimeForCodec$1 = function getMimeForCodec(codecString) {
  49082. if (!codecString || typeof codecString !== "string") {
  49083. return;
  49084. }
  49085. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  49086. return translateLegacyCodec$1(c.trim());
  49087. });
  49088. var type2 = "video";
  49089. if (codecs.length === 1 && isAudioCodec$1(codecs[0])) {
  49090. type2 = "audio";
  49091. } else if (codecs.length === 1 && isTextCodec$1(codecs[0])) {
  49092. type2 = "application";
  49093. }
  49094. var container = "mp4";
  49095. if (codecs.every(function(c) {
  49096. return regexs$1.mp4.test(c);
  49097. })) {
  49098. container = "mp4";
  49099. } else if (codecs.every(function(c) {
  49100. return regexs$1.webm.test(c);
  49101. })) {
  49102. container = "webm";
  49103. } else if (codecs.every(function(c) {
  49104. return regexs$1.ogg.test(c);
  49105. })) {
  49106. container = "ogg";
  49107. }
  49108. return type2 + "/" + container + ';codecs="' + codecString + '"';
  49109. };
  49110. var browserSupportsCodec$1 = function browserSupportsCodec(codecString) {
  49111. if (codecString === void 0) {
  49112. codecString = "";
  49113. }
  49114. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec$1(codecString)) || false;
  49115. };
  49116. var muxerSupportsCodec$1 = function muxerSupportsCodec(codecString) {
  49117. if (codecString === void 0) {
  49118. codecString = "";
  49119. }
  49120. return codecString.toLowerCase().split(",").every(function(codec) {
  49121. codec = codec.trim();
  49122. for (var i2 = 0; i2 < upperMediaTypes$1.length; i2++) {
  49123. var type2 = upperMediaTypes$1[i2];
  49124. if (regexs$1["muxer" + type2].test(codec)) {
  49125. return true;
  49126. }
  49127. }
  49128. return false;
  49129. });
  49130. };
  49131. var DEFAULT_AUDIO_CODEC$1 = "mp4a.40.2";
  49132. var DEFAULT_VIDEO_CODEC$1 = "avc1.4d400d";
  49133. var MPEGURL_REGEX$1 = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  49134. var DASH_REGEX$1 = /^application\/dash\+xml/i;
  49135. var simpleTypeFromSourceType$1 = function simpleTypeFromSourceType(type2) {
  49136. if (MPEGURL_REGEX$1.test(type2)) {
  49137. return "hls";
  49138. }
  49139. if (DASH_REGEX$1.test(type2)) {
  49140. return "dash";
  49141. }
  49142. if (type2 === "application/vnd.videojs.vhs+json") {
  49143. return "vhs-json";
  49144. }
  49145. return null;
  49146. };
  49147. var countBits$1 = function countBits(x) {
  49148. return x.toString(2).length;
  49149. };
  49150. var countBytes$1 = function countBytes(x) {
  49151. return Math.ceil(countBits$1(x) / 8);
  49152. };
  49153. var isArrayBufferView$1 = function isArrayBufferView(obj) {
  49154. if (ArrayBuffer.isView === "function") {
  49155. return ArrayBuffer.isView(obj);
  49156. }
  49157. return obj && obj.buffer instanceof ArrayBuffer;
  49158. };
  49159. var isTypedArray$1 = function isTypedArray(obj) {
  49160. return isArrayBufferView$1(obj);
  49161. };
  49162. var toUint8$1 = function toUint8(bytes) {
  49163. if (bytes instanceof Uint8Array) {
  49164. return bytes;
  49165. }
  49166. if (!Array.isArray(bytes) && !isTypedArray$1(bytes) && !(bytes instanceof ArrayBuffer)) {
  49167. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  49168. bytes = 0;
  49169. } else {
  49170. bytes = [bytes];
  49171. }
  49172. }
  49173. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  49174. };
  49175. var BigInt$1 = window_1.BigInt || Number;
  49176. 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")];
  49177. (function() {
  49178. var a = new Uint16Array([65484]);
  49179. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  49180. if (b[0] === 255) {
  49181. return "big";
  49182. }
  49183. if (b[0] === 204) {
  49184. return "little";
  49185. }
  49186. return "unknown";
  49187. })();
  49188. var bytesToNumber$1 = function bytesToNumber(bytes, _temp) {
  49189. 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;
  49190. bytes = toUint8$1(bytes);
  49191. var fn2 = le ? "reduce" : "reduceRight";
  49192. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  49193. var number = obj.call(bytes, function(total, byte, i2) {
  49194. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49195. return total + BigInt$1(byte) * BYTE_TABLE$1[exponent];
  49196. }, BigInt$1(0));
  49197. if (signed) {
  49198. var max2 = BYTE_TABLE$1[bytes.length] / BigInt$1(2) - BigInt$1(1);
  49199. number = BigInt$1(number);
  49200. if (number > max2) {
  49201. number -= max2;
  49202. number -= max2;
  49203. number -= BigInt$1(2);
  49204. }
  49205. }
  49206. return Number(number);
  49207. };
  49208. var numberToBytes$1 = function numberToBytes(number, _temp2) {
  49209. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  49210. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  49211. number = 0;
  49212. }
  49213. number = BigInt$1(number);
  49214. var byteCount = countBytes$1(number);
  49215. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  49216. for (var i2 = 0; i2 < byteCount; i2++) {
  49217. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49218. bytes[byteIndex] = Number(number / BYTE_TABLE$1[i2] & BigInt$1(255));
  49219. if (number < 0) {
  49220. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  49221. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  49222. }
  49223. }
  49224. return bytes;
  49225. };
  49226. var stringToBytes$1 = function stringToBytes(string, stringIsBytes) {
  49227. if (typeof string !== "string" && string && typeof string.toString === "function") {
  49228. string = string.toString();
  49229. }
  49230. if (typeof string !== "string") {
  49231. return new Uint8Array();
  49232. }
  49233. if (!stringIsBytes) {
  49234. string = unescape(encodeURIComponent(string));
  49235. }
  49236. var view = new Uint8Array(string.length);
  49237. for (var i2 = 0; i2 < string.length; i2++) {
  49238. view[i2] = string.charCodeAt(i2);
  49239. }
  49240. return view;
  49241. };
  49242. var concatTypedArrays$1 = function concatTypedArrays() {
  49243. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  49244. buffers[_key] = arguments[_key];
  49245. }
  49246. buffers = buffers.filter(function(b) {
  49247. return b && (b.byteLength || b.length) && typeof b !== "string";
  49248. });
  49249. if (buffers.length <= 1) {
  49250. return toUint8$1(buffers[0]);
  49251. }
  49252. var totalLen = buffers.reduce(function(total, buf, i2) {
  49253. return total + (buf.byteLength || buf.length);
  49254. }, 0);
  49255. var tempBuffer = new Uint8Array(totalLen);
  49256. var offset = 0;
  49257. buffers.forEach(function(buf) {
  49258. buf = toUint8$1(buf);
  49259. tempBuffer.set(buf, offset);
  49260. offset += buf.byteLength;
  49261. });
  49262. return tempBuffer;
  49263. };
  49264. var bytesMatch$1 = function bytesMatch(a, b, _temp3) {
  49265. 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;
  49266. a = toUint8$1(a);
  49267. b = toUint8$1(b);
  49268. var fn2 = b.every ? b.every : Array.prototype.every;
  49269. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  49270. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  49271. return bByte === aByte;
  49272. });
  49273. };
  49274. var DEFAULT_LOCATION$1 = "http://example.com";
  49275. var resolveUrl$3 = function resolveUrl2(baseUrl, relativeUrl) {
  49276. if (/^[a-z]+:/i.test(relativeUrl)) {
  49277. return relativeUrl;
  49278. }
  49279. if (/^data:/.test(baseUrl)) {
  49280. baseUrl = window_1.location && window_1.location.href || "";
  49281. }
  49282. var nativeURL = typeof window_1.URL === "function";
  49283. var protocolLess = /^\/\//.test(baseUrl);
  49284. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  49285. if (nativeURL) {
  49286. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$1);
  49287. } else if (!/\/\//i.test(baseUrl)) {
  49288. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  49289. }
  49290. if (nativeURL) {
  49291. var newUrl = new URL(relativeUrl, baseUrl);
  49292. if (removeLocation) {
  49293. return newUrl.href.slice(DEFAULT_LOCATION$1.length);
  49294. } else if (protocolLess) {
  49295. return newUrl.href.slice(newUrl.protocol.length);
  49296. }
  49297. return newUrl.href;
  49298. }
  49299. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  49300. };
  49301. var forEachMediaGroup$3 = function forEachMediaGroup(master, groups, callback2) {
  49302. groups.forEach(function(mediaType) {
  49303. for (var groupKey in master.mediaGroups[mediaType]) {
  49304. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  49305. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  49306. callback2(mediaProperties, mediaType, groupKey, labelKey);
  49307. }
  49308. }
  49309. });
  49310. };
  49311. var atob$1 = function atob2(s) {
  49312. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  49313. };
  49314. function decodeB64ToUint8Array$1(b64Text) {
  49315. var decodedString = atob$1(b64Text);
  49316. var array = new Uint8Array(decodedString.length);
  49317. for (var i2 = 0; i2 < decodedString.length; i2++) {
  49318. array[i2] = decodedString.charCodeAt(i2);
  49319. }
  49320. return array;
  49321. }
  49322. var dom$1 = {};
  49323. var conventions$2 = {};
  49324. function find$1(list, predicate, ac) {
  49325. if (ac === void 0) {
  49326. ac = Array.prototype;
  49327. }
  49328. if (list && typeof ac.find === "function") {
  49329. return ac.find.call(list, predicate);
  49330. }
  49331. for (var i2 = 0; i2 < list.length; i2++) {
  49332. if (Object.prototype.hasOwnProperty.call(list, i2)) {
  49333. var item = list[i2];
  49334. if (predicate.call(void 0, item, i2, list)) {
  49335. return item;
  49336. }
  49337. }
  49338. }
  49339. }
  49340. function freeze(object, oc) {
  49341. if (oc === void 0) {
  49342. oc = Object;
  49343. }
  49344. return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
  49345. }
  49346. function assign$1(target, source) {
  49347. if (target === null || typeof target !== "object") {
  49348. throw new TypeError("target is not an object");
  49349. }
  49350. for (var key in source) {
  49351. if (Object.prototype.hasOwnProperty.call(source, key)) {
  49352. target[key] = source[key];
  49353. }
  49354. }
  49355. return target;
  49356. }
  49357. var MIME_TYPE = freeze({
  49358. HTML: "text/html",
  49359. isHTML: function(value) {
  49360. return value === MIME_TYPE.HTML;
  49361. },
  49362. XML_APPLICATION: "application/xml",
  49363. XML_TEXT: "text/xml",
  49364. XML_XHTML_APPLICATION: "application/xhtml+xml",
  49365. XML_SVG_IMAGE: "image/svg+xml"
  49366. });
  49367. var NAMESPACE$3 = freeze({
  49368. HTML: "http://www.w3.org/1999/xhtml",
  49369. isHTML: function(uri) {
  49370. return uri === NAMESPACE$3.HTML;
  49371. },
  49372. SVG: "http://www.w3.org/2000/svg",
  49373. XML: "http://www.w3.org/XML/1998/namespace",
  49374. XMLNS: "http://www.w3.org/2000/xmlns/"
  49375. });
  49376. conventions$2.assign = assign$1;
  49377. conventions$2.find = find$1;
  49378. conventions$2.freeze = freeze;
  49379. conventions$2.MIME_TYPE = MIME_TYPE;
  49380. conventions$2.NAMESPACE = NAMESPACE$3;
  49381. var conventions$1 = conventions$2;
  49382. var find = conventions$1.find;
  49383. var NAMESPACE$2 = conventions$1.NAMESPACE;
  49384. function notEmptyString(input) {
  49385. return input !== "";
  49386. }
  49387. function splitOnASCIIWhitespace(input) {
  49388. return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
  49389. }
  49390. function orderedSetReducer(current, element) {
  49391. if (!current.hasOwnProperty(element)) {
  49392. current[element] = true;
  49393. }
  49394. return current;
  49395. }
  49396. function toOrderedSet(input) {
  49397. if (!input)
  49398. return [];
  49399. var list = splitOnASCIIWhitespace(input);
  49400. return Object.keys(list.reduce(orderedSetReducer, {}));
  49401. }
  49402. function arrayIncludes(list) {
  49403. return function(element) {
  49404. return list && list.indexOf(element) !== -1;
  49405. };
  49406. }
  49407. function copy(src, dest) {
  49408. for (var p in src) {
  49409. if (Object.prototype.hasOwnProperty.call(src, p)) {
  49410. dest[p] = src[p];
  49411. }
  49412. }
  49413. }
  49414. function _extends(Class, Super) {
  49415. var pt2 = Class.prototype;
  49416. if (!(pt2 instanceof Super)) {
  49417. let t2 = function() {
  49418. };
  49419. t2.prototype = Super.prototype;
  49420. t2 = new t2();
  49421. copy(pt2, t2);
  49422. Class.prototype = pt2 = t2;
  49423. }
  49424. if (pt2.constructor != Class) {
  49425. if (typeof Class != "function") {
  49426. console.error("unknown Class:" + Class);
  49427. }
  49428. pt2.constructor = Class;
  49429. }
  49430. }
  49431. var NodeType = {};
  49432. var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
  49433. var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
  49434. var TEXT_NODE = NodeType.TEXT_NODE = 3;
  49435. var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
  49436. var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
  49437. var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
  49438. var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
  49439. var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
  49440. var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
  49441. var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
  49442. var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
  49443. var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
  49444. var ExceptionCode = {};
  49445. var ExceptionMessage = {};
  49446. ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
  49447. ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
  49448. var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
  49449. ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
  49450. ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
  49451. ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
  49452. ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
  49453. var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
  49454. ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
  49455. var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
  49456. ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
  49457. ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
  49458. ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
  49459. ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
  49460. ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
  49461. function DOMException(code, message) {
  49462. if (message instanceof Error) {
  49463. var error = message;
  49464. } else {
  49465. error = this;
  49466. Error.call(this, ExceptionMessage[code]);
  49467. this.message = ExceptionMessage[code];
  49468. if (Error.captureStackTrace)
  49469. Error.captureStackTrace(this, DOMException);
  49470. }
  49471. error.code = code;
  49472. if (message)
  49473. this.message = this.message + ": " + message;
  49474. return error;
  49475. }
  49476. DOMException.prototype = Error.prototype;
  49477. copy(ExceptionCode, DOMException);
  49478. function NodeList() {
  49479. }
  49480. NodeList.prototype = {
  49481. length: 0,
  49482. item: function(index2) {
  49483. return this[index2] || null;
  49484. },
  49485. toString: function(isHTML, nodeFilter) {
  49486. for (var buf = [], i2 = 0; i2 < this.length; i2++) {
  49487. serializeToString(this[i2], buf, isHTML, nodeFilter);
  49488. }
  49489. return buf.join("");
  49490. },
  49491. filter: function(predicate) {
  49492. return Array.prototype.filter.call(this, predicate);
  49493. },
  49494. indexOf: function(item) {
  49495. return Array.prototype.indexOf.call(this, item);
  49496. }
  49497. };
  49498. function LiveNodeList(node, refresh) {
  49499. this._node = node;
  49500. this._refresh = refresh;
  49501. _updateLiveList(this);
  49502. }
  49503. function _updateLiveList(list) {
  49504. var inc = list._node._inc || list._node.ownerDocument._inc;
  49505. if (list._inc != inc) {
  49506. var ls = list._refresh(list._node);
  49507. __set__(list, "length", ls.length);
  49508. copy(ls, list);
  49509. list._inc = inc;
  49510. }
  49511. }
  49512. LiveNodeList.prototype.item = function(i2) {
  49513. _updateLiveList(this);
  49514. return this[i2];
  49515. };
  49516. _extends(LiveNodeList, NodeList);
  49517. function NamedNodeMap() {
  49518. }
  49519. function _findNodeIndex(list, node) {
  49520. var i2 = list.length;
  49521. while (i2--) {
  49522. if (list[i2] === node) {
  49523. return i2;
  49524. }
  49525. }
  49526. }
  49527. function _addNamedNode(el, list, newAttr, oldAttr) {
  49528. if (oldAttr) {
  49529. list[_findNodeIndex(list, oldAttr)] = newAttr;
  49530. } else {
  49531. list[list.length++] = newAttr;
  49532. }
  49533. if (el) {
  49534. newAttr.ownerElement = el;
  49535. var doc = el.ownerDocument;
  49536. if (doc) {
  49537. oldAttr && _onRemoveAttribute(doc, el, oldAttr);
  49538. _onAddAttribute(doc, el, newAttr);
  49539. }
  49540. }
  49541. }
  49542. function _removeNamedNode(el, list, attr) {
  49543. var i2 = _findNodeIndex(list, attr);
  49544. if (i2 >= 0) {
  49545. var lastIndex = list.length - 1;
  49546. while (i2 < lastIndex) {
  49547. list[i2] = list[++i2];
  49548. }
  49549. list.length = lastIndex;
  49550. if (el) {
  49551. var doc = el.ownerDocument;
  49552. if (doc) {
  49553. _onRemoveAttribute(doc, el, attr);
  49554. attr.ownerElement = null;
  49555. }
  49556. }
  49557. } else {
  49558. throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
  49559. }
  49560. }
  49561. NamedNodeMap.prototype = {
  49562. length: 0,
  49563. item: NodeList.prototype.item,
  49564. getNamedItem: function(key) {
  49565. var i2 = this.length;
  49566. while (i2--) {
  49567. var attr = this[i2];
  49568. if (attr.nodeName == key) {
  49569. return attr;
  49570. }
  49571. }
  49572. },
  49573. setNamedItem: function(attr) {
  49574. var el = attr.ownerElement;
  49575. if (el && el != this._ownerElement) {
  49576. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49577. }
  49578. var oldAttr = this.getNamedItem(attr.nodeName);
  49579. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49580. return oldAttr;
  49581. },
  49582. setNamedItemNS: function(attr) {
  49583. var el = attr.ownerElement, oldAttr;
  49584. if (el && el != this._ownerElement) {
  49585. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49586. }
  49587. oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
  49588. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49589. return oldAttr;
  49590. },
  49591. removeNamedItem: function(key) {
  49592. var attr = this.getNamedItem(key);
  49593. _removeNamedNode(this._ownerElement, this, attr);
  49594. return attr;
  49595. },
  49596. removeNamedItemNS: function(namespaceURI, localName) {
  49597. var attr = this.getNamedItemNS(namespaceURI, localName);
  49598. _removeNamedNode(this._ownerElement, this, attr);
  49599. return attr;
  49600. },
  49601. getNamedItemNS: function(namespaceURI, localName) {
  49602. var i2 = this.length;
  49603. while (i2--) {
  49604. var node = this[i2];
  49605. if (node.localName == localName && node.namespaceURI == namespaceURI) {
  49606. return node;
  49607. }
  49608. }
  49609. return null;
  49610. }
  49611. };
  49612. function DOMImplementation$1() {
  49613. }
  49614. DOMImplementation$1.prototype = {
  49615. hasFeature: function(feature2, version2) {
  49616. return true;
  49617. },
  49618. createDocument: function(namespaceURI, qualifiedName, doctype) {
  49619. var doc = new Document();
  49620. doc.implementation = this;
  49621. doc.childNodes = new NodeList();
  49622. doc.doctype = doctype || null;
  49623. if (doctype) {
  49624. doc.appendChild(doctype);
  49625. }
  49626. if (qualifiedName) {
  49627. var root2 = doc.createElementNS(namespaceURI, qualifiedName);
  49628. doc.appendChild(root2);
  49629. }
  49630. return doc;
  49631. },
  49632. createDocumentType: function(qualifiedName, publicId, systemId) {
  49633. var node = new DocumentType();
  49634. node.name = qualifiedName;
  49635. node.nodeName = qualifiedName;
  49636. node.publicId = publicId || "";
  49637. node.systemId = systemId || "";
  49638. return node;
  49639. }
  49640. };
  49641. function Node() {
  49642. }
  49643. Node.prototype = {
  49644. firstChild: null,
  49645. lastChild: null,
  49646. previousSibling: null,
  49647. nextSibling: null,
  49648. attributes: null,
  49649. parentNode: null,
  49650. childNodes: null,
  49651. ownerDocument: null,
  49652. nodeValue: null,
  49653. namespaceURI: null,
  49654. prefix: null,
  49655. localName: null,
  49656. insertBefore: function(newChild, refChild) {
  49657. return _insertBefore(this, newChild, refChild);
  49658. },
  49659. replaceChild: function(newChild, oldChild) {
  49660. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  49661. if (oldChild) {
  49662. this.removeChild(oldChild);
  49663. }
  49664. },
  49665. removeChild: function(oldChild) {
  49666. return _removeChild(this, oldChild);
  49667. },
  49668. appendChild: function(newChild) {
  49669. return this.insertBefore(newChild, null);
  49670. },
  49671. hasChildNodes: function() {
  49672. return this.firstChild != null;
  49673. },
  49674. cloneNode: function(deep) {
  49675. return cloneNode(this.ownerDocument || this, this, deep);
  49676. },
  49677. normalize: function() {
  49678. var child = this.firstChild;
  49679. while (child) {
  49680. var next = child.nextSibling;
  49681. if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {
  49682. this.removeChild(next);
  49683. child.appendData(next.data);
  49684. } else {
  49685. child.normalize();
  49686. child = next;
  49687. }
  49688. }
  49689. },
  49690. isSupported: function(feature2, version2) {
  49691. return this.ownerDocument.implementation.hasFeature(feature2, version2);
  49692. },
  49693. hasAttributes: function() {
  49694. return this.attributes.length > 0;
  49695. },
  49696. lookupPrefix: function(namespaceURI) {
  49697. var el = this;
  49698. while (el) {
  49699. var map = el._nsMap;
  49700. if (map) {
  49701. for (var n in map) {
  49702. if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
  49703. return n;
  49704. }
  49705. }
  49706. }
  49707. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49708. }
  49709. return null;
  49710. },
  49711. lookupNamespaceURI: function(prefix) {
  49712. var el = this;
  49713. while (el) {
  49714. var map = el._nsMap;
  49715. if (map) {
  49716. if (Object.prototype.hasOwnProperty.call(map, prefix)) {
  49717. return map[prefix];
  49718. }
  49719. }
  49720. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49721. }
  49722. return null;
  49723. },
  49724. isDefaultNamespace: function(namespaceURI) {
  49725. var prefix = this.lookupPrefix(namespaceURI);
  49726. return prefix == null;
  49727. }
  49728. };
  49729. function _xmlEncoder(c) {
  49730. return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
  49731. }
  49732. copy(NodeType, Node);
  49733. copy(NodeType, Node.prototype);
  49734. function _visitNode(node, callback2) {
  49735. if (callback2(node)) {
  49736. return true;
  49737. }
  49738. if (node = node.firstChild) {
  49739. do {
  49740. if (_visitNode(node, callback2)) {
  49741. return true;
  49742. }
  49743. } while (node = node.nextSibling);
  49744. }
  49745. }
  49746. function Document() {
  49747. this.ownerDocument = this;
  49748. }
  49749. function _onAddAttribute(doc, el, newAttr) {
  49750. doc && doc._inc++;
  49751. var ns = newAttr.namespaceURI;
  49752. if (ns === NAMESPACE$2.XMLNS) {
  49753. el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
  49754. }
  49755. }
  49756. function _onRemoveAttribute(doc, el, newAttr, remove2) {
  49757. doc && doc._inc++;
  49758. var ns = newAttr.namespaceURI;
  49759. if (ns === NAMESPACE$2.XMLNS) {
  49760. delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
  49761. }
  49762. }
  49763. function _onUpdateChild(doc, el, newChild) {
  49764. if (doc && doc._inc) {
  49765. doc._inc++;
  49766. var cs = el.childNodes;
  49767. if (newChild) {
  49768. cs[cs.length++] = newChild;
  49769. } else {
  49770. var child = el.firstChild;
  49771. var i2 = 0;
  49772. while (child) {
  49773. cs[i2++] = child;
  49774. child = child.nextSibling;
  49775. }
  49776. cs.length = i2;
  49777. delete cs[cs.length];
  49778. }
  49779. }
  49780. }
  49781. function _removeChild(parentNode, child) {
  49782. var previous = child.previousSibling;
  49783. var next = child.nextSibling;
  49784. if (previous) {
  49785. previous.nextSibling = next;
  49786. } else {
  49787. parentNode.firstChild = next;
  49788. }
  49789. if (next) {
  49790. next.previousSibling = previous;
  49791. } else {
  49792. parentNode.lastChild = previous;
  49793. }
  49794. child.parentNode = null;
  49795. child.previousSibling = null;
  49796. child.nextSibling = null;
  49797. _onUpdateChild(parentNode.ownerDocument, parentNode);
  49798. return child;
  49799. }
  49800. function hasValidParentNodeType(node) {
  49801. return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
  49802. }
  49803. function hasInsertableNodeType(node) {
  49804. 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);
  49805. }
  49806. function isDocTypeNode(node) {
  49807. return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
  49808. }
  49809. function isElementNode(node) {
  49810. return node && node.nodeType === Node.ELEMENT_NODE;
  49811. }
  49812. function isTextNode$2(node) {
  49813. return node && node.nodeType === Node.TEXT_NODE;
  49814. }
  49815. function isElementInsertionPossible(doc, child) {
  49816. var parentChildNodes = doc.childNodes || [];
  49817. if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
  49818. return false;
  49819. }
  49820. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49821. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49822. }
  49823. function isElementReplacementPossible(doc, child) {
  49824. var parentChildNodes = doc.childNodes || [];
  49825. function hasElementChildThatIsNotChild(node) {
  49826. return isElementNode(node) && node !== child;
  49827. }
  49828. if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
  49829. return false;
  49830. }
  49831. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49832. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49833. }
  49834. function assertPreInsertionValidity1to5(parent, node, child) {
  49835. if (!hasValidParentNodeType(parent)) {
  49836. throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
  49837. }
  49838. if (child && child.parentNode !== parent) {
  49839. throw new DOMException(NOT_FOUND_ERR, "child not in parent");
  49840. }
  49841. if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {
  49842. throw new DOMException(
  49843. HIERARCHY_REQUEST_ERR,
  49844. "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType
  49845. );
  49846. }
  49847. }
  49848. function assertPreInsertionValidityInDocument(parent, node, child) {
  49849. var parentChildNodes = parent.childNodes || [];
  49850. var nodeChildNodes = node.childNodes || [];
  49851. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49852. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49853. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49854. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49855. }
  49856. if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
  49857. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49858. }
  49859. }
  49860. if (isElementNode(node)) {
  49861. if (!isElementInsertionPossible(parent, child)) {
  49862. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49863. }
  49864. }
  49865. if (isDocTypeNode(node)) {
  49866. if (find(parentChildNodes, isDocTypeNode)) {
  49867. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49868. }
  49869. var parentElementChild = find(parentChildNodes, isElementNode);
  49870. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49871. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49872. }
  49873. if (!child && parentElementChild) {
  49874. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
  49875. }
  49876. }
  49877. }
  49878. function assertPreReplacementValidityInDocument(parent, node, child) {
  49879. var parentChildNodes = parent.childNodes || [];
  49880. var nodeChildNodes = node.childNodes || [];
  49881. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49882. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49883. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49884. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49885. }
  49886. if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
  49887. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49888. }
  49889. }
  49890. if (isElementNode(node)) {
  49891. if (!isElementReplacementPossible(parent, child)) {
  49892. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49893. }
  49894. }
  49895. if (isDocTypeNode(node)) {
  49896. let hasDoctypeChildThatIsNotChild = function(node2) {
  49897. return isDocTypeNode(node2) && node2 !== child;
  49898. };
  49899. if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
  49900. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49901. }
  49902. var parentElementChild = find(parentChildNodes, isElementNode);
  49903. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49904. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49905. }
  49906. }
  49907. }
  49908. function _insertBefore(parent, node, child, _inDocumentAssertion) {
  49909. assertPreInsertionValidity1to5(parent, node, child);
  49910. if (parent.nodeType === Node.DOCUMENT_NODE) {
  49911. (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
  49912. }
  49913. var cp = node.parentNode;
  49914. if (cp) {
  49915. cp.removeChild(node);
  49916. }
  49917. if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
  49918. var newFirst = node.firstChild;
  49919. if (newFirst == null) {
  49920. return node;
  49921. }
  49922. var newLast = node.lastChild;
  49923. } else {
  49924. newFirst = newLast = node;
  49925. }
  49926. var pre = child ? child.previousSibling : parent.lastChild;
  49927. newFirst.previousSibling = pre;
  49928. newLast.nextSibling = child;
  49929. if (pre) {
  49930. pre.nextSibling = newFirst;
  49931. } else {
  49932. parent.firstChild = newFirst;
  49933. }
  49934. if (child == null) {
  49935. parent.lastChild = newLast;
  49936. } else {
  49937. child.previousSibling = newLast;
  49938. }
  49939. do {
  49940. newFirst.parentNode = parent;
  49941. } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
  49942. _onUpdateChild(parent.ownerDocument || parent, parent);
  49943. if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49944. node.firstChild = node.lastChild = null;
  49945. }
  49946. return node;
  49947. }
  49948. function _appendSingleChild(parentNode, newChild) {
  49949. if (newChild.parentNode) {
  49950. newChild.parentNode.removeChild(newChild);
  49951. }
  49952. newChild.parentNode = parentNode;
  49953. newChild.previousSibling = parentNode.lastChild;
  49954. newChild.nextSibling = null;
  49955. if (newChild.previousSibling) {
  49956. newChild.previousSibling.nextSibling = newChild;
  49957. } else {
  49958. parentNode.firstChild = newChild;
  49959. }
  49960. parentNode.lastChild = newChild;
  49961. _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
  49962. return newChild;
  49963. }
  49964. Document.prototype = {
  49965. nodeName: "#document",
  49966. nodeType: DOCUMENT_NODE,
  49967. doctype: null,
  49968. documentElement: null,
  49969. _inc: 1,
  49970. insertBefore: function(newChild, refChild) {
  49971. if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49972. var child = newChild.firstChild;
  49973. while (child) {
  49974. var next = child.nextSibling;
  49975. this.insertBefore(child, refChild);
  49976. child = next;
  49977. }
  49978. return newChild;
  49979. }
  49980. _insertBefore(this, newChild, refChild);
  49981. newChild.ownerDocument = this;
  49982. if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
  49983. this.documentElement = newChild;
  49984. }
  49985. return newChild;
  49986. },
  49987. removeChild: function(oldChild) {
  49988. if (this.documentElement == oldChild) {
  49989. this.documentElement = null;
  49990. }
  49991. return _removeChild(this, oldChild);
  49992. },
  49993. replaceChild: function(newChild, oldChild) {
  49994. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  49995. newChild.ownerDocument = this;
  49996. if (oldChild) {
  49997. this.removeChild(oldChild);
  49998. }
  49999. if (isElementNode(newChild)) {
  50000. this.documentElement = newChild;
  50001. }
  50002. },
  50003. importNode: function(importedNode, deep) {
  50004. return importNode(this, importedNode, deep);
  50005. },
  50006. getElementById: function(id) {
  50007. var rtv = null;
  50008. _visitNode(this.documentElement, function(node) {
  50009. if (node.nodeType == ELEMENT_NODE) {
  50010. if (node.getAttribute("id") == id) {
  50011. rtv = node;
  50012. return true;
  50013. }
  50014. }
  50015. });
  50016. return rtv;
  50017. },
  50018. getElementsByClassName: function(classNames) {
  50019. var classNamesSet = toOrderedSet(classNames);
  50020. return new LiveNodeList(this, function(base2) {
  50021. var ls = [];
  50022. if (classNamesSet.length > 0) {
  50023. _visitNode(base2.documentElement, function(node) {
  50024. if (node !== base2 && node.nodeType === ELEMENT_NODE) {
  50025. var nodeClassNames = node.getAttribute("class");
  50026. if (nodeClassNames) {
  50027. var matches = classNames === nodeClassNames;
  50028. if (!matches) {
  50029. var nodeClassNamesSet = toOrderedSet(nodeClassNames);
  50030. matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
  50031. }
  50032. if (matches) {
  50033. ls.push(node);
  50034. }
  50035. }
  50036. }
  50037. });
  50038. }
  50039. return ls;
  50040. });
  50041. },
  50042. createElement: function(tagName) {
  50043. var node = new Element$1();
  50044. node.ownerDocument = this;
  50045. node.nodeName = tagName;
  50046. node.tagName = tagName;
  50047. node.localName = tagName;
  50048. node.childNodes = new NodeList();
  50049. var attrs = node.attributes = new NamedNodeMap();
  50050. attrs._ownerElement = node;
  50051. return node;
  50052. },
  50053. createDocumentFragment: function() {
  50054. var node = new DocumentFragment();
  50055. node.ownerDocument = this;
  50056. node.childNodes = new NodeList();
  50057. return node;
  50058. },
  50059. createTextNode: function(data) {
  50060. var node = new Text();
  50061. node.ownerDocument = this;
  50062. node.appendData(data);
  50063. return node;
  50064. },
  50065. createComment: function(data) {
  50066. var node = new Comment();
  50067. node.ownerDocument = this;
  50068. node.appendData(data);
  50069. return node;
  50070. },
  50071. createCDATASection: function(data) {
  50072. var node = new CDATASection();
  50073. node.ownerDocument = this;
  50074. node.appendData(data);
  50075. return node;
  50076. },
  50077. createProcessingInstruction: function(target, data) {
  50078. var node = new ProcessingInstruction();
  50079. node.ownerDocument = this;
  50080. node.tagName = node.target = target;
  50081. node.nodeValue = node.data = data;
  50082. return node;
  50083. },
  50084. createAttribute: function(name) {
  50085. var node = new Attr();
  50086. node.ownerDocument = this;
  50087. node.name = name;
  50088. node.nodeName = name;
  50089. node.localName = name;
  50090. node.specified = true;
  50091. return node;
  50092. },
  50093. createEntityReference: function(name) {
  50094. var node = new EntityReference();
  50095. node.ownerDocument = this;
  50096. node.nodeName = name;
  50097. return node;
  50098. },
  50099. createElementNS: function(namespaceURI, qualifiedName) {
  50100. var node = new Element$1();
  50101. var pl = qualifiedName.split(":");
  50102. var attrs = node.attributes = new NamedNodeMap();
  50103. node.childNodes = new NodeList();
  50104. node.ownerDocument = this;
  50105. node.nodeName = qualifiedName;
  50106. node.tagName = qualifiedName;
  50107. node.namespaceURI = namespaceURI;
  50108. if (pl.length == 2) {
  50109. node.prefix = pl[0];
  50110. node.localName = pl[1];
  50111. } else {
  50112. node.localName = qualifiedName;
  50113. }
  50114. attrs._ownerElement = node;
  50115. return node;
  50116. },
  50117. createAttributeNS: function(namespaceURI, qualifiedName) {
  50118. var node = new Attr();
  50119. var pl = qualifiedName.split(":");
  50120. node.ownerDocument = this;
  50121. node.nodeName = qualifiedName;
  50122. node.name = qualifiedName;
  50123. node.namespaceURI = namespaceURI;
  50124. node.specified = true;
  50125. if (pl.length == 2) {
  50126. node.prefix = pl[0];
  50127. node.localName = pl[1];
  50128. } else {
  50129. node.localName = qualifiedName;
  50130. }
  50131. return node;
  50132. }
  50133. };
  50134. _extends(Document, Node);
  50135. function Element$1() {
  50136. this._nsMap = {};
  50137. }
  50138. Element$1.prototype = {
  50139. nodeType: ELEMENT_NODE,
  50140. hasAttribute: function(name) {
  50141. return this.getAttributeNode(name) != null;
  50142. },
  50143. getAttribute: function(name) {
  50144. var attr = this.getAttributeNode(name);
  50145. return attr && attr.value || "";
  50146. },
  50147. getAttributeNode: function(name) {
  50148. return this.attributes.getNamedItem(name);
  50149. },
  50150. setAttribute: function(name, value) {
  50151. var attr = this.ownerDocument.createAttribute(name);
  50152. attr.value = attr.nodeValue = "" + value;
  50153. this.setAttributeNode(attr);
  50154. },
  50155. removeAttribute: function(name) {
  50156. var attr = this.getAttributeNode(name);
  50157. attr && this.removeAttributeNode(attr);
  50158. },
  50159. appendChild: function(newChild) {
  50160. if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
  50161. return this.insertBefore(newChild, null);
  50162. } else {
  50163. return _appendSingleChild(this, newChild);
  50164. }
  50165. },
  50166. setAttributeNode: function(newAttr) {
  50167. return this.attributes.setNamedItem(newAttr);
  50168. },
  50169. setAttributeNodeNS: function(newAttr) {
  50170. return this.attributes.setNamedItemNS(newAttr);
  50171. },
  50172. removeAttributeNode: function(oldAttr) {
  50173. return this.attributes.removeNamedItem(oldAttr.nodeName);
  50174. },
  50175. removeAttributeNS: function(namespaceURI, localName) {
  50176. var old = this.getAttributeNodeNS(namespaceURI, localName);
  50177. old && this.removeAttributeNode(old);
  50178. },
  50179. hasAttributeNS: function(namespaceURI, localName) {
  50180. return this.getAttributeNodeNS(namespaceURI, localName) != null;
  50181. },
  50182. getAttributeNS: function(namespaceURI, localName) {
  50183. var attr = this.getAttributeNodeNS(namespaceURI, localName);
  50184. return attr && attr.value || "";
  50185. },
  50186. setAttributeNS: function(namespaceURI, qualifiedName, value) {
  50187. var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
  50188. attr.value = attr.nodeValue = "" + value;
  50189. this.setAttributeNode(attr);
  50190. },
  50191. getAttributeNodeNS: function(namespaceURI, localName) {
  50192. return this.attributes.getNamedItemNS(namespaceURI, localName);
  50193. },
  50194. getElementsByTagName: function(tagName) {
  50195. return new LiveNodeList(this, function(base2) {
  50196. var ls = [];
  50197. _visitNode(base2, function(node) {
  50198. if (node !== base2 && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
  50199. ls.push(node);
  50200. }
  50201. });
  50202. return ls;
  50203. });
  50204. },
  50205. getElementsByTagNameNS: function(namespaceURI, localName) {
  50206. return new LiveNodeList(this, function(base2) {
  50207. var ls = [];
  50208. _visitNode(base2, function(node) {
  50209. if (node !== base2 && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
  50210. ls.push(node);
  50211. }
  50212. });
  50213. return ls;
  50214. });
  50215. }
  50216. };
  50217. Document.prototype.getElementsByTagName = Element$1.prototype.getElementsByTagName;
  50218. Document.prototype.getElementsByTagNameNS = Element$1.prototype.getElementsByTagNameNS;
  50219. _extends(Element$1, Node);
  50220. function Attr() {
  50221. }
  50222. Attr.prototype.nodeType = ATTRIBUTE_NODE;
  50223. _extends(Attr, Node);
  50224. function CharacterData() {
  50225. }
  50226. CharacterData.prototype = {
  50227. data: "",
  50228. substringData: function(offset, count) {
  50229. return this.data.substring(offset, offset + count);
  50230. },
  50231. appendData: function(text) {
  50232. text = this.data + text;
  50233. this.nodeValue = this.data = text;
  50234. this.length = text.length;
  50235. },
  50236. insertData: function(offset, text) {
  50237. this.replaceData(offset, 0, text);
  50238. },
  50239. appendChild: function(newChild) {
  50240. throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
  50241. },
  50242. deleteData: function(offset, count) {
  50243. this.replaceData(offset, count, "");
  50244. },
  50245. replaceData: function(offset, count, text) {
  50246. var start2 = this.data.substring(0, offset);
  50247. var end = this.data.substring(offset + count);
  50248. text = start2 + text + end;
  50249. this.nodeValue = this.data = text;
  50250. this.length = text.length;
  50251. }
  50252. };
  50253. _extends(CharacterData, Node);
  50254. function Text() {
  50255. }
  50256. Text.prototype = {
  50257. nodeName: "#text",
  50258. nodeType: TEXT_NODE,
  50259. splitText: function(offset) {
  50260. var text = this.data;
  50261. var newText = text.substring(offset);
  50262. text = text.substring(0, offset);
  50263. this.data = this.nodeValue = text;
  50264. this.length = text.length;
  50265. var newNode = this.ownerDocument.createTextNode(newText);
  50266. if (this.parentNode) {
  50267. this.parentNode.insertBefore(newNode, this.nextSibling);
  50268. }
  50269. return newNode;
  50270. }
  50271. };
  50272. _extends(Text, CharacterData);
  50273. function Comment() {
  50274. }
  50275. Comment.prototype = {
  50276. nodeName: "#comment",
  50277. nodeType: COMMENT_NODE
  50278. };
  50279. _extends(Comment, CharacterData);
  50280. function CDATASection() {
  50281. }
  50282. CDATASection.prototype = {
  50283. nodeName: "#cdata-section",
  50284. nodeType: CDATA_SECTION_NODE
  50285. };
  50286. _extends(CDATASection, CharacterData);
  50287. function DocumentType() {
  50288. }
  50289. DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
  50290. _extends(DocumentType, Node);
  50291. function Notation() {
  50292. }
  50293. Notation.prototype.nodeType = NOTATION_NODE;
  50294. _extends(Notation, Node);
  50295. function Entity() {
  50296. }
  50297. Entity.prototype.nodeType = ENTITY_NODE;
  50298. _extends(Entity, Node);
  50299. function EntityReference() {
  50300. }
  50301. EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
  50302. _extends(EntityReference, Node);
  50303. function DocumentFragment() {
  50304. }
  50305. DocumentFragment.prototype.nodeName = "#document-fragment";
  50306. DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
  50307. _extends(DocumentFragment, Node);
  50308. function ProcessingInstruction() {
  50309. }
  50310. ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
  50311. _extends(ProcessingInstruction, Node);
  50312. function XMLSerializer() {
  50313. }
  50314. XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
  50315. return nodeSerializeToString.call(node, isHtml, nodeFilter);
  50316. };
  50317. Node.prototype.toString = nodeSerializeToString;
  50318. function nodeSerializeToString(isHtml, nodeFilter) {
  50319. var buf = [];
  50320. var refNode = this.nodeType == 9 && this.documentElement || this;
  50321. var prefix = refNode.prefix;
  50322. var uri = refNode.namespaceURI;
  50323. if (uri && prefix == null) {
  50324. var prefix = refNode.lookupPrefix(uri);
  50325. if (prefix == null) {
  50326. var visibleNamespaces = [
  50327. { namespace: uri, prefix: null }
  50328. ];
  50329. }
  50330. }
  50331. serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);
  50332. return buf.join("");
  50333. }
  50334. function needNamespaceDefine(node, isHTML, visibleNamespaces) {
  50335. var prefix = node.prefix || "";
  50336. var uri = node.namespaceURI;
  50337. if (!uri) {
  50338. return false;
  50339. }
  50340. if (prefix === "xml" && uri === NAMESPACE$2.XML || uri === NAMESPACE$2.XMLNS) {
  50341. return false;
  50342. }
  50343. var i2 = visibleNamespaces.length;
  50344. while (i2--) {
  50345. var ns = visibleNamespaces[i2];
  50346. if (ns.prefix === prefix) {
  50347. return ns.namespace !== uri;
  50348. }
  50349. }
  50350. return true;
  50351. }
  50352. function addSerializedAttribute(buf, qualifiedName, value) {
  50353. buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
  50354. }
  50355. function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
  50356. if (!visibleNamespaces) {
  50357. visibleNamespaces = [];
  50358. }
  50359. if (nodeFilter) {
  50360. node = nodeFilter(node);
  50361. if (node) {
  50362. if (typeof node == "string") {
  50363. buf.push(node);
  50364. return;
  50365. }
  50366. } else {
  50367. return;
  50368. }
  50369. }
  50370. switch (node.nodeType) {
  50371. case ELEMENT_NODE:
  50372. var attrs = node.attributes;
  50373. var len = attrs.length;
  50374. var child = node.firstChild;
  50375. var nodeName = node.tagName;
  50376. isHTML = NAMESPACE$2.isHTML(node.namespaceURI) || isHTML;
  50377. var prefixedNodeName = nodeName;
  50378. if (!isHTML && !node.prefix && node.namespaceURI) {
  50379. var defaultNS;
  50380. for (var ai = 0; ai < attrs.length; ai++) {
  50381. if (attrs.item(ai).name === "xmlns") {
  50382. defaultNS = attrs.item(ai).value;
  50383. break;
  50384. }
  50385. }
  50386. if (!defaultNS) {
  50387. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50388. var namespace = visibleNamespaces[nsi];
  50389. if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) {
  50390. defaultNS = namespace.namespace;
  50391. break;
  50392. }
  50393. }
  50394. }
  50395. if (defaultNS !== node.namespaceURI) {
  50396. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50397. var namespace = visibleNamespaces[nsi];
  50398. if (namespace.namespace === node.namespaceURI) {
  50399. if (namespace.prefix) {
  50400. prefixedNodeName = namespace.prefix + ":" + nodeName;
  50401. }
  50402. break;
  50403. }
  50404. }
  50405. }
  50406. }
  50407. buf.push("<", prefixedNodeName);
  50408. for (var i2 = 0; i2 < len; i2++) {
  50409. var attr = attrs.item(i2);
  50410. if (attr.prefix == "xmlns") {
  50411. visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
  50412. } else if (attr.nodeName == "xmlns") {
  50413. visibleNamespaces.push({ prefix: "", namespace: attr.value });
  50414. }
  50415. }
  50416. for (var i2 = 0; i2 < len; i2++) {
  50417. var attr = attrs.item(i2);
  50418. if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {
  50419. var prefix = attr.prefix || "";
  50420. var uri = attr.namespaceURI;
  50421. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50422. visibleNamespaces.push({ prefix, namespace: uri });
  50423. }
  50424. serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
  50425. }
  50426. if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
  50427. var prefix = node.prefix || "";
  50428. var uri = node.namespaceURI;
  50429. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50430. visibleNamespaces.push({ prefix, namespace: uri });
  50431. }
  50432. if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
  50433. buf.push(">");
  50434. if (isHTML && /^script$/i.test(nodeName)) {
  50435. while (child) {
  50436. if (child.data) {
  50437. buf.push(child.data);
  50438. } else {
  50439. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50440. }
  50441. child = child.nextSibling;
  50442. }
  50443. } else {
  50444. while (child) {
  50445. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50446. child = child.nextSibling;
  50447. }
  50448. }
  50449. buf.push("</", prefixedNodeName, ">");
  50450. } else {
  50451. buf.push("/>");
  50452. }
  50453. return;
  50454. case DOCUMENT_NODE:
  50455. case DOCUMENT_FRAGMENT_NODE:
  50456. var child = node.firstChild;
  50457. while (child) {
  50458. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50459. child = child.nextSibling;
  50460. }
  50461. return;
  50462. case ATTRIBUTE_NODE:
  50463. return addSerializedAttribute(buf, node.name, node.value);
  50464. case TEXT_NODE:
  50465. return buf.push(
  50466. node.data.replace(/[<&>]/g, _xmlEncoder)
  50467. );
  50468. case CDATA_SECTION_NODE:
  50469. return buf.push("<![CDATA[", node.data, "]]>");
  50470. case COMMENT_NODE:
  50471. return buf.push("<!--", node.data, "-->");
  50472. case DOCUMENT_TYPE_NODE:
  50473. var pubid = node.publicId;
  50474. var sysid = node.systemId;
  50475. buf.push("<!DOCTYPE ", node.name);
  50476. if (pubid) {
  50477. buf.push(" PUBLIC ", pubid);
  50478. if (sysid && sysid != ".") {
  50479. buf.push(" ", sysid);
  50480. }
  50481. buf.push(">");
  50482. } else if (sysid && sysid != ".") {
  50483. buf.push(" SYSTEM ", sysid, ">");
  50484. } else {
  50485. var sub = node.internalSubset;
  50486. if (sub) {
  50487. buf.push(" [", sub, "]");
  50488. }
  50489. buf.push(">");
  50490. }
  50491. return;
  50492. case PROCESSING_INSTRUCTION_NODE:
  50493. return buf.push("<?", node.target, " ", node.data, "?>");
  50494. case ENTITY_REFERENCE_NODE:
  50495. return buf.push("&", node.nodeName, ";");
  50496. default:
  50497. buf.push("??", node.nodeName);
  50498. }
  50499. }
  50500. function importNode(doc, node, deep) {
  50501. var node2;
  50502. switch (node.nodeType) {
  50503. case ELEMENT_NODE:
  50504. node2 = node.cloneNode(false);
  50505. node2.ownerDocument = doc;
  50506. case DOCUMENT_FRAGMENT_NODE:
  50507. break;
  50508. case ATTRIBUTE_NODE:
  50509. deep = true;
  50510. break;
  50511. }
  50512. if (!node2) {
  50513. node2 = node.cloneNode(false);
  50514. }
  50515. node2.ownerDocument = doc;
  50516. node2.parentNode = null;
  50517. if (deep) {
  50518. var child = node.firstChild;
  50519. while (child) {
  50520. node2.appendChild(importNode(doc, child, deep));
  50521. child = child.nextSibling;
  50522. }
  50523. }
  50524. return node2;
  50525. }
  50526. function cloneNode(doc, node, deep) {
  50527. var node2 = new node.constructor();
  50528. for (var n in node) {
  50529. if (Object.prototype.hasOwnProperty.call(node, n)) {
  50530. var v = node[n];
  50531. if (typeof v != "object") {
  50532. if (v != node2[n]) {
  50533. node2[n] = v;
  50534. }
  50535. }
  50536. }
  50537. }
  50538. if (node.childNodes) {
  50539. node2.childNodes = new NodeList();
  50540. }
  50541. node2.ownerDocument = doc;
  50542. switch (node2.nodeType) {
  50543. case ELEMENT_NODE:
  50544. var attrs = node.attributes;
  50545. var attrs2 = node2.attributes = new NamedNodeMap();
  50546. var len = attrs.length;
  50547. attrs2._ownerElement = node2;
  50548. for (var i2 = 0; i2 < len; i2++) {
  50549. node2.setAttributeNode(cloneNode(doc, attrs.item(i2), true));
  50550. }
  50551. break;
  50552. case ATTRIBUTE_NODE:
  50553. deep = true;
  50554. }
  50555. if (deep) {
  50556. var child = node.firstChild;
  50557. while (child) {
  50558. node2.appendChild(cloneNode(doc, child, deep));
  50559. child = child.nextSibling;
  50560. }
  50561. }
  50562. return node2;
  50563. }
  50564. function __set__(object, key, value) {
  50565. object[key] = value;
  50566. }
  50567. try {
  50568. if (Object.defineProperty) {
  50569. let getTextContent = function(node) {
  50570. switch (node.nodeType) {
  50571. case ELEMENT_NODE:
  50572. case DOCUMENT_FRAGMENT_NODE:
  50573. var buf = [];
  50574. node = node.firstChild;
  50575. while (node) {
  50576. if (node.nodeType !== 7 && node.nodeType !== 8) {
  50577. buf.push(getTextContent(node));
  50578. }
  50579. node = node.nextSibling;
  50580. }
  50581. return buf.join("");
  50582. default:
  50583. return node.nodeValue;
  50584. }
  50585. };
  50586. Object.defineProperty(LiveNodeList.prototype, "length", {
  50587. get: function() {
  50588. _updateLiveList(this);
  50589. return this.$$length;
  50590. }
  50591. });
  50592. Object.defineProperty(Node.prototype, "textContent", {
  50593. get: function() {
  50594. return getTextContent(this);
  50595. },
  50596. set: function(data) {
  50597. switch (this.nodeType) {
  50598. case ELEMENT_NODE:
  50599. case DOCUMENT_FRAGMENT_NODE:
  50600. while (this.firstChild) {
  50601. this.removeChild(this.firstChild);
  50602. }
  50603. if (data || String(data)) {
  50604. this.appendChild(this.ownerDocument.createTextNode(data));
  50605. }
  50606. break;
  50607. default:
  50608. this.data = data;
  50609. this.value = data;
  50610. this.nodeValue = data;
  50611. }
  50612. }
  50613. });
  50614. __set__ = function(object, key, value) {
  50615. object["$$" + key] = value;
  50616. };
  50617. }
  50618. } catch (e) {
  50619. }
  50620. dom$1.DocumentType = DocumentType;
  50621. dom$1.DOMException = DOMException;
  50622. dom$1.DOMImplementation = DOMImplementation$1;
  50623. dom$1.Element = Element$1;
  50624. dom$1.Node = Node;
  50625. dom$1.NodeList = NodeList;
  50626. dom$1.XMLSerializer = XMLSerializer;
  50627. var domParser = {};
  50628. var entities$1 = {};
  50629. (function(exports2) {
  50630. var freeze2 = conventions$2.freeze;
  50631. exports2.XML_ENTITIES = freeze2({ amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' });
  50632. exports2.HTML_ENTITIES = freeze2({
  50633. lt: "<",
  50634. gt: ">",
  50635. amp: "&",
  50636. quot: '"',
  50637. apos: "'",
  50638. Agrave: "\xC0",
  50639. Aacute: "\xC1",
  50640. Acirc: "\xC2",
  50641. Atilde: "\xC3",
  50642. Auml: "\xC4",
  50643. Aring: "\xC5",
  50644. AElig: "\xC6",
  50645. Ccedil: "\xC7",
  50646. Egrave: "\xC8",
  50647. Eacute: "\xC9",
  50648. Ecirc: "\xCA",
  50649. Euml: "\xCB",
  50650. Igrave: "\xCC",
  50651. Iacute: "\xCD",
  50652. Icirc: "\xCE",
  50653. Iuml: "\xCF",
  50654. ETH: "\xD0",
  50655. Ntilde: "\xD1",
  50656. Ograve: "\xD2",
  50657. Oacute: "\xD3",
  50658. Ocirc: "\xD4",
  50659. Otilde: "\xD5",
  50660. Ouml: "\xD6",
  50661. Oslash: "\xD8",
  50662. Ugrave: "\xD9",
  50663. Uacute: "\xDA",
  50664. Ucirc: "\xDB",
  50665. Uuml: "\xDC",
  50666. Yacute: "\xDD",
  50667. THORN: "\xDE",
  50668. szlig: "\xDF",
  50669. agrave: "\xE0",
  50670. aacute: "\xE1",
  50671. acirc: "\xE2",
  50672. atilde: "\xE3",
  50673. auml: "\xE4",
  50674. aring: "\xE5",
  50675. aelig: "\xE6",
  50676. ccedil: "\xE7",
  50677. egrave: "\xE8",
  50678. eacute: "\xE9",
  50679. ecirc: "\xEA",
  50680. euml: "\xEB",
  50681. igrave: "\xEC",
  50682. iacute: "\xED",
  50683. icirc: "\xEE",
  50684. iuml: "\xEF",
  50685. eth: "\xF0",
  50686. ntilde: "\xF1",
  50687. ograve: "\xF2",
  50688. oacute: "\xF3",
  50689. ocirc: "\xF4",
  50690. otilde: "\xF5",
  50691. ouml: "\xF6",
  50692. oslash: "\xF8",
  50693. ugrave: "\xF9",
  50694. uacute: "\xFA",
  50695. ucirc: "\xFB",
  50696. uuml: "\xFC",
  50697. yacute: "\xFD",
  50698. thorn: "\xFE",
  50699. yuml: "\xFF",
  50700. nbsp: "\xA0",
  50701. iexcl: "\xA1",
  50702. cent: "\xA2",
  50703. pound: "\xA3",
  50704. curren: "\xA4",
  50705. yen: "\xA5",
  50706. brvbar: "\xA6",
  50707. sect: "\xA7",
  50708. uml: "\xA8",
  50709. copy: "\xA9",
  50710. ordf: "\xAA",
  50711. laquo: "\xAB",
  50712. not: "\xAC",
  50713. shy: "\xAD\xAD",
  50714. reg: "\xAE",
  50715. macr: "\xAF",
  50716. deg: "\xB0",
  50717. plusmn: "\xB1",
  50718. sup2: "\xB2",
  50719. sup3: "\xB3",
  50720. acute: "\xB4",
  50721. micro: "\xB5",
  50722. para: "\xB6",
  50723. middot: "\xB7",
  50724. cedil: "\xB8",
  50725. sup1: "\xB9",
  50726. ordm: "\xBA",
  50727. raquo: "\xBB",
  50728. frac14: "\xBC",
  50729. frac12: "\xBD",
  50730. frac34: "\xBE",
  50731. iquest: "\xBF",
  50732. times: "\xD7",
  50733. divide: "\xF7",
  50734. forall: "\u2200",
  50735. part: "\u2202",
  50736. exist: "\u2203",
  50737. empty: "\u2205",
  50738. nabla: "\u2207",
  50739. isin: "\u2208",
  50740. notin: "\u2209",
  50741. ni: "\u220B",
  50742. prod: "\u220F",
  50743. sum: "\u2211",
  50744. minus: "\u2212",
  50745. lowast: "\u2217",
  50746. radic: "\u221A",
  50747. prop: "\u221D",
  50748. infin: "\u221E",
  50749. ang: "\u2220",
  50750. and: "\u2227",
  50751. or: "\u2228",
  50752. cap: "\u2229",
  50753. cup: "\u222A",
  50754. "int": "\u222B",
  50755. there4: "\u2234",
  50756. sim: "\u223C",
  50757. cong: "\u2245",
  50758. asymp: "\u2248",
  50759. ne: "\u2260",
  50760. equiv: "\u2261",
  50761. le: "\u2264",
  50762. ge: "\u2265",
  50763. sub: "\u2282",
  50764. sup: "\u2283",
  50765. nsub: "\u2284",
  50766. sube: "\u2286",
  50767. supe: "\u2287",
  50768. oplus: "\u2295",
  50769. otimes: "\u2297",
  50770. perp: "\u22A5",
  50771. sdot: "\u22C5",
  50772. Alpha: "\u0391",
  50773. Beta: "\u0392",
  50774. Gamma: "\u0393",
  50775. Delta: "\u0394",
  50776. Epsilon: "\u0395",
  50777. Zeta: "\u0396",
  50778. Eta: "\u0397",
  50779. Theta: "\u0398",
  50780. Iota: "\u0399",
  50781. Kappa: "\u039A",
  50782. Lambda: "\u039B",
  50783. Mu: "\u039C",
  50784. Nu: "\u039D",
  50785. Xi: "\u039E",
  50786. Omicron: "\u039F",
  50787. Pi: "\u03A0",
  50788. Rho: "\u03A1",
  50789. Sigma: "\u03A3",
  50790. Tau: "\u03A4",
  50791. Upsilon: "\u03A5",
  50792. Phi: "\u03A6",
  50793. Chi: "\u03A7",
  50794. Psi: "\u03A8",
  50795. Omega: "\u03A9",
  50796. alpha: "\u03B1",
  50797. beta: "\u03B2",
  50798. gamma: "\u03B3",
  50799. delta: "\u03B4",
  50800. epsilon: "\u03B5",
  50801. zeta: "\u03B6",
  50802. eta: "\u03B7",
  50803. theta: "\u03B8",
  50804. iota: "\u03B9",
  50805. kappa: "\u03BA",
  50806. lambda: "\u03BB",
  50807. mu: "\u03BC",
  50808. nu: "\u03BD",
  50809. xi: "\u03BE",
  50810. omicron: "\u03BF",
  50811. pi: "\u03C0",
  50812. rho: "\u03C1",
  50813. sigmaf: "\u03C2",
  50814. sigma: "\u03C3",
  50815. tau: "\u03C4",
  50816. upsilon: "\u03C5",
  50817. phi: "\u03C6",
  50818. chi: "\u03C7",
  50819. psi: "\u03C8",
  50820. omega: "\u03C9",
  50821. thetasym: "\u03D1",
  50822. upsih: "\u03D2",
  50823. piv: "\u03D6",
  50824. OElig: "\u0152",
  50825. oelig: "\u0153",
  50826. Scaron: "\u0160",
  50827. scaron: "\u0161",
  50828. Yuml: "\u0178",
  50829. fnof: "\u0192",
  50830. circ: "\u02C6",
  50831. tilde: "\u02DC",
  50832. ensp: "\u2002",
  50833. emsp: "\u2003",
  50834. thinsp: "\u2009",
  50835. zwnj: "\u200C",
  50836. zwj: "\u200D",
  50837. lrm: "\u200E",
  50838. rlm: "\u200F",
  50839. ndash: "\u2013",
  50840. mdash: "\u2014",
  50841. lsquo: "\u2018",
  50842. rsquo: "\u2019",
  50843. sbquo: "\u201A",
  50844. ldquo: "\u201C",
  50845. rdquo: "\u201D",
  50846. bdquo: "\u201E",
  50847. dagger: "\u2020",
  50848. Dagger: "\u2021",
  50849. bull: "\u2022",
  50850. hellip: "\u2026",
  50851. permil: "\u2030",
  50852. prime: "\u2032",
  50853. Prime: "\u2033",
  50854. lsaquo: "\u2039",
  50855. rsaquo: "\u203A",
  50856. oline: "\u203E",
  50857. euro: "\u20AC",
  50858. trade: "\u2122",
  50859. larr: "\u2190",
  50860. uarr: "\u2191",
  50861. rarr: "\u2192",
  50862. darr: "\u2193",
  50863. harr: "\u2194",
  50864. crarr: "\u21B5",
  50865. lceil: "\u2308",
  50866. rceil: "\u2309",
  50867. lfloor: "\u230A",
  50868. rfloor: "\u230B",
  50869. loz: "\u25CA",
  50870. spades: "\u2660",
  50871. clubs: "\u2663",
  50872. hearts: "\u2665",
  50873. diams: "\u2666"
  50874. });
  50875. exports2.entityMap = exports2.HTML_ENTITIES;
  50876. })(entities$1);
  50877. var sax$1 = {};
  50878. var NAMESPACE$1 = conventions$2.NAMESPACE;
  50879. 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]/;
  50880. var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
  50881. var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
  50882. var S_TAG = 0;
  50883. var S_ATTR = 1;
  50884. var S_ATTR_SPACE = 2;
  50885. var S_EQ = 3;
  50886. var S_ATTR_NOQUOT_VALUE = 4;
  50887. var S_ATTR_END = 5;
  50888. var S_TAG_SPACE = 6;
  50889. var S_TAG_CLOSE = 7;
  50890. function ParseError$1(message, locator) {
  50891. this.message = message;
  50892. this.locator = locator;
  50893. if (Error.captureStackTrace)
  50894. Error.captureStackTrace(this, ParseError$1);
  50895. }
  50896. ParseError$1.prototype = new Error();
  50897. ParseError$1.prototype.name = ParseError$1.name;
  50898. function XMLReader$1() {
  50899. }
  50900. XMLReader$1.prototype = {
  50901. parse: function(source, defaultNSMap, entityMap) {
  50902. var domBuilder = this.domBuilder;
  50903. domBuilder.startDocument();
  50904. _copy(defaultNSMap, defaultNSMap = {});
  50905. parse$2(
  50906. source,
  50907. defaultNSMap,
  50908. entityMap,
  50909. domBuilder,
  50910. this.errorHandler
  50911. );
  50912. domBuilder.endDocument();
  50913. }
  50914. };
  50915. function parse$2(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
  50916. function fixedFromCharCode(code) {
  50917. if (code > 65535) {
  50918. code -= 65536;
  50919. var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
  50920. return String.fromCharCode(surrogate1, surrogate2);
  50921. } else {
  50922. return String.fromCharCode(code);
  50923. }
  50924. }
  50925. function entityReplacer(a2) {
  50926. var k = a2.slice(1, -1);
  50927. if (Object.hasOwnProperty.call(entityMap, k)) {
  50928. return entityMap[k];
  50929. } else if (k.charAt(0) === "#") {
  50930. return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
  50931. } else {
  50932. errorHandler.error("entity not found:" + a2);
  50933. return a2;
  50934. }
  50935. }
  50936. function appendText(end2) {
  50937. if (end2 > start2) {
  50938. var xt2 = source.substring(start2, end2).replace(/&#?\w+;/g, entityReplacer);
  50939. locator && position2(start2);
  50940. domBuilder.characters(xt2, 0, end2 - start2);
  50941. start2 = end2;
  50942. }
  50943. }
  50944. function position2(p, m) {
  50945. while (p >= lineEnd && (m = linePattern.exec(source))) {
  50946. lineStart = m.index;
  50947. lineEnd = lineStart + m[0].length;
  50948. locator.lineNumber++;
  50949. }
  50950. locator.columnNumber = p - lineStart + 1;
  50951. }
  50952. var lineStart = 0;
  50953. var lineEnd = 0;
  50954. var linePattern = /.*(?:\r\n?|\n)|.*$/g;
  50955. var locator = domBuilder.locator;
  50956. var parseStack = [{ currentNSMap: defaultNSMapCopy }];
  50957. var closeMap = {};
  50958. var start2 = 0;
  50959. while (true) {
  50960. try {
  50961. var tagStart = source.indexOf("<", start2);
  50962. if (tagStart < 0) {
  50963. if (!source.substr(start2).match(/^\s*$/)) {
  50964. var doc = domBuilder.doc;
  50965. var text = doc.createTextNode(source.substr(start2));
  50966. doc.appendChild(text);
  50967. domBuilder.currentElement = text;
  50968. }
  50969. return;
  50970. }
  50971. if (tagStart > start2) {
  50972. appendText(tagStart);
  50973. }
  50974. switch (source.charAt(tagStart + 1)) {
  50975. case "/":
  50976. var end = source.indexOf(">", tagStart + 3);
  50977. var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
  50978. var config = parseStack.pop();
  50979. if (end < 0) {
  50980. tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
  50981. errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
  50982. end = tagStart + 1 + tagName.length;
  50983. } else if (tagName.match(/\s</)) {
  50984. tagName = tagName.replace(/[\s<].*/, "");
  50985. errorHandler.error("end tag name: " + tagName + " maybe not complete");
  50986. end = tagStart + 1 + tagName.length;
  50987. }
  50988. var localNSMap = config.localNSMap;
  50989. var endMatch = config.tagName == tagName;
  50990. var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
  50991. if (endIgnoreCaseMach) {
  50992. domBuilder.endElement(config.uri, config.localName, tagName);
  50993. if (localNSMap) {
  50994. for (var prefix in localNSMap) {
  50995. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  50996. domBuilder.endPrefixMapping(prefix);
  50997. }
  50998. }
  50999. }
  51000. if (!endMatch) {
  51001. errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
  51002. }
  51003. } else {
  51004. parseStack.push(config);
  51005. }
  51006. end++;
  51007. break;
  51008. case "?":
  51009. locator && position2(tagStart);
  51010. end = parseInstruction(source, tagStart, domBuilder);
  51011. break;
  51012. case "!":
  51013. locator && position2(tagStart);
  51014. end = parseDCC(source, tagStart, domBuilder, errorHandler);
  51015. break;
  51016. default:
  51017. locator && position2(tagStart);
  51018. var el = new ElementAttributes();
  51019. var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
  51020. var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
  51021. var len = el.length;
  51022. if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
  51023. el.closed = true;
  51024. if (!entityMap.nbsp) {
  51025. errorHandler.warning("unclosed xml attribute");
  51026. }
  51027. }
  51028. if (locator && len) {
  51029. var locator2 = copyLocator(locator, {});
  51030. for (var i2 = 0; i2 < len; i2++) {
  51031. var a = el[i2];
  51032. position2(a.offset);
  51033. a.locator = copyLocator(locator, {});
  51034. }
  51035. domBuilder.locator = locator2;
  51036. if (appendElement$1(el, domBuilder, currentNSMap)) {
  51037. parseStack.push(el);
  51038. }
  51039. domBuilder.locator = locator;
  51040. } else {
  51041. if (appendElement$1(el, domBuilder, currentNSMap)) {
  51042. parseStack.push(el);
  51043. }
  51044. }
  51045. if (NAMESPACE$1.isHTML(el.uri) && !el.closed) {
  51046. end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
  51047. } else {
  51048. end++;
  51049. }
  51050. }
  51051. } catch (e) {
  51052. if (e instanceof ParseError$1) {
  51053. throw e;
  51054. }
  51055. errorHandler.error("element parse error: " + e);
  51056. end = -1;
  51057. }
  51058. if (end > start2) {
  51059. start2 = end;
  51060. } else {
  51061. appendText(Math.max(tagStart, start2) + 1);
  51062. }
  51063. }
  51064. }
  51065. function copyLocator(f, t2) {
  51066. t2.lineNumber = f.lineNumber;
  51067. t2.columnNumber = f.columnNumber;
  51068. return t2;
  51069. }
  51070. function parseElementStartPart(source, start2, el, currentNSMap, entityReplacer, errorHandler) {
  51071. function addAttribute(qname, value2, startIndex) {
  51072. if (el.attributeNames.hasOwnProperty(qname)) {
  51073. errorHandler.fatalError("Attribute " + qname + " redefined");
  51074. }
  51075. el.addValue(
  51076. qname,
  51077. value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer),
  51078. startIndex
  51079. );
  51080. }
  51081. var attrName;
  51082. var value;
  51083. var p = ++start2;
  51084. var s = S_TAG;
  51085. while (true) {
  51086. var c = source.charAt(p);
  51087. switch (c) {
  51088. case "=":
  51089. if (s === S_ATTR) {
  51090. attrName = source.slice(start2, p);
  51091. s = S_EQ;
  51092. } else if (s === S_ATTR_SPACE) {
  51093. s = S_EQ;
  51094. } else {
  51095. throw new Error("attribute equal must after attrName");
  51096. }
  51097. break;
  51098. case "'":
  51099. case '"':
  51100. if (s === S_EQ || s === S_ATTR) {
  51101. if (s === S_ATTR) {
  51102. errorHandler.warning('attribute value must after "="');
  51103. attrName = source.slice(start2, p);
  51104. }
  51105. start2 = p + 1;
  51106. p = source.indexOf(c, start2);
  51107. if (p > 0) {
  51108. value = source.slice(start2, p);
  51109. addAttribute(attrName, value, start2 - 1);
  51110. s = S_ATTR_END;
  51111. } else {
  51112. throw new Error("attribute value no end '" + c + "' match");
  51113. }
  51114. } else if (s == S_ATTR_NOQUOT_VALUE) {
  51115. value = source.slice(start2, p);
  51116. addAttribute(attrName, value, start2);
  51117. errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!");
  51118. start2 = p + 1;
  51119. s = S_ATTR_END;
  51120. } else {
  51121. throw new Error('attribute value must after "="');
  51122. }
  51123. break;
  51124. case "/":
  51125. switch (s) {
  51126. case S_TAG:
  51127. el.setTagName(source.slice(start2, p));
  51128. case S_ATTR_END:
  51129. case S_TAG_SPACE:
  51130. case S_TAG_CLOSE:
  51131. s = S_TAG_CLOSE;
  51132. el.closed = true;
  51133. case S_ATTR_NOQUOT_VALUE:
  51134. case S_ATTR:
  51135. break;
  51136. case S_ATTR_SPACE:
  51137. el.closed = true;
  51138. break;
  51139. default:
  51140. throw new Error("attribute invalid close char('/')");
  51141. }
  51142. break;
  51143. case "":
  51144. errorHandler.error("unexpected end of input");
  51145. if (s == S_TAG) {
  51146. el.setTagName(source.slice(start2, p));
  51147. }
  51148. return p;
  51149. case ">":
  51150. switch (s) {
  51151. case S_TAG:
  51152. el.setTagName(source.slice(start2, p));
  51153. case S_ATTR_END:
  51154. case S_TAG_SPACE:
  51155. case S_TAG_CLOSE:
  51156. break;
  51157. case S_ATTR_NOQUOT_VALUE:
  51158. case S_ATTR:
  51159. value = source.slice(start2, p);
  51160. if (value.slice(-1) === "/") {
  51161. el.closed = true;
  51162. value = value.slice(0, -1);
  51163. }
  51164. case S_ATTR_SPACE:
  51165. if (s === S_ATTR_SPACE) {
  51166. value = attrName;
  51167. }
  51168. if (s == S_ATTR_NOQUOT_VALUE) {
  51169. errorHandler.warning('attribute "' + value + '" missed quot(")!');
  51170. addAttribute(attrName, value, start2);
  51171. } else {
  51172. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
  51173. errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
  51174. }
  51175. addAttribute(value, value, start2);
  51176. }
  51177. break;
  51178. case S_EQ:
  51179. throw new Error("attribute value missed!!");
  51180. }
  51181. return p;
  51182. case "\x80":
  51183. c = " ";
  51184. default:
  51185. if (c <= " ") {
  51186. switch (s) {
  51187. case S_TAG:
  51188. el.setTagName(source.slice(start2, p));
  51189. s = S_TAG_SPACE;
  51190. break;
  51191. case S_ATTR:
  51192. attrName = source.slice(start2, p);
  51193. s = S_ATTR_SPACE;
  51194. break;
  51195. case S_ATTR_NOQUOT_VALUE:
  51196. var value = source.slice(start2, p);
  51197. errorHandler.warning('attribute "' + value + '" missed quot(")!!');
  51198. addAttribute(attrName, value, start2);
  51199. case S_ATTR_END:
  51200. s = S_TAG_SPACE;
  51201. break;
  51202. }
  51203. } else {
  51204. switch (s) {
  51205. case S_ATTR_SPACE:
  51206. el.tagName;
  51207. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
  51208. errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
  51209. }
  51210. addAttribute(attrName, attrName, start2);
  51211. start2 = p;
  51212. s = S_ATTR;
  51213. break;
  51214. case S_ATTR_END:
  51215. errorHandler.warning('attribute space is required"' + attrName + '"!!');
  51216. case S_TAG_SPACE:
  51217. s = S_ATTR;
  51218. start2 = p;
  51219. break;
  51220. case S_EQ:
  51221. s = S_ATTR_NOQUOT_VALUE;
  51222. start2 = p;
  51223. break;
  51224. case S_TAG_CLOSE:
  51225. throw new Error("elements closed character '/' and '>' must be connected to");
  51226. }
  51227. }
  51228. }
  51229. p++;
  51230. }
  51231. }
  51232. function appendElement$1(el, domBuilder, currentNSMap) {
  51233. var tagName = el.tagName;
  51234. var localNSMap = null;
  51235. var i2 = el.length;
  51236. while (i2--) {
  51237. var a = el[i2];
  51238. var qName = a.qName;
  51239. var value = a.value;
  51240. var nsp = qName.indexOf(":");
  51241. if (nsp > 0) {
  51242. var prefix = a.prefix = qName.slice(0, nsp);
  51243. var localName = qName.slice(nsp + 1);
  51244. var nsPrefix = prefix === "xmlns" && localName;
  51245. } else {
  51246. localName = qName;
  51247. prefix = null;
  51248. nsPrefix = qName === "xmlns" && "";
  51249. }
  51250. a.localName = localName;
  51251. if (nsPrefix !== false) {
  51252. if (localNSMap == null) {
  51253. localNSMap = {};
  51254. _copy(currentNSMap, currentNSMap = {});
  51255. }
  51256. currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
  51257. a.uri = NAMESPACE$1.XMLNS;
  51258. domBuilder.startPrefixMapping(nsPrefix, value);
  51259. }
  51260. }
  51261. var i2 = el.length;
  51262. while (i2--) {
  51263. a = el[i2];
  51264. var prefix = a.prefix;
  51265. if (prefix) {
  51266. if (prefix === "xml") {
  51267. a.uri = NAMESPACE$1.XML;
  51268. }
  51269. if (prefix !== "xmlns") {
  51270. a.uri = currentNSMap[prefix || ""];
  51271. }
  51272. }
  51273. }
  51274. var nsp = tagName.indexOf(":");
  51275. if (nsp > 0) {
  51276. prefix = el.prefix = tagName.slice(0, nsp);
  51277. localName = el.localName = tagName.slice(nsp + 1);
  51278. } else {
  51279. prefix = null;
  51280. localName = el.localName = tagName;
  51281. }
  51282. var ns = el.uri = currentNSMap[prefix || ""];
  51283. domBuilder.startElement(ns, localName, tagName, el);
  51284. if (el.closed) {
  51285. domBuilder.endElement(ns, localName, tagName);
  51286. if (localNSMap) {
  51287. for (prefix in localNSMap) {
  51288. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  51289. domBuilder.endPrefixMapping(prefix);
  51290. }
  51291. }
  51292. }
  51293. } else {
  51294. el.currentNSMap = currentNSMap;
  51295. el.localNSMap = localNSMap;
  51296. return true;
  51297. }
  51298. }
  51299. function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
  51300. if (/^(?:script|textarea)$/i.test(tagName)) {
  51301. var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
  51302. var text = source.substring(elStartEnd + 1, elEndStart);
  51303. if (/[&<]/.test(text)) {
  51304. if (/^script$/i.test(tagName)) {
  51305. domBuilder.characters(text, 0, text.length);
  51306. return elEndStart;
  51307. }
  51308. text = text.replace(/&#?\w+;/g, entityReplacer);
  51309. domBuilder.characters(text, 0, text.length);
  51310. return elEndStart;
  51311. }
  51312. }
  51313. return elStartEnd + 1;
  51314. }
  51315. function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
  51316. var pos = closeMap[tagName];
  51317. if (pos == null) {
  51318. pos = source.lastIndexOf("</" + tagName + ">");
  51319. if (pos < elStartEnd) {
  51320. pos = source.lastIndexOf("</" + tagName);
  51321. }
  51322. closeMap[tagName] = pos;
  51323. }
  51324. return pos < elStartEnd;
  51325. }
  51326. function _copy(source, target) {
  51327. for (var n in source) {
  51328. if (Object.prototype.hasOwnProperty.call(source, n)) {
  51329. target[n] = source[n];
  51330. }
  51331. }
  51332. }
  51333. function parseDCC(source, start2, domBuilder, errorHandler) {
  51334. var next = source.charAt(start2 + 2);
  51335. switch (next) {
  51336. case "-":
  51337. if (source.charAt(start2 + 3) === "-") {
  51338. var end = source.indexOf("-->", start2 + 4);
  51339. if (end > start2) {
  51340. domBuilder.comment(source, start2 + 4, end - start2 - 4);
  51341. return end + 3;
  51342. } else {
  51343. errorHandler.error("Unclosed comment");
  51344. return -1;
  51345. }
  51346. } else {
  51347. return -1;
  51348. }
  51349. default:
  51350. if (source.substr(start2 + 3, 6) == "CDATA[") {
  51351. var end = source.indexOf("]]>", start2 + 9);
  51352. domBuilder.startCDATA();
  51353. domBuilder.characters(source, start2 + 9, end - start2 - 9);
  51354. domBuilder.endCDATA();
  51355. return end + 3;
  51356. }
  51357. var matchs = split(source, start2);
  51358. var len = matchs.length;
  51359. if (len > 1 && /!doctype/i.test(matchs[0][0])) {
  51360. var name = matchs[1][0];
  51361. var pubid = false;
  51362. var sysid = false;
  51363. if (len > 3) {
  51364. if (/^public$/i.test(matchs[2][0])) {
  51365. pubid = matchs[3][0];
  51366. sysid = len > 4 && matchs[4][0];
  51367. } else if (/^system$/i.test(matchs[2][0])) {
  51368. sysid = matchs[3][0];
  51369. }
  51370. }
  51371. var lastMatch = matchs[len - 1];
  51372. domBuilder.startDTD(name, pubid, sysid);
  51373. domBuilder.endDTD();
  51374. return lastMatch.index + lastMatch[0].length;
  51375. }
  51376. }
  51377. return -1;
  51378. }
  51379. function parseInstruction(source, start2, domBuilder) {
  51380. var end = source.indexOf("?>", start2);
  51381. if (end) {
  51382. var match = source.substring(start2, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
  51383. if (match) {
  51384. match[0].length;
  51385. domBuilder.processingInstruction(match[1], match[2]);
  51386. return end + 2;
  51387. } else {
  51388. return -1;
  51389. }
  51390. }
  51391. return -1;
  51392. }
  51393. function ElementAttributes() {
  51394. this.attributeNames = {};
  51395. }
  51396. ElementAttributes.prototype = {
  51397. setTagName: function(tagName) {
  51398. if (!tagNamePattern.test(tagName)) {
  51399. throw new Error("invalid tagName:" + tagName);
  51400. }
  51401. this.tagName = tagName;
  51402. },
  51403. addValue: function(qName, value, offset) {
  51404. if (!tagNamePattern.test(qName)) {
  51405. throw new Error("invalid attribute:" + qName);
  51406. }
  51407. this.attributeNames[qName] = this.length;
  51408. this[this.length++] = { qName, value, offset };
  51409. },
  51410. length: 0,
  51411. getLocalName: function(i2) {
  51412. return this[i2].localName;
  51413. },
  51414. getLocator: function(i2) {
  51415. return this[i2].locator;
  51416. },
  51417. getQName: function(i2) {
  51418. return this[i2].qName;
  51419. },
  51420. getURI: function(i2) {
  51421. return this[i2].uri;
  51422. },
  51423. getValue: function(i2) {
  51424. return this[i2].value;
  51425. }
  51426. };
  51427. function split(source, start2) {
  51428. var match;
  51429. var buf = [];
  51430. var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
  51431. reg.lastIndex = start2;
  51432. reg.exec(source);
  51433. while (match = reg.exec(source)) {
  51434. buf.push(match);
  51435. if (match[1])
  51436. return buf;
  51437. }
  51438. }
  51439. sax$1.XMLReader = XMLReader$1;
  51440. sax$1.ParseError = ParseError$1;
  51441. var conventions = conventions$2;
  51442. var dom = dom$1;
  51443. var entities = entities$1;
  51444. var sax = sax$1;
  51445. var DOMImplementation = dom.DOMImplementation;
  51446. var NAMESPACE = conventions.NAMESPACE;
  51447. var ParseError = sax.ParseError;
  51448. var XMLReader = sax.XMLReader;
  51449. function normalizeLineEndings(input) {
  51450. return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
  51451. }
  51452. function DOMParser$1(options2) {
  51453. this.options = options2 || { locator: {} };
  51454. }
  51455. DOMParser$1.prototype.parseFromString = function(source, mimeType) {
  51456. var options2 = this.options;
  51457. var sax2 = new XMLReader();
  51458. var domBuilder = options2.domBuilder || new DOMHandler();
  51459. var errorHandler = options2.errorHandler;
  51460. var locator = options2.locator;
  51461. var defaultNSMap = options2.xmlns || {};
  51462. var isHTML = /\/x?html?$/.test(mimeType);
  51463. var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
  51464. if (locator) {
  51465. domBuilder.setDocumentLocator(locator);
  51466. }
  51467. sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
  51468. sax2.domBuilder = options2.domBuilder || domBuilder;
  51469. if (isHTML) {
  51470. defaultNSMap[""] = NAMESPACE.HTML;
  51471. }
  51472. defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
  51473. var normalize = options2.normalizeLineEndings || normalizeLineEndings;
  51474. if (source && typeof source === "string") {
  51475. sax2.parse(
  51476. normalize(source),
  51477. defaultNSMap,
  51478. entityMap
  51479. );
  51480. } else {
  51481. sax2.errorHandler.error("invalid doc source");
  51482. }
  51483. return domBuilder.doc;
  51484. };
  51485. function buildErrorHandler(errorImpl, domBuilder, locator) {
  51486. if (!errorImpl) {
  51487. if (domBuilder instanceof DOMHandler) {
  51488. return domBuilder;
  51489. }
  51490. errorImpl = domBuilder;
  51491. }
  51492. var errorHandler = {};
  51493. var isCallback = errorImpl instanceof Function;
  51494. locator = locator || {};
  51495. function build(key) {
  51496. var fn2 = errorImpl[key];
  51497. if (!fn2 && isCallback) {
  51498. fn2 = errorImpl.length == 2 ? function(msg) {
  51499. errorImpl(key, msg);
  51500. } : errorImpl;
  51501. }
  51502. errorHandler[key] = fn2 && function(msg) {
  51503. fn2("[xmldom " + key + "] " + msg + _locator(locator));
  51504. } || function() {
  51505. };
  51506. }
  51507. build("warning");
  51508. build("error");
  51509. build("fatalError");
  51510. return errorHandler;
  51511. }
  51512. function DOMHandler() {
  51513. this.cdata = false;
  51514. }
  51515. function position(locator, node) {
  51516. node.lineNumber = locator.lineNumber;
  51517. node.columnNumber = locator.columnNumber;
  51518. }
  51519. DOMHandler.prototype = {
  51520. startDocument: function() {
  51521. this.doc = new DOMImplementation().createDocument(null, null, null);
  51522. if (this.locator) {
  51523. this.doc.documentURI = this.locator.systemId;
  51524. }
  51525. },
  51526. startElement: function(namespaceURI, localName, qName, attrs) {
  51527. var doc = this.doc;
  51528. var el = doc.createElementNS(namespaceURI, qName || localName);
  51529. var len = attrs.length;
  51530. appendElement(this, el);
  51531. this.currentElement = el;
  51532. this.locator && position(this.locator, el);
  51533. for (var i2 = 0; i2 < len; i2++) {
  51534. var namespaceURI = attrs.getURI(i2);
  51535. var value = attrs.getValue(i2);
  51536. var qName = attrs.getQName(i2);
  51537. var attr = doc.createAttributeNS(namespaceURI, qName);
  51538. this.locator && position(attrs.getLocator(i2), attr);
  51539. attr.value = attr.nodeValue = value;
  51540. el.setAttributeNode(attr);
  51541. }
  51542. },
  51543. endElement: function(namespaceURI, localName, qName) {
  51544. var current = this.currentElement;
  51545. current.tagName;
  51546. this.currentElement = current.parentNode;
  51547. },
  51548. startPrefixMapping: function(prefix, uri) {
  51549. },
  51550. endPrefixMapping: function(prefix) {
  51551. },
  51552. processingInstruction: function(target, data) {
  51553. var ins = this.doc.createProcessingInstruction(target, data);
  51554. this.locator && position(this.locator, ins);
  51555. appendElement(this, ins);
  51556. },
  51557. ignorableWhitespace: function(ch, start2, length) {
  51558. },
  51559. characters: function(chars, start2, length) {
  51560. chars = _toString.apply(this, arguments);
  51561. if (chars) {
  51562. if (this.cdata) {
  51563. var charNode = this.doc.createCDATASection(chars);
  51564. } else {
  51565. var charNode = this.doc.createTextNode(chars);
  51566. }
  51567. if (this.currentElement) {
  51568. this.currentElement.appendChild(charNode);
  51569. } else if (/^\s*$/.test(chars)) {
  51570. this.doc.appendChild(charNode);
  51571. }
  51572. this.locator && position(this.locator, charNode);
  51573. }
  51574. },
  51575. skippedEntity: function(name) {
  51576. },
  51577. endDocument: function() {
  51578. this.doc.normalize();
  51579. },
  51580. setDocumentLocator: function(locator) {
  51581. if (this.locator = locator) {
  51582. locator.lineNumber = 0;
  51583. }
  51584. },
  51585. comment: function(chars, start2, length) {
  51586. chars = _toString.apply(this, arguments);
  51587. var comm = this.doc.createComment(chars);
  51588. this.locator && position(this.locator, comm);
  51589. appendElement(this, comm);
  51590. },
  51591. startCDATA: function() {
  51592. this.cdata = true;
  51593. },
  51594. endCDATA: function() {
  51595. this.cdata = false;
  51596. },
  51597. startDTD: function(name, publicId, systemId) {
  51598. var impl = this.doc.implementation;
  51599. if (impl && impl.createDocumentType) {
  51600. var dt2 = impl.createDocumentType(name, publicId, systemId);
  51601. this.locator && position(this.locator, dt2);
  51602. appendElement(this, dt2);
  51603. this.doc.doctype = dt2;
  51604. }
  51605. },
  51606. warning: function(error) {
  51607. console.warn("[xmldom warning] " + error, _locator(this.locator));
  51608. },
  51609. error: function(error) {
  51610. console.error("[xmldom error] " + error, _locator(this.locator));
  51611. },
  51612. fatalError: function(error) {
  51613. throw new ParseError(error, this.locator);
  51614. }
  51615. };
  51616. function _locator(l) {
  51617. if (l) {
  51618. return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
  51619. }
  51620. }
  51621. function _toString(chars, start2, length) {
  51622. if (typeof chars == "string") {
  51623. return chars.substr(start2, length);
  51624. } else {
  51625. if (chars.length >= start2 + length || start2) {
  51626. return new java.lang.String(chars, start2, length) + "";
  51627. }
  51628. return chars;
  51629. }
  51630. }
  51631. "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
  51632. DOMHandler.prototype[key] = function() {
  51633. return null;
  51634. };
  51635. });
  51636. function appendElement(hander, node) {
  51637. if (!hander.currentElement) {
  51638. hander.doc.appendChild(node);
  51639. } else {
  51640. hander.currentElement.appendChild(node);
  51641. }
  51642. }
  51643. domParser.__DOMHandler = DOMHandler;
  51644. domParser.normalizeLineEndings = normalizeLineEndings;
  51645. domParser.DOMParser = DOMParser$1;
  51646. var DOMParser = domParser.DOMParser;
  51647. /*! @name mpd-parser @version 1.1.1 @license Apache-2.0 */
  51648. const isObject$3 = (obj) => {
  51649. return !!obj && typeof obj === "object";
  51650. };
  51651. const merge$3 = (...objects) => {
  51652. return objects.reduce((result, source) => {
  51653. if (typeof source !== "object") {
  51654. return result;
  51655. }
  51656. Object.keys(source).forEach((key) => {
  51657. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  51658. result[key] = result[key].concat(source[key]);
  51659. } else if (isObject$3(result[key]) && isObject$3(source[key])) {
  51660. result[key] = merge$3(result[key], source[key]);
  51661. } else {
  51662. result[key] = source[key];
  51663. }
  51664. });
  51665. return result;
  51666. }, {});
  51667. };
  51668. const values$1 = (o) => Object.keys(o).map((k) => o[k]);
  51669. const range$1 = (start2, end) => {
  51670. const result = [];
  51671. for (let i2 = start2; i2 < end; i2++) {
  51672. result.push(i2);
  51673. }
  51674. return result;
  51675. };
  51676. const flatten$1 = (lists) => lists.reduce((x, y) => x.concat(y), []);
  51677. const from$1 = (list) => {
  51678. if (!list.length) {
  51679. return [];
  51680. }
  51681. const result = [];
  51682. for (let i2 = 0; i2 < list.length; i2++) {
  51683. result.push(list[i2]);
  51684. }
  51685. return result;
  51686. };
  51687. const findIndexes$1 = (l, key) => l.reduce((a, e, i2) => {
  51688. if (e[key]) {
  51689. a.push(i2);
  51690. }
  51691. return a;
  51692. }, []);
  51693. const union$1 = (lists, keyFunction) => {
  51694. return values$1(lists.reduce((acc, list) => {
  51695. list.forEach((el) => {
  51696. acc[keyFunction(el)] = el;
  51697. });
  51698. return acc;
  51699. }, {}));
  51700. };
  51701. var errors$1 = {
  51702. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  51703. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  51704. DASH_INVALID_XML: "DASH_INVALID_XML",
  51705. NO_BASE_URL: "NO_BASE_URL",
  51706. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  51707. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  51708. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  51709. };
  51710. const urlTypeToSegment$1 = ({
  51711. baseUrl = "",
  51712. source = "",
  51713. range: range3 = "",
  51714. indexRange = ""
  51715. }) => {
  51716. const segment = {
  51717. uri: source,
  51718. resolvedUri: resolveUrl$3(baseUrl || "", source)
  51719. };
  51720. if (range3 || indexRange) {
  51721. const rangeStr = range3 ? range3 : indexRange;
  51722. const ranges = rangeStr.split("-");
  51723. let startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  51724. let endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  51725. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  51726. startRange = Number(startRange);
  51727. }
  51728. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  51729. endRange = Number(endRange);
  51730. }
  51731. let length;
  51732. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  51733. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  51734. } else {
  51735. length = endRange - startRange + 1;
  51736. }
  51737. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  51738. length = Number(length);
  51739. }
  51740. segment.byterange = {
  51741. length,
  51742. offset: startRange
  51743. };
  51744. }
  51745. return segment;
  51746. };
  51747. const byteRangeToString$1 = (byterange) => {
  51748. let endRange;
  51749. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  51750. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  51751. } else {
  51752. endRange = byterange.offset + byterange.length - 1;
  51753. }
  51754. return `${byterange.offset}-${endRange}`;
  51755. };
  51756. const parseEndNumber$1 = (endNumber) => {
  51757. if (endNumber && typeof endNumber !== "number") {
  51758. endNumber = parseInt(endNumber, 10);
  51759. }
  51760. if (isNaN(endNumber)) {
  51761. return null;
  51762. }
  51763. return endNumber;
  51764. };
  51765. const segmentRange$1 = {
  51766. static(attributes) {
  51767. const {
  51768. duration: duration5,
  51769. timescale: timescale2 = 1,
  51770. sourceDuration,
  51771. periodDuration
  51772. } = attributes;
  51773. const endNumber = parseEndNumber$1(attributes.endNumber);
  51774. const segmentDuration = duration5 / timescale2;
  51775. if (typeof endNumber === "number") {
  51776. return {
  51777. start: 0,
  51778. end: endNumber
  51779. };
  51780. }
  51781. if (typeof periodDuration === "number") {
  51782. return {
  51783. start: 0,
  51784. end: periodDuration / segmentDuration
  51785. };
  51786. }
  51787. return {
  51788. start: 0,
  51789. end: sourceDuration / segmentDuration
  51790. };
  51791. },
  51792. dynamic(attributes) {
  51793. const {
  51794. NOW,
  51795. clientOffset,
  51796. availabilityStartTime: availabilityStartTime2,
  51797. timescale: timescale2 = 1,
  51798. duration: duration5,
  51799. periodStart = 0,
  51800. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  51801. timeShiftBufferDepth: timeShiftBufferDepth2 = Infinity
  51802. } = attributes;
  51803. const endNumber = parseEndNumber$1(attributes.endNumber);
  51804. const now2 = (NOW + clientOffset) / 1e3;
  51805. const periodStartWC = availabilityStartTime2 + periodStart;
  51806. const periodEndWC = now2 + minimumUpdatePeriod2;
  51807. const periodDuration = periodEndWC - periodStartWC;
  51808. const segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  51809. const availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  51810. const availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  51811. return {
  51812. start: Math.max(0, availableStart),
  51813. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  51814. };
  51815. }
  51816. };
  51817. const toSegments$1 = (attributes) => (number) => {
  51818. const {
  51819. duration: duration5,
  51820. timescale: timescale2 = 1,
  51821. periodStart,
  51822. startNumber: startNumber2 = 1
  51823. } = attributes;
  51824. return {
  51825. number: startNumber2 + number,
  51826. duration: duration5 / timescale2,
  51827. timeline: periodStart,
  51828. time: number * duration5
  51829. };
  51830. };
  51831. const parseByDuration$1 = (attributes) => {
  51832. const {
  51833. type: type2,
  51834. duration: duration5,
  51835. timescale: timescale2 = 1,
  51836. periodDuration,
  51837. sourceDuration
  51838. } = attributes;
  51839. const {
  51840. start: start2,
  51841. end
  51842. } = segmentRange$1[type2](attributes);
  51843. const segments = range$1(start2, end).map(toSegments$1(attributes));
  51844. if (type2 === "static") {
  51845. const index2 = segments.length - 1;
  51846. const sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  51847. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  51848. }
  51849. return segments;
  51850. };
  51851. const segmentsFromBase$1 = (attributes) => {
  51852. const {
  51853. baseUrl,
  51854. initialization = {},
  51855. sourceDuration,
  51856. indexRange = "",
  51857. periodStart,
  51858. presentationTime,
  51859. number = 0,
  51860. duration: duration5
  51861. } = attributes;
  51862. if (!baseUrl) {
  51863. throw new Error(errors$1.NO_BASE_URL);
  51864. }
  51865. const initSegment = urlTypeToSegment$1({
  51866. baseUrl,
  51867. source: initialization.sourceURL,
  51868. range: initialization.range
  51869. });
  51870. const segment = urlTypeToSegment$1({
  51871. baseUrl,
  51872. source: baseUrl,
  51873. indexRange
  51874. });
  51875. segment.map = initSegment;
  51876. if (duration5) {
  51877. const segmentTimeInfo = parseByDuration$1(attributes);
  51878. if (segmentTimeInfo.length) {
  51879. segment.duration = segmentTimeInfo[0].duration;
  51880. segment.timeline = segmentTimeInfo[0].timeline;
  51881. }
  51882. } else if (sourceDuration) {
  51883. segment.duration = sourceDuration;
  51884. segment.timeline = periodStart;
  51885. }
  51886. segment.presentationTime = presentationTime || periodStart;
  51887. segment.number = number;
  51888. return [segment];
  51889. };
  51890. const addSidxSegmentsToPlaylist$1$1 = (playlist, sidx, baseUrl) => {
  51891. const initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  51892. const sourceDuration = playlist.sidx.duration;
  51893. const timeline = playlist.timeline || 0;
  51894. const sidxByteRange = playlist.sidx.byterange;
  51895. const sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  51896. const timescale2 = sidx.timescale;
  51897. const mediaReferences = sidx.references.filter((r2) => r2.referenceType !== 1);
  51898. const segments = [];
  51899. const type2 = playlist.endList ? "static" : "dynamic";
  51900. const periodStart = playlist.sidx.timeline;
  51901. let presentationTime = periodStart;
  51902. let number = playlist.mediaSequence || 0;
  51903. let startIndex;
  51904. if (typeof sidx.firstOffset === "bigint") {
  51905. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  51906. } else {
  51907. startIndex = sidxEnd + sidx.firstOffset;
  51908. }
  51909. for (let i2 = 0; i2 < mediaReferences.length; i2++) {
  51910. const reference = sidx.references[i2];
  51911. const size = reference.referencedSize;
  51912. const duration5 = reference.subsegmentDuration;
  51913. let endIndex;
  51914. if (typeof startIndex === "bigint") {
  51915. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  51916. } else {
  51917. endIndex = startIndex + size - 1;
  51918. }
  51919. const indexRange = `${startIndex}-${endIndex}`;
  51920. const attributes = {
  51921. baseUrl,
  51922. timescale: timescale2,
  51923. timeline,
  51924. periodStart,
  51925. presentationTime,
  51926. number,
  51927. duration: duration5,
  51928. sourceDuration,
  51929. indexRange,
  51930. type: type2
  51931. };
  51932. const segment = segmentsFromBase$1(attributes)[0];
  51933. if (initSegment) {
  51934. segment.map = initSegment;
  51935. }
  51936. segments.push(segment);
  51937. if (typeof startIndex === "bigint") {
  51938. startIndex += window_1.BigInt(size);
  51939. } else {
  51940. startIndex += size;
  51941. }
  51942. presentationTime += duration5 / timescale2;
  51943. number++;
  51944. }
  51945. playlist.segments = segments;
  51946. return playlist;
  51947. };
  51948. const SUPPORTED_MEDIA_TYPES$1 = ["AUDIO", "SUBTITLES"];
  51949. const TIME_FUDGE$1 = 1 / 60;
  51950. const getUniqueTimelineStarts$1 = (timelineStarts) => {
  51951. return union$1(timelineStarts, ({
  51952. timeline
  51953. }) => timeline).sort((a, b) => a.timeline > b.timeline ? 1 : -1);
  51954. };
  51955. const findPlaylistWithName$1 = (playlists, name) => {
  51956. for (let i2 = 0; i2 < playlists.length; i2++) {
  51957. if (playlists[i2].attributes.NAME === name) {
  51958. return playlists[i2];
  51959. }
  51960. }
  51961. return null;
  51962. };
  51963. const getMediaGroupPlaylists$1 = (manifest) => {
  51964. let mediaGroupPlaylists = [];
  51965. forEachMediaGroup$3(manifest, SUPPORTED_MEDIA_TYPES$1, (properties, type2, group, label2) => {
  51966. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  51967. });
  51968. return mediaGroupPlaylists;
  51969. };
  51970. const updateMediaSequenceForPlaylist$1 = ({
  51971. playlist,
  51972. mediaSequence
  51973. }) => {
  51974. playlist.mediaSequence = mediaSequence;
  51975. playlist.segments.forEach((segment, index2) => {
  51976. segment.number = playlist.mediaSequence + index2;
  51977. });
  51978. };
  51979. const updateSequenceNumbers$1 = ({
  51980. oldPlaylists,
  51981. newPlaylists,
  51982. timelineStarts
  51983. }) => {
  51984. newPlaylists.forEach((playlist) => {
  51985. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  51986. timeline
  51987. }) {
  51988. return timeline === playlist.timeline;
  51989. });
  51990. const oldPlaylist = findPlaylistWithName$1(oldPlaylists, playlist.attributes.NAME);
  51991. if (!oldPlaylist) {
  51992. return;
  51993. }
  51994. if (playlist.sidx) {
  51995. return;
  51996. }
  51997. const firstNewSegment = playlist.segments[0];
  51998. const oldMatchingSegmentIndex = oldPlaylist.segments.findIndex(function(oldSegment) {
  51999. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE$1;
  52000. });
  52001. if (oldMatchingSegmentIndex === -1) {
  52002. updateMediaSequenceForPlaylist$1({
  52003. playlist,
  52004. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  52005. });
  52006. playlist.segments[0].discontinuity = true;
  52007. playlist.discontinuityStarts.unshift(0);
  52008. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  52009. playlist.discontinuitySequence--;
  52010. }
  52011. return;
  52012. }
  52013. const oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  52014. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  52015. firstNewSegment.discontinuity = true;
  52016. playlist.discontinuityStarts.unshift(0);
  52017. playlist.discontinuitySequence--;
  52018. }
  52019. updateMediaSequenceForPlaylist$1({
  52020. playlist,
  52021. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  52022. });
  52023. });
  52024. };
  52025. const positionManifestOnTimeline$1 = ({
  52026. oldManifest,
  52027. newManifest
  52028. }) => {
  52029. const oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists$1(oldManifest));
  52030. const newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists$1(newManifest));
  52031. newManifest.timelineStarts = getUniqueTimelineStarts$1([oldManifest.timelineStarts, newManifest.timelineStarts]);
  52032. updateSequenceNumbers$1({
  52033. oldPlaylists,
  52034. newPlaylists,
  52035. timelineStarts: newManifest.timelineStarts
  52036. });
  52037. return newManifest;
  52038. };
  52039. const generateSidxKey$1 = (sidx) => sidx && sidx.uri + "-" + byteRangeToString$1(sidx.byterange);
  52040. const mergeDiscontiguousPlaylists$1 = (playlists) => {
  52041. const mergedPlaylists = values$1(playlists.reduce((acc, playlist) => {
  52042. const name = playlist.attributes.id + (playlist.attributes.lang || "");
  52043. if (!acc[name]) {
  52044. acc[name] = playlist;
  52045. acc[name].attributes.timelineStarts = [];
  52046. } else {
  52047. if (playlist.segments) {
  52048. if (playlist.segments[0]) {
  52049. playlist.segments[0].discontinuity = true;
  52050. }
  52051. acc[name].segments.push(...playlist.segments);
  52052. }
  52053. if (playlist.attributes.contentProtection) {
  52054. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  52055. }
  52056. }
  52057. acc[name].attributes.timelineStarts.push({
  52058. start: playlist.attributes.periodStart,
  52059. timeline: playlist.attributes.periodStart
  52060. });
  52061. return acc;
  52062. }, {}));
  52063. return mergedPlaylists.map((playlist) => {
  52064. playlist.discontinuityStarts = findIndexes$1(playlist.segments || [], "discontinuity");
  52065. return playlist;
  52066. });
  52067. };
  52068. const addSidxSegmentsToPlaylist$2 = (playlist, sidxMapping) => {
  52069. const sidxKey = generateSidxKey$1(playlist.sidx);
  52070. const sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  52071. if (sidxMatch) {
  52072. addSidxSegmentsToPlaylist$1$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  52073. }
  52074. return playlist;
  52075. };
  52076. const addSidxSegmentsToPlaylists$1 = (playlists, sidxMapping = {}) => {
  52077. if (!Object.keys(sidxMapping).length) {
  52078. return playlists;
  52079. }
  52080. for (const i2 in playlists) {
  52081. playlists[i2] = addSidxSegmentsToPlaylist$2(playlists[i2], sidxMapping);
  52082. }
  52083. return playlists;
  52084. };
  52085. const formatAudioPlaylist$1 = ({
  52086. attributes,
  52087. segments,
  52088. sidx,
  52089. mediaSequence,
  52090. discontinuitySequence,
  52091. discontinuityStarts
  52092. }, isAudioOnly3) => {
  52093. const playlist = {
  52094. attributes: {
  52095. NAME: attributes.id,
  52096. BANDWIDTH: attributes.bandwidth,
  52097. CODECS: attributes.codecs,
  52098. ["PROGRAM-ID"]: 1
  52099. },
  52100. uri: "",
  52101. endList: attributes.type === "static",
  52102. timeline: attributes.periodStart,
  52103. resolvedUri: "",
  52104. targetDuration: attributes.duration,
  52105. discontinuitySequence,
  52106. discontinuityStarts,
  52107. timelineStarts: attributes.timelineStarts,
  52108. mediaSequence,
  52109. segments
  52110. };
  52111. if (attributes.contentProtection) {
  52112. playlist.contentProtection = attributes.contentProtection;
  52113. }
  52114. if (sidx) {
  52115. playlist.sidx = sidx;
  52116. }
  52117. if (isAudioOnly3) {
  52118. playlist.attributes.AUDIO = "audio";
  52119. playlist.attributes.SUBTITLES = "subs";
  52120. }
  52121. return playlist;
  52122. };
  52123. const formatVttPlaylist$1 = ({
  52124. attributes,
  52125. segments,
  52126. mediaSequence,
  52127. discontinuityStarts,
  52128. discontinuitySequence
  52129. }) => {
  52130. if (typeof segments === "undefined") {
  52131. segments = [{
  52132. uri: attributes.baseUrl,
  52133. timeline: attributes.periodStart,
  52134. resolvedUri: attributes.baseUrl || "",
  52135. duration: attributes.sourceDuration,
  52136. number: 0
  52137. }];
  52138. attributes.duration = attributes.sourceDuration;
  52139. }
  52140. const m3u8Attributes = {
  52141. NAME: attributes.id,
  52142. BANDWIDTH: attributes.bandwidth,
  52143. ["PROGRAM-ID"]: 1
  52144. };
  52145. if (attributes.codecs) {
  52146. m3u8Attributes.CODECS = attributes.codecs;
  52147. }
  52148. return {
  52149. attributes: m3u8Attributes,
  52150. uri: "",
  52151. endList: attributes.type === "static",
  52152. timeline: attributes.periodStart,
  52153. resolvedUri: attributes.baseUrl || "",
  52154. targetDuration: attributes.duration,
  52155. timelineStarts: attributes.timelineStarts,
  52156. discontinuityStarts,
  52157. discontinuitySequence,
  52158. mediaSequence,
  52159. segments
  52160. };
  52161. };
  52162. const organizeAudioPlaylists$1 = (playlists, sidxMapping = {}, isAudioOnly3 = false) => {
  52163. let mainPlaylist;
  52164. const formattedPlaylists = playlists.reduce((a, playlist) => {
  52165. const role = playlist.attributes.role && playlist.attributes.role.value || "";
  52166. const language = playlist.attributes.lang || "";
  52167. let label2 = playlist.attributes.label || "main";
  52168. if (language && !playlist.attributes.label) {
  52169. const roleLabel = role ? ` (${role})` : "";
  52170. label2 = `${playlist.attributes.lang}${roleLabel}`;
  52171. }
  52172. if (!a[label2]) {
  52173. a[label2] = {
  52174. language,
  52175. autoselect: true,
  52176. default: role === "main",
  52177. playlists: [],
  52178. uri: ""
  52179. };
  52180. }
  52181. const formatted = addSidxSegmentsToPlaylist$2(formatAudioPlaylist$1(playlist, isAudioOnly3), sidxMapping);
  52182. a[label2].playlists.push(formatted);
  52183. if (typeof mainPlaylist === "undefined" && role === "main") {
  52184. mainPlaylist = playlist;
  52185. mainPlaylist.default = true;
  52186. }
  52187. return a;
  52188. }, {});
  52189. if (!mainPlaylist) {
  52190. const firstLabel = Object.keys(formattedPlaylists)[0];
  52191. formattedPlaylists[firstLabel].default = true;
  52192. }
  52193. return formattedPlaylists;
  52194. };
  52195. const organizeVttPlaylists$1 = (playlists, sidxMapping = {}) => {
  52196. return playlists.reduce((a, playlist) => {
  52197. const label2 = playlist.attributes.label || playlist.attributes.lang || "text";
  52198. if (!a[label2]) {
  52199. a[label2] = {
  52200. language: label2,
  52201. default: false,
  52202. autoselect: false,
  52203. playlists: [],
  52204. uri: ""
  52205. };
  52206. }
  52207. a[label2].playlists.push(addSidxSegmentsToPlaylist$2(formatVttPlaylist$1(playlist), sidxMapping));
  52208. return a;
  52209. }, {});
  52210. };
  52211. const organizeCaptionServices$1 = (captionServices) => captionServices.reduce((svcObj, svc) => {
  52212. if (!svc) {
  52213. return svcObj;
  52214. }
  52215. svc.forEach((service) => {
  52216. const {
  52217. channel,
  52218. language
  52219. } = service;
  52220. svcObj[language] = {
  52221. autoselect: false,
  52222. default: false,
  52223. instreamId: channel,
  52224. language
  52225. };
  52226. if (service.hasOwnProperty("aspectRatio")) {
  52227. svcObj[language].aspectRatio = service.aspectRatio;
  52228. }
  52229. if (service.hasOwnProperty("easyReader")) {
  52230. svcObj[language].easyReader = service.easyReader;
  52231. }
  52232. if (service.hasOwnProperty("3D")) {
  52233. svcObj[language]["3D"] = service["3D"];
  52234. }
  52235. });
  52236. return svcObj;
  52237. }, {});
  52238. const formatVideoPlaylist$1 = ({
  52239. attributes,
  52240. segments,
  52241. sidx,
  52242. discontinuityStarts
  52243. }) => {
  52244. const playlist = {
  52245. attributes: {
  52246. NAME: attributes.id,
  52247. AUDIO: "audio",
  52248. SUBTITLES: "subs",
  52249. RESOLUTION: {
  52250. width: attributes.width,
  52251. height: attributes.height
  52252. },
  52253. CODECS: attributes.codecs,
  52254. BANDWIDTH: attributes.bandwidth,
  52255. ["PROGRAM-ID"]: 1
  52256. },
  52257. uri: "",
  52258. endList: attributes.type === "static",
  52259. timeline: attributes.periodStart,
  52260. resolvedUri: "",
  52261. targetDuration: attributes.duration,
  52262. discontinuityStarts,
  52263. timelineStarts: attributes.timelineStarts,
  52264. segments
  52265. };
  52266. if (attributes.frameRate) {
  52267. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  52268. }
  52269. if (attributes.contentProtection) {
  52270. playlist.contentProtection = attributes.contentProtection;
  52271. }
  52272. if (sidx) {
  52273. playlist.sidx = sidx;
  52274. }
  52275. return playlist;
  52276. };
  52277. const videoOnly$1 = ({
  52278. attributes
  52279. }) => attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  52280. const audioOnly$1 = ({
  52281. attributes
  52282. }) => attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  52283. const vttOnly$1 = ({
  52284. attributes
  52285. }) => attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  52286. const addMediaSequenceValues$1 = (playlists, timelineStarts) => {
  52287. playlists.forEach((playlist) => {
  52288. playlist.mediaSequence = 0;
  52289. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  52290. timeline
  52291. }) {
  52292. return timeline === playlist.timeline;
  52293. });
  52294. if (!playlist.segments) {
  52295. return;
  52296. }
  52297. playlist.segments.forEach((segment, index2) => {
  52298. segment.number = index2;
  52299. });
  52300. });
  52301. };
  52302. const flattenMediaGroupPlaylists$1 = (mediaGroupObject) => {
  52303. if (!mediaGroupObject) {
  52304. return [];
  52305. }
  52306. return Object.keys(mediaGroupObject).reduce((acc, label2) => {
  52307. const labelContents = mediaGroupObject[label2];
  52308. return acc.concat(labelContents.playlists);
  52309. }, []);
  52310. };
  52311. const toM3u8$1 = ({
  52312. dashPlaylists,
  52313. locations,
  52314. sidxMapping = {},
  52315. previousManifest,
  52316. eventStream
  52317. }) => {
  52318. if (!dashPlaylists.length) {
  52319. return {};
  52320. }
  52321. const {
  52322. sourceDuration: duration5,
  52323. type: type2,
  52324. suggestedPresentationDelay: suggestedPresentationDelay2,
  52325. minimumUpdatePeriod: minimumUpdatePeriod2
  52326. } = dashPlaylists[0].attributes;
  52327. const videoPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(videoOnly$1)).map(formatVideoPlaylist$1);
  52328. const audioPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(audioOnly$1));
  52329. const vttPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(vttOnly$1));
  52330. const captions = dashPlaylists.map((playlist) => playlist.attributes.captionServices).filter(Boolean);
  52331. const manifest = {
  52332. allowCache: true,
  52333. discontinuityStarts: [],
  52334. segments: [],
  52335. endList: true,
  52336. mediaGroups: {
  52337. AUDIO: {},
  52338. VIDEO: {},
  52339. ["CLOSED-CAPTIONS"]: {},
  52340. SUBTITLES: {}
  52341. },
  52342. uri: "",
  52343. duration: duration5,
  52344. playlists: addSidxSegmentsToPlaylists$1(videoPlaylists, sidxMapping)
  52345. };
  52346. if (minimumUpdatePeriod2 >= 0) {
  52347. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  52348. }
  52349. if (locations) {
  52350. manifest.locations = locations;
  52351. }
  52352. if (type2 === "dynamic") {
  52353. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  52354. }
  52355. if (eventStream && eventStream.length > 0) {
  52356. manifest.eventStream = eventStream;
  52357. }
  52358. const isAudioOnly3 = manifest.playlists.length === 0;
  52359. const organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists$1(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  52360. const organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists$1(vttPlaylists, sidxMapping) : null;
  52361. const formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists$1(organizedAudioGroup), flattenMediaGroupPlaylists$1(organizedVttGroup));
  52362. const playlistTimelineStarts = formattedPlaylists.map(({
  52363. timelineStarts
  52364. }) => timelineStarts);
  52365. manifest.timelineStarts = getUniqueTimelineStarts$1(playlistTimelineStarts);
  52366. addMediaSequenceValues$1(formattedPlaylists, manifest.timelineStarts);
  52367. if (organizedAudioGroup) {
  52368. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  52369. }
  52370. if (organizedVttGroup) {
  52371. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  52372. }
  52373. if (captions.length) {
  52374. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices$1(captions);
  52375. }
  52376. if (previousManifest) {
  52377. return positionManifestOnTimeline$1({
  52378. oldManifest: previousManifest,
  52379. newManifest: manifest
  52380. });
  52381. }
  52382. return manifest;
  52383. };
  52384. const getLiveRValue$1 = (attributes, time, duration5) => {
  52385. const {
  52386. NOW,
  52387. clientOffset,
  52388. availabilityStartTime: availabilityStartTime2,
  52389. timescale: timescale2 = 1,
  52390. periodStart = 0,
  52391. minimumUpdatePeriod: minimumUpdatePeriod2 = 0
  52392. } = attributes;
  52393. const now2 = (NOW + clientOffset) / 1e3;
  52394. const periodStartWC = availabilityStartTime2 + periodStart;
  52395. const periodEndWC = now2 + minimumUpdatePeriod2;
  52396. const periodDuration = periodEndWC - periodStartWC;
  52397. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  52398. };
  52399. const parseByTimeline$1 = (attributes, segmentTimeline) => {
  52400. const {
  52401. type: type2,
  52402. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  52403. media = "",
  52404. sourceDuration,
  52405. timescale: timescale2 = 1,
  52406. startNumber: startNumber2 = 1,
  52407. periodStart: timeline
  52408. } = attributes;
  52409. const segments = [];
  52410. let time = -1;
  52411. for (let sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  52412. const S = segmentTimeline[sIndex];
  52413. const duration5 = S.d;
  52414. const repeat = S.r || 0;
  52415. const segmentTime = S.t || 0;
  52416. if (time < 0) {
  52417. time = segmentTime;
  52418. }
  52419. if (segmentTime && segmentTime > time) {
  52420. time = segmentTime;
  52421. }
  52422. let count;
  52423. if (repeat < 0) {
  52424. const nextS = sIndex + 1;
  52425. if (nextS === segmentTimeline.length) {
  52426. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  52427. count = getLiveRValue$1(attributes, time, duration5);
  52428. } else {
  52429. count = (sourceDuration * timescale2 - time) / duration5;
  52430. }
  52431. } else {
  52432. count = (segmentTimeline[nextS].t - time) / duration5;
  52433. }
  52434. } else {
  52435. count = repeat + 1;
  52436. }
  52437. const end = startNumber2 + segments.length + count;
  52438. let number = startNumber2 + segments.length;
  52439. while (number < end) {
  52440. segments.push({
  52441. number,
  52442. duration: duration5 / timescale2,
  52443. time,
  52444. timeline
  52445. });
  52446. time += duration5;
  52447. number++;
  52448. }
  52449. }
  52450. return segments;
  52451. };
  52452. const identifierPattern$1 = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  52453. const identifierReplacement$1 = (values3) => (match, identifier, format, width2) => {
  52454. if (match === "$$") {
  52455. return "$";
  52456. }
  52457. if (typeof values3[identifier] === "undefined") {
  52458. return match;
  52459. }
  52460. const value = "" + values3[identifier];
  52461. if (identifier === "RepresentationID") {
  52462. return value;
  52463. }
  52464. if (!format) {
  52465. width2 = 1;
  52466. } else {
  52467. width2 = parseInt(width2, 10);
  52468. }
  52469. if (value.length >= width2) {
  52470. return value;
  52471. }
  52472. return `${new Array(width2 - value.length + 1).join("0")}${value}`;
  52473. };
  52474. const constructTemplateUrl$1 = (url, values3) => url.replace(identifierPattern$1, identifierReplacement$1(values3));
  52475. const parseTemplateInfo$1 = (attributes, segmentTimeline) => {
  52476. if (!attributes.duration && !segmentTimeline) {
  52477. return [{
  52478. number: attributes.startNumber || 1,
  52479. duration: attributes.sourceDuration,
  52480. time: 0,
  52481. timeline: attributes.periodStart
  52482. }];
  52483. }
  52484. if (attributes.duration) {
  52485. return parseByDuration$1(attributes);
  52486. }
  52487. return parseByTimeline$1(attributes, segmentTimeline);
  52488. };
  52489. const segmentsFromTemplate$1 = (attributes, segmentTimeline) => {
  52490. const templateValues = {
  52491. RepresentationID: attributes.id,
  52492. Bandwidth: attributes.bandwidth || 0
  52493. };
  52494. const {
  52495. initialization = {
  52496. sourceURL: "",
  52497. range: ""
  52498. }
  52499. } = attributes;
  52500. const mapSegment = urlTypeToSegment$1({
  52501. baseUrl: attributes.baseUrl,
  52502. source: constructTemplateUrl$1(initialization.sourceURL, templateValues),
  52503. range: initialization.range
  52504. });
  52505. const segments = parseTemplateInfo$1(attributes, segmentTimeline);
  52506. return segments.map((segment) => {
  52507. templateValues.Number = segment.number;
  52508. templateValues.Time = segment.time;
  52509. const uri = constructTemplateUrl$1(attributes.media || "", templateValues);
  52510. const timescale2 = attributes.timescale || 1;
  52511. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52512. const presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  52513. const map = {
  52514. uri,
  52515. timeline: segment.timeline,
  52516. duration: segment.duration,
  52517. resolvedUri: resolveUrl$3(attributes.baseUrl || "", uri),
  52518. map: mapSegment,
  52519. number: segment.number,
  52520. presentationTime
  52521. };
  52522. return map;
  52523. });
  52524. };
  52525. const SegmentURLToSegmentObject$1 = (attributes, segmentUrl) => {
  52526. const {
  52527. baseUrl,
  52528. initialization = {}
  52529. } = attributes;
  52530. const initSegment = urlTypeToSegment$1({
  52531. baseUrl,
  52532. source: initialization.sourceURL,
  52533. range: initialization.range
  52534. });
  52535. const segment = urlTypeToSegment$1({
  52536. baseUrl,
  52537. source: segmentUrl.media,
  52538. range: segmentUrl.mediaRange
  52539. });
  52540. segment.map = initSegment;
  52541. return segment;
  52542. };
  52543. const segmentsFromList$1 = (attributes, segmentTimeline) => {
  52544. const {
  52545. duration: duration5,
  52546. segmentUrls = [],
  52547. periodStart
  52548. } = attributes;
  52549. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  52550. throw new Error(errors$1.SEGMENT_TIME_UNSPECIFIED);
  52551. }
  52552. const segmentUrlMap = segmentUrls.map((segmentUrlObject) => SegmentURLToSegmentObject$1(attributes, segmentUrlObject));
  52553. let segmentTimeInfo;
  52554. if (duration5) {
  52555. segmentTimeInfo = parseByDuration$1(attributes);
  52556. }
  52557. if (segmentTimeline) {
  52558. segmentTimeInfo = parseByTimeline$1(attributes, segmentTimeline);
  52559. }
  52560. const segments = segmentTimeInfo.map((segmentTime, index2) => {
  52561. if (segmentUrlMap[index2]) {
  52562. const segment = segmentUrlMap[index2];
  52563. const timescale2 = attributes.timescale || 1;
  52564. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52565. segment.timeline = segmentTime.timeline;
  52566. segment.duration = segmentTime.duration;
  52567. segment.number = segmentTime.number;
  52568. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  52569. return segment;
  52570. }
  52571. }).filter((segment) => segment);
  52572. return segments;
  52573. };
  52574. const generateSegments$1 = ({
  52575. attributes,
  52576. segmentInfo
  52577. }) => {
  52578. let segmentAttributes;
  52579. let segmentsFn;
  52580. if (segmentInfo.template) {
  52581. segmentsFn = segmentsFromTemplate$1;
  52582. segmentAttributes = merge$3(attributes, segmentInfo.template);
  52583. } else if (segmentInfo.base) {
  52584. segmentsFn = segmentsFromBase$1;
  52585. segmentAttributes = merge$3(attributes, segmentInfo.base);
  52586. } else if (segmentInfo.list) {
  52587. segmentsFn = segmentsFromList$1;
  52588. segmentAttributes = merge$3(attributes, segmentInfo.list);
  52589. }
  52590. const segmentsInfo = {
  52591. attributes
  52592. };
  52593. if (!segmentsFn) {
  52594. return segmentsInfo;
  52595. }
  52596. const segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  52597. if (segmentAttributes.duration) {
  52598. const {
  52599. duration: duration5,
  52600. timescale: timescale2 = 1
  52601. } = segmentAttributes;
  52602. segmentAttributes.duration = duration5 / timescale2;
  52603. } else if (segments.length) {
  52604. segmentAttributes.duration = segments.reduce((max2, segment) => {
  52605. return Math.max(max2, Math.ceil(segment.duration));
  52606. }, 0);
  52607. } else {
  52608. segmentAttributes.duration = 0;
  52609. }
  52610. segmentsInfo.attributes = segmentAttributes;
  52611. segmentsInfo.segments = segments;
  52612. if (segmentInfo.base && segmentAttributes.indexRange) {
  52613. segmentsInfo.sidx = segments[0];
  52614. segmentsInfo.segments = [];
  52615. }
  52616. return segmentsInfo;
  52617. };
  52618. const toPlaylists$1 = (representations) => representations.map(generateSegments$1);
  52619. const findChildren$1 = (element, name) => from$1(element.childNodes).filter(({
  52620. tagName
  52621. }) => tagName === name);
  52622. const getContent$1 = (element) => element.textContent.trim();
  52623. const parseDivisionValue$1 = (value) => {
  52624. return parseFloat(value.split("/").reduce((prev, current) => prev / current));
  52625. };
  52626. const parseDuration$1 = (str) => {
  52627. const SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  52628. const SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  52629. const SECONDS_IN_DAY = 24 * 60 * 60;
  52630. const SECONDS_IN_HOUR = 60 * 60;
  52631. const SECONDS_IN_MIN = 60;
  52632. const durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  52633. const match = durationRegex.exec(str);
  52634. if (!match) {
  52635. return 0;
  52636. }
  52637. const [year, month, day, hour, minute, second] = match.slice(1);
  52638. 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);
  52639. };
  52640. const parseDate$1 = (str) => {
  52641. const dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  52642. if (dateRegex.test(str)) {
  52643. str += "Z";
  52644. }
  52645. return Date.parse(str);
  52646. };
  52647. const parsers$1 = {
  52648. mediaPresentationDuration(value) {
  52649. return parseDuration$1(value);
  52650. },
  52651. availabilityStartTime(value) {
  52652. return parseDate$1(value) / 1e3;
  52653. },
  52654. minimumUpdatePeriod(value) {
  52655. return parseDuration$1(value);
  52656. },
  52657. suggestedPresentationDelay(value) {
  52658. return parseDuration$1(value);
  52659. },
  52660. type(value) {
  52661. return value;
  52662. },
  52663. timeShiftBufferDepth(value) {
  52664. return parseDuration$1(value);
  52665. },
  52666. start(value) {
  52667. return parseDuration$1(value);
  52668. },
  52669. width(value) {
  52670. return parseInt(value, 10);
  52671. },
  52672. height(value) {
  52673. return parseInt(value, 10);
  52674. },
  52675. bandwidth(value) {
  52676. return parseInt(value, 10);
  52677. },
  52678. frameRate(value) {
  52679. return parseDivisionValue$1(value);
  52680. },
  52681. startNumber(value) {
  52682. return parseInt(value, 10);
  52683. },
  52684. timescale(value) {
  52685. return parseInt(value, 10);
  52686. },
  52687. presentationTimeOffset(value) {
  52688. return parseInt(value, 10);
  52689. },
  52690. duration(value) {
  52691. const parsedValue = parseInt(value, 10);
  52692. if (isNaN(parsedValue)) {
  52693. return parseDuration$1(value);
  52694. }
  52695. return parsedValue;
  52696. },
  52697. d(value) {
  52698. return parseInt(value, 10);
  52699. },
  52700. t(value) {
  52701. return parseInt(value, 10);
  52702. },
  52703. r(value) {
  52704. return parseInt(value, 10);
  52705. },
  52706. presentationTime(value) {
  52707. return parseInt(value, 10);
  52708. },
  52709. DEFAULT(value) {
  52710. return value;
  52711. }
  52712. };
  52713. const parseAttributes$2 = (el) => {
  52714. if (!(el && el.attributes)) {
  52715. return {};
  52716. }
  52717. return from$1(el.attributes).reduce((a, e) => {
  52718. const parseFn = parsers$1[e.name] || parsers$1.DEFAULT;
  52719. a[e.name] = parseFn(e.value);
  52720. return a;
  52721. }, {});
  52722. };
  52723. const keySystemsMap$1 = {
  52724. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  52725. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  52726. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  52727. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  52728. };
  52729. const buildBaseUrls$1 = (referenceUrls, baseUrlElements) => {
  52730. if (!baseUrlElements.length) {
  52731. return referenceUrls;
  52732. }
  52733. return flatten$1(referenceUrls.map(function(reference) {
  52734. return baseUrlElements.map(function(baseUrlElement) {
  52735. return resolveUrl$3(reference, getContent$1(baseUrlElement));
  52736. });
  52737. }));
  52738. };
  52739. const getSegmentInformation$1 = (adaptationSet) => {
  52740. const segmentTemplate = findChildren$1(adaptationSet, "SegmentTemplate")[0];
  52741. const segmentList = findChildren$1(adaptationSet, "SegmentList")[0];
  52742. const segmentUrls = segmentList && findChildren$1(segmentList, "SegmentURL").map((s) => merge$3({
  52743. tag: "SegmentURL"
  52744. }, parseAttributes$2(s)));
  52745. const segmentBase = findChildren$1(adaptationSet, "SegmentBase")[0];
  52746. const segmentTimelineParentNode = segmentList || segmentTemplate;
  52747. const segmentTimeline = segmentTimelineParentNode && findChildren$1(segmentTimelineParentNode, "SegmentTimeline")[0];
  52748. const segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  52749. const segmentInitialization = segmentInitializationParentNode && findChildren$1(segmentInitializationParentNode, "Initialization")[0];
  52750. const template = segmentTemplate && parseAttributes$2(segmentTemplate);
  52751. if (template && segmentInitialization) {
  52752. template.initialization = segmentInitialization && parseAttributes$2(segmentInitialization);
  52753. } else if (template && template.initialization) {
  52754. template.initialization = {
  52755. sourceURL: template.initialization
  52756. };
  52757. }
  52758. const segmentInfo = {
  52759. template,
  52760. segmentTimeline: segmentTimeline && findChildren$1(segmentTimeline, "S").map((s) => parseAttributes$2(s)),
  52761. list: segmentList && merge$3(parseAttributes$2(segmentList), {
  52762. segmentUrls,
  52763. initialization: parseAttributes$2(segmentInitialization)
  52764. }),
  52765. base: segmentBase && merge$3(parseAttributes$2(segmentBase), {
  52766. initialization: parseAttributes$2(segmentInitialization)
  52767. })
  52768. };
  52769. Object.keys(segmentInfo).forEach((key) => {
  52770. if (!segmentInfo[key]) {
  52771. delete segmentInfo[key];
  52772. }
  52773. });
  52774. return segmentInfo;
  52775. };
  52776. const inheritBaseUrls$1 = (adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) => (representation) => {
  52777. const repBaseUrlElements = findChildren$1(representation, "BaseURL");
  52778. const repBaseUrls = buildBaseUrls$1(adaptationSetBaseUrls, repBaseUrlElements);
  52779. const attributes = merge$3(adaptationSetAttributes, parseAttributes$2(representation));
  52780. const representationSegmentInfo = getSegmentInformation$1(representation);
  52781. return repBaseUrls.map((baseUrl) => {
  52782. return {
  52783. segmentInfo: merge$3(adaptationSetSegmentInfo, representationSegmentInfo),
  52784. attributes: merge$3(attributes, {
  52785. baseUrl
  52786. })
  52787. };
  52788. });
  52789. };
  52790. const generateKeySystemInformation$1 = (contentProtectionNodes) => {
  52791. return contentProtectionNodes.reduce((acc, node) => {
  52792. const attributes = parseAttributes$2(node);
  52793. if (attributes.schemeIdUri) {
  52794. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  52795. }
  52796. const keySystem = keySystemsMap$1[attributes.schemeIdUri];
  52797. if (keySystem) {
  52798. acc[keySystem] = {
  52799. attributes
  52800. };
  52801. const psshNode = findChildren$1(node, "cenc:pssh")[0];
  52802. if (psshNode) {
  52803. const pssh = getContent$1(psshNode);
  52804. acc[keySystem].pssh = pssh && decodeB64ToUint8Array$1(pssh);
  52805. }
  52806. }
  52807. return acc;
  52808. }, {});
  52809. };
  52810. const parseCaptionServiceMetadata$1 = (service) => {
  52811. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  52812. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52813. return values3.map((value) => {
  52814. let channel;
  52815. let language;
  52816. language = value;
  52817. if (/^CC\d=/.test(value)) {
  52818. [channel, language] = value.split("=");
  52819. } else if (/^CC\d$/.test(value)) {
  52820. channel = value;
  52821. }
  52822. return {
  52823. channel,
  52824. language
  52825. };
  52826. });
  52827. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  52828. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52829. return values3.map((value) => {
  52830. const flags = {
  52831. "channel": void 0,
  52832. "language": void 0,
  52833. "aspectRatio": 1,
  52834. "easyReader": 0,
  52835. "3D": 0
  52836. };
  52837. if (/=/.test(value)) {
  52838. const [channel, opts = ""] = value.split("=");
  52839. flags.channel = channel;
  52840. flags.language = value;
  52841. opts.split(",").forEach((opt) => {
  52842. const [name, val] = opt.split(":");
  52843. if (name === "lang") {
  52844. flags.language = val;
  52845. } else if (name === "er") {
  52846. flags.easyReader = Number(val);
  52847. } else if (name === "war") {
  52848. flags.aspectRatio = Number(val);
  52849. } else if (name === "3D") {
  52850. flags["3D"] = Number(val);
  52851. }
  52852. });
  52853. } else {
  52854. flags.language = value;
  52855. }
  52856. if (flags.channel) {
  52857. flags.channel = "SERVICE" + flags.channel;
  52858. }
  52859. return flags;
  52860. });
  52861. }
  52862. };
  52863. const toEventStream = (period) => {
  52864. return flatten$1(findChildren$1(period.node, "EventStream").map((eventStream) => {
  52865. const eventStreamAttributes = parseAttributes$2(eventStream);
  52866. const schemeIdUri = eventStreamAttributes.schemeIdUri;
  52867. return findChildren$1(eventStream, "Event").map((event2) => {
  52868. const eventAttributes = parseAttributes$2(event2);
  52869. const presentationTime = eventAttributes.presentationTime || 0;
  52870. const timescale2 = eventStreamAttributes.timescale || 1;
  52871. const duration5 = eventAttributes.duration || 0;
  52872. const start2 = presentationTime / timescale2 + period.attributes.start;
  52873. return {
  52874. schemeIdUri,
  52875. value: eventStreamAttributes.value,
  52876. id: eventAttributes.id,
  52877. start: start2,
  52878. end: start2 + duration5 / timescale2,
  52879. messageData: getContent$1(event2) || eventAttributes.messageData,
  52880. contentEncoding: eventStreamAttributes.contentEncoding,
  52881. presentationTimeOffset: eventStreamAttributes.presentationTimeOffset || 0
  52882. };
  52883. });
  52884. }));
  52885. };
  52886. const toRepresentations$1 = (periodAttributes, periodBaseUrls, periodSegmentInfo) => (adaptationSet) => {
  52887. const adaptationSetAttributes = parseAttributes$2(adaptationSet);
  52888. const adaptationSetBaseUrls = buildBaseUrls$1(periodBaseUrls, findChildren$1(adaptationSet, "BaseURL"));
  52889. const role = findChildren$1(adaptationSet, "Role")[0];
  52890. const roleAttributes = {
  52891. role: parseAttributes$2(role)
  52892. };
  52893. let attrs = merge$3(periodAttributes, adaptationSetAttributes, roleAttributes);
  52894. const accessibility = findChildren$1(adaptationSet, "Accessibility")[0];
  52895. const captionServices = parseCaptionServiceMetadata$1(parseAttributes$2(accessibility));
  52896. if (captionServices) {
  52897. attrs = merge$3(attrs, {
  52898. captionServices
  52899. });
  52900. }
  52901. const label2 = findChildren$1(adaptationSet, "Label")[0];
  52902. if (label2 && label2.childNodes.length) {
  52903. const labelVal = label2.childNodes[0].nodeValue.trim();
  52904. attrs = merge$3(attrs, {
  52905. label: labelVal
  52906. });
  52907. }
  52908. const contentProtection = generateKeySystemInformation$1(findChildren$1(adaptationSet, "ContentProtection"));
  52909. if (Object.keys(contentProtection).length) {
  52910. attrs = merge$3(attrs, {
  52911. contentProtection
  52912. });
  52913. }
  52914. const segmentInfo = getSegmentInformation$1(adaptationSet);
  52915. const representations = findChildren$1(adaptationSet, "Representation");
  52916. const adaptationSetSegmentInfo = merge$3(periodSegmentInfo, segmentInfo);
  52917. return flatten$1(representations.map(inheritBaseUrls$1(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  52918. };
  52919. const toAdaptationSets$1 = (mpdAttributes, mpdBaseUrls) => (period, index2) => {
  52920. const periodBaseUrls = buildBaseUrls$1(mpdBaseUrls, findChildren$1(period.node, "BaseURL"));
  52921. const periodAttributes = merge$3(mpdAttributes, {
  52922. periodStart: period.attributes.start
  52923. });
  52924. if (typeof period.attributes.duration === "number") {
  52925. periodAttributes.periodDuration = period.attributes.duration;
  52926. }
  52927. const adaptationSets = findChildren$1(period.node, "AdaptationSet");
  52928. const periodSegmentInfo = getSegmentInformation$1(period.node);
  52929. return flatten$1(adaptationSets.map(toRepresentations$1(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  52930. };
  52931. const getPeriodStart$1 = ({
  52932. attributes,
  52933. priorPeriodAttributes,
  52934. mpdType
  52935. }) => {
  52936. if (typeof attributes.start === "number") {
  52937. return attributes.start;
  52938. }
  52939. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  52940. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  52941. }
  52942. if (!priorPeriodAttributes && mpdType === "static") {
  52943. return 0;
  52944. }
  52945. return null;
  52946. };
  52947. const inheritAttributes$1 = (mpd, options2 = {}) => {
  52948. const {
  52949. manifestUri = "",
  52950. NOW = Date.now(),
  52951. clientOffset = 0
  52952. } = options2;
  52953. const periodNodes = findChildren$1(mpd, "Period");
  52954. if (!periodNodes.length) {
  52955. throw new Error(errors$1.INVALID_NUMBER_OF_PERIOD);
  52956. }
  52957. const locations = findChildren$1(mpd, "Location");
  52958. const mpdAttributes = parseAttributes$2(mpd);
  52959. const mpdBaseUrls = buildBaseUrls$1([manifestUri], findChildren$1(mpd, "BaseURL"));
  52960. mpdAttributes.type = mpdAttributes.type || "static";
  52961. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  52962. mpdAttributes.NOW = NOW;
  52963. mpdAttributes.clientOffset = clientOffset;
  52964. if (locations.length) {
  52965. mpdAttributes.locations = locations.map(getContent$1);
  52966. }
  52967. const periods = [];
  52968. periodNodes.forEach((node, index2) => {
  52969. const attributes = parseAttributes$2(node);
  52970. const priorPeriod = periods[index2 - 1];
  52971. attributes.start = getPeriodStart$1({
  52972. attributes,
  52973. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  52974. mpdType: mpdAttributes.type
  52975. });
  52976. periods.push({
  52977. node,
  52978. attributes
  52979. });
  52980. });
  52981. return {
  52982. locations: mpdAttributes.locations,
  52983. representationInfo: flatten$1(periods.map(toAdaptationSets$1(mpdAttributes, mpdBaseUrls))),
  52984. eventStream: flatten$1(periods.map(toEventStream))
  52985. };
  52986. };
  52987. const stringToMpdXml$1 = (manifestString) => {
  52988. if (manifestString === "") {
  52989. throw new Error(errors$1.DASH_EMPTY_MANIFEST);
  52990. }
  52991. const parser2 = new DOMParser();
  52992. let xml;
  52993. let mpd;
  52994. try {
  52995. xml = parser2.parseFromString(manifestString, "application/xml");
  52996. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  52997. } catch (e) {
  52998. }
  52999. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  53000. throw new Error(errors$1.DASH_INVALID_XML);
  53001. }
  53002. return mpd;
  53003. };
  53004. const parseUTCTimingScheme$1 = (mpd) => {
  53005. const UTCTimingNode = findChildren$1(mpd, "UTCTiming")[0];
  53006. if (!UTCTimingNode) {
  53007. return null;
  53008. }
  53009. const attributes = parseAttributes$2(UTCTimingNode);
  53010. switch (attributes.schemeIdUri) {
  53011. case "urn:mpeg:dash:utc:http-head:2014":
  53012. case "urn:mpeg:dash:utc:http-head:2012":
  53013. attributes.method = "HEAD";
  53014. break;
  53015. case "urn:mpeg:dash:utc:http-xsdate:2014":
  53016. case "urn:mpeg:dash:utc:http-iso:2014":
  53017. case "urn:mpeg:dash:utc:http-xsdate:2012":
  53018. case "urn:mpeg:dash:utc:http-iso:2012":
  53019. attributes.method = "GET";
  53020. break;
  53021. case "urn:mpeg:dash:utc:direct:2014":
  53022. case "urn:mpeg:dash:utc:direct:2012":
  53023. attributes.method = "DIRECT";
  53024. attributes.value = Date.parse(attributes.value);
  53025. break;
  53026. case "urn:mpeg:dash:utc:http-ntp:2014":
  53027. case "urn:mpeg:dash:utc:ntp:2014":
  53028. case "urn:mpeg:dash:utc:sntp:2014":
  53029. default:
  53030. throw new Error(errors$1.UNSUPPORTED_UTC_TIMING_SCHEME);
  53031. }
  53032. return attributes;
  53033. };
  53034. const parse$1 = (manifestString, options2 = {}) => {
  53035. const parsedManifestInfo = inheritAttributes$1(stringToMpdXml$1(manifestString), options2);
  53036. const playlists = toPlaylists$1(parsedManifestInfo.representationInfo);
  53037. return toM3u8$1({
  53038. dashPlaylists: playlists,
  53039. locations: parsedManifestInfo.locations,
  53040. sidxMapping: options2.sidxMapping,
  53041. previousManifest: options2.previousManifest,
  53042. eventStream: parsedManifestInfo.eventStream
  53043. });
  53044. };
  53045. const parseUTCTiming$1 = (manifestString) => parseUTCTimingScheme$1(stringToMpdXml$1(manifestString));
  53046. var MAX_UINT32$1 = Math.pow(2, 32);
  53047. var getUint64$3 = function(uint8) {
  53048. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  53049. var value;
  53050. if (dv.getBigUint64) {
  53051. value = dv.getBigUint64(0);
  53052. if (value < Number.MAX_SAFE_INTEGER) {
  53053. return Number(value);
  53054. }
  53055. return value;
  53056. }
  53057. return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4);
  53058. };
  53059. var numbers$1 = {
  53060. getUint64: getUint64$3,
  53061. MAX_UINT32: MAX_UINT32$1
  53062. };
  53063. var getUint64$2 = numbers$1.getUint64;
  53064. var parseSidx$1 = function(data) {
  53065. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  53066. version: data[0],
  53067. flags: new Uint8Array(data.subarray(1, 4)),
  53068. references: [],
  53069. referenceId: view.getUint32(4),
  53070. timescale: view.getUint32(8)
  53071. }, i2 = 12;
  53072. if (result.version === 0) {
  53073. result.earliestPresentationTime = view.getUint32(i2);
  53074. result.firstOffset = view.getUint32(i2 + 4);
  53075. i2 += 8;
  53076. } else {
  53077. result.earliestPresentationTime = getUint64$2(data.subarray(i2));
  53078. result.firstOffset = getUint64$2(data.subarray(i2 + 8));
  53079. i2 += 16;
  53080. }
  53081. i2 += 2;
  53082. var referenceCount = view.getUint16(i2);
  53083. i2 += 2;
  53084. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  53085. result.references.push({
  53086. referenceType: (data[i2] & 128) >>> 7,
  53087. referencedSize: view.getUint32(i2) & 2147483647,
  53088. subsegmentDuration: view.getUint32(i2 + 4),
  53089. startsWithSap: !!(data[i2 + 8] & 128),
  53090. sapType: (data[i2 + 8] & 112) >>> 4,
  53091. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  53092. });
  53093. }
  53094. return result;
  53095. };
  53096. var parseSidx_1$1 = parseSidx$1;
  53097. var ID3$1 = toUint8$1([73, 68, 51]);
  53098. var getId3Size$1 = function getId3Size(bytes, offset) {
  53099. if (offset === void 0) {
  53100. offset = 0;
  53101. }
  53102. bytes = toUint8$1(bytes);
  53103. var flags = bytes[offset + 5];
  53104. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  53105. var footerPresent = (flags & 16) >> 4;
  53106. if (footerPresent) {
  53107. return returnSize + 20;
  53108. }
  53109. return returnSize + 10;
  53110. };
  53111. var getId3Offset$1 = function getId3Offset(bytes, offset) {
  53112. if (offset === void 0) {
  53113. offset = 0;
  53114. }
  53115. bytes = toUint8$1(bytes);
  53116. if (bytes.length - offset < 10 || !bytesMatch$1(bytes, ID3$1, {
  53117. offset
  53118. })) {
  53119. return offset;
  53120. }
  53121. offset += getId3Size$1(bytes, offset);
  53122. return getId3Offset(bytes, offset);
  53123. };
  53124. var normalizePath$3 = function normalizePath(path) {
  53125. if (typeof path === "string") {
  53126. return stringToBytes$1(path);
  53127. }
  53128. if (typeof path === "number") {
  53129. return path;
  53130. }
  53131. return path;
  53132. };
  53133. var normalizePaths$3 = function normalizePaths(paths) {
  53134. if (!Array.isArray(paths)) {
  53135. return [normalizePath$3(paths)];
  53136. }
  53137. return paths.map(function(p) {
  53138. return normalizePath$3(p);
  53139. });
  53140. };
  53141. var findBox$1 = function findBox(bytes, paths, complete) {
  53142. if (complete === void 0) {
  53143. complete = false;
  53144. }
  53145. paths = normalizePaths$3(paths);
  53146. bytes = toUint8$1(bytes);
  53147. var results = [];
  53148. if (!paths.length) {
  53149. return results;
  53150. }
  53151. var i2 = 0;
  53152. while (i2 < bytes.length) {
  53153. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  53154. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  53155. if (size === 0) {
  53156. break;
  53157. }
  53158. var end = i2 + size;
  53159. if (end > bytes.length) {
  53160. if (complete) {
  53161. break;
  53162. }
  53163. end = bytes.length;
  53164. }
  53165. var data = bytes.subarray(i2 + 8, end);
  53166. if (bytesMatch$1(type2, paths[0])) {
  53167. if (paths.length === 1) {
  53168. results.push(data);
  53169. } else {
  53170. results.push.apply(results, findBox(data, paths.slice(1), complete));
  53171. }
  53172. }
  53173. i2 = end;
  53174. }
  53175. return results;
  53176. };
  53177. var EBML_TAGS$1 = {
  53178. EBML: toUint8$1([26, 69, 223, 163]),
  53179. DocType: toUint8$1([66, 130]),
  53180. Segment: toUint8$1([24, 83, 128, 103]),
  53181. SegmentInfo: toUint8$1([21, 73, 169, 102]),
  53182. Tracks: toUint8$1([22, 84, 174, 107]),
  53183. Track: toUint8$1([174]),
  53184. TrackNumber: toUint8$1([215]),
  53185. DefaultDuration: toUint8$1([35, 227, 131]),
  53186. TrackEntry: toUint8$1([174]),
  53187. TrackType: toUint8$1([131]),
  53188. FlagDefault: toUint8$1([136]),
  53189. CodecID: toUint8$1([134]),
  53190. CodecPrivate: toUint8$1([99, 162]),
  53191. VideoTrack: toUint8$1([224]),
  53192. AudioTrack: toUint8$1([225]),
  53193. Cluster: toUint8$1([31, 67, 182, 117]),
  53194. Timestamp: toUint8$1([231]),
  53195. TimestampScale: toUint8$1([42, 215, 177]),
  53196. BlockGroup: toUint8$1([160]),
  53197. BlockDuration: toUint8$1([155]),
  53198. Block: toUint8$1([161]),
  53199. SimpleBlock: toUint8$1([163])
  53200. };
  53201. var LENGTH_TABLE$1 = [128, 64, 32, 16, 8, 4, 2, 1];
  53202. var getLength$1 = function getLength(byte) {
  53203. var len = 1;
  53204. for (var i2 = 0; i2 < LENGTH_TABLE$1.length; i2++) {
  53205. if (byte & LENGTH_TABLE$1[i2]) {
  53206. break;
  53207. }
  53208. len++;
  53209. }
  53210. return len;
  53211. };
  53212. var getvint$1 = function getvint(bytes, offset, removeLength, signed) {
  53213. if (removeLength === void 0) {
  53214. removeLength = true;
  53215. }
  53216. if (signed === void 0) {
  53217. signed = false;
  53218. }
  53219. var length = getLength$1(bytes[offset]);
  53220. var valueBytes = bytes.subarray(offset, offset + length);
  53221. if (removeLength) {
  53222. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  53223. valueBytes[0] ^= LENGTH_TABLE$1[length - 1];
  53224. }
  53225. return {
  53226. length,
  53227. value: bytesToNumber$1(valueBytes, {
  53228. signed
  53229. }),
  53230. bytes: valueBytes
  53231. };
  53232. };
  53233. var normalizePath$2 = function normalizePath2(path) {
  53234. if (typeof path === "string") {
  53235. return path.match(/.{1,2}/g).map(function(p) {
  53236. return normalizePath2(p);
  53237. });
  53238. }
  53239. if (typeof path === "number") {
  53240. return numberToBytes$1(path);
  53241. }
  53242. return path;
  53243. };
  53244. var normalizePaths$2 = function normalizePaths2(paths) {
  53245. if (!Array.isArray(paths)) {
  53246. return [normalizePath$2(paths)];
  53247. }
  53248. return paths.map(function(p) {
  53249. return normalizePath$2(p);
  53250. });
  53251. };
  53252. var getInfinityDataSize$1 = function getInfinityDataSize(id, bytes, offset) {
  53253. if (offset >= bytes.length) {
  53254. return bytes.length;
  53255. }
  53256. var innerid = getvint$1(bytes, offset, false);
  53257. if (bytesMatch$1(id.bytes, innerid.bytes)) {
  53258. return offset;
  53259. }
  53260. var dataHeader = getvint$1(bytes, offset + innerid.length);
  53261. return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  53262. };
  53263. var findEbml$1 = function findEbml(bytes, paths) {
  53264. paths = normalizePaths$2(paths);
  53265. bytes = toUint8$1(bytes);
  53266. var results = [];
  53267. if (!paths.length) {
  53268. return results;
  53269. }
  53270. var i2 = 0;
  53271. while (i2 < bytes.length) {
  53272. var id = getvint$1(bytes, i2, false);
  53273. var dataHeader = getvint$1(bytes, i2 + id.length);
  53274. var dataStart = i2 + id.length + dataHeader.length;
  53275. if (dataHeader.value === 127) {
  53276. dataHeader.value = getInfinityDataSize$1(id, bytes, dataStart);
  53277. if (dataHeader.value !== bytes.length) {
  53278. dataHeader.value -= dataStart;
  53279. }
  53280. }
  53281. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  53282. var data = bytes.subarray(dataStart, dataEnd);
  53283. if (bytesMatch$1(paths[0], id.bytes)) {
  53284. if (paths.length === 1) {
  53285. results.push(data);
  53286. } else {
  53287. results = results.concat(findEbml(data, paths.slice(1)));
  53288. }
  53289. }
  53290. var totalLength = id.length + dataHeader.length + data.length;
  53291. i2 += totalLength;
  53292. }
  53293. return results;
  53294. };
  53295. var NAL_TYPE_ONE$1 = toUint8$1([0, 0, 0, 1]);
  53296. var NAL_TYPE_TWO$1 = toUint8$1([0, 0, 1]);
  53297. var EMULATION_PREVENTION$1 = toUint8$1([0, 0, 3]);
  53298. var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(bytes) {
  53299. var positions = [];
  53300. var i2 = 1;
  53301. while (i2 < bytes.length - 2) {
  53302. if (bytesMatch$1(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION$1)) {
  53303. positions.push(i2 + 2);
  53304. i2++;
  53305. }
  53306. i2++;
  53307. }
  53308. if (positions.length === 0) {
  53309. return bytes;
  53310. }
  53311. var newLength = bytes.length - positions.length;
  53312. var newData = new Uint8Array(newLength);
  53313. var sourceIndex = 0;
  53314. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  53315. if (sourceIndex === positions[0]) {
  53316. sourceIndex++;
  53317. positions.shift();
  53318. }
  53319. newData[i2] = bytes[sourceIndex];
  53320. }
  53321. return newData;
  53322. };
  53323. var findNal$1 = function findNal(bytes, dataType, types, nalLimit) {
  53324. if (nalLimit === void 0) {
  53325. nalLimit = Infinity;
  53326. }
  53327. bytes = toUint8$1(bytes);
  53328. types = [].concat(types);
  53329. var i2 = 0;
  53330. var nalStart;
  53331. var nalsFound = 0;
  53332. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  53333. var nalOffset = void 0;
  53334. if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_ONE$1)) {
  53335. nalOffset = 4;
  53336. } else if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_TWO$1)) {
  53337. nalOffset = 3;
  53338. }
  53339. if (!nalOffset) {
  53340. i2++;
  53341. continue;
  53342. }
  53343. nalsFound++;
  53344. if (nalStart) {
  53345. return discardEmulationPreventionBytes$1(bytes.subarray(nalStart, i2));
  53346. }
  53347. var nalType = void 0;
  53348. if (dataType === "h264") {
  53349. nalType = bytes[i2 + nalOffset] & 31;
  53350. } else if (dataType === "h265") {
  53351. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  53352. }
  53353. if (types.indexOf(nalType) !== -1) {
  53354. nalStart = i2 + nalOffset;
  53355. }
  53356. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  53357. }
  53358. return bytes.subarray(0, 0);
  53359. };
  53360. var findH264Nal$1 = function findH264Nal(bytes, type2, nalLimit) {
  53361. return findNal$1(bytes, "h264", type2, nalLimit);
  53362. };
  53363. var findH265Nal$1 = function findH265Nal(bytes, type2, nalLimit) {
  53364. return findNal$1(bytes, "h265", type2, nalLimit);
  53365. };
  53366. var CONSTANTS$1 = {
  53367. "webm": toUint8$1([119, 101, 98, 109]),
  53368. "matroska": toUint8$1([109, 97, 116, 114, 111, 115, 107, 97]),
  53369. "flac": toUint8$1([102, 76, 97, 67]),
  53370. "ogg": toUint8$1([79, 103, 103, 83]),
  53371. "ac3": toUint8$1([11, 119]),
  53372. "riff": toUint8$1([82, 73, 70, 70]),
  53373. "avi": toUint8$1([65, 86, 73]),
  53374. "wav": toUint8$1([87, 65, 86, 69]),
  53375. "3gp": toUint8$1([102, 116, 121, 112, 51, 103]),
  53376. "mp4": toUint8$1([102, 116, 121, 112]),
  53377. "fmp4": toUint8$1([115, 116, 121, 112]),
  53378. "mov": toUint8$1([102, 116, 121, 112, 113, 116]),
  53379. "moov": toUint8$1([109, 111, 111, 118]),
  53380. "moof": toUint8$1([109, 111, 111, 102])
  53381. };
  53382. var _isLikely$1 = {
  53383. aac: function aac(bytes) {
  53384. var offset = getId3Offset$1(bytes);
  53385. return bytesMatch$1(bytes, [255, 16], {
  53386. offset,
  53387. mask: [255, 22]
  53388. });
  53389. },
  53390. mp3: function mp3(bytes) {
  53391. var offset = getId3Offset$1(bytes);
  53392. return bytesMatch$1(bytes, [255, 2], {
  53393. offset,
  53394. mask: [255, 6]
  53395. });
  53396. },
  53397. webm: function webm(bytes) {
  53398. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53399. return bytesMatch$1(docType, CONSTANTS$1.webm);
  53400. },
  53401. mkv: function mkv(bytes) {
  53402. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53403. return bytesMatch$1(docType, CONSTANTS$1.matroska);
  53404. },
  53405. mp4: function mp4(bytes) {
  53406. if (_isLikely$1["3gp"](bytes) || _isLikely$1.mov(bytes)) {
  53407. return false;
  53408. }
  53409. if (bytesMatch$1(bytes, CONSTANTS$1.mp4, {
  53410. offset: 4
  53411. }) || bytesMatch$1(bytes, CONSTANTS$1.fmp4, {
  53412. offset: 4
  53413. })) {
  53414. return true;
  53415. }
  53416. if (bytesMatch$1(bytes, CONSTANTS$1.moof, {
  53417. offset: 4
  53418. }) || bytesMatch$1(bytes, CONSTANTS$1.moov, {
  53419. offset: 4
  53420. })) {
  53421. return true;
  53422. }
  53423. },
  53424. mov: function mov(bytes) {
  53425. return bytesMatch$1(bytes, CONSTANTS$1.mov, {
  53426. offset: 4
  53427. });
  53428. },
  53429. "3gp": function gp(bytes) {
  53430. return bytesMatch$1(bytes, CONSTANTS$1["3gp"], {
  53431. offset: 4
  53432. });
  53433. },
  53434. ac3: function ac3(bytes) {
  53435. var offset = getId3Offset$1(bytes);
  53436. return bytesMatch$1(bytes, CONSTANTS$1.ac3, {
  53437. offset
  53438. });
  53439. },
  53440. ts: function ts(bytes) {
  53441. if (bytes.length < 189 && bytes.length >= 1) {
  53442. return bytes[0] === 71;
  53443. }
  53444. var i2 = 0;
  53445. while (i2 + 188 < bytes.length && i2 < 188) {
  53446. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  53447. return true;
  53448. }
  53449. i2 += 1;
  53450. }
  53451. return false;
  53452. },
  53453. flac: function flac(bytes) {
  53454. var offset = getId3Offset$1(bytes);
  53455. return bytesMatch$1(bytes, CONSTANTS$1.flac, {
  53456. offset
  53457. });
  53458. },
  53459. ogg: function ogg(bytes) {
  53460. return bytesMatch$1(bytes, CONSTANTS$1.ogg);
  53461. },
  53462. avi: function avi(bytes) {
  53463. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.avi, {
  53464. offset: 8
  53465. });
  53466. },
  53467. wav: function wav(bytes) {
  53468. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.wav, {
  53469. offset: 8
  53470. });
  53471. },
  53472. "h264": function h264(bytes) {
  53473. return findH264Nal$1(bytes, 7, 3).length;
  53474. },
  53475. "h265": function h265(bytes) {
  53476. return findH265Nal$1(bytes, [32, 33], 3).length;
  53477. }
  53478. };
  53479. var isLikelyTypes$1 = Object.keys(_isLikely$1).filter(function(t2) {
  53480. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  53481. }).concat(["ts", "h264", "h265"]);
  53482. isLikelyTypes$1.forEach(function(type2) {
  53483. var isLikelyFn = _isLikely$1[type2];
  53484. _isLikely$1[type2] = function(bytes) {
  53485. return isLikelyFn(toUint8$1(bytes));
  53486. };
  53487. });
  53488. var isLikely$1 = _isLikely$1;
  53489. var detectContainerForBytes$1 = function detectContainerForBytes(bytes) {
  53490. bytes = toUint8$1(bytes);
  53491. for (var i2 = 0; i2 < isLikelyTypes$1.length; i2++) {
  53492. var type2 = isLikelyTypes$1[i2];
  53493. if (isLikely$1[type2](bytes)) {
  53494. return type2;
  53495. }
  53496. }
  53497. return "";
  53498. };
  53499. var isLikelyFmp4MediaSegment$1 = function isLikelyFmp4MediaSegment(bytes) {
  53500. return findBox$1(bytes, ["moof"]).length > 0;
  53501. };
  53502. var ONE_SECOND_IN_TS$1 = 9e4, secondsToVideoTs$1, secondsToAudioTs$1, videoTsToSeconds$1, audioTsToSeconds$1, audioTsToVideoTs$1, videoTsToAudioTs$1, metadataTsToSeconds$1;
  53503. secondsToVideoTs$1 = function(seconds) {
  53504. return seconds * ONE_SECOND_IN_TS$1;
  53505. };
  53506. secondsToAudioTs$1 = function(seconds, sampleRate) {
  53507. return seconds * sampleRate;
  53508. };
  53509. videoTsToSeconds$1 = function(timestamp) {
  53510. return timestamp / ONE_SECOND_IN_TS$1;
  53511. };
  53512. audioTsToSeconds$1 = function(timestamp, sampleRate) {
  53513. return timestamp / sampleRate;
  53514. };
  53515. audioTsToVideoTs$1 = function(timestamp, sampleRate) {
  53516. return secondsToVideoTs$1(audioTsToSeconds$1(timestamp, sampleRate));
  53517. };
  53518. videoTsToAudioTs$1 = function(timestamp, sampleRate) {
  53519. return secondsToAudioTs$1(videoTsToSeconds$1(timestamp), sampleRate);
  53520. };
  53521. metadataTsToSeconds$1 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  53522. return videoTsToSeconds$1(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  53523. };
  53524. var clock$1 = {
  53525. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$1,
  53526. secondsToVideoTs: secondsToVideoTs$1,
  53527. secondsToAudioTs: secondsToAudioTs$1,
  53528. videoTsToSeconds: videoTsToSeconds$1,
  53529. audioTsToSeconds: audioTsToSeconds$1,
  53530. audioTsToVideoTs: audioTsToVideoTs$1,
  53531. videoTsToAudioTs: videoTsToAudioTs$1,
  53532. metadataTsToSeconds: metadataTsToSeconds$1
  53533. };
  53534. /**
  53535. * @license
  53536. * Video.js 8.3.0 <http://videojs.com/>
  53537. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  53538. * Available under Apache License Version 2.0
  53539. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  53540. *
  53541. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  53542. * Available under Apache License Version 2.0
  53543. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  53544. */
  53545. var version$6$1 = "8.3.0";
  53546. const hooks_$1 = {};
  53547. const hooks$1 = function(type2, fn2) {
  53548. hooks_$1[type2] = hooks_$1[type2] || [];
  53549. if (fn2) {
  53550. hooks_$1[type2] = hooks_$1[type2].concat(fn2);
  53551. }
  53552. return hooks_$1[type2];
  53553. };
  53554. const hook$1 = function(type2, fn2) {
  53555. hooks$1(type2, fn2);
  53556. };
  53557. const removeHook$1 = function(type2, fn2) {
  53558. const index2 = hooks$1(type2).indexOf(fn2);
  53559. if (index2 <= -1) {
  53560. return false;
  53561. }
  53562. hooks_$1[type2] = hooks_$1[type2].slice();
  53563. hooks_$1[type2].splice(index2, 1);
  53564. return true;
  53565. };
  53566. const hookOnce$1 = function(type2, fn2) {
  53567. hooks$1(type2, [].concat(fn2).map((original) => {
  53568. const wrapper = (...args) => {
  53569. removeHook$1(type2, wrapper);
  53570. return original(...args);
  53571. };
  53572. return wrapper;
  53573. }));
  53574. };
  53575. const FullscreenApi$1 = {
  53576. prefixed: true
  53577. };
  53578. const apiMap$1 = [
  53579. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  53580. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  53581. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  53582. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  53583. ];
  53584. const specApi$1 = apiMap$1[0];
  53585. let browserApi$1;
  53586. for (let i2 = 0; i2 < apiMap$1.length; i2++) {
  53587. if (apiMap$1[i2][1] in document_1) {
  53588. browserApi$1 = apiMap$1[i2];
  53589. break;
  53590. }
  53591. }
  53592. if (browserApi$1) {
  53593. for (let i2 = 0; i2 < browserApi$1.length; i2++) {
  53594. FullscreenApi$1[specApi$1[i2]] = browserApi$1[i2];
  53595. }
  53596. FullscreenApi$1.prefixed = browserApi$1[0] !== specApi$1[0];
  53597. }
  53598. let history$1 = [];
  53599. const LogByTypeFactory$1 = (name, log2) => (type2, level, args) => {
  53600. const lvl = log2.levels[level];
  53601. const lvlRegExp = new RegExp(`^(${lvl})$`);
  53602. if (type2 !== "log") {
  53603. args.unshift(type2.toUpperCase() + ":");
  53604. }
  53605. args.unshift(name + ":");
  53606. if (history$1) {
  53607. history$1.push([].concat(args));
  53608. const splice2 = history$1.length - 1e3;
  53609. history$1.splice(0, splice2 > 0 ? splice2 : 0);
  53610. }
  53611. if (!window_1.console) {
  53612. return;
  53613. }
  53614. let fn2 = window_1.console[type2];
  53615. if (!fn2 && type2 === "debug") {
  53616. fn2 = window_1.console.info || window_1.console.log;
  53617. }
  53618. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  53619. return;
  53620. }
  53621. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  53622. };
  53623. function createLogger$1$1(name) {
  53624. let level = "info";
  53625. let logByType;
  53626. const log2 = function(...args) {
  53627. logByType("log", level, args);
  53628. };
  53629. logByType = LogByTypeFactory$1(name, log2);
  53630. log2.createLogger = (subname) => createLogger$1$1(name + ": " + subname);
  53631. log2.levels = {
  53632. all: "debug|log|warn|error",
  53633. off: "",
  53634. debug: "debug|log|warn|error",
  53635. info: "log|warn|error",
  53636. warn: "warn|error",
  53637. error: "error",
  53638. DEFAULT: level
  53639. };
  53640. log2.level = (lvl) => {
  53641. if (typeof lvl === "string") {
  53642. if (!log2.levels.hasOwnProperty(lvl)) {
  53643. throw new Error(`"${lvl}" in not a valid log level`);
  53644. }
  53645. level = lvl;
  53646. }
  53647. return level;
  53648. };
  53649. log2.history = () => history$1 ? [].concat(history$1) : [];
  53650. log2.history.filter = (fname) => {
  53651. return (history$1 || []).filter((historyItem) => {
  53652. return new RegExp(`.*${fname}.*`).test(historyItem[0]);
  53653. });
  53654. };
  53655. log2.history.clear = () => {
  53656. if (history$1) {
  53657. history$1.length = 0;
  53658. }
  53659. };
  53660. log2.history.disable = () => {
  53661. if (history$1 !== null) {
  53662. history$1.length = 0;
  53663. history$1 = null;
  53664. }
  53665. };
  53666. log2.history.enable = () => {
  53667. if (history$1 === null) {
  53668. history$1 = [];
  53669. }
  53670. };
  53671. log2.error = (...args) => logByType("error", level, args);
  53672. log2.warn = (...args) => logByType("warn", level, args);
  53673. log2.debug = (...args) => logByType("debug", level, args);
  53674. return log2;
  53675. }
  53676. const log$1$1 = createLogger$1$1("VIDEOJS");
  53677. const createLogger$2 = log$1$1.createLogger;
  53678. const toString$1 = Object.prototype.toString;
  53679. const keys$1 = function(object) {
  53680. return isObject$2(object) ? Object.keys(object) : [];
  53681. };
  53682. function each$1(object, fn2) {
  53683. keys$1(object).forEach((key) => fn2(object[key], key));
  53684. }
  53685. function reduce$1(object, fn2, initial = 0) {
  53686. return keys$1(object).reduce((accum, key) => fn2(accum, object[key], key), initial);
  53687. }
  53688. function isObject$2(value) {
  53689. return !!value && typeof value === "object";
  53690. }
  53691. function isPlain$1(value) {
  53692. return isObject$2(value) && toString$1.call(value) === "[object Object]" && value.constructor === Object;
  53693. }
  53694. function merge$1(...sources) {
  53695. const result = {};
  53696. sources.forEach((source) => {
  53697. if (!source) {
  53698. return;
  53699. }
  53700. each$1(source, (value, key) => {
  53701. if (!isPlain$1(value)) {
  53702. result[key] = value;
  53703. return;
  53704. }
  53705. if (!isPlain$1(result[key])) {
  53706. result[key] = {};
  53707. }
  53708. result[key] = merge$1(result[key], value);
  53709. });
  53710. });
  53711. return result;
  53712. }
  53713. function defineLazyProperty$1(obj, key, getValue2, setter = true) {
  53714. const set4 = (value) => Object.defineProperty(obj, key, {
  53715. value,
  53716. enumerable: true,
  53717. writable: true
  53718. });
  53719. const options2 = {
  53720. configurable: true,
  53721. enumerable: true,
  53722. get() {
  53723. const value = getValue2();
  53724. set4(value);
  53725. return value;
  53726. }
  53727. };
  53728. if (setter) {
  53729. options2.set = set4;
  53730. }
  53731. return Object.defineProperty(obj, key, options2);
  53732. }
  53733. var Obj = /* @__PURE__ */ Object.freeze({
  53734. __proto__: null,
  53735. each: each$1,
  53736. reduce: reduce$1,
  53737. isObject: isObject$2,
  53738. isPlain: isPlain$1,
  53739. merge: merge$1,
  53740. defineLazyProperty: defineLazyProperty$1
  53741. });
  53742. let IS_IPOD$1 = false;
  53743. let IOS_VERSION$1 = null;
  53744. let IS_ANDROID$1 = false;
  53745. let ANDROID_VERSION$1;
  53746. let IS_FIREFOX$1 = false;
  53747. let IS_EDGE$1 = false;
  53748. let IS_CHROMIUM = false;
  53749. let IS_CHROME$1 = false;
  53750. let CHROMIUM_VERSION = null;
  53751. let CHROME_VERSION$1 = null;
  53752. let IE_VERSION$1 = null;
  53753. let IS_SAFARI$1 = false;
  53754. let IS_WINDOWS$1 = false;
  53755. let IS_IPAD$1 = false;
  53756. let IS_IPHONE$1 = false;
  53757. 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));
  53758. const UAD = window_1.navigator && window_1.navigator.userAgentData;
  53759. if (UAD) {
  53760. IS_ANDROID$1 = UAD.platform === "Android";
  53761. IS_EDGE$1 = Boolean(UAD.brands.find((b) => b.brand === "Microsoft Edge"));
  53762. IS_CHROMIUM = Boolean(UAD.brands.find((b) => b.brand === "Chromium"));
  53763. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53764. CHROMIUM_VERSION = CHROME_VERSION$1 = (UAD.brands.find((b) => b.brand === "Chromium") || {}).version || null;
  53765. IS_WINDOWS$1 = UAD.platform === "Windows";
  53766. }
  53767. if (!IS_CHROMIUM) {
  53768. const USER_AGENT2 = window_1.navigator && window_1.navigator.userAgent || "";
  53769. IS_IPOD$1 = /iPod/i.test(USER_AGENT2);
  53770. IOS_VERSION$1 = function() {
  53771. const match = USER_AGENT2.match(/OS (\d+)_/i);
  53772. if (match && match[1]) {
  53773. return match[1];
  53774. }
  53775. return null;
  53776. }();
  53777. IS_ANDROID$1 = /Android/i.test(USER_AGENT2);
  53778. ANDROID_VERSION$1 = function() {
  53779. const match = USER_AGENT2.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  53780. if (!match) {
  53781. return null;
  53782. }
  53783. const major = match[1] && parseFloat(match[1]);
  53784. const minor = match[2] && parseFloat(match[2]);
  53785. if (major && minor) {
  53786. return parseFloat(match[1] + "." + match[2]);
  53787. } else if (major) {
  53788. return major;
  53789. }
  53790. return null;
  53791. }();
  53792. IS_FIREFOX$1 = /Firefox/i.test(USER_AGENT2);
  53793. IS_EDGE$1 = /Edg/i.test(USER_AGENT2);
  53794. IS_CHROMIUM = /Chrome/i.test(USER_AGENT2) || /CriOS/i.test(USER_AGENT2);
  53795. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53796. CHROMIUM_VERSION = CHROME_VERSION$1 = function() {
  53797. const match = USER_AGENT2.match(/(Chrome|CriOS)\/(\d+)/);
  53798. if (match && match[2]) {
  53799. return parseFloat(match[2]);
  53800. }
  53801. return null;
  53802. }();
  53803. IE_VERSION$1 = function() {
  53804. const result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT2);
  53805. let version2 = result && parseFloat(result[1]);
  53806. if (!version2 && /Trident\/7.0/i.test(USER_AGENT2) && /rv:11.0/.test(USER_AGENT2)) {
  53807. version2 = 11;
  53808. }
  53809. return version2;
  53810. }();
  53811. IS_SAFARI$1 = /Safari/i.test(USER_AGENT2) && !IS_CHROME$1 && !IS_ANDROID$1 && !IS_EDGE$1;
  53812. IS_WINDOWS$1 = /Windows/i.test(USER_AGENT2);
  53813. IS_IPAD$1 = /iPad/i.test(USER_AGENT2) || IS_SAFARI$1 && TOUCH_ENABLED$1 && !/iPhone/i.test(USER_AGENT2);
  53814. IS_IPHONE$1 = /iPhone/i.test(USER_AGENT2) && !IS_IPAD$1;
  53815. }
  53816. const IS_IOS$1 = IS_IPHONE$1 || IS_IPAD$1 || IS_IPOD$1;
  53817. const IS_ANY_SAFARI$1 = (IS_SAFARI$1 || IS_IOS$1) && !IS_CHROME$1;
  53818. var browser$1 = /* @__PURE__ */ Object.freeze({
  53819. __proto__: null,
  53820. get IS_IPOD() {
  53821. return IS_IPOD$1;
  53822. },
  53823. get IOS_VERSION() {
  53824. return IOS_VERSION$1;
  53825. },
  53826. get IS_ANDROID() {
  53827. return IS_ANDROID$1;
  53828. },
  53829. get ANDROID_VERSION() {
  53830. return ANDROID_VERSION$1;
  53831. },
  53832. get IS_FIREFOX() {
  53833. return IS_FIREFOX$1;
  53834. },
  53835. get IS_EDGE() {
  53836. return IS_EDGE$1;
  53837. },
  53838. get IS_CHROMIUM() {
  53839. return IS_CHROMIUM;
  53840. },
  53841. get IS_CHROME() {
  53842. return IS_CHROME$1;
  53843. },
  53844. get CHROMIUM_VERSION() {
  53845. return CHROMIUM_VERSION;
  53846. },
  53847. get CHROME_VERSION() {
  53848. return CHROME_VERSION$1;
  53849. },
  53850. get IE_VERSION() {
  53851. return IE_VERSION$1;
  53852. },
  53853. get IS_SAFARI() {
  53854. return IS_SAFARI$1;
  53855. },
  53856. get IS_WINDOWS() {
  53857. return IS_WINDOWS$1;
  53858. },
  53859. get IS_IPAD() {
  53860. return IS_IPAD$1;
  53861. },
  53862. get IS_IPHONE() {
  53863. return IS_IPHONE$1;
  53864. },
  53865. TOUCH_ENABLED: TOUCH_ENABLED$1,
  53866. IS_IOS: IS_IOS$1,
  53867. IS_ANY_SAFARI: IS_ANY_SAFARI$1
  53868. });
  53869. function isNonBlankString$1(str) {
  53870. return typeof str === "string" && Boolean(str.trim());
  53871. }
  53872. function throwIfWhitespace$1(str) {
  53873. if (str.indexOf(" ") >= 0) {
  53874. throw new Error("class has illegal whitespace characters");
  53875. }
  53876. }
  53877. function isReal$1() {
  53878. return document_1 === window_1.document;
  53879. }
  53880. function isEl$1(value) {
  53881. return isObject$2(value) && value.nodeType === 1;
  53882. }
  53883. function isInFrame$1() {
  53884. try {
  53885. return window_1.parent !== window_1.self;
  53886. } catch (x) {
  53887. return true;
  53888. }
  53889. }
  53890. function createQuerier$1(method) {
  53891. return function(selector, context) {
  53892. if (!isNonBlankString$1(selector)) {
  53893. return document_1[method](null);
  53894. }
  53895. if (isNonBlankString$1(context)) {
  53896. context = document_1.querySelector(context);
  53897. }
  53898. const ctx = isEl$1(context) ? context : document_1;
  53899. return ctx[method] && ctx[method](selector);
  53900. };
  53901. }
  53902. function createEl$1(tagName = "div", properties = {}, attributes = {}, content) {
  53903. const el = document_1.createElement(tagName);
  53904. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  53905. const val = properties[propName];
  53906. if (propName === "textContent") {
  53907. textContent$1(el, val);
  53908. } else if (el[propName] !== val || propName === "tabIndex") {
  53909. el[propName] = val;
  53910. }
  53911. });
  53912. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53913. el.setAttribute(attrName, attributes[attrName]);
  53914. });
  53915. if (content) {
  53916. appendContent$1(el, content);
  53917. }
  53918. return el;
  53919. }
  53920. function textContent$1(el, text) {
  53921. if (typeof el.textContent === "undefined") {
  53922. el.innerText = text;
  53923. } else {
  53924. el.textContent = text;
  53925. }
  53926. return el;
  53927. }
  53928. function prependTo$1(child, parent) {
  53929. if (parent.firstChild) {
  53930. parent.insertBefore(child, parent.firstChild);
  53931. } else {
  53932. parent.appendChild(child);
  53933. }
  53934. }
  53935. function hasClass$1(element, classToCheck) {
  53936. throwIfWhitespace$1(classToCheck);
  53937. return element.classList.contains(classToCheck);
  53938. }
  53939. function addClass$1(element, ...classesToAdd) {
  53940. element.classList.add(...classesToAdd.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53941. return element;
  53942. }
  53943. function removeClass$1(element, ...classesToRemove) {
  53944. if (!element) {
  53945. log$1$1.warn("removeClass was called with an element that doesn't exist");
  53946. return null;
  53947. }
  53948. element.classList.remove(...classesToRemove.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53949. return element;
  53950. }
  53951. function toggleClass$1(element, classToToggle, predicate) {
  53952. if (typeof predicate === "function") {
  53953. predicate = predicate(element, classToToggle);
  53954. }
  53955. if (typeof predicate !== "boolean") {
  53956. predicate = void 0;
  53957. }
  53958. classToToggle.split(/\s+/).forEach((className) => element.classList.toggle(className, predicate));
  53959. return element;
  53960. }
  53961. function setAttributes$1(el, attributes) {
  53962. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53963. const attrValue = attributes[attrName];
  53964. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  53965. el.removeAttribute(attrName);
  53966. } else {
  53967. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  53968. }
  53969. });
  53970. }
  53971. function getAttributes$1(tag) {
  53972. const obj = {};
  53973. const knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  53974. if (tag && tag.attributes && tag.attributes.length > 0) {
  53975. const attrs = tag.attributes;
  53976. for (let i2 = attrs.length - 1; i2 >= 0; i2--) {
  53977. const attrName = attrs[i2].name;
  53978. let attrVal = attrs[i2].value;
  53979. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  53980. attrVal = attrVal !== null ? true : false;
  53981. }
  53982. obj[attrName] = attrVal;
  53983. }
  53984. }
  53985. return obj;
  53986. }
  53987. function getAttribute$1(el, attribute) {
  53988. return el.getAttribute(attribute);
  53989. }
  53990. function setAttribute$1(el, attribute, value) {
  53991. el.setAttribute(attribute, value);
  53992. }
  53993. function removeAttribute$1(el, attribute) {
  53994. el.removeAttribute(attribute);
  53995. }
  53996. function blockTextSelection$1() {
  53997. document_1.body.focus();
  53998. document_1.onselectstart = function() {
  53999. return false;
  54000. };
  54001. }
  54002. function unblockTextSelection$1() {
  54003. document_1.onselectstart = function() {
  54004. return true;
  54005. };
  54006. }
  54007. function getBoundingClientRect$1(el) {
  54008. if (el && el.getBoundingClientRect && el.parentNode) {
  54009. const rect = el.getBoundingClientRect();
  54010. const result = {};
  54011. ["bottom", "height", "left", "right", "top", "width"].forEach((k) => {
  54012. if (rect[k] !== void 0) {
  54013. result[k] = rect[k];
  54014. }
  54015. });
  54016. if (!result.height) {
  54017. result.height = parseFloat(computedStyle$1(el, "height"));
  54018. }
  54019. if (!result.width) {
  54020. result.width = parseFloat(computedStyle$1(el, "width"));
  54021. }
  54022. return result;
  54023. }
  54024. }
  54025. function findPosition$1(el) {
  54026. if (!el || el && !el.offsetParent) {
  54027. return {
  54028. left: 0,
  54029. top: 0,
  54030. width: 0,
  54031. height: 0
  54032. };
  54033. }
  54034. const width2 = el.offsetWidth;
  54035. const height2 = el.offsetHeight;
  54036. let left = 0;
  54037. let top = 0;
  54038. while (el.offsetParent && el !== document_1[FullscreenApi$1.fullscreenElement]) {
  54039. left += el.offsetLeft;
  54040. top += el.offsetTop;
  54041. el = el.offsetParent;
  54042. }
  54043. return {
  54044. left,
  54045. top,
  54046. width: width2,
  54047. height: height2
  54048. };
  54049. }
  54050. function getPointerPosition$1(el, event2) {
  54051. const translated = {
  54052. x: 0,
  54053. y: 0
  54054. };
  54055. if (IS_IOS$1) {
  54056. let item = el;
  54057. while (item && item.nodeName.toLowerCase() !== "html") {
  54058. const transform3 = computedStyle$1(item, "transform");
  54059. if (/^matrix/.test(transform3)) {
  54060. const values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  54061. translated.x += values3[4];
  54062. translated.y += values3[5];
  54063. } else if (/^matrix3d/.test(transform3)) {
  54064. const values3 = transform3.slice(9, -1).split(/,\s/).map(Number);
  54065. translated.x += values3[12];
  54066. translated.y += values3[13];
  54067. }
  54068. item = item.parentNode;
  54069. }
  54070. }
  54071. const position2 = {};
  54072. const boxTarget = findPosition$1(event2.target);
  54073. const box = findPosition$1(el);
  54074. const boxW = box.width;
  54075. const boxH = box.height;
  54076. let offsetY = event2.offsetY - (box.top - boxTarget.top);
  54077. let offsetX = event2.offsetX - (box.left - boxTarget.left);
  54078. if (event2.changedTouches) {
  54079. offsetX = event2.changedTouches[0].pageX - box.left;
  54080. offsetY = event2.changedTouches[0].pageY + box.top;
  54081. if (IS_IOS$1) {
  54082. offsetX -= translated.x;
  54083. offsetY -= translated.y;
  54084. }
  54085. }
  54086. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  54087. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  54088. return position2;
  54089. }
  54090. function isTextNode$1(value) {
  54091. return isObject$2(value) && value.nodeType === 3;
  54092. }
  54093. function emptyEl$1(el) {
  54094. while (el.firstChild) {
  54095. el.removeChild(el.firstChild);
  54096. }
  54097. return el;
  54098. }
  54099. function normalizeContent$1(content) {
  54100. if (typeof content === "function") {
  54101. content = content();
  54102. }
  54103. return (Array.isArray(content) ? content : [content]).map((value) => {
  54104. if (typeof value === "function") {
  54105. value = value();
  54106. }
  54107. if (isEl$1(value) || isTextNode$1(value)) {
  54108. return value;
  54109. }
  54110. if (typeof value === "string" && /\S/.test(value)) {
  54111. return document_1.createTextNode(value);
  54112. }
  54113. }).filter((value) => value);
  54114. }
  54115. function appendContent$1(el, content) {
  54116. normalizeContent$1(content).forEach((node) => el.appendChild(node));
  54117. return el;
  54118. }
  54119. function insertContent$1(el, content) {
  54120. return appendContent$1(emptyEl$1(el), content);
  54121. }
  54122. function isSingleLeftClick$1(event2) {
  54123. if (event2.button === void 0 && event2.buttons === void 0) {
  54124. return true;
  54125. }
  54126. if (event2.button === 0 && event2.buttons === void 0) {
  54127. return true;
  54128. }
  54129. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  54130. return true;
  54131. }
  54132. if (event2.button !== 0 || event2.buttons !== 1) {
  54133. return false;
  54134. }
  54135. return true;
  54136. }
  54137. const $$1 = createQuerier$1("querySelector");
  54138. const $$$1 = createQuerier$1("querySelectorAll");
  54139. function computedStyle$1(el, prop) {
  54140. if (!el || !prop) {
  54141. return "";
  54142. }
  54143. if (typeof window_1.getComputedStyle === "function") {
  54144. let computedStyleValue;
  54145. try {
  54146. computedStyleValue = window_1.getComputedStyle(el);
  54147. } catch (e) {
  54148. return "";
  54149. }
  54150. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  54151. }
  54152. return "";
  54153. }
  54154. var Dom$2 = /* @__PURE__ */ Object.freeze({
  54155. __proto__: null,
  54156. isReal: isReal$1,
  54157. isEl: isEl$1,
  54158. isInFrame: isInFrame$1,
  54159. createEl: createEl$1,
  54160. textContent: textContent$1,
  54161. prependTo: prependTo$1,
  54162. hasClass: hasClass$1,
  54163. addClass: addClass$1,
  54164. removeClass: removeClass$1,
  54165. toggleClass: toggleClass$1,
  54166. setAttributes: setAttributes$1,
  54167. getAttributes: getAttributes$1,
  54168. getAttribute: getAttribute$1,
  54169. setAttribute: setAttribute$1,
  54170. removeAttribute: removeAttribute$1,
  54171. blockTextSelection: blockTextSelection$1,
  54172. unblockTextSelection: unblockTextSelection$1,
  54173. getBoundingClientRect: getBoundingClientRect$1,
  54174. findPosition: findPosition$1,
  54175. getPointerPosition: getPointerPosition$1,
  54176. isTextNode: isTextNode$1,
  54177. emptyEl: emptyEl$1,
  54178. normalizeContent: normalizeContent$1,
  54179. appendContent: appendContent$1,
  54180. insertContent: insertContent$1,
  54181. isSingleLeftClick: isSingleLeftClick$1,
  54182. $: $$1,
  54183. $$: $$$1,
  54184. computedStyle: computedStyle$1
  54185. });
  54186. let _windowLoaded$1 = false;
  54187. let videojs$1$1;
  54188. const autoSetup$1 = function() {
  54189. if (videojs$1$1.options.autoSetup === false) {
  54190. return;
  54191. }
  54192. const vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  54193. const audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  54194. const divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  54195. const mediaEls = vids.concat(audios, divs);
  54196. if (mediaEls && mediaEls.length > 0) {
  54197. for (let i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  54198. const mediaEl = mediaEls[i2];
  54199. if (mediaEl && mediaEl.getAttribute) {
  54200. if (mediaEl.player === void 0) {
  54201. const options2 = mediaEl.getAttribute("data-setup");
  54202. if (options2 !== null) {
  54203. videojs$1$1(mediaEl);
  54204. }
  54205. }
  54206. } else {
  54207. autoSetupTimeout$1(1);
  54208. break;
  54209. }
  54210. }
  54211. } else if (!_windowLoaded$1) {
  54212. autoSetupTimeout$1(1);
  54213. }
  54214. };
  54215. function autoSetupTimeout$1(wait, vjs) {
  54216. if (!isReal$1()) {
  54217. return;
  54218. }
  54219. if (vjs) {
  54220. videojs$1$1 = vjs;
  54221. }
  54222. window_1.setTimeout(autoSetup$1, wait);
  54223. }
  54224. function setWindowLoaded$1() {
  54225. _windowLoaded$1 = true;
  54226. window_1.removeEventListener("load", setWindowLoaded$1);
  54227. }
  54228. if (isReal$1()) {
  54229. if (document_1.readyState === "complete") {
  54230. setWindowLoaded$1();
  54231. } else {
  54232. window_1.addEventListener("load", setWindowLoaded$1);
  54233. }
  54234. }
  54235. const createStyleElement$1 = function(className) {
  54236. const style = document_1.createElement("style");
  54237. style.className = className;
  54238. return style;
  54239. };
  54240. const setTextContent$1 = function(el, content) {
  54241. if (el.styleSheet) {
  54242. el.styleSheet.cssText = content;
  54243. } else {
  54244. el.textContent = content;
  54245. }
  54246. };
  54247. var DomData$1 = /* @__PURE__ */ new WeakMap();
  54248. const _initialGuid$1 = 3;
  54249. let _guid$1 = _initialGuid$1;
  54250. function newGUID$1() {
  54251. return _guid$1++;
  54252. }
  54253. function _cleanUpEvents$1(elem, type2) {
  54254. if (!DomData$1.has(elem)) {
  54255. return;
  54256. }
  54257. const data = DomData$1.get(elem);
  54258. if (data.handlers[type2].length === 0) {
  54259. delete data.handlers[type2];
  54260. if (elem.removeEventListener) {
  54261. elem.removeEventListener(type2, data.dispatcher, false);
  54262. } else if (elem.detachEvent) {
  54263. elem.detachEvent("on" + type2, data.dispatcher);
  54264. }
  54265. }
  54266. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  54267. delete data.handlers;
  54268. delete data.dispatcher;
  54269. delete data.disabled;
  54270. }
  54271. if (Object.getOwnPropertyNames(data).length === 0) {
  54272. DomData$1.delete(elem);
  54273. }
  54274. }
  54275. function _handleMultipleEvents$1(fn2, elem, types, callback2) {
  54276. types.forEach(function(type2) {
  54277. fn2(elem, type2, callback2);
  54278. });
  54279. }
  54280. function fixEvent$1(event2) {
  54281. if (event2.fixed_) {
  54282. return event2;
  54283. }
  54284. function returnTrue() {
  54285. return true;
  54286. }
  54287. function returnFalse() {
  54288. return false;
  54289. }
  54290. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  54291. const old = event2 || window_1.event;
  54292. event2 = {};
  54293. for (const key in old) {
  54294. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  54295. if (!(key === "returnValue" && old.preventDefault)) {
  54296. event2[key] = old[key];
  54297. }
  54298. }
  54299. }
  54300. if (!event2.target) {
  54301. event2.target = event2.srcElement || document_1;
  54302. }
  54303. if (!event2.relatedTarget) {
  54304. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  54305. }
  54306. event2.preventDefault = function() {
  54307. if (old.preventDefault) {
  54308. old.preventDefault();
  54309. }
  54310. event2.returnValue = false;
  54311. old.returnValue = false;
  54312. event2.defaultPrevented = true;
  54313. };
  54314. event2.defaultPrevented = false;
  54315. event2.stopPropagation = function() {
  54316. if (old.stopPropagation) {
  54317. old.stopPropagation();
  54318. }
  54319. event2.cancelBubble = true;
  54320. old.cancelBubble = true;
  54321. event2.isPropagationStopped = returnTrue;
  54322. };
  54323. event2.isPropagationStopped = returnFalse;
  54324. event2.stopImmediatePropagation = function() {
  54325. if (old.stopImmediatePropagation) {
  54326. old.stopImmediatePropagation();
  54327. }
  54328. event2.isImmediatePropagationStopped = returnTrue;
  54329. event2.stopPropagation();
  54330. };
  54331. event2.isImmediatePropagationStopped = returnFalse;
  54332. if (event2.clientX !== null && event2.clientX !== void 0) {
  54333. const doc = document_1.documentElement;
  54334. const body = document_1.body;
  54335. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  54336. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  54337. }
  54338. event2.which = event2.charCode || event2.keyCode;
  54339. if (event2.button !== null && event2.button !== void 0) {
  54340. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  54341. }
  54342. }
  54343. event2.fixed_ = true;
  54344. return event2;
  54345. }
  54346. let _supportsPassive$1;
  54347. const supportsPassive$1 = function() {
  54348. if (typeof _supportsPassive$1 !== "boolean") {
  54349. _supportsPassive$1 = false;
  54350. try {
  54351. const opts = Object.defineProperty({}, "passive", {
  54352. get() {
  54353. _supportsPassive$1 = true;
  54354. }
  54355. });
  54356. window_1.addEventListener("test", null, opts);
  54357. window_1.removeEventListener("test", null, opts);
  54358. } catch (e) {
  54359. }
  54360. }
  54361. return _supportsPassive$1;
  54362. };
  54363. const passiveEvents$1 = ["touchstart", "touchmove"];
  54364. function on$1(elem, type2, fn2) {
  54365. if (Array.isArray(type2)) {
  54366. return _handleMultipleEvents$1(on$1, elem, type2, fn2);
  54367. }
  54368. if (!DomData$1.has(elem)) {
  54369. DomData$1.set(elem, {});
  54370. }
  54371. const data = DomData$1.get(elem);
  54372. if (!data.handlers) {
  54373. data.handlers = {};
  54374. }
  54375. if (!data.handlers[type2]) {
  54376. data.handlers[type2] = [];
  54377. }
  54378. if (!fn2.guid) {
  54379. fn2.guid = newGUID$1();
  54380. }
  54381. data.handlers[type2].push(fn2);
  54382. if (!data.dispatcher) {
  54383. data.disabled = false;
  54384. data.dispatcher = function(event2, hash) {
  54385. if (data.disabled) {
  54386. return;
  54387. }
  54388. event2 = fixEvent$1(event2);
  54389. const handlers = data.handlers[event2.type];
  54390. if (handlers) {
  54391. const handlersCopy = handlers.slice(0);
  54392. for (let m = 0, n = handlersCopy.length; m < n; m++) {
  54393. if (event2.isImmediatePropagationStopped()) {
  54394. break;
  54395. } else {
  54396. try {
  54397. handlersCopy[m].call(elem, event2, hash);
  54398. } catch (e) {
  54399. log$1$1.error(e);
  54400. }
  54401. }
  54402. }
  54403. }
  54404. };
  54405. }
  54406. if (data.handlers[type2].length === 1) {
  54407. if (elem.addEventListener) {
  54408. let options2 = false;
  54409. if (supportsPassive$1() && passiveEvents$1.indexOf(type2) > -1) {
  54410. options2 = {
  54411. passive: true
  54412. };
  54413. }
  54414. elem.addEventListener(type2, data.dispatcher, options2);
  54415. } else if (elem.attachEvent) {
  54416. elem.attachEvent("on" + type2, data.dispatcher);
  54417. }
  54418. }
  54419. }
  54420. function off$1(elem, type2, fn2) {
  54421. if (!DomData$1.has(elem)) {
  54422. return;
  54423. }
  54424. const data = DomData$1.get(elem);
  54425. if (!data.handlers) {
  54426. return;
  54427. }
  54428. if (Array.isArray(type2)) {
  54429. return _handleMultipleEvents$1(off$1, elem, type2, fn2);
  54430. }
  54431. const removeType = function(el, t2) {
  54432. data.handlers[t2] = [];
  54433. _cleanUpEvents$1(el, t2);
  54434. };
  54435. if (type2 === void 0) {
  54436. for (const t2 in data.handlers) {
  54437. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  54438. removeType(elem, t2);
  54439. }
  54440. }
  54441. return;
  54442. }
  54443. const handlers = data.handlers[type2];
  54444. if (!handlers) {
  54445. return;
  54446. }
  54447. if (!fn2) {
  54448. removeType(elem, type2);
  54449. return;
  54450. }
  54451. if (fn2.guid) {
  54452. for (let n = 0; n < handlers.length; n++) {
  54453. if (handlers[n].guid === fn2.guid) {
  54454. handlers.splice(n--, 1);
  54455. }
  54456. }
  54457. }
  54458. _cleanUpEvents$1(elem, type2);
  54459. }
  54460. function trigger$1(elem, event2, hash) {
  54461. const elemData = DomData$1.has(elem) ? DomData$1.get(elem) : {};
  54462. const parent = elem.parentNode || elem.ownerDocument;
  54463. if (typeof event2 === "string") {
  54464. event2 = {
  54465. type: event2,
  54466. target: elem
  54467. };
  54468. } else if (!event2.target) {
  54469. event2.target = elem;
  54470. }
  54471. event2 = fixEvent$1(event2);
  54472. if (elemData.dispatcher) {
  54473. elemData.dispatcher.call(elem, event2, hash);
  54474. }
  54475. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  54476. trigger$1.call(null, parent, event2, hash);
  54477. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  54478. if (!DomData$1.has(event2.target)) {
  54479. DomData$1.set(event2.target, {});
  54480. }
  54481. const targetData = DomData$1.get(event2.target);
  54482. if (event2.target[event2.type]) {
  54483. targetData.disabled = true;
  54484. if (typeof event2.target[event2.type] === "function") {
  54485. event2.target[event2.type]();
  54486. }
  54487. targetData.disabled = false;
  54488. }
  54489. }
  54490. return !event2.defaultPrevented;
  54491. }
  54492. function one$1(elem, type2, fn2) {
  54493. if (Array.isArray(type2)) {
  54494. return _handleMultipleEvents$1(one$1, elem, type2, fn2);
  54495. }
  54496. const func = function() {
  54497. off$1(elem, type2, func);
  54498. fn2.apply(this, arguments);
  54499. };
  54500. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54501. on$1(elem, type2, func);
  54502. }
  54503. function any$1(elem, type2, fn2) {
  54504. const func = function() {
  54505. off$1(elem, type2, func);
  54506. fn2.apply(this, arguments);
  54507. };
  54508. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54509. on$1(elem, type2, func);
  54510. }
  54511. var Events$1 = /* @__PURE__ */ Object.freeze({
  54512. __proto__: null,
  54513. fixEvent: fixEvent$1,
  54514. on: on$1,
  54515. off: off$1,
  54516. trigger: trigger$1,
  54517. one: one$1,
  54518. any: any$1
  54519. });
  54520. const UPDATE_REFRESH_INTERVAL$1 = 30;
  54521. const bind_ = function(context, fn2, uid) {
  54522. if (!fn2.guid) {
  54523. fn2.guid = newGUID$1();
  54524. }
  54525. const bound = fn2.bind(context);
  54526. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  54527. return bound;
  54528. };
  54529. const throttle$1 = function(fn2, wait) {
  54530. let last = window_1.performance.now();
  54531. const throttled = function(...args) {
  54532. const now2 = window_1.performance.now();
  54533. if (now2 - last >= wait) {
  54534. fn2(...args);
  54535. last = now2;
  54536. }
  54537. };
  54538. return throttled;
  54539. };
  54540. const debounce$1 = function(func, wait, immediate, context = window_1) {
  54541. let timeout;
  54542. const cancel = () => {
  54543. context.clearTimeout(timeout);
  54544. timeout = null;
  54545. };
  54546. const debounced = function() {
  54547. const self2 = this;
  54548. const args = arguments;
  54549. let later = function() {
  54550. timeout = null;
  54551. later = null;
  54552. if (!immediate) {
  54553. func.apply(self2, args);
  54554. }
  54555. };
  54556. if (!timeout && immediate) {
  54557. func.apply(self2, args);
  54558. }
  54559. context.clearTimeout(timeout);
  54560. timeout = context.setTimeout(later, wait);
  54561. };
  54562. debounced.cancel = cancel;
  54563. return debounced;
  54564. };
  54565. var Fn = /* @__PURE__ */ Object.freeze({
  54566. __proto__: null,
  54567. UPDATE_REFRESH_INTERVAL: UPDATE_REFRESH_INTERVAL$1,
  54568. bind_,
  54569. throttle: throttle$1,
  54570. debounce: debounce$1
  54571. });
  54572. let EVENT_MAP$1;
  54573. class EventTarget$2$1 {
  54574. on(type2, fn2) {
  54575. const ael = this.addEventListener;
  54576. this.addEventListener = () => {
  54577. };
  54578. on$1(this, type2, fn2);
  54579. this.addEventListener = ael;
  54580. }
  54581. off(type2, fn2) {
  54582. off$1(this, type2, fn2);
  54583. }
  54584. one(type2, fn2) {
  54585. const ael = this.addEventListener;
  54586. this.addEventListener = () => {
  54587. };
  54588. one$1(this, type2, fn2);
  54589. this.addEventListener = ael;
  54590. }
  54591. any(type2, fn2) {
  54592. const ael = this.addEventListener;
  54593. this.addEventListener = () => {
  54594. };
  54595. any$1(this, type2, fn2);
  54596. this.addEventListener = ael;
  54597. }
  54598. trigger(event2) {
  54599. const type2 = event2.type || event2;
  54600. if (typeof event2 === "string") {
  54601. event2 = {
  54602. type: type2
  54603. };
  54604. }
  54605. event2 = fixEvent$1(event2);
  54606. if (this.allowedEvents_[type2] && this["on" + type2]) {
  54607. this["on" + type2](event2);
  54608. }
  54609. trigger$1(this, event2);
  54610. }
  54611. queueTrigger(event2) {
  54612. if (!EVENT_MAP$1) {
  54613. EVENT_MAP$1 = /* @__PURE__ */ new Map();
  54614. }
  54615. const type2 = event2.type || event2;
  54616. let map = EVENT_MAP$1.get(this);
  54617. if (!map) {
  54618. map = /* @__PURE__ */ new Map();
  54619. EVENT_MAP$1.set(this, map);
  54620. }
  54621. const oldTimeout = map.get(type2);
  54622. map.delete(type2);
  54623. window_1.clearTimeout(oldTimeout);
  54624. const timeout = window_1.setTimeout(() => {
  54625. map.delete(type2);
  54626. if (map.size === 0) {
  54627. map = null;
  54628. EVENT_MAP$1.delete(this);
  54629. }
  54630. this.trigger(event2);
  54631. }, 0);
  54632. map.set(type2, timeout);
  54633. }
  54634. }
  54635. EventTarget$2$1.prototype.allowedEvents_ = {};
  54636. EventTarget$2$1.prototype.addEventListener = EventTarget$2$1.prototype.on;
  54637. EventTarget$2$1.prototype.removeEventListener = EventTarget$2$1.prototype.off;
  54638. EventTarget$2$1.prototype.dispatchEvent = EventTarget$2$1.prototype.trigger;
  54639. const objName$1 = (obj) => {
  54640. if (typeof obj.name === "function") {
  54641. return obj.name();
  54642. }
  54643. if (typeof obj.name === "string") {
  54644. return obj.name;
  54645. }
  54646. if (obj.name_) {
  54647. return obj.name_;
  54648. }
  54649. if (obj.constructor && obj.constructor.name) {
  54650. return obj.constructor.name;
  54651. }
  54652. return typeof obj;
  54653. };
  54654. const isEvented$1 = (object) => object instanceof EventTarget$2$1 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every((k) => typeof object[k] === "function");
  54655. const addEventedCallback$1 = (target, callback2) => {
  54656. if (isEvented$1(target)) {
  54657. callback2();
  54658. } else {
  54659. if (!target.eventedCallbacks) {
  54660. target.eventedCallbacks = [];
  54661. }
  54662. target.eventedCallbacks.push(callback2);
  54663. }
  54664. };
  54665. const isValidEventType$1 = (type2) => typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  54666. const validateTarget$1 = (target, obj, fnName) => {
  54667. if (!target || !target.nodeName && !isEvented$1(target)) {
  54668. throw new Error(`Invalid target for ${objName$1(obj)}#${fnName}; must be a DOM node or evented object.`);
  54669. }
  54670. };
  54671. const validateEventType$1 = (type2, obj, fnName) => {
  54672. if (!isValidEventType$1(type2)) {
  54673. throw new Error(`Invalid event type for ${objName$1(obj)}#${fnName}; must be a non-empty string or array.`);
  54674. }
  54675. };
  54676. const validateListener$1 = (listener, obj, fnName) => {
  54677. if (typeof listener !== "function") {
  54678. throw new Error(`Invalid listener for ${objName$1(obj)}#${fnName}; must be a function.`);
  54679. }
  54680. };
  54681. const normalizeListenArgs$1 = (self2, args, fnName) => {
  54682. const isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  54683. let target;
  54684. let type2;
  54685. let listener;
  54686. if (isTargetingSelf) {
  54687. target = self2.eventBusEl_;
  54688. if (args.length >= 3) {
  54689. args.shift();
  54690. }
  54691. [type2, listener] = args;
  54692. } else {
  54693. [target, type2, listener] = args;
  54694. }
  54695. validateTarget$1(target, self2, fnName);
  54696. validateEventType$1(type2, self2, fnName);
  54697. validateListener$1(listener, self2, fnName);
  54698. listener = bind_(self2, listener);
  54699. return {
  54700. isTargetingSelf,
  54701. target,
  54702. type: type2,
  54703. listener
  54704. };
  54705. };
  54706. const listen$1 = (target, method, type2, listener) => {
  54707. validateTarget$1(target, target, method);
  54708. if (target.nodeName) {
  54709. Events$1[method](target, type2, listener);
  54710. } else {
  54711. target[method](type2, listener);
  54712. }
  54713. };
  54714. const EventedMixin$1 = {
  54715. on(...args) {
  54716. const {
  54717. isTargetingSelf,
  54718. target,
  54719. type: type2,
  54720. listener
  54721. } = normalizeListenArgs$1(this, args, "on");
  54722. listen$1(target, "on", type2, listener);
  54723. if (!isTargetingSelf) {
  54724. const removeListenerOnDispose = () => this.off(target, type2, listener);
  54725. removeListenerOnDispose.guid = listener.guid;
  54726. const removeRemoverOnTargetDispose = () => this.off("dispose", removeListenerOnDispose);
  54727. removeRemoverOnTargetDispose.guid = listener.guid;
  54728. listen$1(this, "on", "dispose", removeListenerOnDispose);
  54729. listen$1(target, "on", "dispose", removeRemoverOnTargetDispose);
  54730. }
  54731. },
  54732. one(...args) {
  54733. const {
  54734. isTargetingSelf,
  54735. target,
  54736. type: type2,
  54737. listener
  54738. } = normalizeListenArgs$1(this, args, "one");
  54739. if (isTargetingSelf) {
  54740. listen$1(target, "one", type2, listener);
  54741. } else {
  54742. const wrapper = (...largs) => {
  54743. this.off(target, type2, wrapper);
  54744. listener.apply(null, largs);
  54745. };
  54746. wrapper.guid = listener.guid;
  54747. listen$1(target, "one", type2, wrapper);
  54748. }
  54749. },
  54750. any(...args) {
  54751. const {
  54752. isTargetingSelf,
  54753. target,
  54754. type: type2,
  54755. listener
  54756. } = normalizeListenArgs$1(this, args, "any");
  54757. if (isTargetingSelf) {
  54758. listen$1(target, "any", type2, listener);
  54759. } else {
  54760. const wrapper = (...largs) => {
  54761. this.off(target, type2, wrapper);
  54762. listener.apply(null, largs);
  54763. };
  54764. wrapper.guid = listener.guid;
  54765. listen$1(target, "any", type2, wrapper);
  54766. }
  54767. },
  54768. off(targetOrType, typeOrListener, listener) {
  54769. if (!targetOrType || isValidEventType$1(targetOrType)) {
  54770. off$1(this.eventBusEl_, targetOrType, typeOrListener);
  54771. } else {
  54772. const target = targetOrType;
  54773. const type2 = typeOrListener;
  54774. validateTarget$1(target, this, "off");
  54775. validateEventType$1(type2, this, "off");
  54776. validateListener$1(listener, this, "off");
  54777. listener = bind_(this, listener);
  54778. this.off("dispose", listener);
  54779. if (target.nodeName) {
  54780. off$1(target, type2, listener);
  54781. off$1(target, "dispose", listener);
  54782. } else if (isEvented$1(target)) {
  54783. target.off(type2, listener);
  54784. target.off("dispose", listener);
  54785. }
  54786. }
  54787. },
  54788. trigger(event2, hash) {
  54789. validateTarget$1(this.eventBusEl_, this, "trigger");
  54790. const type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  54791. if (!isValidEventType$1(type2)) {
  54792. 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.`);
  54793. }
  54794. return trigger$1(this.eventBusEl_, event2, hash);
  54795. }
  54796. };
  54797. function evented$1(target, options2 = {}) {
  54798. const {
  54799. eventBusKey
  54800. } = options2;
  54801. if (eventBusKey) {
  54802. if (!target[eventBusKey].nodeName) {
  54803. throw new Error(`The eventBusKey "${eventBusKey}" does not refer to an element.`);
  54804. }
  54805. target.eventBusEl_ = target[eventBusKey];
  54806. } else {
  54807. target.eventBusEl_ = createEl$1("span", {
  54808. className: "vjs-event-bus"
  54809. });
  54810. }
  54811. Object.assign(target, EventedMixin$1);
  54812. if (target.eventedCallbacks) {
  54813. target.eventedCallbacks.forEach((callback2) => {
  54814. callback2();
  54815. });
  54816. }
  54817. target.on("dispose", () => {
  54818. target.off();
  54819. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  54820. if (val && DomData$1.has(val)) {
  54821. DomData$1.delete(val);
  54822. }
  54823. });
  54824. window_1.setTimeout(() => {
  54825. target.eventBusEl_ = null;
  54826. }, 0);
  54827. });
  54828. return target;
  54829. }
  54830. const StatefulMixin$1 = {
  54831. state: {},
  54832. setState(stateUpdates) {
  54833. if (typeof stateUpdates === "function") {
  54834. stateUpdates = stateUpdates();
  54835. }
  54836. let changes;
  54837. each$1(stateUpdates, (value, key) => {
  54838. if (this.state[key] !== value) {
  54839. changes = changes || {};
  54840. changes[key] = {
  54841. from: this.state[key],
  54842. to: value
  54843. };
  54844. }
  54845. this.state[key] = value;
  54846. });
  54847. if (changes && isEvented$1(this)) {
  54848. this.trigger({
  54849. changes,
  54850. type: "statechanged"
  54851. });
  54852. }
  54853. return changes;
  54854. }
  54855. };
  54856. function stateful$1(target, defaultState) {
  54857. Object.assign(target, StatefulMixin$1);
  54858. target.state = Object.assign({}, target.state, defaultState);
  54859. if (typeof target.handleStateChanged === "function" && isEvented$1(target)) {
  54860. target.on("statechanged", target.handleStateChanged);
  54861. }
  54862. return target;
  54863. }
  54864. const toLowerCase$1 = function(string) {
  54865. if (typeof string !== "string") {
  54866. return string;
  54867. }
  54868. return string.replace(/./, (w) => w.toLowerCase());
  54869. };
  54870. const toTitleCase$1$1 = function(string) {
  54871. if (typeof string !== "string") {
  54872. return string;
  54873. }
  54874. return string.replace(/./, (w) => w.toUpperCase());
  54875. };
  54876. const titleCaseEquals$1 = function(str1, str2) {
  54877. return toTitleCase$1$1(str1) === toTitleCase$1$1(str2);
  54878. };
  54879. var Str = /* @__PURE__ */ Object.freeze({
  54880. __proto__: null,
  54881. toLowerCase: toLowerCase$1,
  54882. toTitleCase: toTitleCase$1$1,
  54883. titleCaseEquals: titleCaseEquals$1
  54884. });
  54885. class Component$1$1 {
  54886. constructor(player, options2, ready) {
  54887. if (!player && this.play) {
  54888. this.player_ = player = this;
  54889. } else {
  54890. this.player_ = player;
  54891. }
  54892. this.isDisposed_ = false;
  54893. this.parentComponent_ = null;
  54894. this.options_ = merge$1({}, this.options_);
  54895. options2 = this.options_ = merge$1(this.options_, options2);
  54896. this.id_ = options2.id || options2.el && options2.el.id;
  54897. if (!this.id_) {
  54898. const id = player && player.id && player.id() || "no_player";
  54899. this.id_ = `${id}_component_${newGUID$1()}`;
  54900. }
  54901. this.name_ = options2.name || null;
  54902. if (options2.el) {
  54903. this.el_ = options2.el;
  54904. } else if (options2.createEl !== false) {
  54905. this.el_ = this.createEl();
  54906. }
  54907. if (options2.className && this.el_) {
  54908. options2.className.split(" ").forEach((c) => this.addClass(c));
  54909. }
  54910. ["on", "off", "one", "any", "trigger"].forEach((fn2) => {
  54911. this[fn2] = void 0;
  54912. });
  54913. if (options2.evented !== false) {
  54914. evented$1(this, {
  54915. eventBusKey: this.el_ ? "el_" : null
  54916. });
  54917. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  54918. this.on(this.player_, "languagechange", this.handleLanguagechange);
  54919. }
  54920. stateful$1(this, this.constructor.defaultState);
  54921. this.children_ = [];
  54922. this.childIndex_ = {};
  54923. this.childNameIndex_ = {};
  54924. this.setTimeoutIds_ = /* @__PURE__ */ new Set();
  54925. this.setIntervalIds_ = /* @__PURE__ */ new Set();
  54926. this.rafIds_ = /* @__PURE__ */ new Set();
  54927. this.namedRafs_ = /* @__PURE__ */ new Map();
  54928. this.clearingTimersOnDispose_ = false;
  54929. if (options2.initChildren !== false) {
  54930. this.initChildren();
  54931. }
  54932. this.ready(ready);
  54933. if (options2.reportTouchActivity !== false) {
  54934. this.enableTouchActivity();
  54935. }
  54936. }
  54937. on(type2, fn2) {
  54938. }
  54939. off(type2, fn2) {
  54940. }
  54941. one(type2, fn2) {
  54942. }
  54943. any(type2, fn2) {
  54944. }
  54945. trigger(event2) {
  54946. }
  54947. dispose(options2 = {}) {
  54948. if (this.isDisposed_) {
  54949. return;
  54950. }
  54951. if (this.readyQueue_) {
  54952. this.readyQueue_.length = 0;
  54953. }
  54954. this.trigger({
  54955. type: "dispose",
  54956. bubbles: false
  54957. });
  54958. this.isDisposed_ = true;
  54959. if (this.children_) {
  54960. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  54961. if (this.children_[i2].dispose) {
  54962. this.children_[i2].dispose();
  54963. }
  54964. }
  54965. }
  54966. this.children_ = null;
  54967. this.childIndex_ = null;
  54968. this.childNameIndex_ = null;
  54969. this.parentComponent_ = null;
  54970. if (this.el_) {
  54971. if (this.el_.parentNode) {
  54972. if (options2.restoreEl) {
  54973. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  54974. } else {
  54975. this.el_.parentNode.removeChild(this.el_);
  54976. }
  54977. }
  54978. this.el_ = null;
  54979. }
  54980. this.player_ = null;
  54981. }
  54982. isDisposed() {
  54983. return Boolean(this.isDisposed_);
  54984. }
  54985. player() {
  54986. return this.player_;
  54987. }
  54988. options(obj) {
  54989. if (!obj) {
  54990. return this.options_;
  54991. }
  54992. this.options_ = merge$1(this.options_, obj);
  54993. return this.options_;
  54994. }
  54995. el() {
  54996. return this.el_;
  54997. }
  54998. createEl(tagName, properties, attributes) {
  54999. return createEl$1(tagName, properties, attributes);
  55000. }
  55001. localize(string, tokens, defaultValue2 = string) {
  55002. const code = this.player_.language && this.player_.language();
  55003. const languages = this.player_.languages && this.player_.languages();
  55004. const language = languages && languages[code];
  55005. const primaryCode = code && code.split("-")[0];
  55006. const primaryLang = languages && languages[primaryCode];
  55007. let localizedString = defaultValue2;
  55008. if (language && language[string]) {
  55009. localizedString = language[string];
  55010. } else if (primaryLang && primaryLang[string]) {
  55011. localizedString = primaryLang[string];
  55012. }
  55013. if (tokens) {
  55014. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  55015. const value = tokens[index2 - 1];
  55016. let ret = value;
  55017. if (typeof value === "undefined") {
  55018. ret = match;
  55019. }
  55020. return ret;
  55021. });
  55022. }
  55023. return localizedString;
  55024. }
  55025. handleLanguagechange() {
  55026. }
  55027. contentEl() {
  55028. return this.contentEl_ || this.el_;
  55029. }
  55030. id() {
  55031. return this.id_;
  55032. }
  55033. name() {
  55034. return this.name_;
  55035. }
  55036. children() {
  55037. return this.children_;
  55038. }
  55039. getChildById(id) {
  55040. return this.childIndex_[id];
  55041. }
  55042. getChild(name) {
  55043. if (!name) {
  55044. return;
  55045. }
  55046. return this.childNameIndex_[name];
  55047. }
  55048. getDescendant(...names2) {
  55049. names2 = names2.reduce((acc, n) => acc.concat(n), []);
  55050. let currentChild = this;
  55051. for (let i2 = 0; i2 < names2.length; i2++) {
  55052. currentChild = currentChild.getChild(names2[i2]);
  55053. if (!currentChild || !currentChild.getChild) {
  55054. return;
  55055. }
  55056. }
  55057. return currentChild;
  55058. }
  55059. addChild(child, options2 = {}, index2 = this.children_.length) {
  55060. let component;
  55061. let componentName;
  55062. if (typeof child === "string") {
  55063. componentName = toTitleCase$1$1(child);
  55064. const componentClassName = options2.componentClass || componentName;
  55065. options2.name = componentName;
  55066. const ComponentClass = Component$1$1.getComponent(componentClassName);
  55067. if (!ComponentClass) {
  55068. throw new Error(`Component ${componentClassName} does not exist`);
  55069. }
  55070. if (typeof ComponentClass !== "function") {
  55071. return null;
  55072. }
  55073. component = new ComponentClass(this.player_ || this, options2);
  55074. } else {
  55075. component = child;
  55076. }
  55077. if (component.parentComponent_) {
  55078. component.parentComponent_.removeChild(component);
  55079. }
  55080. this.children_.splice(index2, 0, component);
  55081. component.parentComponent_ = this;
  55082. if (typeof component.id === "function") {
  55083. this.childIndex_[component.id()] = component;
  55084. }
  55085. componentName = componentName || component.name && toTitleCase$1$1(component.name());
  55086. if (componentName) {
  55087. this.childNameIndex_[componentName] = component;
  55088. this.childNameIndex_[toLowerCase$1(componentName)] = component;
  55089. }
  55090. if (typeof component.el === "function" && component.el()) {
  55091. let refNode = null;
  55092. if (this.children_[index2 + 1]) {
  55093. if (this.children_[index2 + 1].el_) {
  55094. refNode = this.children_[index2 + 1].el_;
  55095. } else if (isEl$1(this.children_[index2 + 1])) {
  55096. refNode = this.children_[index2 + 1];
  55097. }
  55098. }
  55099. this.contentEl().insertBefore(component.el(), refNode);
  55100. }
  55101. return component;
  55102. }
  55103. removeChild(component) {
  55104. if (typeof component === "string") {
  55105. component = this.getChild(component);
  55106. }
  55107. if (!component || !this.children_) {
  55108. return;
  55109. }
  55110. let childFound = false;
  55111. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  55112. if (this.children_[i2] === component) {
  55113. childFound = true;
  55114. this.children_.splice(i2, 1);
  55115. break;
  55116. }
  55117. }
  55118. if (!childFound) {
  55119. return;
  55120. }
  55121. component.parentComponent_ = null;
  55122. this.childIndex_[component.id()] = null;
  55123. this.childNameIndex_[toTitleCase$1$1(component.name())] = null;
  55124. this.childNameIndex_[toLowerCase$1(component.name())] = null;
  55125. const compEl = component.el();
  55126. if (compEl && compEl.parentNode === this.contentEl()) {
  55127. this.contentEl().removeChild(component.el());
  55128. }
  55129. }
  55130. initChildren() {
  55131. const children = this.options_.children;
  55132. if (children) {
  55133. const parentOptions = this.options_;
  55134. const handleAdd = (child) => {
  55135. const name = child.name;
  55136. let opts = child.opts;
  55137. if (parentOptions[name] !== void 0) {
  55138. opts = parentOptions[name];
  55139. }
  55140. if (opts === false) {
  55141. return;
  55142. }
  55143. if (opts === true) {
  55144. opts = {};
  55145. }
  55146. opts.playerOptions = this.options_.playerOptions;
  55147. const newChild = this.addChild(name, opts);
  55148. if (newChild) {
  55149. this[name] = newChild;
  55150. }
  55151. };
  55152. let workingChildren;
  55153. const Tech2 = Component$1$1.getComponent("Tech");
  55154. if (Array.isArray(children)) {
  55155. workingChildren = children;
  55156. } else {
  55157. workingChildren = Object.keys(children);
  55158. }
  55159. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  55160. return !workingChildren.some(function(wchild) {
  55161. if (typeof wchild === "string") {
  55162. return child === wchild;
  55163. }
  55164. return child === wchild.name;
  55165. });
  55166. })).map((child) => {
  55167. let name;
  55168. let opts;
  55169. if (typeof child === "string") {
  55170. name = child;
  55171. opts = children[name] || this.options_[name] || {};
  55172. } else {
  55173. name = child.name;
  55174. opts = child;
  55175. }
  55176. return {
  55177. name,
  55178. opts
  55179. };
  55180. }).filter((child) => {
  55181. const c = Component$1$1.getComponent(child.opts.componentClass || toTitleCase$1$1(child.name));
  55182. return c && !Tech2.isTech(c);
  55183. }).forEach(handleAdd);
  55184. }
  55185. }
  55186. buildCSSClass() {
  55187. return "";
  55188. }
  55189. ready(fn2, sync = false) {
  55190. if (!fn2) {
  55191. return;
  55192. }
  55193. if (!this.isReady_) {
  55194. this.readyQueue_ = this.readyQueue_ || [];
  55195. this.readyQueue_.push(fn2);
  55196. return;
  55197. }
  55198. if (sync) {
  55199. fn2.call(this);
  55200. } else {
  55201. this.setTimeout(fn2, 1);
  55202. }
  55203. }
  55204. triggerReady() {
  55205. this.isReady_ = true;
  55206. this.setTimeout(function() {
  55207. const readyQueue = this.readyQueue_;
  55208. this.readyQueue_ = [];
  55209. if (readyQueue && readyQueue.length > 0) {
  55210. readyQueue.forEach(function(fn2) {
  55211. fn2.call(this);
  55212. }, this);
  55213. }
  55214. this.trigger("ready");
  55215. }, 1);
  55216. }
  55217. $(selector, context) {
  55218. return $$1(selector, context || this.contentEl());
  55219. }
  55220. $$(selector, context) {
  55221. return $$$1(selector, context || this.contentEl());
  55222. }
  55223. hasClass(classToCheck) {
  55224. return hasClass$1(this.el_, classToCheck);
  55225. }
  55226. addClass(...classesToAdd) {
  55227. addClass$1(this.el_, ...classesToAdd);
  55228. }
  55229. removeClass(...classesToRemove) {
  55230. removeClass$1(this.el_, ...classesToRemove);
  55231. }
  55232. toggleClass(classToToggle, predicate) {
  55233. toggleClass$1(this.el_, classToToggle, predicate);
  55234. }
  55235. show() {
  55236. this.removeClass("vjs-hidden");
  55237. }
  55238. hide() {
  55239. this.addClass("vjs-hidden");
  55240. }
  55241. lockShowing() {
  55242. this.addClass("vjs-lock-showing");
  55243. }
  55244. unlockShowing() {
  55245. this.removeClass("vjs-lock-showing");
  55246. }
  55247. getAttribute(attribute) {
  55248. return getAttribute$1(this.el_, attribute);
  55249. }
  55250. setAttribute(attribute, value) {
  55251. setAttribute$1(this.el_, attribute, value);
  55252. }
  55253. removeAttribute(attribute) {
  55254. removeAttribute$1(this.el_, attribute);
  55255. }
  55256. width(num, skipListeners) {
  55257. return this.dimension("width", num, skipListeners);
  55258. }
  55259. height(num, skipListeners) {
  55260. return this.dimension("height", num, skipListeners);
  55261. }
  55262. dimensions(width2, height2) {
  55263. this.width(width2, true);
  55264. this.height(height2);
  55265. }
  55266. dimension(widthOrHeight, num, skipListeners) {
  55267. if (num !== void 0) {
  55268. if (num === null || num !== num) {
  55269. num = 0;
  55270. }
  55271. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  55272. this.el_.style[widthOrHeight] = num;
  55273. } else if (num === "auto") {
  55274. this.el_.style[widthOrHeight] = "";
  55275. } else {
  55276. this.el_.style[widthOrHeight] = num + "px";
  55277. }
  55278. if (!skipListeners) {
  55279. this.trigger("componentresize");
  55280. }
  55281. return;
  55282. }
  55283. if (!this.el_) {
  55284. return 0;
  55285. }
  55286. const val = this.el_.style[widthOrHeight];
  55287. const pxIndex = val.indexOf("px");
  55288. if (pxIndex !== -1) {
  55289. return parseInt(val.slice(0, pxIndex), 10);
  55290. }
  55291. return parseInt(this.el_["offset" + toTitleCase$1$1(widthOrHeight)], 10);
  55292. }
  55293. currentDimension(widthOrHeight) {
  55294. let computedWidthOrHeight = 0;
  55295. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  55296. throw new Error("currentDimension only accepts width or height value");
  55297. }
  55298. computedWidthOrHeight = computedStyle$1(this.el_, widthOrHeight);
  55299. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  55300. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  55301. const rule = `offset${toTitleCase$1$1(widthOrHeight)}`;
  55302. computedWidthOrHeight = this.el_[rule];
  55303. }
  55304. return computedWidthOrHeight;
  55305. }
  55306. currentDimensions() {
  55307. return {
  55308. width: this.currentDimension("width"),
  55309. height: this.currentDimension("height")
  55310. };
  55311. }
  55312. currentWidth() {
  55313. return this.currentDimension("width");
  55314. }
  55315. currentHeight() {
  55316. return this.currentDimension("height");
  55317. }
  55318. focus() {
  55319. this.el_.focus();
  55320. }
  55321. blur() {
  55322. this.el_.blur();
  55323. }
  55324. handleKeyDown(event2) {
  55325. if (this.player_) {
  55326. if (!keycode.isEventKey(event2, "Tab")) {
  55327. event2.stopPropagation();
  55328. }
  55329. this.player_.handleKeyDown(event2);
  55330. }
  55331. }
  55332. handleKeyPress(event2) {
  55333. this.handleKeyDown(event2);
  55334. }
  55335. emitTapEvents() {
  55336. let touchStart = 0;
  55337. let firstTouch = null;
  55338. const tapMovementThreshold = 10;
  55339. const touchTimeThreshold = 200;
  55340. let couldBeTap;
  55341. this.on("touchstart", function(event2) {
  55342. if (event2.touches.length === 1) {
  55343. firstTouch = {
  55344. pageX: event2.touches[0].pageX,
  55345. pageY: event2.touches[0].pageY
  55346. };
  55347. touchStart = window_1.performance.now();
  55348. couldBeTap = true;
  55349. }
  55350. });
  55351. this.on("touchmove", function(event2) {
  55352. if (event2.touches.length > 1) {
  55353. couldBeTap = false;
  55354. } else if (firstTouch) {
  55355. const xdiff = event2.touches[0].pageX - firstTouch.pageX;
  55356. const ydiff = event2.touches[0].pageY - firstTouch.pageY;
  55357. const touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  55358. if (touchDistance > tapMovementThreshold) {
  55359. couldBeTap = false;
  55360. }
  55361. }
  55362. });
  55363. const noTap = function() {
  55364. couldBeTap = false;
  55365. };
  55366. this.on("touchleave", noTap);
  55367. this.on("touchcancel", noTap);
  55368. this.on("touchend", function(event2) {
  55369. firstTouch = null;
  55370. if (couldBeTap === true) {
  55371. const touchTime = window_1.performance.now() - touchStart;
  55372. if (touchTime < touchTimeThreshold) {
  55373. event2.preventDefault();
  55374. this.trigger("tap");
  55375. }
  55376. }
  55377. });
  55378. }
  55379. enableTouchActivity() {
  55380. if (!this.player() || !this.player().reportUserActivity) {
  55381. return;
  55382. }
  55383. const report = bind_(this.player(), this.player().reportUserActivity);
  55384. let touchHolding;
  55385. this.on("touchstart", function() {
  55386. report();
  55387. this.clearInterval(touchHolding);
  55388. touchHolding = this.setInterval(report, 250);
  55389. });
  55390. const touchEnd = function(event2) {
  55391. report();
  55392. this.clearInterval(touchHolding);
  55393. };
  55394. this.on("touchmove", report);
  55395. this.on("touchend", touchEnd);
  55396. this.on("touchcancel", touchEnd);
  55397. }
  55398. setTimeout(fn2, timeout) {
  55399. var timeoutId;
  55400. fn2 = bind_(this, fn2);
  55401. this.clearTimersOnDispose_();
  55402. timeoutId = window_1.setTimeout(() => {
  55403. if (this.setTimeoutIds_.has(timeoutId)) {
  55404. this.setTimeoutIds_.delete(timeoutId);
  55405. }
  55406. fn2();
  55407. }, timeout);
  55408. this.setTimeoutIds_.add(timeoutId);
  55409. return timeoutId;
  55410. }
  55411. clearTimeout(timeoutId) {
  55412. if (this.setTimeoutIds_.has(timeoutId)) {
  55413. this.setTimeoutIds_.delete(timeoutId);
  55414. window_1.clearTimeout(timeoutId);
  55415. }
  55416. return timeoutId;
  55417. }
  55418. setInterval(fn2, interval) {
  55419. fn2 = bind_(this, fn2);
  55420. this.clearTimersOnDispose_();
  55421. const intervalId = window_1.setInterval(fn2, interval);
  55422. this.setIntervalIds_.add(intervalId);
  55423. return intervalId;
  55424. }
  55425. clearInterval(intervalId) {
  55426. if (this.setIntervalIds_.has(intervalId)) {
  55427. this.setIntervalIds_.delete(intervalId);
  55428. window_1.clearInterval(intervalId);
  55429. }
  55430. return intervalId;
  55431. }
  55432. requestAnimationFrame(fn2) {
  55433. this.clearTimersOnDispose_();
  55434. var id;
  55435. fn2 = bind_(this, fn2);
  55436. id = window_1.requestAnimationFrame(() => {
  55437. if (this.rafIds_.has(id)) {
  55438. this.rafIds_.delete(id);
  55439. }
  55440. fn2();
  55441. });
  55442. this.rafIds_.add(id);
  55443. return id;
  55444. }
  55445. requestNamedAnimationFrame(name, fn2) {
  55446. if (this.namedRafs_.has(name)) {
  55447. return;
  55448. }
  55449. this.clearTimersOnDispose_();
  55450. fn2 = bind_(this, fn2);
  55451. const id = this.requestAnimationFrame(() => {
  55452. fn2();
  55453. if (this.namedRafs_.has(name)) {
  55454. this.namedRafs_.delete(name);
  55455. }
  55456. });
  55457. this.namedRafs_.set(name, id);
  55458. return name;
  55459. }
  55460. cancelNamedAnimationFrame(name) {
  55461. if (!this.namedRafs_.has(name)) {
  55462. return;
  55463. }
  55464. this.cancelAnimationFrame(this.namedRafs_.get(name));
  55465. this.namedRafs_.delete(name);
  55466. }
  55467. cancelAnimationFrame(id) {
  55468. if (this.rafIds_.has(id)) {
  55469. this.rafIds_.delete(id);
  55470. window_1.cancelAnimationFrame(id);
  55471. }
  55472. return id;
  55473. }
  55474. clearTimersOnDispose_() {
  55475. if (this.clearingTimersOnDispose_) {
  55476. return;
  55477. }
  55478. this.clearingTimersOnDispose_ = true;
  55479. this.one("dispose", () => {
  55480. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(([idName, cancelName]) => {
  55481. this[idName].forEach((val, key) => this[cancelName](key));
  55482. });
  55483. this.clearingTimersOnDispose_ = false;
  55484. });
  55485. }
  55486. static registerComponent(name, ComponentToRegister) {
  55487. if (typeof name !== "string" || !name) {
  55488. throw new Error(`Illegal component name, "${name}"; must be a non-empty string.`);
  55489. }
  55490. const Tech2 = Component$1$1.getComponent("Tech");
  55491. const isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  55492. const isComp = Component$1$1 === ComponentToRegister || Component$1$1.prototype.isPrototypeOf(ComponentToRegister.prototype);
  55493. if (isTech || !isComp) {
  55494. let reason;
  55495. if (isTech) {
  55496. reason = "techs must be registered using Tech.registerTech()";
  55497. } else {
  55498. reason = "must be a Component subclass";
  55499. }
  55500. throw new Error(`Illegal component, "${name}"; ${reason}.`);
  55501. }
  55502. name = toTitleCase$1$1(name);
  55503. if (!Component$1$1.components_) {
  55504. Component$1$1.components_ = {};
  55505. }
  55506. const Player2 = Component$1$1.getComponent("Player");
  55507. if (name === "Player" && Player2 && Player2.players) {
  55508. const players = Player2.players;
  55509. const playerNames = Object.keys(players);
  55510. if (players && playerNames.length > 0 && playerNames.map((pname) => players[pname]).every(Boolean)) {
  55511. throw new Error("Can not register Player component after player has been created.");
  55512. }
  55513. }
  55514. Component$1$1.components_[name] = ComponentToRegister;
  55515. Component$1$1.components_[toLowerCase$1(name)] = ComponentToRegister;
  55516. return ComponentToRegister;
  55517. }
  55518. static getComponent(name) {
  55519. if (!name || !Component$1$1.components_) {
  55520. return;
  55521. }
  55522. return Component$1$1.components_[name];
  55523. }
  55524. }
  55525. Component$1$1.registerComponent("Component", Component$1$1);
  55526. function rangeCheck$1(fnName, index2, maxIndex) {
  55527. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  55528. throw new Error(`Failed to execute '${fnName}' on 'TimeRanges': The index provided (${index2}) is non-numeric or out of bounds (0-${maxIndex}).`);
  55529. }
  55530. }
  55531. function getRange$1(fnName, valueIndex, ranges, rangeIndex) {
  55532. rangeCheck$1(fnName, rangeIndex, ranges.length - 1);
  55533. return ranges[rangeIndex][valueIndex];
  55534. }
  55535. function createTimeRangesObj$1(ranges) {
  55536. let timeRangesObj;
  55537. if (ranges === void 0 || ranges.length === 0) {
  55538. timeRangesObj = {
  55539. length: 0,
  55540. start() {
  55541. throw new Error("This TimeRanges object is empty");
  55542. },
  55543. end() {
  55544. throw new Error("This TimeRanges object is empty");
  55545. }
  55546. };
  55547. } else {
  55548. timeRangesObj = {
  55549. length: ranges.length,
  55550. start: getRange$1.bind(null, "start", 0, ranges),
  55551. end: getRange$1.bind(null, "end", 1, ranges)
  55552. };
  55553. }
  55554. if (window_1.Symbol && window_1.Symbol.iterator) {
  55555. timeRangesObj[window_1.Symbol.iterator] = () => (ranges || []).values();
  55556. }
  55557. return timeRangesObj;
  55558. }
  55559. function createTimeRanges$1(start2, end) {
  55560. if (Array.isArray(start2)) {
  55561. return createTimeRangesObj$1(start2);
  55562. } else if (start2 === void 0 || end === void 0) {
  55563. return createTimeRangesObj$1();
  55564. }
  55565. return createTimeRangesObj$1([[start2, end]]);
  55566. }
  55567. const defaultImplementation$1 = function(seconds, guide) {
  55568. seconds = seconds < 0 ? 0 : seconds;
  55569. let s = Math.floor(seconds % 60);
  55570. let m = Math.floor(seconds / 60 % 60);
  55571. let h2 = Math.floor(seconds / 3600);
  55572. const gm = Math.floor(guide / 60 % 60);
  55573. const gh = Math.floor(guide / 3600);
  55574. if (isNaN(seconds) || seconds === Infinity) {
  55575. h2 = m = s = "-";
  55576. }
  55577. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  55578. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  55579. s = s < 10 ? "0" + s : s;
  55580. return h2 + m + s;
  55581. };
  55582. let implementation$1 = defaultImplementation$1;
  55583. function setFormatTime$1(customImplementation) {
  55584. implementation$1 = customImplementation;
  55585. }
  55586. function resetFormatTime$1() {
  55587. implementation$1 = defaultImplementation$1;
  55588. }
  55589. function formatTime$1(seconds, guide = seconds) {
  55590. return implementation$1(seconds, guide);
  55591. }
  55592. var Time = /* @__PURE__ */ Object.freeze({
  55593. __proto__: null,
  55594. createTimeRanges: createTimeRanges$1,
  55595. createTimeRange: createTimeRanges$1,
  55596. setFormatTime: setFormatTime$1,
  55597. resetFormatTime: resetFormatTime$1,
  55598. formatTime: formatTime$1
  55599. });
  55600. function bufferedPercent$1(buffered, duration5) {
  55601. let bufferedDuration = 0;
  55602. let start2;
  55603. let end;
  55604. if (!duration5) {
  55605. return 0;
  55606. }
  55607. if (!buffered || !buffered.length) {
  55608. buffered = createTimeRanges$1(0, 0);
  55609. }
  55610. for (let i2 = 0; i2 < buffered.length; i2++) {
  55611. start2 = buffered.start(i2);
  55612. end = buffered.end(i2);
  55613. if (end > duration5) {
  55614. end = duration5;
  55615. }
  55616. bufferedDuration += end - start2;
  55617. }
  55618. return bufferedDuration / duration5;
  55619. }
  55620. function MediaError$1(value) {
  55621. if (value instanceof MediaError$1) {
  55622. return value;
  55623. }
  55624. if (typeof value === "number") {
  55625. this.code = value;
  55626. } else if (typeof value === "string") {
  55627. this.message = value;
  55628. } else if (isObject$2(value)) {
  55629. if (typeof value.code === "number") {
  55630. this.code = value.code;
  55631. }
  55632. Object.assign(this, value);
  55633. }
  55634. if (!this.message) {
  55635. this.message = MediaError$1.defaultMessages[this.code] || "";
  55636. }
  55637. }
  55638. MediaError$1.prototype.code = 0;
  55639. MediaError$1.prototype.message = "";
  55640. MediaError$1.prototype.status = null;
  55641. MediaError$1.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  55642. MediaError$1.defaultMessages = {
  55643. 1: "You aborted the media playback",
  55644. 2: "A network error caused the media download to fail part-way.",
  55645. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  55646. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  55647. 5: "The media is encrypted and we do not have the keys to decrypt it."
  55648. };
  55649. for (let errNum = 0; errNum < MediaError$1.errorTypes.length; errNum++) {
  55650. MediaError$1[MediaError$1.errorTypes[errNum]] = errNum;
  55651. MediaError$1.prototype[MediaError$1.errorTypes[errNum]] = errNum;
  55652. }
  55653. function isPromise$1(value) {
  55654. return value !== void 0 && value !== null && typeof value.then === "function";
  55655. }
  55656. function silencePromise$1(value) {
  55657. if (isPromise$1(value)) {
  55658. value.then(null, (e) => {
  55659. });
  55660. }
  55661. }
  55662. const trackToJson_$1 = function(track) {
  55663. const ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce((acc, prop, i2) => {
  55664. if (track[prop]) {
  55665. acc[prop] = track[prop];
  55666. }
  55667. return acc;
  55668. }, {
  55669. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  55670. return {
  55671. startTime: cue.startTime,
  55672. endTime: cue.endTime,
  55673. text: cue.text,
  55674. id: cue.id
  55675. };
  55676. })
  55677. });
  55678. return ret;
  55679. };
  55680. const textTracksToJson$1 = function(tech) {
  55681. const trackEls = tech.$$("track");
  55682. const trackObjs = Array.prototype.map.call(trackEls, (t2) => t2.track);
  55683. const tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  55684. const json = trackToJson_$1(trackEl.track);
  55685. if (trackEl.src) {
  55686. json.src = trackEl.src;
  55687. }
  55688. return json;
  55689. });
  55690. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  55691. return trackObjs.indexOf(track) === -1;
  55692. }).map(trackToJson_$1));
  55693. };
  55694. const jsonToTextTracks$1 = function(json, tech) {
  55695. json.forEach(function(track) {
  55696. const addedTrack = tech.addRemoteTextTrack(track).track;
  55697. if (!track.src && track.cues) {
  55698. track.cues.forEach((cue) => addedTrack.addCue(cue));
  55699. }
  55700. });
  55701. return tech.textTracks();
  55702. };
  55703. var textTrackConverter$1 = {
  55704. textTracksToJson: textTracksToJson$1,
  55705. jsonToTextTracks: jsonToTextTracks$1,
  55706. trackToJson_: trackToJson_$1
  55707. };
  55708. const MODAL_CLASS_NAME$1 = "vjs-modal-dialog";
  55709. class ModalDialog$1 extends Component$1$1 {
  55710. constructor(player, options2) {
  55711. super(player, options2);
  55712. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  55713. this.close_ = (e) => this.close(e);
  55714. this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = false;
  55715. this.closeable(!this.options_.uncloseable);
  55716. this.content(this.options_.content);
  55717. this.contentEl_ = createEl$1("div", {
  55718. className: `${MODAL_CLASS_NAME$1}-content`
  55719. }, {
  55720. role: "document"
  55721. });
  55722. this.descEl_ = createEl$1("p", {
  55723. className: `${MODAL_CLASS_NAME$1}-description vjs-control-text`,
  55724. id: this.el().getAttribute("aria-describedby")
  55725. });
  55726. textContent$1(this.descEl_, this.description());
  55727. this.el_.appendChild(this.descEl_);
  55728. this.el_.appendChild(this.contentEl_);
  55729. }
  55730. createEl() {
  55731. return super.createEl("div", {
  55732. className: this.buildCSSClass(),
  55733. tabIndex: -1
  55734. }, {
  55735. "aria-describedby": `${this.id()}_description`,
  55736. "aria-hidden": "true",
  55737. "aria-label": this.label(),
  55738. "role": "dialog"
  55739. });
  55740. }
  55741. dispose() {
  55742. this.contentEl_ = null;
  55743. this.descEl_ = null;
  55744. this.previouslyActiveEl_ = null;
  55745. super.dispose();
  55746. }
  55747. buildCSSClass() {
  55748. return `${MODAL_CLASS_NAME$1} vjs-hidden ${super.buildCSSClass()}`;
  55749. }
  55750. label() {
  55751. return this.localize(this.options_.label || "Modal Window");
  55752. }
  55753. description() {
  55754. let desc = this.options_.description || this.localize("This is a modal window.");
  55755. if (this.closeable()) {
  55756. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  55757. }
  55758. return desc;
  55759. }
  55760. open() {
  55761. if (!this.opened_) {
  55762. const player = this.player();
  55763. this.trigger("beforemodalopen");
  55764. this.opened_ = true;
  55765. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  55766. this.fill();
  55767. }
  55768. this.wasPlaying_ = !player.paused();
  55769. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  55770. player.pause();
  55771. }
  55772. this.on("keydown", this.handleKeyDown_);
  55773. this.hadControls_ = player.controls();
  55774. player.controls(false);
  55775. this.show();
  55776. this.conditionalFocus_();
  55777. this.el().setAttribute("aria-hidden", "false");
  55778. this.trigger("modalopen");
  55779. this.hasBeenOpened_ = true;
  55780. }
  55781. }
  55782. opened(value) {
  55783. if (typeof value === "boolean") {
  55784. this[value ? "open" : "close"]();
  55785. }
  55786. return this.opened_;
  55787. }
  55788. close() {
  55789. if (!this.opened_) {
  55790. return;
  55791. }
  55792. const player = this.player();
  55793. this.trigger("beforemodalclose");
  55794. this.opened_ = false;
  55795. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  55796. player.play();
  55797. }
  55798. this.off("keydown", this.handleKeyDown_);
  55799. if (this.hadControls_) {
  55800. player.controls(true);
  55801. }
  55802. this.hide();
  55803. this.el().setAttribute("aria-hidden", "true");
  55804. this.trigger("modalclose");
  55805. this.conditionalBlur_();
  55806. if (this.options_.temporary) {
  55807. this.dispose();
  55808. }
  55809. }
  55810. closeable(value) {
  55811. if (typeof value === "boolean") {
  55812. const closeable = this.closeable_ = !!value;
  55813. let close = this.getChild("closeButton");
  55814. if (closeable && !close) {
  55815. const temp = this.contentEl_;
  55816. this.contentEl_ = this.el_;
  55817. close = this.addChild("closeButton", {
  55818. controlText: "Close Modal Dialog"
  55819. });
  55820. this.contentEl_ = temp;
  55821. this.on(close, "close", this.close_);
  55822. }
  55823. if (!closeable && close) {
  55824. this.off(close, "close", this.close_);
  55825. this.removeChild(close);
  55826. close.dispose();
  55827. }
  55828. }
  55829. return this.closeable_;
  55830. }
  55831. fill() {
  55832. this.fillWith(this.content());
  55833. }
  55834. fillWith(content) {
  55835. const contentEl = this.contentEl();
  55836. const parentEl = contentEl.parentNode;
  55837. const nextSiblingEl = contentEl.nextSibling;
  55838. this.trigger("beforemodalfill");
  55839. this.hasBeenFilled_ = true;
  55840. parentEl.removeChild(contentEl);
  55841. this.empty();
  55842. insertContent$1(contentEl, content);
  55843. this.trigger("modalfill");
  55844. if (nextSiblingEl) {
  55845. parentEl.insertBefore(contentEl, nextSiblingEl);
  55846. } else {
  55847. parentEl.appendChild(contentEl);
  55848. }
  55849. const closeButton = this.getChild("closeButton");
  55850. if (closeButton) {
  55851. parentEl.appendChild(closeButton.el_);
  55852. }
  55853. }
  55854. empty() {
  55855. this.trigger("beforemodalempty");
  55856. emptyEl$1(this.contentEl());
  55857. this.trigger("modalempty");
  55858. }
  55859. content(value) {
  55860. if (typeof value !== "undefined") {
  55861. this.content_ = value;
  55862. }
  55863. return this.content_;
  55864. }
  55865. conditionalFocus_() {
  55866. const activeEl = document_1.activeElement;
  55867. const playerEl = this.player_.el_;
  55868. this.previouslyActiveEl_ = null;
  55869. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  55870. this.previouslyActiveEl_ = activeEl;
  55871. this.focus();
  55872. }
  55873. }
  55874. conditionalBlur_() {
  55875. if (this.previouslyActiveEl_) {
  55876. this.previouslyActiveEl_.focus();
  55877. this.previouslyActiveEl_ = null;
  55878. }
  55879. }
  55880. handleKeyDown(event2) {
  55881. event2.stopPropagation();
  55882. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  55883. event2.preventDefault();
  55884. this.close();
  55885. return;
  55886. }
  55887. if (!keycode.isEventKey(event2, "Tab")) {
  55888. return;
  55889. }
  55890. const focusableEls = this.focusableEls_();
  55891. const activeEl = this.el_.querySelector(":focus");
  55892. let focusIndex;
  55893. for (let i2 = 0; i2 < focusableEls.length; i2++) {
  55894. if (activeEl === focusableEls[i2]) {
  55895. focusIndex = i2;
  55896. break;
  55897. }
  55898. }
  55899. if (document_1.activeElement === this.el_) {
  55900. focusIndex = 0;
  55901. }
  55902. if (event2.shiftKey && focusIndex === 0) {
  55903. focusableEls[focusableEls.length - 1].focus();
  55904. event2.preventDefault();
  55905. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  55906. focusableEls[0].focus();
  55907. event2.preventDefault();
  55908. }
  55909. }
  55910. focusableEls_() {
  55911. const allChildren = this.el_.querySelectorAll("*");
  55912. return Array.prototype.filter.call(allChildren, (child) => {
  55913. 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");
  55914. });
  55915. }
  55916. }
  55917. ModalDialog$1.prototype.options_ = {
  55918. pauseOnOpen: true,
  55919. temporary: true
  55920. };
  55921. Component$1$1.registerComponent("ModalDialog", ModalDialog$1);
  55922. class TrackList$1 extends EventTarget$2$1 {
  55923. constructor(tracks = []) {
  55924. super();
  55925. this.tracks_ = [];
  55926. Object.defineProperty(this, "length", {
  55927. get() {
  55928. return this.tracks_.length;
  55929. }
  55930. });
  55931. for (let i2 = 0; i2 < tracks.length; i2++) {
  55932. this.addTrack(tracks[i2]);
  55933. }
  55934. }
  55935. addTrack(track) {
  55936. const index2 = this.tracks_.length;
  55937. if (!("" + index2 in this)) {
  55938. Object.defineProperty(this, index2, {
  55939. get() {
  55940. return this.tracks_[index2];
  55941. }
  55942. });
  55943. }
  55944. if (this.tracks_.indexOf(track) === -1) {
  55945. this.tracks_.push(track);
  55946. this.trigger({
  55947. track,
  55948. type: "addtrack",
  55949. target: this
  55950. });
  55951. }
  55952. track.labelchange_ = () => {
  55953. this.trigger({
  55954. track,
  55955. type: "labelchange",
  55956. target: this
  55957. });
  55958. };
  55959. if (isEvented$1(track)) {
  55960. track.addEventListener("labelchange", track.labelchange_);
  55961. }
  55962. }
  55963. removeTrack(rtrack) {
  55964. let track;
  55965. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  55966. if (this[i2] === rtrack) {
  55967. track = this[i2];
  55968. if (track.off) {
  55969. track.off();
  55970. }
  55971. this.tracks_.splice(i2, 1);
  55972. break;
  55973. }
  55974. }
  55975. if (!track) {
  55976. return;
  55977. }
  55978. this.trigger({
  55979. track,
  55980. type: "removetrack",
  55981. target: this
  55982. });
  55983. }
  55984. getTrackById(id) {
  55985. let result = null;
  55986. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  55987. const track = this[i2];
  55988. if (track.id === id) {
  55989. result = track;
  55990. break;
  55991. }
  55992. }
  55993. return result;
  55994. }
  55995. }
  55996. TrackList$1.prototype.allowedEvents_ = {
  55997. change: "change",
  55998. addtrack: "addtrack",
  55999. removetrack: "removetrack",
  56000. labelchange: "labelchange"
  56001. };
  56002. for (const event2 in TrackList$1.prototype.allowedEvents_) {
  56003. TrackList$1.prototype["on" + event2] = null;
  56004. }
  56005. const disableOthers$1$1 = function(list, track) {
  56006. for (let i2 = 0; i2 < list.length; i2++) {
  56007. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  56008. continue;
  56009. }
  56010. list[i2].enabled = false;
  56011. }
  56012. };
  56013. class AudioTrackList$1 extends TrackList$1 {
  56014. constructor(tracks = []) {
  56015. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  56016. if (tracks[i2].enabled) {
  56017. disableOthers$1$1(tracks, tracks[i2]);
  56018. break;
  56019. }
  56020. }
  56021. super(tracks);
  56022. this.changing_ = false;
  56023. }
  56024. addTrack(track) {
  56025. if (track.enabled) {
  56026. disableOthers$1$1(this, track);
  56027. }
  56028. super.addTrack(track);
  56029. if (!track.addEventListener) {
  56030. return;
  56031. }
  56032. track.enabledChange_ = () => {
  56033. if (this.changing_) {
  56034. return;
  56035. }
  56036. this.changing_ = true;
  56037. disableOthers$1$1(this, track);
  56038. this.changing_ = false;
  56039. this.trigger("change");
  56040. };
  56041. track.addEventListener("enabledchange", track.enabledChange_);
  56042. }
  56043. removeTrack(rtrack) {
  56044. super.removeTrack(rtrack);
  56045. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  56046. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  56047. rtrack.enabledChange_ = null;
  56048. }
  56049. }
  56050. }
  56051. const disableOthers$2 = function(list, track) {
  56052. for (let i2 = 0; i2 < list.length; i2++) {
  56053. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  56054. continue;
  56055. }
  56056. list[i2].selected = false;
  56057. }
  56058. };
  56059. class VideoTrackList$1 extends TrackList$1 {
  56060. constructor(tracks = []) {
  56061. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  56062. if (tracks[i2].selected) {
  56063. disableOthers$2(tracks, tracks[i2]);
  56064. break;
  56065. }
  56066. }
  56067. super(tracks);
  56068. this.changing_ = false;
  56069. Object.defineProperty(this, "selectedIndex", {
  56070. get() {
  56071. for (let i2 = 0; i2 < this.length; i2++) {
  56072. if (this[i2].selected) {
  56073. return i2;
  56074. }
  56075. }
  56076. return -1;
  56077. },
  56078. set() {
  56079. }
  56080. });
  56081. }
  56082. addTrack(track) {
  56083. if (track.selected) {
  56084. disableOthers$2(this, track);
  56085. }
  56086. super.addTrack(track);
  56087. if (!track.addEventListener) {
  56088. return;
  56089. }
  56090. track.selectedChange_ = () => {
  56091. if (this.changing_) {
  56092. return;
  56093. }
  56094. this.changing_ = true;
  56095. disableOthers$2(this, track);
  56096. this.changing_ = false;
  56097. this.trigger("change");
  56098. };
  56099. track.addEventListener("selectedchange", track.selectedChange_);
  56100. }
  56101. removeTrack(rtrack) {
  56102. super.removeTrack(rtrack);
  56103. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  56104. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  56105. rtrack.selectedChange_ = null;
  56106. }
  56107. }
  56108. }
  56109. class TextTrackList$1 extends TrackList$1 {
  56110. addTrack(track) {
  56111. super.addTrack(track);
  56112. if (!this.queueChange_) {
  56113. this.queueChange_ = () => this.queueTrigger("change");
  56114. }
  56115. if (!this.triggerSelectedlanguagechange) {
  56116. this.triggerSelectedlanguagechange_ = () => this.trigger("selectedlanguagechange");
  56117. }
  56118. track.addEventListener("modechange", this.queueChange_);
  56119. const nonLanguageTextTrackKind = ["metadata", "chapters"];
  56120. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  56121. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  56122. }
  56123. }
  56124. removeTrack(rtrack) {
  56125. super.removeTrack(rtrack);
  56126. if (rtrack.removeEventListener) {
  56127. if (this.queueChange_) {
  56128. rtrack.removeEventListener("modechange", this.queueChange_);
  56129. }
  56130. if (this.selectedlanguagechange_) {
  56131. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  56132. }
  56133. }
  56134. }
  56135. }
  56136. class HtmlTrackElementList$1 {
  56137. constructor(trackElements = []) {
  56138. this.trackElements_ = [];
  56139. Object.defineProperty(this, "length", {
  56140. get() {
  56141. return this.trackElements_.length;
  56142. }
  56143. });
  56144. for (let i2 = 0, length = trackElements.length; i2 < length; i2++) {
  56145. this.addTrackElement_(trackElements[i2]);
  56146. }
  56147. }
  56148. addTrackElement_(trackElement) {
  56149. const index2 = this.trackElements_.length;
  56150. if (!("" + index2 in this)) {
  56151. Object.defineProperty(this, index2, {
  56152. get() {
  56153. return this.trackElements_[index2];
  56154. }
  56155. });
  56156. }
  56157. if (this.trackElements_.indexOf(trackElement) === -1) {
  56158. this.trackElements_.push(trackElement);
  56159. }
  56160. }
  56161. getTrackElementByTrack_(track) {
  56162. let trackElement_;
  56163. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56164. if (track === this.trackElements_[i2].track) {
  56165. trackElement_ = this.trackElements_[i2];
  56166. break;
  56167. }
  56168. }
  56169. return trackElement_;
  56170. }
  56171. removeTrackElement_(trackElement) {
  56172. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56173. if (trackElement === this.trackElements_[i2]) {
  56174. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  56175. this.trackElements_[i2].track.off();
  56176. }
  56177. if (typeof this.trackElements_[i2].off === "function") {
  56178. this.trackElements_[i2].off();
  56179. }
  56180. this.trackElements_.splice(i2, 1);
  56181. break;
  56182. }
  56183. }
  56184. }
  56185. }
  56186. class TextTrackCueList$1 {
  56187. constructor(cues) {
  56188. TextTrackCueList$1.prototype.setCues_.call(this, cues);
  56189. Object.defineProperty(this, "length", {
  56190. get() {
  56191. return this.length_;
  56192. }
  56193. });
  56194. }
  56195. setCues_(cues) {
  56196. const oldLength = this.length || 0;
  56197. let i2 = 0;
  56198. const l = cues.length;
  56199. this.cues_ = cues;
  56200. this.length_ = cues.length;
  56201. const defineProp = function(index2) {
  56202. if (!("" + index2 in this)) {
  56203. Object.defineProperty(this, "" + index2, {
  56204. get() {
  56205. return this.cues_[index2];
  56206. }
  56207. });
  56208. }
  56209. };
  56210. if (oldLength < l) {
  56211. i2 = oldLength;
  56212. for (; i2 < l; i2++) {
  56213. defineProp.call(this, i2);
  56214. }
  56215. }
  56216. }
  56217. getCueById(id) {
  56218. let result = null;
  56219. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  56220. const cue = this[i2];
  56221. if (cue.id === id) {
  56222. result = cue;
  56223. break;
  56224. }
  56225. }
  56226. return result;
  56227. }
  56228. }
  56229. const VideoTrackKind$1 = {
  56230. alternative: "alternative",
  56231. captions: "captions",
  56232. main: "main",
  56233. sign: "sign",
  56234. subtitles: "subtitles",
  56235. commentary: "commentary"
  56236. };
  56237. const AudioTrackKind$1 = {
  56238. "alternative": "alternative",
  56239. "descriptions": "descriptions",
  56240. "main": "main",
  56241. "main-desc": "main-desc",
  56242. "translation": "translation",
  56243. "commentary": "commentary"
  56244. };
  56245. const TextTrackKind$1 = {
  56246. subtitles: "subtitles",
  56247. captions: "captions",
  56248. descriptions: "descriptions",
  56249. chapters: "chapters",
  56250. metadata: "metadata"
  56251. };
  56252. const TextTrackMode$1 = {
  56253. disabled: "disabled",
  56254. hidden: "hidden",
  56255. showing: "showing"
  56256. };
  56257. class Track$1 extends EventTarget$2$1 {
  56258. constructor(options2 = {}) {
  56259. super();
  56260. const trackProps = {
  56261. id: options2.id || "vjs_track_" + newGUID$1(),
  56262. kind: options2.kind || "",
  56263. language: options2.language || ""
  56264. };
  56265. let label2 = options2.label || "";
  56266. for (const key in trackProps) {
  56267. Object.defineProperty(this, key, {
  56268. get() {
  56269. return trackProps[key];
  56270. },
  56271. set() {
  56272. }
  56273. });
  56274. }
  56275. Object.defineProperty(this, "label", {
  56276. get() {
  56277. return label2;
  56278. },
  56279. set(newLabel) {
  56280. if (newLabel !== label2) {
  56281. label2 = newLabel;
  56282. this.trigger("labelchange");
  56283. }
  56284. }
  56285. });
  56286. }
  56287. }
  56288. const parseUrl$1 = function(url) {
  56289. const props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  56290. const a = document_1.createElement("a");
  56291. a.href = url;
  56292. const details = {};
  56293. for (let i2 = 0; i2 < props.length; i2++) {
  56294. details[props[i2]] = a[props[i2]];
  56295. }
  56296. if (details.protocol === "http:") {
  56297. details.host = details.host.replace(/:80$/, "");
  56298. }
  56299. if (details.protocol === "https:") {
  56300. details.host = details.host.replace(/:443$/, "");
  56301. }
  56302. if (!details.protocol) {
  56303. details.protocol = window_1.location.protocol;
  56304. }
  56305. if (!details.host) {
  56306. details.host = window_1.location.host;
  56307. }
  56308. return details;
  56309. };
  56310. const getAbsoluteURL$1 = function(url) {
  56311. if (!url.match(/^https?:\/\//)) {
  56312. const a = document_1.createElement("a");
  56313. a.href = url;
  56314. url = a.href;
  56315. }
  56316. return url;
  56317. };
  56318. const getFileExtension$1 = function(path) {
  56319. if (typeof path === "string") {
  56320. const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  56321. const pathParts = splitPathRe.exec(path);
  56322. if (pathParts) {
  56323. return pathParts.pop().toLowerCase();
  56324. }
  56325. }
  56326. return "";
  56327. };
  56328. const isCrossOrigin$1 = function(url, winLoc = window_1.location) {
  56329. const urlInfo = parseUrl$1(url);
  56330. const srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  56331. const crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  56332. return crossOrigin;
  56333. };
  56334. var Url$2 = /* @__PURE__ */ Object.freeze({
  56335. __proto__: null,
  56336. parseUrl: parseUrl$1,
  56337. getAbsoluteURL: getAbsoluteURL$1,
  56338. getFileExtension: getFileExtension$1,
  56339. isCrossOrigin: isCrossOrigin$1
  56340. });
  56341. const parseCues$1 = function(srcContent, track) {
  56342. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  56343. const errors2 = [];
  56344. parser2.oncue = function(cue) {
  56345. track.addCue(cue);
  56346. };
  56347. parser2.onparsingerror = function(error) {
  56348. errors2.push(error);
  56349. };
  56350. parser2.onflush = function() {
  56351. track.trigger({
  56352. type: "loadeddata",
  56353. target: track
  56354. });
  56355. };
  56356. parser2.parse(srcContent);
  56357. if (errors2.length > 0) {
  56358. if (window_1.console && window_1.console.groupCollapsed) {
  56359. window_1.console.groupCollapsed(`Text Track parsing errors for ${track.src}`);
  56360. }
  56361. errors2.forEach((error) => log$1$1.error(error));
  56362. if (window_1.console && window_1.console.groupEnd) {
  56363. window_1.console.groupEnd();
  56364. }
  56365. }
  56366. parser2.flush();
  56367. };
  56368. const loadTrack$1 = function(src, track) {
  56369. const opts = {
  56370. uri: src
  56371. };
  56372. const crossOrigin = isCrossOrigin$1(src);
  56373. if (crossOrigin) {
  56374. opts.cors = crossOrigin;
  56375. }
  56376. const withCredentials = track.tech_.crossOrigin() === "use-credentials";
  56377. if (withCredentials) {
  56378. opts.withCredentials = withCredentials;
  56379. }
  56380. XHR(opts, bind_(this, function(err, response, responseBody) {
  56381. if (err) {
  56382. return log$1$1.error(err, response);
  56383. }
  56384. track.loaded_ = true;
  56385. if (typeof window_1.WebVTT !== "function") {
  56386. if (track.tech_) {
  56387. track.tech_.any(["vttjsloaded", "vttjserror"], (event2) => {
  56388. if (event2.type === "vttjserror") {
  56389. log$1$1.error(`vttjs failed to load, stopping trying to process ${track.src}`);
  56390. return;
  56391. }
  56392. return parseCues$1(responseBody, track);
  56393. });
  56394. }
  56395. } else {
  56396. parseCues$1(responseBody, track);
  56397. }
  56398. }));
  56399. };
  56400. class TextTrack$1 extends Track$1 {
  56401. constructor(options2 = {}) {
  56402. if (!options2.tech) {
  56403. throw new Error("A tech was not provided.");
  56404. }
  56405. const settings = merge$1(options2, {
  56406. kind: TextTrackKind$1[options2.kind] || "subtitles",
  56407. language: options2.language || options2.srclang || ""
  56408. });
  56409. let mode = TextTrackMode$1[settings.mode] || "disabled";
  56410. const default_ = settings.default;
  56411. if (settings.kind === "metadata" || settings.kind === "chapters") {
  56412. mode = "hidden";
  56413. }
  56414. super(settings);
  56415. this.tech_ = settings.tech;
  56416. this.cues_ = [];
  56417. this.activeCues_ = [];
  56418. this.preload_ = this.tech_.preloadTextTracks !== false;
  56419. const cues = new TextTrackCueList$1(this.cues_);
  56420. const activeCues = new TextTrackCueList$1(this.activeCues_);
  56421. let changed = false;
  56422. this.timeupdateHandler = bind_(this, function(event2 = {}) {
  56423. if (this.tech_.isDisposed()) {
  56424. return;
  56425. }
  56426. if (!this.tech_.isReady_) {
  56427. if (event2.type !== "timeupdate") {
  56428. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56429. }
  56430. return;
  56431. }
  56432. this.activeCues = this.activeCues;
  56433. if (changed) {
  56434. this.trigger("cuechange");
  56435. changed = false;
  56436. }
  56437. if (event2.type !== "timeupdate") {
  56438. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56439. }
  56440. });
  56441. const disposeHandler = () => {
  56442. this.stopTracking();
  56443. };
  56444. this.tech_.one("dispose", disposeHandler);
  56445. if (mode !== "disabled") {
  56446. this.startTracking();
  56447. }
  56448. Object.defineProperties(this, {
  56449. default: {
  56450. get() {
  56451. return default_;
  56452. },
  56453. set() {
  56454. }
  56455. },
  56456. mode: {
  56457. get() {
  56458. return mode;
  56459. },
  56460. set(newMode) {
  56461. if (!TextTrackMode$1[newMode]) {
  56462. return;
  56463. }
  56464. if (mode === newMode) {
  56465. return;
  56466. }
  56467. mode = newMode;
  56468. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  56469. loadTrack$1(this.src, this);
  56470. }
  56471. this.stopTracking();
  56472. if (mode !== "disabled") {
  56473. this.startTracking();
  56474. }
  56475. this.trigger("modechange");
  56476. }
  56477. },
  56478. cues: {
  56479. get() {
  56480. if (!this.loaded_) {
  56481. return null;
  56482. }
  56483. return cues;
  56484. },
  56485. set() {
  56486. }
  56487. },
  56488. activeCues: {
  56489. get() {
  56490. if (!this.loaded_) {
  56491. return null;
  56492. }
  56493. if (this.cues.length === 0) {
  56494. return activeCues;
  56495. }
  56496. const ct2 = this.tech_.currentTime();
  56497. const active = [];
  56498. for (let i2 = 0, l = this.cues.length; i2 < l; i2++) {
  56499. const cue = this.cues[i2];
  56500. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  56501. active.push(cue);
  56502. }
  56503. }
  56504. changed = false;
  56505. if (active.length !== this.activeCues_.length) {
  56506. changed = true;
  56507. } else {
  56508. for (let i2 = 0; i2 < active.length; i2++) {
  56509. if (this.activeCues_.indexOf(active[i2]) === -1) {
  56510. changed = true;
  56511. }
  56512. }
  56513. }
  56514. this.activeCues_ = active;
  56515. activeCues.setCues_(this.activeCues_);
  56516. return activeCues;
  56517. },
  56518. set() {
  56519. }
  56520. }
  56521. });
  56522. if (settings.src) {
  56523. this.src = settings.src;
  56524. if (!this.preload_) {
  56525. this.loaded_ = true;
  56526. }
  56527. if (this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  56528. loadTrack$1(this.src, this);
  56529. }
  56530. } else {
  56531. this.loaded_ = true;
  56532. }
  56533. }
  56534. startTracking() {
  56535. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56536. this.tech_.on("timeupdate", this.timeupdateHandler);
  56537. }
  56538. stopTracking() {
  56539. if (this.rvf_) {
  56540. this.tech_.cancelVideoFrameCallback(this.rvf_);
  56541. this.rvf_ = void 0;
  56542. }
  56543. this.tech_.off("timeupdate", this.timeupdateHandler);
  56544. }
  56545. addCue(originalCue) {
  56546. let cue = originalCue;
  56547. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  56548. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  56549. for (const prop in originalCue) {
  56550. if (!(prop in cue)) {
  56551. cue[prop] = originalCue[prop];
  56552. }
  56553. }
  56554. cue.id = originalCue.id;
  56555. cue.originalCue_ = originalCue;
  56556. }
  56557. const tracks = this.tech_.textTracks();
  56558. for (let i2 = 0; i2 < tracks.length; i2++) {
  56559. if (tracks[i2] !== this) {
  56560. tracks[i2].removeCue(cue);
  56561. }
  56562. }
  56563. this.cues_.push(cue);
  56564. this.cues.setCues_(this.cues_);
  56565. }
  56566. removeCue(removeCue) {
  56567. let i2 = this.cues_.length;
  56568. while (i2--) {
  56569. const cue = this.cues_[i2];
  56570. if (cue === removeCue || cue.originalCue_ && cue.originalCue_ === removeCue) {
  56571. this.cues_.splice(i2, 1);
  56572. this.cues.setCues_(this.cues_);
  56573. break;
  56574. }
  56575. }
  56576. }
  56577. }
  56578. TextTrack$1.prototype.allowedEvents_ = {
  56579. cuechange: "cuechange"
  56580. };
  56581. class AudioTrack$1 extends Track$1 {
  56582. constructor(options2 = {}) {
  56583. const settings = merge$1(options2, {
  56584. kind: AudioTrackKind$1[options2.kind] || ""
  56585. });
  56586. super(settings);
  56587. let enabled = false;
  56588. Object.defineProperty(this, "enabled", {
  56589. get() {
  56590. return enabled;
  56591. },
  56592. set(newEnabled) {
  56593. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  56594. return;
  56595. }
  56596. enabled = newEnabled;
  56597. this.trigger("enabledchange");
  56598. }
  56599. });
  56600. if (settings.enabled) {
  56601. this.enabled = settings.enabled;
  56602. }
  56603. this.loaded_ = true;
  56604. }
  56605. }
  56606. class VideoTrack$1 extends Track$1 {
  56607. constructor(options2 = {}) {
  56608. const settings = merge$1(options2, {
  56609. kind: VideoTrackKind$1[options2.kind] || ""
  56610. });
  56611. super(settings);
  56612. let selected = false;
  56613. Object.defineProperty(this, "selected", {
  56614. get() {
  56615. return selected;
  56616. },
  56617. set(newSelected) {
  56618. if (typeof newSelected !== "boolean" || newSelected === selected) {
  56619. return;
  56620. }
  56621. selected = newSelected;
  56622. this.trigger("selectedchange");
  56623. }
  56624. });
  56625. if (settings.selected) {
  56626. this.selected = settings.selected;
  56627. }
  56628. }
  56629. }
  56630. class HTMLTrackElement$1 extends EventTarget$2$1 {
  56631. constructor(options2 = {}) {
  56632. super();
  56633. let readyState;
  56634. const track = new TextTrack$1(options2);
  56635. this.kind = track.kind;
  56636. this.src = track.src;
  56637. this.srclang = track.language;
  56638. this.label = track.label;
  56639. this.default = track.default;
  56640. Object.defineProperties(this, {
  56641. readyState: {
  56642. get() {
  56643. return readyState;
  56644. }
  56645. },
  56646. track: {
  56647. get() {
  56648. return track;
  56649. }
  56650. }
  56651. });
  56652. readyState = HTMLTrackElement$1.NONE;
  56653. track.addEventListener("loadeddata", () => {
  56654. readyState = HTMLTrackElement$1.LOADED;
  56655. this.trigger({
  56656. type: "load",
  56657. target: this
  56658. });
  56659. });
  56660. }
  56661. }
  56662. HTMLTrackElement$1.prototype.allowedEvents_ = {
  56663. load: "load"
  56664. };
  56665. HTMLTrackElement$1.NONE = 0;
  56666. HTMLTrackElement$1.LOADING = 1;
  56667. HTMLTrackElement$1.LOADED = 2;
  56668. HTMLTrackElement$1.ERROR = 3;
  56669. const NORMAL$1 = {
  56670. audio: {
  56671. ListClass: AudioTrackList$1,
  56672. TrackClass: AudioTrack$1,
  56673. capitalName: "Audio"
  56674. },
  56675. video: {
  56676. ListClass: VideoTrackList$1,
  56677. TrackClass: VideoTrack$1,
  56678. capitalName: "Video"
  56679. },
  56680. text: {
  56681. ListClass: TextTrackList$1,
  56682. TrackClass: TextTrack$1,
  56683. capitalName: "Text"
  56684. }
  56685. };
  56686. Object.keys(NORMAL$1).forEach(function(type2) {
  56687. NORMAL$1[type2].getterName = `${type2}Tracks`;
  56688. NORMAL$1[type2].privateName = `${type2}Tracks_`;
  56689. });
  56690. const REMOTE$1 = {
  56691. remoteText: {
  56692. ListClass: TextTrackList$1,
  56693. TrackClass: TextTrack$1,
  56694. capitalName: "RemoteText",
  56695. getterName: "remoteTextTracks",
  56696. privateName: "remoteTextTracks_"
  56697. },
  56698. remoteTextEl: {
  56699. ListClass: HtmlTrackElementList$1,
  56700. TrackClass: HTMLTrackElement$1,
  56701. capitalName: "RemoteTextTrackEls",
  56702. getterName: "remoteTextTrackEls",
  56703. privateName: "remoteTextTrackEls_"
  56704. }
  56705. };
  56706. const ALL$1 = Object.assign({}, NORMAL$1, REMOTE$1);
  56707. REMOTE$1.names = Object.keys(REMOTE$1);
  56708. NORMAL$1.names = Object.keys(NORMAL$1);
  56709. ALL$1.names = [].concat(REMOTE$1.names).concat(NORMAL$1.names);
  56710. function createTrackHelper$1(self2, kind, label2, language, options2 = {}) {
  56711. const tracks = self2.textTracks();
  56712. options2.kind = kind;
  56713. if (label2) {
  56714. options2.label = label2;
  56715. }
  56716. if (language) {
  56717. options2.language = language;
  56718. }
  56719. options2.tech = self2;
  56720. const track = new ALL$1.text.TrackClass(options2);
  56721. tracks.addTrack(track);
  56722. return track;
  56723. }
  56724. class Tech$2 extends Component$1$1 {
  56725. constructor(options2 = {}, ready = function() {
  56726. }) {
  56727. options2.reportTouchActivity = false;
  56728. super(null, options2, ready);
  56729. this.onDurationChange_ = (e) => this.onDurationChange(e);
  56730. this.trackProgress_ = (e) => this.trackProgress(e);
  56731. this.trackCurrentTime_ = (e) => this.trackCurrentTime(e);
  56732. this.stopTrackingCurrentTime_ = (e) => this.stopTrackingCurrentTime(e);
  56733. this.disposeSourceHandler_ = (e) => this.disposeSourceHandler(e);
  56734. this.queuedHanders_ = /* @__PURE__ */ new Set();
  56735. this.hasStarted_ = false;
  56736. this.on("playing", function() {
  56737. this.hasStarted_ = true;
  56738. });
  56739. this.on("loadstart", function() {
  56740. this.hasStarted_ = false;
  56741. });
  56742. ALL$1.names.forEach((name) => {
  56743. const props = ALL$1[name];
  56744. if (options2 && options2[props.getterName]) {
  56745. this[props.privateName] = options2[props.getterName];
  56746. }
  56747. });
  56748. if (!this.featuresProgressEvents) {
  56749. this.manualProgressOn();
  56750. }
  56751. if (!this.featuresTimeupdateEvents) {
  56752. this.manualTimeUpdatesOn();
  56753. }
  56754. ["Text", "Audio", "Video"].forEach((track) => {
  56755. if (options2[`native${track}Tracks`] === false) {
  56756. this[`featuresNative${track}Tracks`] = false;
  56757. }
  56758. });
  56759. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  56760. this.featuresNativeTextTracks = false;
  56761. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  56762. this.featuresNativeTextTracks = true;
  56763. }
  56764. if (!this.featuresNativeTextTracks) {
  56765. this.emulateTextTracks();
  56766. }
  56767. this.preloadTextTracks = options2.preloadTextTracks !== false;
  56768. this.autoRemoteTextTracks_ = new ALL$1.text.ListClass();
  56769. this.initTrackListeners();
  56770. if (!options2.nativeControlsForTouch) {
  56771. this.emitTapEvents();
  56772. }
  56773. if (this.constructor) {
  56774. this.name_ = this.constructor.name || "Unknown Tech";
  56775. }
  56776. }
  56777. triggerSourceset(src) {
  56778. if (!this.isReady_) {
  56779. this.one("ready", () => this.setTimeout(() => this.triggerSourceset(src), 1));
  56780. }
  56781. this.trigger({
  56782. src,
  56783. type: "sourceset"
  56784. });
  56785. }
  56786. manualProgressOn() {
  56787. this.on("durationchange", this.onDurationChange_);
  56788. this.manualProgress = true;
  56789. this.one("ready", this.trackProgress_);
  56790. }
  56791. manualProgressOff() {
  56792. this.manualProgress = false;
  56793. this.stopTrackingProgress();
  56794. this.off("durationchange", this.onDurationChange_);
  56795. }
  56796. trackProgress(event2) {
  56797. this.stopTrackingProgress();
  56798. this.progressInterval = this.setInterval(bind_(this, function() {
  56799. const numBufferedPercent = this.bufferedPercent();
  56800. if (this.bufferedPercent_ !== numBufferedPercent) {
  56801. this.trigger("progress");
  56802. }
  56803. this.bufferedPercent_ = numBufferedPercent;
  56804. if (numBufferedPercent === 1) {
  56805. this.stopTrackingProgress();
  56806. }
  56807. }), 500);
  56808. }
  56809. onDurationChange(event2) {
  56810. this.duration_ = this.duration();
  56811. }
  56812. buffered() {
  56813. return createTimeRanges$1(0, 0);
  56814. }
  56815. bufferedPercent() {
  56816. return bufferedPercent$1(this.buffered(), this.duration_);
  56817. }
  56818. stopTrackingProgress() {
  56819. this.clearInterval(this.progressInterval);
  56820. }
  56821. manualTimeUpdatesOn() {
  56822. this.manualTimeUpdates = true;
  56823. this.on("play", this.trackCurrentTime_);
  56824. this.on("pause", this.stopTrackingCurrentTime_);
  56825. }
  56826. manualTimeUpdatesOff() {
  56827. this.manualTimeUpdates = false;
  56828. this.stopTrackingCurrentTime();
  56829. this.off("play", this.trackCurrentTime_);
  56830. this.off("pause", this.stopTrackingCurrentTime_);
  56831. }
  56832. trackCurrentTime() {
  56833. if (this.currentTimeInterval) {
  56834. this.stopTrackingCurrentTime();
  56835. }
  56836. this.currentTimeInterval = this.setInterval(function() {
  56837. this.trigger({
  56838. type: "timeupdate",
  56839. target: this,
  56840. manuallyTriggered: true
  56841. });
  56842. }, 250);
  56843. }
  56844. stopTrackingCurrentTime() {
  56845. this.clearInterval(this.currentTimeInterval);
  56846. this.trigger({
  56847. type: "timeupdate",
  56848. target: this,
  56849. manuallyTriggered: true
  56850. });
  56851. }
  56852. dispose() {
  56853. this.clearTracks(NORMAL$1.names);
  56854. if (this.manualProgress) {
  56855. this.manualProgressOff();
  56856. }
  56857. if (this.manualTimeUpdates) {
  56858. this.manualTimeUpdatesOff();
  56859. }
  56860. super.dispose();
  56861. }
  56862. clearTracks(types) {
  56863. types = [].concat(types);
  56864. types.forEach((type2) => {
  56865. const list = this[`${type2}Tracks`]() || [];
  56866. let i2 = list.length;
  56867. while (i2--) {
  56868. const track = list[i2];
  56869. if (type2 === "text") {
  56870. this.removeRemoteTextTrack(track);
  56871. }
  56872. list.removeTrack(track);
  56873. }
  56874. });
  56875. }
  56876. cleanupAutoTextTracks() {
  56877. const list = this.autoRemoteTextTracks_ || [];
  56878. let i2 = list.length;
  56879. while (i2--) {
  56880. const track = list[i2];
  56881. this.removeRemoteTextTrack(track);
  56882. }
  56883. }
  56884. reset() {
  56885. }
  56886. crossOrigin() {
  56887. }
  56888. setCrossOrigin() {
  56889. }
  56890. error(err) {
  56891. if (err !== void 0) {
  56892. this.error_ = new MediaError$1(err);
  56893. this.trigger("error");
  56894. }
  56895. return this.error_;
  56896. }
  56897. played() {
  56898. if (this.hasStarted_) {
  56899. return createTimeRanges$1(0, 0);
  56900. }
  56901. return createTimeRanges$1();
  56902. }
  56903. play() {
  56904. }
  56905. setScrubbing(_isScrubbing) {
  56906. }
  56907. scrubbing() {
  56908. }
  56909. setCurrentTime(_seconds) {
  56910. if (this.manualTimeUpdates) {
  56911. this.trigger({
  56912. type: "timeupdate",
  56913. target: this,
  56914. manuallyTriggered: true
  56915. });
  56916. }
  56917. }
  56918. initTrackListeners() {
  56919. NORMAL$1.names.forEach((name) => {
  56920. const props = NORMAL$1[name];
  56921. const trackListChanges = () => {
  56922. this.trigger(`${name}trackchange`);
  56923. };
  56924. const tracks = this[props.getterName]();
  56925. tracks.addEventListener("removetrack", trackListChanges);
  56926. tracks.addEventListener("addtrack", trackListChanges);
  56927. this.on("dispose", () => {
  56928. tracks.removeEventListener("removetrack", trackListChanges);
  56929. tracks.removeEventListener("addtrack", trackListChanges);
  56930. });
  56931. });
  56932. }
  56933. addWebVttScript_() {
  56934. if (window_1.WebVTT) {
  56935. return;
  56936. }
  56937. if (document_1.body.contains(this.el())) {
  56938. if (!this.options_["vtt.js"] && isPlain$1(vtt) && Object.keys(vtt).length > 0) {
  56939. this.trigger("vttjsloaded");
  56940. return;
  56941. }
  56942. const script = document_1.createElement("script");
  56943. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  56944. script.onload = () => {
  56945. this.trigger("vttjsloaded");
  56946. };
  56947. script.onerror = () => {
  56948. this.trigger("vttjserror");
  56949. };
  56950. this.on("dispose", () => {
  56951. script.onload = null;
  56952. script.onerror = null;
  56953. });
  56954. window_1.WebVTT = true;
  56955. this.el().parentNode.appendChild(script);
  56956. } else {
  56957. this.ready(this.addWebVttScript_);
  56958. }
  56959. }
  56960. emulateTextTracks() {
  56961. const tracks = this.textTracks();
  56962. const remoteTracks = this.remoteTextTracks();
  56963. const handleAddTrack = (e) => tracks.addTrack(e.track);
  56964. const handleRemoveTrack = (e) => tracks.removeTrack(e.track);
  56965. remoteTracks.on("addtrack", handleAddTrack);
  56966. remoteTracks.on("removetrack", handleRemoveTrack);
  56967. this.addWebVttScript_();
  56968. const updateDisplay = () => this.trigger("texttrackchange");
  56969. const textTracksChanges = () => {
  56970. updateDisplay();
  56971. for (let i2 = 0; i2 < tracks.length; i2++) {
  56972. const track = tracks[i2];
  56973. track.removeEventListener("cuechange", updateDisplay);
  56974. if (track.mode === "showing") {
  56975. track.addEventListener("cuechange", updateDisplay);
  56976. }
  56977. }
  56978. };
  56979. textTracksChanges();
  56980. tracks.addEventListener("change", textTracksChanges);
  56981. tracks.addEventListener("addtrack", textTracksChanges);
  56982. tracks.addEventListener("removetrack", textTracksChanges);
  56983. this.on("dispose", function() {
  56984. remoteTracks.off("addtrack", handleAddTrack);
  56985. remoteTracks.off("removetrack", handleRemoveTrack);
  56986. tracks.removeEventListener("change", textTracksChanges);
  56987. tracks.removeEventListener("addtrack", textTracksChanges);
  56988. tracks.removeEventListener("removetrack", textTracksChanges);
  56989. for (let i2 = 0; i2 < tracks.length; i2++) {
  56990. const track = tracks[i2];
  56991. track.removeEventListener("cuechange", updateDisplay);
  56992. }
  56993. });
  56994. }
  56995. addTextTrack(kind, label2, language) {
  56996. if (!kind) {
  56997. throw new Error("TextTrack kind is required but was not provided");
  56998. }
  56999. return createTrackHelper$1(this, kind, label2, language);
  57000. }
  57001. createRemoteTextTrack(options2) {
  57002. const track = merge$1(options2, {
  57003. tech: this
  57004. });
  57005. return new REMOTE$1.remoteTextEl.TrackClass(track);
  57006. }
  57007. addRemoteTextTrack(options2 = {}, manualCleanup) {
  57008. const htmlTrackElement = this.createRemoteTextTrack(options2);
  57009. if (typeof manualCleanup !== "boolean") {
  57010. manualCleanup = false;
  57011. }
  57012. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  57013. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  57014. if (manualCleanup === false) {
  57015. this.ready(() => this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track));
  57016. }
  57017. return htmlTrackElement;
  57018. }
  57019. removeRemoteTextTrack(track) {
  57020. const trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  57021. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  57022. this.remoteTextTracks().removeTrack(track);
  57023. this.autoRemoteTextTracks_.removeTrack(track);
  57024. }
  57025. getVideoPlaybackQuality() {
  57026. return {};
  57027. }
  57028. requestPictureInPicture() {
  57029. return Promise.reject();
  57030. }
  57031. disablePictureInPicture() {
  57032. return true;
  57033. }
  57034. setDisablePictureInPicture() {
  57035. }
  57036. requestVideoFrameCallback(cb) {
  57037. const id = newGUID$1();
  57038. if (!this.isReady_ || this.paused()) {
  57039. this.queuedHanders_.add(id);
  57040. this.one("playing", () => {
  57041. if (this.queuedHanders_.has(id)) {
  57042. this.queuedHanders_.delete(id);
  57043. cb();
  57044. }
  57045. });
  57046. } else {
  57047. this.requestNamedAnimationFrame(id, cb);
  57048. }
  57049. return id;
  57050. }
  57051. cancelVideoFrameCallback(id) {
  57052. if (this.queuedHanders_.has(id)) {
  57053. this.queuedHanders_.delete(id);
  57054. } else {
  57055. this.cancelNamedAnimationFrame(id);
  57056. }
  57057. }
  57058. setPoster() {
  57059. }
  57060. playsinline() {
  57061. }
  57062. setPlaysinline() {
  57063. }
  57064. overrideNativeAudioTracks(override) {
  57065. }
  57066. overrideNativeVideoTracks(override) {
  57067. }
  57068. canPlayType(_type) {
  57069. return "";
  57070. }
  57071. static canPlayType(_type) {
  57072. return "";
  57073. }
  57074. static canPlaySource(srcObj, options2) {
  57075. return Tech$2.canPlayType(srcObj.type);
  57076. }
  57077. static isTech(component) {
  57078. return component.prototype instanceof Tech$2 || component instanceof Tech$2 || component === Tech$2;
  57079. }
  57080. static registerTech(name, tech) {
  57081. if (!Tech$2.techs_) {
  57082. Tech$2.techs_ = {};
  57083. }
  57084. if (!Tech$2.isTech(tech)) {
  57085. throw new Error(`Tech ${name} must be a Tech`);
  57086. }
  57087. if (!Tech$2.canPlayType) {
  57088. throw new Error("Techs must have a static canPlayType method on them");
  57089. }
  57090. if (!Tech$2.canPlaySource) {
  57091. throw new Error("Techs must have a static canPlaySource method on them");
  57092. }
  57093. name = toTitleCase$1$1(name);
  57094. Tech$2.techs_[name] = tech;
  57095. Tech$2.techs_[toLowerCase$1(name)] = tech;
  57096. if (name !== "Tech") {
  57097. Tech$2.defaultTechOrder_.push(name);
  57098. }
  57099. return tech;
  57100. }
  57101. static getTech(name) {
  57102. if (!name) {
  57103. return;
  57104. }
  57105. if (Tech$2.techs_ && Tech$2.techs_[name]) {
  57106. return Tech$2.techs_[name];
  57107. }
  57108. name = toTitleCase$1$1(name);
  57109. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  57110. log$1$1.warn(`The ${name} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`);
  57111. return window_1.videojs[name];
  57112. }
  57113. }
  57114. }
  57115. ALL$1.names.forEach(function(name) {
  57116. const props = ALL$1[name];
  57117. Tech$2.prototype[props.getterName] = function() {
  57118. this[props.privateName] = this[props.privateName] || new props.ListClass();
  57119. return this[props.privateName];
  57120. };
  57121. });
  57122. Tech$2.prototype.featuresVolumeControl = true;
  57123. Tech$2.prototype.featuresMuteControl = true;
  57124. Tech$2.prototype.featuresFullscreenResize = false;
  57125. Tech$2.prototype.featuresPlaybackRate = false;
  57126. Tech$2.prototype.featuresProgressEvents = false;
  57127. Tech$2.prototype.featuresSourceset = false;
  57128. Tech$2.prototype.featuresTimeupdateEvents = false;
  57129. Tech$2.prototype.featuresNativeTextTracks = false;
  57130. Tech$2.prototype.featuresVideoFrameCallback = false;
  57131. Tech$2.withSourceHandlers = function(_Tech) {
  57132. _Tech.registerSourceHandler = function(handler, index2) {
  57133. let handlers = _Tech.sourceHandlers;
  57134. if (!handlers) {
  57135. handlers = _Tech.sourceHandlers = [];
  57136. }
  57137. if (index2 === void 0) {
  57138. index2 = handlers.length;
  57139. }
  57140. handlers.splice(index2, 0, handler);
  57141. };
  57142. _Tech.canPlayType = function(type2) {
  57143. const handlers = _Tech.sourceHandlers || [];
  57144. let can;
  57145. for (let i2 = 0; i2 < handlers.length; i2++) {
  57146. can = handlers[i2].canPlayType(type2);
  57147. if (can) {
  57148. return can;
  57149. }
  57150. }
  57151. return "";
  57152. };
  57153. _Tech.selectSourceHandler = function(source, options2) {
  57154. const handlers = _Tech.sourceHandlers || [];
  57155. let can;
  57156. for (let i2 = 0; i2 < handlers.length; i2++) {
  57157. can = handlers[i2].canHandleSource(source, options2);
  57158. if (can) {
  57159. return handlers[i2];
  57160. }
  57161. }
  57162. return null;
  57163. };
  57164. _Tech.canPlaySource = function(srcObj, options2) {
  57165. const sh = _Tech.selectSourceHandler(srcObj, options2);
  57166. if (sh) {
  57167. return sh.canHandleSource(srcObj, options2);
  57168. }
  57169. return "";
  57170. };
  57171. const deferrable = ["seekable", "seeking", "duration"];
  57172. deferrable.forEach(function(fnName) {
  57173. const originalFn = this[fnName];
  57174. if (typeof originalFn !== "function") {
  57175. return;
  57176. }
  57177. this[fnName] = function() {
  57178. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  57179. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  57180. }
  57181. return originalFn.apply(this, arguments);
  57182. };
  57183. }, _Tech.prototype);
  57184. _Tech.prototype.setSource = function(source) {
  57185. let sh = _Tech.selectSourceHandler(source, this.options_);
  57186. if (!sh) {
  57187. if (_Tech.nativeSourceHandler) {
  57188. sh = _Tech.nativeSourceHandler;
  57189. } else {
  57190. log$1$1.error("No source handler found for the current source.");
  57191. }
  57192. }
  57193. this.disposeSourceHandler();
  57194. this.off("dispose", this.disposeSourceHandler_);
  57195. if (sh !== _Tech.nativeSourceHandler) {
  57196. this.currentSource_ = source;
  57197. }
  57198. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  57199. this.one("dispose", this.disposeSourceHandler_);
  57200. };
  57201. _Tech.prototype.disposeSourceHandler = function() {
  57202. if (this.currentSource_) {
  57203. this.clearTracks(["audio", "video"]);
  57204. this.currentSource_ = null;
  57205. }
  57206. this.cleanupAutoTextTracks();
  57207. if (this.sourceHandler_) {
  57208. if (this.sourceHandler_.dispose) {
  57209. this.sourceHandler_.dispose();
  57210. }
  57211. this.sourceHandler_ = null;
  57212. }
  57213. };
  57214. };
  57215. Component$1$1.registerComponent("Tech", Tech$2);
  57216. Tech$2.registerTech("Tech", Tech$2);
  57217. Tech$2.defaultTechOrder_ = [];
  57218. const middlewares$1 = {};
  57219. const middlewareInstances$1 = {};
  57220. const TERMINATOR$1 = {};
  57221. function use$1(type2, middleware) {
  57222. middlewares$1[type2] = middlewares$1[type2] || [];
  57223. middlewares$1[type2].push(middleware);
  57224. }
  57225. function setSource$1(player, src, next) {
  57226. player.setTimeout(() => setSourceHelper$1(src, middlewares$1[src.type], next, player), 1);
  57227. }
  57228. function setTech$1(middleware, tech) {
  57229. middleware.forEach((mw) => mw.setTech && mw.setTech(tech));
  57230. }
  57231. function get$1(middleware, tech, method) {
  57232. return middleware.reduceRight(middlewareIterator$1(method), tech[method]());
  57233. }
  57234. function set$1(middleware, tech, method, arg) {
  57235. return tech[method](middleware.reduce(middlewareIterator$1(method), arg));
  57236. }
  57237. function mediate$1(middleware, tech, method, arg = null) {
  57238. const callMethod = "call" + toTitleCase$1$1(method);
  57239. const middlewareValue = middleware.reduce(middlewareIterator$1(callMethod), arg);
  57240. const terminated = middlewareValue === TERMINATOR$1;
  57241. const returnValue = terminated ? null : tech[method](middlewareValue);
  57242. executeRight$1(middleware, method, returnValue, terminated);
  57243. return returnValue;
  57244. }
  57245. const allowedGetters$1 = {
  57246. buffered: 1,
  57247. currentTime: 1,
  57248. duration: 1,
  57249. muted: 1,
  57250. played: 1,
  57251. paused: 1,
  57252. seekable: 1,
  57253. volume: 1,
  57254. ended: 1
  57255. };
  57256. const allowedSetters$1 = {
  57257. setCurrentTime: 1,
  57258. setMuted: 1,
  57259. setVolume: 1
  57260. };
  57261. const allowedMediators$1 = {
  57262. play: 1,
  57263. pause: 1
  57264. };
  57265. function middlewareIterator$1(method) {
  57266. return (value, mw) => {
  57267. if (value === TERMINATOR$1) {
  57268. return TERMINATOR$1;
  57269. }
  57270. if (mw[method]) {
  57271. return mw[method](value);
  57272. }
  57273. return value;
  57274. };
  57275. }
  57276. function executeRight$1(mws, method, value, terminated) {
  57277. for (let i2 = mws.length - 1; i2 >= 0; i2--) {
  57278. const mw = mws[i2];
  57279. if (mw[method]) {
  57280. mw[method](terminated, value);
  57281. }
  57282. }
  57283. }
  57284. function clearCacheForPlayer$1(player) {
  57285. middlewareInstances$1[player.id()] = null;
  57286. }
  57287. function getOrCreateFactory$1(player, mwFactory) {
  57288. const mws = middlewareInstances$1[player.id()];
  57289. let mw = null;
  57290. if (mws === void 0 || mws === null) {
  57291. mw = mwFactory(player);
  57292. middlewareInstances$1[player.id()] = [[mwFactory, mw]];
  57293. return mw;
  57294. }
  57295. for (let i2 = 0; i2 < mws.length; i2++) {
  57296. const [mwf, mwi] = mws[i2];
  57297. if (mwf !== mwFactory) {
  57298. continue;
  57299. }
  57300. mw = mwi;
  57301. }
  57302. if (mw === null) {
  57303. mw = mwFactory(player);
  57304. mws.push([mwFactory, mw]);
  57305. }
  57306. return mw;
  57307. }
  57308. function setSourceHelper$1(src = {}, middleware = [], next, player, acc = [], lastRun = false) {
  57309. const [mwFactory, ...mwrest] = middleware;
  57310. if (typeof mwFactory === "string") {
  57311. setSourceHelper$1(src, middlewares$1[mwFactory], next, player, acc, lastRun);
  57312. } else if (mwFactory) {
  57313. const mw = getOrCreateFactory$1(player, mwFactory);
  57314. if (!mw.setSource) {
  57315. acc.push(mw);
  57316. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57317. }
  57318. mw.setSource(Object.assign({}, src), function(err, _src) {
  57319. if (err) {
  57320. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57321. }
  57322. acc.push(mw);
  57323. setSourceHelper$1(_src, src.type === _src.type ? mwrest : middlewares$1[_src.type], next, player, acc, lastRun);
  57324. });
  57325. } else if (mwrest.length) {
  57326. setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57327. } else if (lastRun) {
  57328. next(src, acc);
  57329. } else {
  57330. setSourceHelper$1(src, middlewares$1["*"], next, player, acc, true);
  57331. }
  57332. }
  57333. const MimetypesKind$1 = {
  57334. opus: "video/ogg",
  57335. ogv: "video/ogg",
  57336. mp4: "video/mp4",
  57337. mov: "video/mp4",
  57338. m4v: "video/mp4",
  57339. mkv: "video/x-matroska",
  57340. m4a: "audio/mp4",
  57341. mp3: "audio/mpeg",
  57342. aac: "audio/aac",
  57343. caf: "audio/x-caf",
  57344. flac: "audio/flac",
  57345. oga: "audio/ogg",
  57346. wav: "audio/wav",
  57347. m3u8: "application/x-mpegURL",
  57348. mpd: "application/dash+xml",
  57349. jpg: "image/jpeg",
  57350. jpeg: "image/jpeg",
  57351. gif: "image/gif",
  57352. png: "image/png",
  57353. svg: "image/svg+xml",
  57354. webp: "image/webp"
  57355. };
  57356. const getMimetype$1 = function(src = "") {
  57357. const ext = getFileExtension$1(src);
  57358. const mimetype = MimetypesKind$1[ext.toLowerCase()];
  57359. return mimetype || "";
  57360. };
  57361. const findMimetype$1 = (player, src) => {
  57362. if (!src) {
  57363. return "";
  57364. }
  57365. if (player.cache_.source.src === src && player.cache_.source.type) {
  57366. return player.cache_.source.type;
  57367. }
  57368. const matchingSources = player.cache_.sources.filter((s) => s.src === src);
  57369. if (matchingSources.length) {
  57370. return matchingSources[0].type;
  57371. }
  57372. const sources = player.$$("source");
  57373. for (let i2 = 0; i2 < sources.length; i2++) {
  57374. const s = sources[i2];
  57375. if (s.type && s.src && s.src === src) {
  57376. return s.type;
  57377. }
  57378. }
  57379. return getMimetype$1(src);
  57380. };
  57381. const filterSource$1 = function(src) {
  57382. if (Array.isArray(src)) {
  57383. let newsrc = [];
  57384. src.forEach(function(srcobj) {
  57385. srcobj = filterSource$1(srcobj);
  57386. if (Array.isArray(srcobj)) {
  57387. newsrc = newsrc.concat(srcobj);
  57388. } else if (isObject$2(srcobj)) {
  57389. newsrc.push(srcobj);
  57390. }
  57391. });
  57392. src = newsrc;
  57393. } else if (typeof src === "string" && src.trim()) {
  57394. src = [fixSource$1({
  57395. src
  57396. })];
  57397. } else if (isObject$2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  57398. src = [fixSource$1(src)];
  57399. } else {
  57400. src = [];
  57401. }
  57402. return src;
  57403. };
  57404. function fixSource$1(src) {
  57405. if (!src.type) {
  57406. const mimetype = getMimetype$1(src.src);
  57407. if (mimetype) {
  57408. src.type = mimetype;
  57409. }
  57410. }
  57411. return src;
  57412. }
  57413. class MediaLoader$1 extends Component$1$1 {
  57414. constructor(player, options2, ready) {
  57415. const options_ = merge$1({
  57416. createEl: false
  57417. }, options2);
  57418. super(player, options_, ready);
  57419. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  57420. for (let i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  57421. const techName = toTitleCase$1$1(j[i2]);
  57422. let tech = Tech$2.getTech(techName);
  57423. if (!techName) {
  57424. tech = Component$1$1.getComponent(techName);
  57425. }
  57426. if (tech && tech.isSupported()) {
  57427. player.loadTech_(techName);
  57428. break;
  57429. }
  57430. }
  57431. } else {
  57432. player.src(options2.playerOptions.sources);
  57433. }
  57434. }
  57435. }
  57436. Component$1$1.registerComponent("MediaLoader", MediaLoader$1);
  57437. class ClickableComponent$1 extends Component$1$1 {
  57438. constructor(player, options2) {
  57439. super(player, options2);
  57440. if (this.options_.controlText) {
  57441. this.controlText(this.options_.controlText);
  57442. }
  57443. this.handleMouseOver_ = (e) => this.handleMouseOver(e);
  57444. this.handleMouseOut_ = (e) => this.handleMouseOut(e);
  57445. this.handleClick_ = (e) => this.handleClick(e);
  57446. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  57447. this.emitTapEvents();
  57448. this.enable();
  57449. }
  57450. createEl(tag = "div", props = {}, attributes = {}) {
  57451. props = Object.assign({
  57452. className: this.buildCSSClass(),
  57453. tabIndex: 0
  57454. }, props);
  57455. if (tag === "button") {
  57456. log$1$1.error(`Creating a ClickableComponent with an HTML element of ${tag} is not supported; use a Button instead.`);
  57457. }
  57458. attributes = Object.assign({
  57459. role: "button"
  57460. }, attributes);
  57461. this.tabIndex_ = props.tabIndex;
  57462. const el = createEl$1(tag, props, attributes);
  57463. el.appendChild(createEl$1("span", {
  57464. className: "vjs-icon-placeholder"
  57465. }, {
  57466. "aria-hidden": true
  57467. }));
  57468. this.createControlTextEl(el);
  57469. return el;
  57470. }
  57471. dispose() {
  57472. this.controlTextEl_ = null;
  57473. super.dispose();
  57474. }
  57475. createControlTextEl(el) {
  57476. this.controlTextEl_ = createEl$1("span", {
  57477. className: "vjs-control-text"
  57478. }, {
  57479. "aria-live": "polite"
  57480. });
  57481. if (el) {
  57482. el.appendChild(this.controlTextEl_);
  57483. }
  57484. this.controlText(this.controlText_, el);
  57485. return this.controlTextEl_;
  57486. }
  57487. controlText(text, el = this.el()) {
  57488. if (text === void 0) {
  57489. return this.controlText_ || "Need Text";
  57490. }
  57491. const localizedText = this.localize(text);
  57492. this.controlText_ = text;
  57493. textContent$1(this.controlTextEl_, localizedText);
  57494. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  57495. el.setAttribute("title", localizedText);
  57496. }
  57497. }
  57498. buildCSSClass() {
  57499. return `vjs-control vjs-button ${super.buildCSSClass()}`;
  57500. }
  57501. enable() {
  57502. if (!this.enabled_) {
  57503. this.enabled_ = true;
  57504. this.removeClass("vjs-disabled");
  57505. this.el_.setAttribute("aria-disabled", "false");
  57506. if (typeof this.tabIndex_ !== "undefined") {
  57507. this.el_.setAttribute("tabIndex", this.tabIndex_);
  57508. }
  57509. this.on(["tap", "click"], this.handleClick_);
  57510. this.on("keydown", this.handleKeyDown_);
  57511. }
  57512. }
  57513. disable() {
  57514. this.enabled_ = false;
  57515. this.addClass("vjs-disabled");
  57516. this.el_.setAttribute("aria-disabled", "true");
  57517. if (typeof this.tabIndex_ !== "undefined") {
  57518. this.el_.removeAttribute("tabIndex");
  57519. }
  57520. this.off("mouseover", this.handleMouseOver_);
  57521. this.off("mouseout", this.handleMouseOut_);
  57522. this.off(["tap", "click"], this.handleClick_);
  57523. this.off("keydown", this.handleKeyDown_);
  57524. }
  57525. handleLanguagechange() {
  57526. this.controlText(this.controlText_);
  57527. }
  57528. handleClick(event2) {
  57529. if (this.options_.clickHandler) {
  57530. this.options_.clickHandler.call(this, arguments);
  57531. }
  57532. }
  57533. handleKeyDown(event2) {
  57534. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57535. event2.preventDefault();
  57536. event2.stopPropagation();
  57537. this.trigger("click");
  57538. } else {
  57539. super.handleKeyDown(event2);
  57540. }
  57541. }
  57542. }
  57543. Component$1$1.registerComponent("ClickableComponent", ClickableComponent$1);
  57544. class PosterImage$1 extends ClickableComponent$1 {
  57545. constructor(player, options2) {
  57546. super(player, options2);
  57547. this.update();
  57548. this.update_ = (e) => this.update(e);
  57549. player.on("posterchange", this.update_);
  57550. }
  57551. dispose() {
  57552. this.player().off("posterchange", this.update_);
  57553. super.dispose();
  57554. }
  57555. createEl() {
  57556. return createEl$1("div", {
  57557. className: "vjs-poster"
  57558. });
  57559. }
  57560. crossOrigin(value) {
  57561. if (typeof value === "undefined") {
  57562. if (this.$("img")) {
  57563. return this.$("img").crossOrigin;
  57564. } else if (this.player_.tech_ && this.player_.tech_.isReady_) {
  57565. return this.player_.crossOrigin();
  57566. }
  57567. return this.player_.options_.crossOrigin || this.player_.options_.crossorigin || null;
  57568. }
  57569. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  57570. this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  57571. return;
  57572. }
  57573. if (this.$("img")) {
  57574. this.$("img").crossOrigin = value;
  57575. }
  57576. return;
  57577. }
  57578. update(event2) {
  57579. const url = this.player().poster();
  57580. this.setSrc(url);
  57581. if (url) {
  57582. this.show();
  57583. } else {
  57584. this.hide();
  57585. }
  57586. }
  57587. setSrc(url) {
  57588. if (!url) {
  57589. this.el_.textContent = "";
  57590. return;
  57591. }
  57592. if (!this.$("img")) {
  57593. this.el_.appendChild(createEl$1("picture", {
  57594. className: "vjs-poster",
  57595. tabIndex: -1
  57596. }, {}, createEl$1("img", {
  57597. loading: "lazy",
  57598. crossOrigin: this.crossOrigin()
  57599. }, {
  57600. alt: ""
  57601. })));
  57602. }
  57603. this.$("img").src = url;
  57604. }
  57605. handleClick(event2) {
  57606. if (!this.player_.controls()) {
  57607. return;
  57608. }
  57609. if (this.player_.tech(true)) {
  57610. this.player_.tech(true).focus();
  57611. }
  57612. if (this.player_.paused()) {
  57613. silencePromise$1(this.player_.play());
  57614. } else {
  57615. this.player_.pause();
  57616. }
  57617. }
  57618. }
  57619. PosterImage$1.prototype.crossorigin = PosterImage$1.prototype.crossOrigin;
  57620. Component$1$1.registerComponent("PosterImage", PosterImage$1);
  57621. const darkGray$1 = "#222";
  57622. const lightGray$1 = "#ccc";
  57623. const fontMap$1 = {
  57624. monospace: "monospace",
  57625. sansSerif: "sans-serif",
  57626. serif: "serif",
  57627. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  57628. monospaceSerif: '"Courier New", monospace',
  57629. proportionalSansSerif: "sans-serif",
  57630. proportionalSerif: "serif",
  57631. casual: '"Comic Sans MS", Impact, fantasy',
  57632. script: '"Monotype Corsiva", cursive',
  57633. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  57634. };
  57635. function constructColor$1(color2, opacity) {
  57636. let hex;
  57637. if (color2.length === 4) {
  57638. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  57639. } else if (color2.length === 7) {
  57640. hex = color2.slice(1);
  57641. } else {
  57642. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  57643. }
  57644. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  57645. }
  57646. function tryUpdateStyle$1(el, style, rule) {
  57647. try {
  57648. el.style[style] = rule;
  57649. } catch (e) {
  57650. return;
  57651. }
  57652. }
  57653. class TextTrackDisplay$1 extends Component$1$1 {
  57654. constructor(player, options2, ready) {
  57655. super(player, options2, ready);
  57656. const updateDisplayHandler = (e) => this.updateDisplay(e);
  57657. player.on("loadstart", (e) => this.toggleDisplay(e));
  57658. player.on("texttrackchange", updateDisplayHandler);
  57659. player.on("loadedmetadata", (e) => this.preselectTrack(e));
  57660. player.ready(bind_(this, function() {
  57661. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  57662. this.hide();
  57663. return;
  57664. }
  57665. player.on("fullscreenchange", updateDisplayHandler);
  57666. player.on("playerresize", updateDisplayHandler);
  57667. const screenOrientation = window_1.screen.orientation || window_1;
  57668. const changeOrientationEvent = window_1.screen.orientation ? "change" : "orientationchange";
  57669. screenOrientation.addEventListener(changeOrientationEvent, updateDisplayHandler);
  57670. player.on("dispose", () => screenOrientation.removeEventListener(changeOrientationEvent, updateDisplayHandler));
  57671. const tracks = this.options_.playerOptions.tracks || [];
  57672. for (let i2 = 0; i2 < tracks.length; i2++) {
  57673. this.player_.addRemoteTextTrack(tracks[i2], true);
  57674. }
  57675. this.preselectTrack();
  57676. }));
  57677. }
  57678. preselectTrack() {
  57679. const modes = {
  57680. captions: 1,
  57681. subtitles: 1
  57682. };
  57683. const trackList = this.player_.textTracks();
  57684. const userPref = this.player_.cache_.selectedLanguage;
  57685. let firstDesc;
  57686. let firstCaptions;
  57687. let preferredTrack;
  57688. for (let i2 = 0; i2 < trackList.length; i2++) {
  57689. const track = trackList[i2];
  57690. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  57691. if (track.kind === userPref.kind) {
  57692. preferredTrack = track;
  57693. } else if (!preferredTrack) {
  57694. preferredTrack = track;
  57695. }
  57696. } else if (userPref && !userPref.enabled) {
  57697. preferredTrack = null;
  57698. firstDesc = null;
  57699. firstCaptions = null;
  57700. } else if (track.default) {
  57701. if (track.kind === "descriptions" && !firstDesc) {
  57702. firstDesc = track;
  57703. } else if (track.kind in modes && !firstCaptions) {
  57704. firstCaptions = track;
  57705. }
  57706. }
  57707. }
  57708. if (preferredTrack) {
  57709. preferredTrack.mode = "showing";
  57710. } else if (firstCaptions) {
  57711. firstCaptions.mode = "showing";
  57712. } else if (firstDesc) {
  57713. firstDesc.mode = "showing";
  57714. }
  57715. }
  57716. toggleDisplay() {
  57717. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  57718. this.hide();
  57719. } else {
  57720. this.show();
  57721. }
  57722. }
  57723. createEl() {
  57724. return super.createEl("div", {
  57725. className: "vjs-text-track-display"
  57726. }, {
  57727. "translate": "yes",
  57728. "aria-live": "off",
  57729. "aria-atomic": "true"
  57730. });
  57731. }
  57732. clearDisplay() {
  57733. if (typeof window_1.WebVTT === "function") {
  57734. window_1.WebVTT.processCues(window_1, [], this.el_);
  57735. }
  57736. }
  57737. updateDisplay() {
  57738. const tracks = this.player_.textTracks();
  57739. const allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  57740. this.clearDisplay();
  57741. if (allowMultipleShowingTracks) {
  57742. const showingTracks = [];
  57743. for (let i3 = 0; i3 < tracks.length; ++i3) {
  57744. const track = tracks[i3];
  57745. if (track.mode !== "showing") {
  57746. continue;
  57747. }
  57748. showingTracks.push(track);
  57749. }
  57750. this.updateForTrack(showingTracks);
  57751. return;
  57752. }
  57753. let descriptionsTrack = null;
  57754. let captionsSubtitlesTrack = null;
  57755. let i2 = tracks.length;
  57756. while (i2--) {
  57757. const track = tracks[i2];
  57758. if (track.mode === "showing") {
  57759. if (track.kind === "descriptions") {
  57760. descriptionsTrack = track;
  57761. } else {
  57762. captionsSubtitlesTrack = track;
  57763. }
  57764. }
  57765. }
  57766. if (captionsSubtitlesTrack) {
  57767. if (this.getAttribute("aria-live") !== "off") {
  57768. this.setAttribute("aria-live", "off");
  57769. }
  57770. this.updateForTrack(captionsSubtitlesTrack);
  57771. } else if (descriptionsTrack) {
  57772. if (this.getAttribute("aria-live") !== "assertive") {
  57773. this.setAttribute("aria-live", "assertive");
  57774. }
  57775. this.updateForTrack(descriptionsTrack);
  57776. }
  57777. }
  57778. updateDisplayState(track) {
  57779. const overrides = this.player_.textTrackSettings.getValues();
  57780. const cues = track.activeCues;
  57781. let i2 = cues.length;
  57782. while (i2--) {
  57783. const cue = cues[i2];
  57784. if (!cue) {
  57785. continue;
  57786. }
  57787. const cueDiv = cue.displayState;
  57788. if (overrides.color) {
  57789. cueDiv.firstChild.style.color = overrides.color;
  57790. }
  57791. if (overrides.textOpacity) {
  57792. tryUpdateStyle$1(cueDiv.firstChild, "color", constructColor$1(overrides.color || "#fff", overrides.textOpacity));
  57793. }
  57794. if (overrides.backgroundColor) {
  57795. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  57796. }
  57797. if (overrides.backgroundOpacity) {
  57798. tryUpdateStyle$1(cueDiv.firstChild, "backgroundColor", constructColor$1(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  57799. }
  57800. if (overrides.windowColor) {
  57801. if (overrides.windowOpacity) {
  57802. tryUpdateStyle$1(cueDiv, "backgroundColor", constructColor$1(overrides.windowColor, overrides.windowOpacity));
  57803. } else {
  57804. cueDiv.style.backgroundColor = overrides.windowColor;
  57805. }
  57806. }
  57807. if (overrides.edgeStyle) {
  57808. if (overrides.edgeStyle === "dropshadow") {
  57809. cueDiv.firstChild.style.textShadow = `2px 2px 3px ${darkGray$1}, 2px 2px 4px ${darkGray$1}, 2px 2px 5px ${darkGray$1}`;
  57810. } else if (overrides.edgeStyle === "raised") {
  57811. cueDiv.firstChild.style.textShadow = `1px 1px ${darkGray$1}, 2px 2px ${darkGray$1}, 3px 3px ${darkGray$1}`;
  57812. } else if (overrides.edgeStyle === "depressed") {
  57813. cueDiv.firstChild.style.textShadow = `1px 1px ${lightGray$1}, 0 1px ${lightGray$1}, -1px -1px ${darkGray$1}, 0 -1px ${darkGray$1}`;
  57814. } else if (overrides.edgeStyle === "uniform") {
  57815. cueDiv.firstChild.style.textShadow = `0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}`;
  57816. }
  57817. }
  57818. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  57819. const fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  57820. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  57821. cueDiv.style.height = "auto";
  57822. cueDiv.style.top = "auto";
  57823. }
  57824. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  57825. if (overrides.fontFamily === "small-caps") {
  57826. cueDiv.firstChild.style.fontVariant = "small-caps";
  57827. } else {
  57828. cueDiv.firstChild.style.fontFamily = fontMap$1[overrides.fontFamily];
  57829. }
  57830. }
  57831. }
  57832. }
  57833. updateForTrack(tracks) {
  57834. if (!Array.isArray(tracks)) {
  57835. tracks = [tracks];
  57836. }
  57837. if (typeof window_1.WebVTT !== "function" || tracks.every((track) => {
  57838. return !track.activeCues;
  57839. })) {
  57840. return;
  57841. }
  57842. const cues = [];
  57843. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57844. const track = tracks[i2];
  57845. for (let j = 0; j < track.activeCues.length; ++j) {
  57846. cues.push(track.activeCues[j]);
  57847. }
  57848. }
  57849. window_1.WebVTT.processCues(window_1, cues, this.el_);
  57850. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57851. const track = tracks[i2];
  57852. for (let j = 0; j < track.activeCues.length; ++j) {
  57853. const cueEl = track.activeCues[j].displayState;
  57854. addClass$1(cueEl, "vjs-text-track-cue", "vjs-text-track-cue-" + (track.language ? track.language : i2));
  57855. if (track.language) {
  57856. setAttribute$1(cueEl, "lang", track.language);
  57857. }
  57858. }
  57859. if (this.player_.textTrackSettings) {
  57860. this.updateDisplayState(track);
  57861. }
  57862. }
  57863. }
  57864. }
  57865. Component$1$1.registerComponent("TextTrackDisplay", TextTrackDisplay$1);
  57866. class LoadingSpinner$1 extends Component$1$1 {
  57867. createEl() {
  57868. const isAudio = this.player_.isAudio();
  57869. const playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  57870. const controlText = createEl$1("span", {
  57871. className: "vjs-control-text",
  57872. textContent: this.localize("{1} is loading.", [playerType])
  57873. });
  57874. const el = super.createEl("div", {
  57875. className: "vjs-loading-spinner",
  57876. dir: "ltr"
  57877. });
  57878. el.appendChild(controlText);
  57879. return el;
  57880. }
  57881. handleLanguagechange() {
  57882. this.$(".vjs-control-text").textContent = this.localize("{1} is loading.", [this.player_.isAudio() ? "Audio Player" : "Video Player"]);
  57883. }
  57884. }
  57885. Component$1$1.registerComponent("LoadingSpinner", LoadingSpinner$1);
  57886. class Button$1 extends ClickableComponent$1 {
  57887. createEl(tag, props = {}, attributes = {}) {
  57888. tag = "button";
  57889. props = Object.assign({
  57890. className: this.buildCSSClass()
  57891. }, props);
  57892. attributes = Object.assign({
  57893. type: "button"
  57894. }, attributes);
  57895. const el = createEl$1(tag, props, attributes);
  57896. el.appendChild(createEl$1("span", {
  57897. className: "vjs-icon-placeholder"
  57898. }, {
  57899. "aria-hidden": true
  57900. }));
  57901. this.createControlTextEl(el);
  57902. return el;
  57903. }
  57904. addChild(child, options2 = {}) {
  57905. const className = this.constructor.name;
  57906. log$1$1.warn(`Adding an actionable (user controllable) child to a Button (${className}) is not supported; use a ClickableComponent instead.`);
  57907. return Component$1$1.prototype.addChild.call(this, child, options2);
  57908. }
  57909. enable() {
  57910. super.enable();
  57911. this.el_.removeAttribute("disabled");
  57912. }
  57913. disable() {
  57914. super.disable();
  57915. this.el_.setAttribute("disabled", "disabled");
  57916. }
  57917. handleKeyDown(event2) {
  57918. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57919. event2.stopPropagation();
  57920. return;
  57921. }
  57922. super.handleKeyDown(event2);
  57923. }
  57924. }
  57925. Component$1$1.registerComponent("Button", Button$1);
  57926. class BigPlayButton$1 extends Button$1 {
  57927. constructor(player, options2) {
  57928. super(player, options2);
  57929. this.mouseused_ = false;
  57930. this.on("mousedown", (e) => this.handleMouseDown(e));
  57931. }
  57932. buildCSSClass() {
  57933. return "vjs-big-play-button";
  57934. }
  57935. handleClick(event2) {
  57936. const playPromise = this.player_.play();
  57937. if (this.mouseused_ && event2.clientX && event2.clientY) {
  57938. silencePromise$1(playPromise);
  57939. if (this.player_.tech(true)) {
  57940. this.player_.tech(true).focus();
  57941. }
  57942. return;
  57943. }
  57944. const cb = this.player_.getChild("controlBar");
  57945. const playToggle = cb && cb.getChild("playToggle");
  57946. if (!playToggle) {
  57947. this.player_.tech(true).focus();
  57948. return;
  57949. }
  57950. const playFocus = () => playToggle.focus();
  57951. if (isPromise$1(playPromise)) {
  57952. playPromise.then(playFocus, () => {
  57953. });
  57954. } else {
  57955. this.setTimeout(playFocus, 1);
  57956. }
  57957. }
  57958. handleKeyDown(event2) {
  57959. this.mouseused_ = false;
  57960. super.handleKeyDown(event2);
  57961. }
  57962. handleMouseDown(event2) {
  57963. this.mouseused_ = true;
  57964. }
  57965. }
  57966. BigPlayButton$1.prototype.controlText_ = "Play Video";
  57967. Component$1$1.registerComponent("BigPlayButton", BigPlayButton$1);
  57968. class CloseButton$1 extends Button$1 {
  57969. constructor(player, options2) {
  57970. super(player, options2);
  57971. this.controlText(options2 && options2.controlText || this.localize("Close"));
  57972. }
  57973. buildCSSClass() {
  57974. return `vjs-close-button ${super.buildCSSClass()}`;
  57975. }
  57976. handleClick(event2) {
  57977. this.trigger({
  57978. type: "close",
  57979. bubbles: false
  57980. });
  57981. }
  57982. handleKeyDown(event2) {
  57983. if (keycode.isEventKey(event2, "Esc")) {
  57984. event2.preventDefault();
  57985. event2.stopPropagation();
  57986. this.trigger("click");
  57987. } else {
  57988. super.handleKeyDown(event2);
  57989. }
  57990. }
  57991. }
  57992. Component$1$1.registerComponent("CloseButton", CloseButton$1);
  57993. class PlayToggle$1 extends Button$1 {
  57994. constructor(player, options2 = {}) {
  57995. super(player, options2);
  57996. options2.replay = options2.replay === void 0 || options2.replay;
  57997. this.on(player, "play", (e) => this.handlePlay(e));
  57998. this.on(player, "pause", (e) => this.handlePause(e));
  57999. if (options2.replay) {
  58000. this.on(player, "ended", (e) => this.handleEnded(e));
  58001. }
  58002. }
  58003. buildCSSClass() {
  58004. return `vjs-play-control ${super.buildCSSClass()}`;
  58005. }
  58006. handleClick(event2) {
  58007. if (this.player_.paused()) {
  58008. silencePromise$1(this.player_.play());
  58009. } else {
  58010. this.player_.pause();
  58011. }
  58012. }
  58013. handleSeeked(event2) {
  58014. this.removeClass("vjs-ended");
  58015. if (this.player_.paused()) {
  58016. this.handlePause(event2);
  58017. } else {
  58018. this.handlePlay(event2);
  58019. }
  58020. }
  58021. handlePlay(event2) {
  58022. this.removeClass("vjs-ended", "vjs-paused");
  58023. this.addClass("vjs-playing");
  58024. this.controlText("Pause");
  58025. }
  58026. handlePause(event2) {
  58027. this.removeClass("vjs-playing");
  58028. this.addClass("vjs-paused");
  58029. this.controlText("Play");
  58030. }
  58031. handleEnded(event2) {
  58032. this.removeClass("vjs-playing");
  58033. this.addClass("vjs-ended");
  58034. this.controlText("Replay");
  58035. this.one(this.player_, "seeked", (e) => this.handleSeeked(e));
  58036. }
  58037. }
  58038. PlayToggle$1.prototype.controlText_ = "Play";
  58039. Component$1$1.registerComponent("PlayToggle", PlayToggle$1);
  58040. class TimeDisplay$1 extends Component$1$1 {
  58041. constructor(player, options2) {
  58042. super(player, options2);
  58043. this.on(player, ["timeupdate", "ended"], (e) => this.updateContent(e));
  58044. this.updateTextNode_();
  58045. }
  58046. createEl() {
  58047. const className = this.buildCSSClass();
  58048. const el = super.createEl("div", {
  58049. className: `${className} vjs-time-control vjs-control`
  58050. });
  58051. const span = createEl$1("span", {
  58052. className: "vjs-control-text",
  58053. textContent: `${this.localize(this.labelText_)}\xA0`
  58054. }, {
  58055. role: "presentation"
  58056. });
  58057. el.appendChild(span);
  58058. this.contentEl_ = createEl$1("span", {
  58059. className: `${className}-display`
  58060. }, {
  58061. role: "presentation"
  58062. });
  58063. el.appendChild(this.contentEl_);
  58064. return el;
  58065. }
  58066. dispose() {
  58067. this.contentEl_ = null;
  58068. this.textNode_ = null;
  58069. super.dispose();
  58070. }
  58071. updateTextNode_(time = 0) {
  58072. time = formatTime$1(time);
  58073. if (this.formattedTime_ === time) {
  58074. return;
  58075. }
  58076. this.formattedTime_ = time;
  58077. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", () => {
  58078. if (!this.contentEl_) {
  58079. return;
  58080. }
  58081. let oldNode = this.textNode_;
  58082. if (oldNode && this.contentEl_.firstChild !== oldNode) {
  58083. oldNode = null;
  58084. 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.");
  58085. }
  58086. this.textNode_ = document_1.createTextNode(this.formattedTime_);
  58087. if (!this.textNode_) {
  58088. return;
  58089. }
  58090. if (oldNode) {
  58091. this.contentEl_.replaceChild(this.textNode_, oldNode);
  58092. } else {
  58093. this.contentEl_.appendChild(this.textNode_);
  58094. }
  58095. });
  58096. }
  58097. updateContent(event2) {
  58098. }
  58099. }
  58100. TimeDisplay$1.prototype.labelText_ = "Time";
  58101. TimeDisplay$1.prototype.controlText_ = "Time";
  58102. Component$1$1.registerComponent("TimeDisplay", TimeDisplay$1);
  58103. class CurrentTimeDisplay$1 extends TimeDisplay$1 {
  58104. buildCSSClass() {
  58105. return "vjs-current-time";
  58106. }
  58107. updateContent(event2) {
  58108. let time;
  58109. if (this.player_.ended()) {
  58110. time = this.player_.duration();
  58111. } else {
  58112. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58113. }
  58114. this.updateTextNode_(time);
  58115. }
  58116. }
  58117. CurrentTimeDisplay$1.prototype.labelText_ = "Current Time";
  58118. CurrentTimeDisplay$1.prototype.controlText_ = "Current Time";
  58119. Component$1$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay$1);
  58120. class DurationDisplay$1 extends TimeDisplay$1 {
  58121. constructor(player, options2) {
  58122. super(player, options2);
  58123. const updateContent = (e) => this.updateContent(e);
  58124. this.on(player, "durationchange", updateContent);
  58125. this.on(player, "loadstart", updateContent);
  58126. this.on(player, "loadedmetadata", updateContent);
  58127. }
  58128. buildCSSClass() {
  58129. return "vjs-duration";
  58130. }
  58131. updateContent(event2) {
  58132. const duration5 = this.player_.duration();
  58133. this.updateTextNode_(duration5);
  58134. }
  58135. }
  58136. DurationDisplay$1.prototype.labelText_ = "Duration";
  58137. DurationDisplay$1.prototype.controlText_ = "Duration";
  58138. Component$1$1.registerComponent("DurationDisplay", DurationDisplay$1);
  58139. class TimeDivider$1 extends Component$1$1 {
  58140. createEl() {
  58141. const el = super.createEl("div", {
  58142. className: "vjs-time-control vjs-time-divider"
  58143. }, {
  58144. "aria-hidden": true
  58145. });
  58146. const div = super.createEl("div");
  58147. const span = super.createEl("span", {
  58148. textContent: "/"
  58149. });
  58150. div.appendChild(span);
  58151. el.appendChild(div);
  58152. return el;
  58153. }
  58154. }
  58155. Component$1$1.registerComponent("TimeDivider", TimeDivider$1);
  58156. class RemainingTimeDisplay$1 extends TimeDisplay$1 {
  58157. constructor(player, options2) {
  58158. super(player, options2);
  58159. this.on(player, "durationchange", (e) => this.updateContent(e));
  58160. }
  58161. buildCSSClass() {
  58162. return "vjs-remaining-time";
  58163. }
  58164. createEl() {
  58165. const el = super.createEl();
  58166. if (this.options_.displayNegative !== false) {
  58167. el.insertBefore(createEl$1("span", {}, {
  58168. "aria-hidden": true
  58169. }, "-"), this.contentEl_);
  58170. }
  58171. return el;
  58172. }
  58173. updateContent(event2) {
  58174. if (typeof this.player_.duration() !== "number") {
  58175. return;
  58176. }
  58177. let time;
  58178. if (this.player_.ended()) {
  58179. time = 0;
  58180. } else if (this.player_.remainingTimeDisplay) {
  58181. time = this.player_.remainingTimeDisplay();
  58182. } else {
  58183. time = this.player_.remainingTime();
  58184. }
  58185. this.updateTextNode_(time);
  58186. }
  58187. }
  58188. RemainingTimeDisplay$1.prototype.labelText_ = "Remaining Time";
  58189. RemainingTimeDisplay$1.prototype.controlText_ = "Remaining Time";
  58190. Component$1$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay$1);
  58191. class LiveDisplay$1 extends Component$1$1 {
  58192. constructor(player, options2) {
  58193. super(player, options2);
  58194. this.updateShowing();
  58195. this.on(this.player(), "durationchange", (e) => this.updateShowing(e));
  58196. }
  58197. createEl() {
  58198. const el = super.createEl("div", {
  58199. className: "vjs-live-control vjs-control"
  58200. });
  58201. this.contentEl_ = createEl$1("div", {
  58202. className: "vjs-live-display"
  58203. }, {
  58204. "aria-live": "off"
  58205. });
  58206. this.contentEl_.appendChild(createEl$1("span", {
  58207. className: "vjs-control-text",
  58208. textContent: `${this.localize("Stream Type")}\xA0`
  58209. }));
  58210. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  58211. el.appendChild(this.contentEl_);
  58212. return el;
  58213. }
  58214. dispose() {
  58215. this.contentEl_ = null;
  58216. super.dispose();
  58217. }
  58218. updateShowing(event2) {
  58219. if (this.player().duration() === Infinity) {
  58220. this.show();
  58221. } else {
  58222. this.hide();
  58223. }
  58224. }
  58225. }
  58226. Component$1$1.registerComponent("LiveDisplay", LiveDisplay$1);
  58227. class SeekToLive$1 extends Button$1 {
  58228. constructor(player, options2) {
  58229. super(player, options2);
  58230. this.updateLiveEdgeStatus();
  58231. if (this.player_.liveTracker) {
  58232. this.updateLiveEdgeStatusHandler_ = (e) => this.updateLiveEdgeStatus(e);
  58233. this.on(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58234. }
  58235. }
  58236. createEl() {
  58237. const el = super.createEl("button", {
  58238. className: "vjs-seek-to-live-control vjs-control"
  58239. });
  58240. this.textEl_ = createEl$1("span", {
  58241. className: "vjs-seek-to-live-text",
  58242. textContent: this.localize("LIVE")
  58243. }, {
  58244. "aria-hidden": "true"
  58245. });
  58246. el.appendChild(this.textEl_);
  58247. return el;
  58248. }
  58249. updateLiveEdgeStatus() {
  58250. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  58251. this.setAttribute("aria-disabled", true);
  58252. this.addClass("vjs-at-live-edge");
  58253. this.controlText("Seek to live, currently playing live");
  58254. } else {
  58255. this.setAttribute("aria-disabled", false);
  58256. this.removeClass("vjs-at-live-edge");
  58257. this.controlText("Seek to live, currently behind live");
  58258. }
  58259. }
  58260. handleClick() {
  58261. this.player_.liveTracker.seekToLiveEdge();
  58262. }
  58263. dispose() {
  58264. if (this.player_.liveTracker) {
  58265. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58266. }
  58267. this.textEl_ = null;
  58268. super.dispose();
  58269. }
  58270. }
  58271. SeekToLive$1.prototype.controlText_ = "Seek to live, currently playing live";
  58272. Component$1$1.registerComponent("SeekToLive", SeekToLive$1);
  58273. function clamp$1(number, min2, max2) {
  58274. number = Number(number);
  58275. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  58276. }
  58277. var Num = /* @__PURE__ */ Object.freeze({
  58278. __proto__: null,
  58279. clamp: clamp$1
  58280. });
  58281. class Slider$1 extends Component$1$1 {
  58282. constructor(player, options2) {
  58283. super(player, options2);
  58284. this.handleMouseDown_ = (e) => this.handleMouseDown(e);
  58285. this.handleMouseUp_ = (e) => this.handleMouseUp(e);
  58286. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  58287. this.handleClick_ = (e) => this.handleClick(e);
  58288. this.handleMouseMove_ = (e) => this.handleMouseMove(e);
  58289. this.update_ = (e) => this.update(e);
  58290. this.bar = this.getChild(this.options_.barName);
  58291. this.vertical(!!this.options_.vertical);
  58292. this.enable();
  58293. }
  58294. enabled() {
  58295. return this.enabled_;
  58296. }
  58297. enable() {
  58298. if (this.enabled()) {
  58299. return;
  58300. }
  58301. this.on("mousedown", this.handleMouseDown_);
  58302. this.on("touchstart", this.handleMouseDown_);
  58303. this.on("keydown", this.handleKeyDown_);
  58304. this.on("click", this.handleClick_);
  58305. this.on(this.player_, "controlsvisible", this.update);
  58306. if (this.playerEvent) {
  58307. this.on(this.player_, this.playerEvent, this.update);
  58308. }
  58309. this.removeClass("disabled");
  58310. this.setAttribute("tabindex", 0);
  58311. this.enabled_ = true;
  58312. }
  58313. disable() {
  58314. if (!this.enabled()) {
  58315. return;
  58316. }
  58317. const doc = this.bar.el_.ownerDocument;
  58318. this.off("mousedown", this.handleMouseDown_);
  58319. this.off("touchstart", this.handleMouseDown_);
  58320. this.off("keydown", this.handleKeyDown_);
  58321. this.off("click", this.handleClick_);
  58322. this.off(this.player_, "controlsvisible", this.update_);
  58323. this.off(doc, "mousemove", this.handleMouseMove_);
  58324. this.off(doc, "mouseup", this.handleMouseUp_);
  58325. this.off(doc, "touchmove", this.handleMouseMove_);
  58326. this.off(doc, "touchend", this.handleMouseUp_);
  58327. this.removeAttribute("tabindex");
  58328. this.addClass("disabled");
  58329. if (this.playerEvent) {
  58330. this.off(this.player_, this.playerEvent, this.update);
  58331. }
  58332. this.enabled_ = false;
  58333. }
  58334. createEl(type2, props = {}, attributes = {}) {
  58335. props.className = props.className + " vjs-slider";
  58336. props = Object.assign({
  58337. tabIndex: 0
  58338. }, props);
  58339. attributes = Object.assign({
  58340. "role": "slider",
  58341. "aria-valuenow": 0,
  58342. "aria-valuemin": 0,
  58343. "aria-valuemax": 100
  58344. }, attributes);
  58345. return super.createEl(type2, props, attributes);
  58346. }
  58347. handleMouseDown(event2) {
  58348. const doc = this.bar.el_.ownerDocument;
  58349. if (event2.type === "mousedown") {
  58350. event2.preventDefault();
  58351. }
  58352. if (event2.type === "touchstart" && !IS_CHROME$1) {
  58353. event2.preventDefault();
  58354. }
  58355. blockTextSelection$1();
  58356. this.addClass("vjs-sliding");
  58357. this.trigger("slideractive");
  58358. this.on(doc, "mousemove", this.handleMouseMove_);
  58359. this.on(doc, "mouseup", this.handleMouseUp_);
  58360. this.on(doc, "touchmove", this.handleMouseMove_);
  58361. this.on(doc, "touchend", this.handleMouseUp_);
  58362. this.handleMouseMove(event2, true);
  58363. }
  58364. handleMouseMove(event2) {
  58365. }
  58366. handleMouseUp(event2) {
  58367. const doc = this.bar.el_.ownerDocument;
  58368. unblockTextSelection$1();
  58369. this.removeClass("vjs-sliding");
  58370. this.trigger("sliderinactive");
  58371. this.off(doc, "mousemove", this.handleMouseMove_);
  58372. this.off(doc, "mouseup", this.handleMouseUp_);
  58373. this.off(doc, "touchmove", this.handleMouseMove_);
  58374. this.off(doc, "touchend", this.handleMouseUp_);
  58375. this.update();
  58376. }
  58377. update() {
  58378. if (!this.el_ || !this.bar) {
  58379. return;
  58380. }
  58381. const progress = this.getProgress();
  58382. if (progress === this.progress_) {
  58383. return progress;
  58384. }
  58385. this.progress_ = progress;
  58386. this.requestNamedAnimationFrame("Slider#update", () => {
  58387. const sizeKey = this.vertical() ? "height" : "width";
  58388. this.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  58389. });
  58390. return progress;
  58391. }
  58392. getProgress() {
  58393. return Number(clamp$1(this.getPercent(), 0, 1).toFixed(4));
  58394. }
  58395. calculateDistance(event2) {
  58396. const position2 = getPointerPosition$1(this.el_, event2);
  58397. if (this.vertical()) {
  58398. return position2.y;
  58399. }
  58400. return position2.x;
  58401. }
  58402. handleKeyDown(event2) {
  58403. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  58404. event2.preventDefault();
  58405. event2.stopPropagation();
  58406. this.stepBack();
  58407. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  58408. event2.preventDefault();
  58409. event2.stopPropagation();
  58410. this.stepForward();
  58411. } else {
  58412. super.handleKeyDown(event2);
  58413. }
  58414. }
  58415. handleClick(event2) {
  58416. event2.stopPropagation();
  58417. event2.preventDefault();
  58418. }
  58419. vertical(bool) {
  58420. if (bool === void 0) {
  58421. return this.vertical_ || false;
  58422. }
  58423. this.vertical_ = !!bool;
  58424. if (this.vertical_) {
  58425. this.addClass("vjs-slider-vertical");
  58426. } else {
  58427. this.addClass("vjs-slider-horizontal");
  58428. }
  58429. }
  58430. }
  58431. Component$1$1.registerComponent("Slider", Slider$1);
  58432. const percentify$1 = (time, end) => clamp$1(time / end * 100, 0, 100).toFixed(2) + "%";
  58433. class LoadProgressBar$1 extends Component$1$1 {
  58434. constructor(player, options2) {
  58435. super(player, options2);
  58436. this.partEls_ = [];
  58437. this.on(player, "progress", (e) => this.update(e));
  58438. }
  58439. createEl() {
  58440. const el = super.createEl("div", {
  58441. className: "vjs-load-progress"
  58442. });
  58443. const wrapper = createEl$1("span", {
  58444. className: "vjs-control-text"
  58445. });
  58446. const loadedText = createEl$1("span", {
  58447. textContent: this.localize("Loaded")
  58448. });
  58449. const separator = document_1.createTextNode(": ");
  58450. this.percentageEl_ = createEl$1("span", {
  58451. className: "vjs-control-text-loaded-percentage",
  58452. textContent: "0%"
  58453. });
  58454. el.appendChild(wrapper);
  58455. wrapper.appendChild(loadedText);
  58456. wrapper.appendChild(separator);
  58457. wrapper.appendChild(this.percentageEl_);
  58458. return el;
  58459. }
  58460. dispose() {
  58461. this.partEls_ = null;
  58462. this.percentageEl_ = null;
  58463. super.dispose();
  58464. }
  58465. update(event2) {
  58466. this.requestNamedAnimationFrame("LoadProgressBar#update", () => {
  58467. const liveTracker = this.player_.liveTracker;
  58468. const buffered = this.player_.buffered();
  58469. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  58470. const bufferedEnd = this.player_.bufferedEnd();
  58471. const children = this.partEls_;
  58472. const percent = percentify$1(bufferedEnd, duration5);
  58473. if (this.percent_ !== percent) {
  58474. this.el_.style.width = percent;
  58475. textContent$1(this.percentageEl_, percent);
  58476. this.percent_ = percent;
  58477. }
  58478. for (let i2 = 0; i2 < buffered.length; i2++) {
  58479. const start2 = buffered.start(i2);
  58480. const end = buffered.end(i2);
  58481. let part = children[i2];
  58482. if (!part) {
  58483. part = this.el_.appendChild(createEl$1());
  58484. children[i2] = part;
  58485. }
  58486. if (part.dataset.start === start2 && part.dataset.end === end) {
  58487. continue;
  58488. }
  58489. part.dataset.start = start2;
  58490. part.dataset.end = end;
  58491. part.style.left = percentify$1(start2, bufferedEnd);
  58492. part.style.width = percentify$1(end - start2, bufferedEnd);
  58493. }
  58494. for (let i2 = children.length; i2 > buffered.length; i2--) {
  58495. this.el_.removeChild(children[i2 - 1]);
  58496. }
  58497. children.length = buffered.length;
  58498. });
  58499. }
  58500. }
  58501. Component$1$1.registerComponent("LoadProgressBar", LoadProgressBar$1);
  58502. class TimeTooltip$1 extends Component$1$1 {
  58503. constructor(player, options2) {
  58504. super(player, options2);
  58505. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58506. }
  58507. createEl() {
  58508. return super.createEl("div", {
  58509. className: "vjs-time-tooltip"
  58510. }, {
  58511. "aria-hidden": "true"
  58512. });
  58513. }
  58514. update(seekBarRect, seekBarPoint, content) {
  58515. const tooltipRect = findPosition$1(this.el_);
  58516. const playerRect = getBoundingClientRect$1(this.player_.el());
  58517. const seekBarPointPx = seekBarRect.width * seekBarPoint;
  58518. if (!playerRect || !tooltipRect) {
  58519. return;
  58520. }
  58521. const spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  58522. const spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  58523. let pullTooltipBy = tooltipRect.width / 2;
  58524. if (spaceLeftOfPoint < pullTooltipBy) {
  58525. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  58526. } else if (spaceRightOfPoint < pullTooltipBy) {
  58527. pullTooltipBy = spaceRightOfPoint;
  58528. }
  58529. if (pullTooltipBy < 0) {
  58530. pullTooltipBy = 0;
  58531. } else if (pullTooltipBy > tooltipRect.width) {
  58532. pullTooltipBy = tooltipRect.width;
  58533. }
  58534. pullTooltipBy = Math.round(pullTooltipBy);
  58535. this.el_.style.right = `-${pullTooltipBy}px`;
  58536. this.write(content);
  58537. }
  58538. write(content) {
  58539. textContent$1(this.el_, content);
  58540. }
  58541. updateTime(seekBarRect, seekBarPoint, time, cb) {
  58542. this.requestNamedAnimationFrame("TimeTooltip#updateTime", () => {
  58543. let content;
  58544. const duration5 = this.player_.duration();
  58545. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58546. const liveWindow = this.player_.liveTracker.liveWindow();
  58547. const secondsBehind = liveWindow - seekBarPoint * liveWindow;
  58548. content = (secondsBehind < 1 ? "" : "-") + formatTime$1(secondsBehind, liveWindow);
  58549. } else {
  58550. content = formatTime$1(time, duration5);
  58551. }
  58552. this.update(seekBarRect, seekBarPoint, content);
  58553. if (cb) {
  58554. cb();
  58555. }
  58556. });
  58557. }
  58558. }
  58559. Component$1$1.registerComponent("TimeTooltip", TimeTooltip$1);
  58560. class PlayProgressBar$1 extends Component$1$1 {
  58561. constructor(player, options2) {
  58562. super(player, options2);
  58563. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58564. }
  58565. createEl() {
  58566. return super.createEl("div", {
  58567. className: "vjs-play-progress vjs-slider-bar"
  58568. }, {
  58569. "aria-hidden": "true"
  58570. });
  58571. }
  58572. update(seekBarRect, seekBarPoint) {
  58573. const timeTooltip = this.getChild("timeTooltip");
  58574. if (!timeTooltip) {
  58575. return;
  58576. }
  58577. const time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58578. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  58579. }
  58580. }
  58581. PlayProgressBar$1.prototype.options_ = {
  58582. children: []
  58583. };
  58584. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58585. PlayProgressBar$1.prototype.options_.children.push("timeTooltip");
  58586. }
  58587. Component$1$1.registerComponent("PlayProgressBar", PlayProgressBar$1);
  58588. class MouseTimeDisplay$1 extends Component$1$1 {
  58589. constructor(player, options2) {
  58590. super(player, options2);
  58591. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58592. }
  58593. createEl() {
  58594. return super.createEl("div", {
  58595. className: "vjs-mouse-display"
  58596. });
  58597. }
  58598. update(seekBarRect, seekBarPoint) {
  58599. const time = seekBarPoint * this.player_.duration();
  58600. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, () => {
  58601. this.el_.style.left = `${seekBarRect.width * seekBarPoint}px`;
  58602. });
  58603. }
  58604. }
  58605. MouseTimeDisplay$1.prototype.options_ = {
  58606. children: ["timeTooltip"]
  58607. };
  58608. Component$1$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay$1);
  58609. const STEP_SECONDS$1 = 5;
  58610. const PAGE_KEY_MULTIPLIER$1 = 12;
  58611. class SeekBar$1 extends Slider$1 {
  58612. constructor(player, options2) {
  58613. super(player, options2);
  58614. this.setEventHandlers_();
  58615. }
  58616. setEventHandlers_() {
  58617. this.update_ = bind_(this, this.update);
  58618. this.update = throttle$1(this.update_, UPDATE_REFRESH_INTERVAL$1);
  58619. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58620. if (this.player_.liveTracker) {
  58621. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  58622. }
  58623. this.updateInterval = null;
  58624. this.enableIntervalHandler_ = (e) => this.enableInterval_(e);
  58625. this.disableIntervalHandler_ = (e) => this.disableInterval_(e);
  58626. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  58627. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58628. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58629. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  58630. }
  58631. }
  58632. toggleVisibility_(e) {
  58633. if (document_1.visibilityState === "hidden") {
  58634. this.cancelNamedAnimationFrame("SeekBar#update");
  58635. this.cancelNamedAnimationFrame("Slider#update");
  58636. this.disableInterval_(e);
  58637. } else {
  58638. if (!this.player_.ended() && !this.player_.paused()) {
  58639. this.enableInterval_();
  58640. }
  58641. this.update();
  58642. }
  58643. }
  58644. enableInterval_() {
  58645. if (this.updateInterval) {
  58646. return;
  58647. }
  58648. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL$1);
  58649. }
  58650. disableInterval_(e) {
  58651. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  58652. return;
  58653. }
  58654. if (!this.updateInterval) {
  58655. return;
  58656. }
  58657. this.clearInterval(this.updateInterval);
  58658. this.updateInterval = null;
  58659. }
  58660. createEl() {
  58661. return super.createEl("div", {
  58662. className: "vjs-progress-holder"
  58663. }, {
  58664. "aria-label": this.localize("Progress Bar")
  58665. });
  58666. }
  58667. update(event2) {
  58668. if (document_1.visibilityState === "hidden") {
  58669. return;
  58670. }
  58671. const percent = super.update();
  58672. this.requestNamedAnimationFrame("SeekBar#update", () => {
  58673. const currentTime = this.player_.ended() ? this.player_.duration() : this.getCurrentTime_();
  58674. const liveTracker = this.player_.liveTracker;
  58675. let duration5 = this.player_.duration();
  58676. if (liveTracker && liveTracker.isLive()) {
  58677. duration5 = this.player_.liveTracker.liveCurrentTime();
  58678. }
  58679. if (this.percent_ !== percent) {
  58680. this.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  58681. this.percent_ = percent;
  58682. }
  58683. if (this.currentTime_ !== currentTime || this.duration_ !== duration5) {
  58684. 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}"));
  58685. this.currentTime_ = currentTime;
  58686. this.duration_ = duration5;
  58687. }
  58688. if (this.bar) {
  58689. this.bar.update(getBoundingClientRect$1(this.el()), this.getProgress());
  58690. }
  58691. });
  58692. return percent;
  58693. }
  58694. userSeek_(ct2) {
  58695. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58696. this.player_.liveTracker.nextSeekedFromUser();
  58697. }
  58698. this.player_.currentTime(ct2);
  58699. }
  58700. getCurrentTime_() {
  58701. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58702. }
  58703. getPercent() {
  58704. const currentTime = this.getCurrentTime_();
  58705. let percent;
  58706. const liveTracker = this.player_.liveTracker;
  58707. if (liveTracker && liveTracker.isLive()) {
  58708. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  58709. if (liveTracker.atLiveEdge()) {
  58710. percent = 1;
  58711. }
  58712. } else {
  58713. percent = currentTime / this.player_.duration();
  58714. }
  58715. return percent;
  58716. }
  58717. handleMouseDown(event2) {
  58718. if (!isSingleLeftClick$1(event2)) {
  58719. return;
  58720. }
  58721. event2.stopPropagation();
  58722. this.videoWasPlaying = !this.player_.paused();
  58723. this.player_.pause();
  58724. super.handleMouseDown(event2);
  58725. }
  58726. handleMouseMove(event2, mouseDown = false) {
  58727. if (!isSingleLeftClick$1(event2)) {
  58728. return;
  58729. }
  58730. if (!mouseDown && !this.player_.scrubbing()) {
  58731. this.player_.scrubbing(true);
  58732. }
  58733. let newTime;
  58734. const distance2 = this.calculateDistance(event2);
  58735. const liveTracker = this.player_.liveTracker;
  58736. if (!liveTracker || !liveTracker.isLive()) {
  58737. newTime = distance2 * this.player_.duration();
  58738. if (newTime === this.player_.duration()) {
  58739. newTime = newTime - 0.1;
  58740. }
  58741. } else {
  58742. if (distance2 >= 0.99) {
  58743. liveTracker.seekToLiveEdge();
  58744. return;
  58745. }
  58746. const seekableStart = liveTracker.seekableStart();
  58747. const seekableEnd = liveTracker.liveCurrentTime();
  58748. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  58749. if (newTime >= seekableEnd) {
  58750. newTime = seekableEnd;
  58751. }
  58752. if (newTime <= seekableStart) {
  58753. newTime = seekableStart + 0.1;
  58754. }
  58755. if (newTime === Infinity) {
  58756. return;
  58757. }
  58758. }
  58759. this.userSeek_(newTime);
  58760. }
  58761. enable() {
  58762. super.enable();
  58763. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58764. if (!mouseTimeDisplay) {
  58765. return;
  58766. }
  58767. mouseTimeDisplay.show();
  58768. }
  58769. disable() {
  58770. super.disable();
  58771. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58772. if (!mouseTimeDisplay) {
  58773. return;
  58774. }
  58775. mouseTimeDisplay.hide();
  58776. }
  58777. handleMouseUp(event2) {
  58778. super.handleMouseUp(event2);
  58779. if (event2) {
  58780. event2.stopPropagation();
  58781. }
  58782. this.player_.scrubbing(false);
  58783. this.player_.trigger({
  58784. type: "timeupdate",
  58785. target: this,
  58786. manuallyTriggered: true
  58787. });
  58788. if (this.videoWasPlaying) {
  58789. silencePromise$1(this.player_.play());
  58790. } else {
  58791. this.update_();
  58792. }
  58793. }
  58794. stepForward() {
  58795. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1);
  58796. }
  58797. stepBack() {
  58798. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1);
  58799. }
  58800. handleAction(event2) {
  58801. if (this.player_.paused()) {
  58802. this.player_.play();
  58803. } else {
  58804. this.player_.pause();
  58805. }
  58806. }
  58807. handleKeyDown(event2) {
  58808. const liveTracker = this.player_.liveTracker;
  58809. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  58810. event2.preventDefault();
  58811. event2.stopPropagation();
  58812. this.handleAction(event2);
  58813. } else if (keycode.isEventKey(event2, "Home")) {
  58814. event2.preventDefault();
  58815. event2.stopPropagation();
  58816. this.userSeek_(0);
  58817. } else if (keycode.isEventKey(event2, "End")) {
  58818. event2.preventDefault();
  58819. event2.stopPropagation();
  58820. if (liveTracker && liveTracker.isLive()) {
  58821. this.userSeek_(liveTracker.liveCurrentTime());
  58822. } else {
  58823. this.userSeek_(this.player_.duration());
  58824. }
  58825. } else if (/^[0-9]$/.test(keycode(event2))) {
  58826. event2.preventDefault();
  58827. event2.stopPropagation();
  58828. const gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  58829. if (liveTracker && liveTracker.isLive()) {
  58830. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  58831. } else {
  58832. this.userSeek_(this.player_.duration() * gotoFraction);
  58833. }
  58834. } else if (keycode.isEventKey(event2, "PgDn")) {
  58835. event2.preventDefault();
  58836. event2.stopPropagation();
  58837. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58838. } else if (keycode.isEventKey(event2, "PgUp")) {
  58839. event2.preventDefault();
  58840. event2.stopPropagation();
  58841. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58842. } else {
  58843. super.handleKeyDown(event2);
  58844. }
  58845. }
  58846. dispose() {
  58847. this.disableInterval_();
  58848. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58849. if (this.player_.liveTracker) {
  58850. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  58851. }
  58852. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  58853. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58854. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58855. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  58856. }
  58857. super.dispose();
  58858. }
  58859. }
  58860. SeekBar$1.prototype.options_ = {
  58861. children: ["loadProgressBar", "playProgressBar"],
  58862. barName: "playProgressBar"
  58863. };
  58864. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58865. SeekBar$1.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  58866. }
  58867. Component$1$1.registerComponent("SeekBar", SeekBar$1);
  58868. class ProgressControl$1 extends Component$1$1 {
  58869. constructor(player, options2) {
  58870. super(player, options2);
  58871. this.handleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  58872. this.throttledHandleMouseSeek = throttle$1(bind_(this, this.handleMouseSeek), UPDATE_REFRESH_INTERVAL$1);
  58873. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  58874. this.handleMouseDownHandler_ = (e) => this.handleMouseDown(e);
  58875. this.enable();
  58876. }
  58877. createEl() {
  58878. return super.createEl("div", {
  58879. className: "vjs-progress-control vjs-control"
  58880. });
  58881. }
  58882. handleMouseMove(event2) {
  58883. const seekBar = this.getChild("seekBar");
  58884. if (!seekBar) {
  58885. return;
  58886. }
  58887. const playProgressBar = seekBar.getChild("playProgressBar");
  58888. const mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  58889. if (!playProgressBar && !mouseTimeDisplay) {
  58890. return;
  58891. }
  58892. const seekBarEl = seekBar.el();
  58893. const seekBarRect = findPosition$1(seekBarEl);
  58894. let seekBarPoint = getPointerPosition$1(seekBarEl, event2).x;
  58895. seekBarPoint = clamp$1(seekBarPoint, 0, 1);
  58896. if (mouseTimeDisplay) {
  58897. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  58898. }
  58899. if (playProgressBar) {
  58900. playProgressBar.update(seekBarRect, seekBar.getProgress());
  58901. }
  58902. }
  58903. handleMouseSeek(event2) {
  58904. const seekBar = this.getChild("seekBar");
  58905. if (seekBar) {
  58906. seekBar.handleMouseMove(event2);
  58907. }
  58908. }
  58909. enabled() {
  58910. return this.enabled_;
  58911. }
  58912. disable() {
  58913. this.children().forEach((child) => child.disable && child.disable());
  58914. if (!this.enabled()) {
  58915. return;
  58916. }
  58917. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58918. this.off(this.el_, "mousemove", this.handleMouseMove);
  58919. this.removeListenersAddedOnMousedownAndTouchstart();
  58920. this.addClass("disabled");
  58921. this.enabled_ = false;
  58922. if (this.player_.scrubbing()) {
  58923. const seekBar = this.getChild("seekBar");
  58924. this.player_.scrubbing(false);
  58925. if (seekBar.videoWasPlaying) {
  58926. silencePromise$1(this.player_.play());
  58927. }
  58928. }
  58929. }
  58930. enable() {
  58931. this.children().forEach((child) => child.enable && child.enable());
  58932. if (this.enabled()) {
  58933. return;
  58934. }
  58935. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58936. this.on(this.el_, "mousemove", this.handleMouseMove);
  58937. this.removeClass("disabled");
  58938. this.enabled_ = true;
  58939. }
  58940. removeListenersAddedOnMousedownAndTouchstart() {
  58941. const doc = this.el_.ownerDocument;
  58942. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  58943. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  58944. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  58945. this.off(doc, "touchend", this.handleMouseUpHandler_);
  58946. }
  58947. handleMouseDown(event2) {
  58948. const doc = this.el_.ownerDocument;
  58949. const seekBar = this.getChild("seekBar");
  58950. if (seekBar) {
  58951. seekBar.handleMouseDown(event2);
  58952. }
  58953. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  58954. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  58955. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  58956. this.on(doc, "touchend", this.handleMouseUpHandler_);
  58957. }
  58958. handleMouseUp(event2) {
  58959. const seekBar = this.getChild("seekBar");
  58960. if (seekBar) {
  58961. seekBar.handleMouseUp(event2);
  58962. }
  58963. this.removeListenersAddedOnMousedownAndTouchstart();
  58964. }
  58965. }
  58966. ProgressControl$1.prototype.options_ = {
  58967. children: ["seekBar"]
  58968. };
  58969. Component$1$1.registerComponent("ProgressControl", ProgressControl$1);
  58970. class PictureInPictureToggle$1 extends Button$1 {
  58971. constructor(player, options2) {
  58972. super(player, options2);
  58973. this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], (e) => this.handlePictureInPictureChange(e));
  58974. this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], (e) => this.handlePictureInPictureEnabledChange(e));
  58975. this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], () => {
  58976. const isSourceAudio = player.currentType().substring(0, 5) === "audio";
  58977. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  58978. if (player.isInPictureInPicture()) {
  58979. player.exitPictureInPicture();
  58980. }
  58981. this.hide();
  58982. } else {
  58983. this.show();
  58984. }
  58985. });
  58986. this.disable();
  58987. }
  58988. buildCSSClass() {
  58989. return `vjs-picture-in-picture-control ${super.buildCSSClass()}`;
  58990. }
  58991. handlePictureInPictureEnabledChange() {
  58992. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false || this.player_.options_.enableDocumentPictureInPicture && "documentPictureInPicture" in window_1) {
  58993. this.enable();
  58994. } else {
  58995. this.disable();
  58996. }
  58997. }
  58998. handlePictureInPictureChange(event2) {
  58999. if (this.player_.isInPictureInPicture()) {
  59000. this.controlText("Exit Picture-in-Picture");
  59001. } else {
  59002. this.controlText("Picture-in-Picture");
  59003. }
  59004. this.handlePictureInPictureEnabledChange();
  59005. }
  59006. handleClick(event2) {
  59007. if (!this.player_.isInPictureInPicture()) {
  59008. this.player_.requestPictureInPicture();
  59009. } else {
  59010. this.player_.exitPictureInPicture();
  59011. }
  59012. }
  59013. }
  59014. PictureInPictureToggle$1.prototype.controlText_ = "Picture-in-Picture";
  59015. Component$1$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle$1);
  59016. class FullscreenToggle$1 extends Button$1 {
  59017. constructor(player, options2) {
  59018. super(player, options2);
  59019. this.on(player, "fullscreenchange", (e) => this.handleFullscreenChange(e));
  59020. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  59021. this.disable();
  59022. }
  59023. }
  59024. buildCSSClass() {
  59025. return `vjs-fullscreen-control ${super.buildCSSClass()}`;
  59026. }
  59027. handleFullscreenChange(event2) {
  59028. if (this.player_.isFullscreen()) {
  59029. this.controlText("Exit Fullscreen");
  59030. } else {
  59031. this.controlText("Fullscreen");
  59032. }
  59033. }
  59034. handleClick(event2) {
  59035. if (!this.player_.isFullscreen()) {
  59036. this.player_.requestFullscreen();
  59037. } else {
  59038. this.player_.exitFullscreen();
  59039. }
  59040. }
  59041. }
  59042. FullscreenToggle$1.prototype.controlText_ = "Fullscreen";
  59043. Component$1$1.registerComponent("FullscreenToggle", FullscreenToggle$1);
  59044. const checkVolumeSupport$1 = function(self2, player) {
  59045. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  59046. self2.addClass("vjs-hidden");
  59047. }
  59048. self2.on(player, "loadstart", function() {
  59049. if (!player.tech_.featuresVolumeControl) {
  59050. self2.addClass("vjs-hidden");
  59051. } else {
  59052. self2.removeClass("vjs-hidden");
  59053. }
  59054. });
  59055. };
  59056. class VolumeLevel$1 extends Component$1$1 {
  59057. createEl() {
  59058. const el = super.createEl("div", {
  59059. className: "vjs-volume-level"
  59060. });
  59061. el.appendChild(super.createEl("span", {
  59062. className: "vjs-control-text"
  59063. }));
  59064. return el;
  59065. }
  59066. }
  59067. Component$1$1.registerComponent("VolumeLevel", VolumeLevel$1);
  59068. class VolumeLevelTooltip$1 extends Component$1$1 {
  59069. constructor(player, options2) {
  59070. super(player, options2);
  59071. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  59072. }
  59073. createEl() {
  59074. return super.createEl("div", {
  59075. className: "vjs-volume-tooltip"
  59076. }, {
  59077. "aria-hidden": "true"
  59078. });
  59079. }
  59080. update(rangeBarRect, rangeBarPoint, vertical, content) {
  59081. if (!vertical) {
  59082. const tooltipRect = getBoundingClientRect$1(this.el_);
  59083. const playerRect = getBoundingClientRect$1(this.player_.el());
  59084. const volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  59085. if (!playerRect || !tooltipRect) {
  59086. return;
  59087. }
  59088. const spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  59089. const spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  59090. let pullTooltipBy = tooltipRect.width / 2;
  59091. if (spaceLeftOfPoint < pullTooltipBy) {
  59092. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  59093. } else if (spaceRightOfPoint < pullTooltipBy) {
  59094. pullTooltipBy = spaceRightOfPoint;
  59095. }
  59096. if (pullTooltipBy < 0) {
  59097. pullTooltipBy = 0;
  59098. } else if (pullTooltipBy > tooltipRect.width) {
  59099. pullTooltipBy = tooltipRect.width;
  59100. }
  59101. this.el_.style.right = `-${pullTooltipBy}px`;
  59102. }
  59103. this.write(`${content}%`);
  59104. }
  59105. write(content) {
  59106. textContent$1(this.el_, content);
  59107. }
  59108. updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  59109. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", () => {
  59110. this.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  59111. if (cb) {
  59112. cb();
  59113. }
  59114. });
  59115. }
  59116. }
  59117. Component$1$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip$1);
  59118. class MouseVolumeLevelDisplay$1 extends Component$1$1 {
  59119. constructor(player, options2) {
  59120. super(player, options2);
  59121. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  59122. }
  59123. createEl() {
  59124. return super.createEl("div", {
  59125. className: "vjs-mouse-display"
  59126. });
  59127. }
  59128. update(rangeBarRect, rangeBarPoint, vertical) {
  59129. const volume = 100 * rangeBarPoint;
  59130. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, () => {
  59131. if (vertical) {
  59132. this.el_.style.bottom = `${rangeBarRect.height * rangeBarPoint}px`;
  59133. } else {
  59134. this.el_.style.left = `${rangeBarRect.width * rangeBarPoint}px`;
  59135. }
  59136. });
  59137. }
  59138. }
  59139. MouseVolumeLevelDisplay$1.prototype.options_ = {
  59140. children: ["volumeLevelTooltip"]
  59141. };
  59142. Component$1$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay$1);
  59143. class VolumeBar$1 extends Slider$1 {
  59144. constructor(player, options2) {
  59145. super(player, options2);
  59146. this.on("slideractive", (e) => this.updateLastVolume_(e));
  59147. this.on(player, "volumechange", (e) => this.updateARIAAttributes(e));
  59148. player.ready(() => this.updateARIAAttributes());
  59149. }
  59150. createEl() {
  59151. return super.createEl("div", {
  59152. className: "vjs-volume-bar vjs-slider-bar"
  59153. }, {
  59154. "aria-label": this.localize("Volume Level"),
  59155. "aria-live": "polite"
  59156. });
  59157. }
  59158. handleMouseDown(event2) {
  59159. if (!isSingleLeftClick$1(event2)) {
  59160. return;
  59161. }
  59162. super.handleMouseDown(event2);
  59163. }
  59164. handleMouseMove(event2) {
  59165. const mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  59166. if (mouseVolumeLevelDisplay) {
  59167. const volumeBarEl = this.el();
  59168. const volumeBarRect = getBoundingClientRect$1(volumeBarEl);
  59169. const vertical = this.vertical();
  59170. let volumeBarPoint = getPointerPosition$1(volumeBarEl, event2);
  59171. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  59172. volumeBarPoint = clamp$1(volumeBarPoint, 0, 1);
  59173. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  59174. }
  59175. if (!isSingleLeftClick$1(event2)) {
  59176. return;
  59177. }
  59178. this.checkMuted();
  59179. this.player_.volume(this.calculateDistance(event2));
  59180. }
  59181. checkMuted() {
  59182. if (this.player_.muted()) {
  59183. this.player_.muted(false);
  59184. }
  59185. }
  59186. getPercent() {
  59187. if (this.player_.muted()) {
  59188. return 0;
  59189. }
  59190. return this.player_.volume();
  59191. }
  59192. stepForward() {
  59193. this.checkMuted();
  59194. this.player_.volume(this.player_.volume() + 0.1);
  59195. }
  59196. stepBack() {
  59197. this.checkMuted();
  59198. this.player_.volume(this.player_.volume() - 0.1);
  59199. }
  59200. updateARIAAttributes(event2) {
  59201. const ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  59202. this.el_.setAttribute("aria-valuenow", ariaValue);
  59203. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  59204. }
  59205. volumeAsPercentage_() {
  59206. return Math.round(this.player_.volume() * 100);
  59207. }
  59208. updateLastVolume_() {
  59209. const volumeBeforeDrag = this.player_.volume();
  59210. this.one("sliderinactive", () => {
  59211. if (this.player_.volume() === 0) {
  59212. this.player_.lastVolume_(volumeBeforeDrag);
  59213. }
  59214. });
  59215. }
  59216. }
  59217. VolumeBar$1.prototype.options_ = {
  59218. children: ["volumeLevel"],
  59219. barName: "volumeLevel"
  59220. };
  59221. if (!IS_IOS$1 && !IS_ANDROID$1) {
  59222. VolumeBar$1.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  59223. }
  59224. VolumeBar$1.prototype.playerEvent = "volumechange";
  59225. Component$1$1.registerComponent("VolumeBar", VolumeBar$1);
  59226. class VolumeControl$1 extends Component$1$1 {
  59227. constructor(player, options2 = {}) {
  59228. options2.vertical = options2.vertical || false;
  59229. if (typeof options2.volumeBar === "undefined" || isPlain$1(options2.volumeBar)) {
  59230. options2.volumeBar = options2.volumeBar || {};
  59231. options2.volumeBar.vertical = options2.vertical;
  59232. }
  59233. super(player, options2);
  59234. checkVolumeSupport$1(this, player);
  59235. this.throttledHandleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  59236. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  59237. this.on("mousedown", (e) => this.handleMouseDown(e));
  59238. this.on("touchstart", (e) => this.handleMouseDown(e));
  59239. this.on("mousemove", (e) => this.handleMouseMove(e));
  59240. this.on(this.volumeBar, ["focus", "slideractive"], () => {
  59241. this.volumeBar.addClass("vjs-slider-active");
  59242. this.addClass("vjs-slider-active");
  59243. this.trigger("slideractive");
  59244. });
  59245. this.on(this.volumeBar, ["blur", "sliderinactive"], () => {
  59246. this.volumeBar.removeClass("vjs-slider-active");
  59247. this.removeClass("vjs-slider-active");
  59248. this.trigger("sliderinactive");
  59249. });
  59250. }
  59251. createEl() {
  59252. let orientationClass = "vjs-volume-horizontal";
  59253. if (this.options_.vertical) {
  59254. orientationClass = "vjs-volume-vertical";
  59255. }
  59256. return super.createEl("div", {
  59257. className: `vjs-volume-control vjs-control ${orientationClass}`
  59258. });
  59259. }
  59260. handleMouseDown(event2) {
  59261. const doc = this.el_.ownerDocument;
  59262. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  59263. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  59264. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  59265. this.on(doc, "touchend", this.handleMouseUpHandler_);
  59266. }
  59267. handleMouseUp(event2) {
  59268. const doc = this.el_.ownerDocument;
  59269. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  59270. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  59271. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  59272. this.off(doc, "touchend", this.handleMouseUpHandler_);
  59273. }
  59274. handleMouseMove(event2) {
  59275. this.volumeBar.handleMouseMove(event2);
  59276. }
  59277. }
  59278. VolumeControl$1.prototype.options_ = {
  59279. children: ["volumeBar"]
  59280. };
  59281. Component$1$1.registerComponent("VolumeControl", VolumeControl$1);
  59282. const checkMuteSupport$1 = function(self2, player) {
  59283. if (player.tech_ && !player.tech_.featuresMuteControl) {
  59284. self2.addClass("vjs-hidden");
  59285. }
  59286. self2.on(player, "loadstart", function() {
  59287. if (!player.tech_.featuresMuteControl) {
  59288. self2.addClass("vjs-hidden");
  59289. } else {
  59290. self2.removeClass("vjs-hidden");
  59291. }
  59292. });
  59293. };
  59294. class MuteToggle$1 extends Button$1 {
  59295. constructor(player, options2) {
  59296. super(player, options2);
  59297. checkMuteSupport$1(this, player);
  59298. this.on(player, ["loadstart", "volumechange"], (e) => this.update(e));
  59299. }
  59300. buildCSSClass() {
  59301. return `vjs-mute-control ${super.buildCSSClass()}`;
  59302. }
  59303. handleClick(event2) {
  59304. const vol = this.player_.volume();
  59305. const lastVolume = this.player_.lastVolume_();
  59306. if (vol === 0) {
  59307. const volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  59308. this.player_.volume(volumeToSet);
  59309. this.player_.muted(false);
  59310. } else {
  59311. this.player_.muted(this.player_.muted() ? false : true);
  59312. }
  59313. }
  59314. update(event2) {
  59315. this.updateIcon_();
  59316. this.updateControlText_();
  59317. }
  59318. updateIcon_() {
  59319. const vol = this.player_.volume();
  59320. let level = 3;
  59321. if (IS_IOS$1 && this.player_.tech_ && this.player_.tech_.el_) {
  59322. this.player_.muted(this.player_.tech_.el_.muted);
  59323. }
  59324. if (vol === 0 || this.player_.muted()) {
  59325. level = 0;
  59326. } else if (vol < 0.33) {
  59327. level = 1;
  59328. } else if (vol < 0.67) {
  59329. level = 2;
  59330. }
  59331. removeClass$1(this.el_, [0, 1, 2, 3].reduce((str, i2) => str + `${i2 ? " " : ""}vjs-vol-${i2}`, ""));
  59332. addClass$1(this.el_, `vjs-vol-${level}`);
  59333. }
  59334. updateControlText_() {
  59335. const soundOff = this.player_.muted() || this.player_.volume() === 0;
  59336. const text = soundOff ? "Unmute" : "Mute";
  59337. if (this.controlText() !== text) {
  59338. this.controlText(text);
  59339. }
  59340. }
  59341. }
  59342. MuteToggle$1.prototype.controlText_ = "Mute";
  59343. Component$1$1.registerComponent("MuteToggle", MuteToggle$1);
  59344. class VolumePanel$1 extends Component$1$1 {
  59345. constructor(player, options2 = {}) {
  59346. if (typeof options2.inline !== "undefined") {
  59347. options2.inline = options2.inline;
  59348. } else {
  59349. options2.inline = true;
  59350. }
  59351. if (typeof options2.volumeControl === "undefined" || isPlain$1(options2.volumeControl)) {
  59352. options2.volumeControl = options2.volumeControl || {};
  59353. options2.volumeControl.vertical = !options2.inline;
  59354. }
  59355. super(player, options2);
  59356. this.handleKeyPressHandler_ = (e) => this.handleKeyPress(e);
  59357. this.on(player, ["loadstart"], (e) => this.volumePanelState_(e));
  59358. this.on(this.muteToggle, "keyup", (e) => this.handleKeyPress(e));
  59359. this.on(this.volumeControl, "keyup", (e) => this.handleVolumeControlKeyUp(e));
  59360. this.on("keydown", (e) => this.handleKeyPress(e));
  59361. this.on("mouseover", (e) => this.handleMouseOver(e));
  59362. this.on("mouseout", (e) => this.handleMouseOut(e));
  59363. this.on(this.volumeControl, ["slideractive"], this.sliderActive_);
  59364. this.on(this.volumeControl, ["sliderinactive"], this.sliderInactive_);
  59365. }
  59366. sliderActive_() {
  59367. this.addClass("vjs-slider-active");
  59368. }
  59369. sliderInactive_() {
  59370. this.removeClass("vjs-slider-active");
  59371. }
  59372. volumePanelState_() {
  59373. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  59374. this.addClass("vjs-hidden");
  59375. }
  59376. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  59377. this.addClass("vjs-mute-toggle-only");
  59378. }
  59379. }
  59380. createEl() {
  59381. let orientationClass = "vjs-volume-panel-horizontal";
  59382. if (!this.options_.inline) {
  59383. orientationClass = "vjs-volume-panel-vertical";
  59384. }
  59385. return super.createEl("div", {
  59386. className: `vjs-volume-panel vjs-control ${orientationClass}`
  59387. });
  59388. }
  59389. dispose() {
  59390. this.handleMouseOut();
  59391. super.dispose();
  59392. }
  59393. handleVolumeControlKeyUp(event2) {
  59394. if (keycode.isEventKey(event2, "Esc")) {
  59395. this.muteToggle.focus();
  59396. }
  59397. }
  59398. handleMouseOver(event2) {
  59399. this.addClass("vjs-hover");
  59400. on$1(document_1, "keyup", this.handleKeyPressHandler_);
  59401. }
  59402. handleMouseOut(event2) {
  59403. this.removeClass("vjs-hover");
  59404. off$1(document_1, "keyup", this.handleKeyPressHandler_);
  59405. }
  59406. handleKeyPress(event2) {
  59407. if (keycode.isEventKey(event2, "Esc")) {
  59408. this.handleMouseOut();
  59409. }
  59410. }
  59411. }
  59412. VolumePanel$1.prototype.options_ = {
  59413. children: ["muteToggle", "volumeControl"]
  59414. };
  59415. Component$1$1.registerComponent("VolumePanel", VolumePanel$1);
  59416. class SkipForward extends Button$1 {
  59417. constructor(player, options2) {
  59418. super(player, options2);
  59419. this.validOptions = [5, 10, 30];
  59420. this.skipTime = this.getSkipForwardTime();
  59421. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59422. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59423. this.show();
  59424. } else {
  59425. this.hide();
  59426. }
  59427. }
  59428. getSkipForwardTime() {
  59429. const playerOptions = this.options_.playerOptions;
  59430. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.forward;
  59431. }
  59432. buildCSSClass() {
  59433. return `vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`;
  59434. }
  59435. handleClick(event2) {
  59436. const currentVideoTime = this.player_.currentTime();
  59437. const liveTracker = this.player_.liveTracker;
  59438. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  59439. let newTime;
  59440. if (currentVideoTime + this.skipTime <= duration5) {
  59441. newTime = currentVideoTime + this.skipTime;
  59442. } else {
  59443. newTime = duration5;
  59444. }
  59445. this.player_.currentTime(newTime);
  59446. }
  59447. handleLanguagechange() {
  59448. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59449. }
  59450. }
  59451. Component$1$1.registerComponent("SkipForward", SkipForward);
  59452. class SkipBackward extends Button$1 {
  59453. constructor(player, options2) {
  59454. super(player, options2);
  59455. this.validOptions = [5, 10, 30];
  59456. this.skipTime = this.getSkipBackwardTime();
  59457. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59458. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59459. this.show();
  59460. } else {
  59461. this.hide();
  59462. }
  59463. }
  59464. getSkipBackwardTime() {
  59465. const playerOptions = this.options_.playerOptions;
  59466. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.backward;
  59467. }
  59468. buildCSSClass() {
  59469. return `vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`;
  59470. }
  59471. handleClick(event2) {
  59472. const currentVideoTime = this.player_.currentTime();
  59473. const liveTracker = this.player_.liveTracker;
  59474. const seekableStart = liveTracker && liveTracker.isLive() && liveTracker.seekableStart();
  59475. let newTime;
  59476. if (seekableStart && currentVideoTime - this.skipTime <= seekableStart) {
  59477. newTime = seekableStart;
  59478. } else if (currentVideoTime >= this.skipTime) {
  59479. newTime = currentVideoTime - this.skipTime;
  59480. } else {
  59481. newTime = 0;
  59482. }
  59483. this.player_.currentTime(newTime);
  59484. }
  59485. handleLanguagechange() {
  59486. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59487. }
  59488. }
  59489. SkipBackward.prototype.controlText_ = "Skip Backward";
  59490. Component$1$1.registerComponent("SkipBackward", SkipBackward);
  59491. class Menu$1 extends Component$1$1 {
  59492. constructor(player, options2) {
  59493. super(player, options2);
  59494. if (options2) {
  59495. this.menuButton_ = options2.menuButton;
  59496. }
  59497. this.focusedChild_ = -1;
  59498. this.on("keydown", (e) => this.handleKeyDown(e));
  59499. this.boundHandleBlur_ = (e) => this.handleBlur(e);
  59500. this.boundHandleTapClick_ = (e) => this.handleTapClick(e);
  59501. }
  59502. addEventListenerForItem(component) {
  59503. if (!(component instanceof Component$1$1)) {
  59504. return;
  59505. }
  59506. this.on(component, "blur", this.boundHandleBlur_);
  59507. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  59508. }
  59509. removeEventListenerForItem(component) {
  59510. if (!(component instanceof Component$1$1)) {
  59511. return;
  59512. }
  59513. this.off(component, "blur", this.boundHandleBlur_);
  59514. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  59515. }
  59516. removeChild(component) {
  59517. if (typeof component === "string") {
  59518. component = this.getChild(component);
  59519. }
  59520. this.removeEventListenerForItem(component);
  59521. super.removeChild(component);
  59522. }
  59523. addItem(component) {
  59524. const childComponent = this.addChild(component);
  59525. if (childComponent) {
  59526. this.addEventListenerForItem(childComponent);
  59527. }
  59528. }
  59529. createEl() {
  59530. const contentElType = this.options_.contentElType || "ul";
  59531. this.contentEl_ = createEl$1(contentElType, {
  59532. className: "vjs-menu-content"
  59533. });
  59534. this.contentEl_.setAttribute("role", "menu");
  59535. const el = super.createEl("div", {
  59536. append: this.contentEl_,
  59537. className: "vjs-menu"
  59538. });
  59539. el.appendChild(this.contentEl_);
  59540. on$1(el, "click", function(event2) {
  59541. event2.preventDefault();
  59542. event2.stopImmediatePropagation();
  59543. });
  59544. return el;
  59545. }
  59546. dispose() {
  59547. this.contentEl_ = null;
  59548. this.boundHandleBlur_ = null;
  59549. this.boundHandleTapClick_ = null;
  59550. super.dispose();
  59551. }
  59552. handleBlur(event2) {
  59553. const relatedTarget = event2.relatedTarget || document_1.activeElement;
  59554. if (!this.children().some((element) => {
  59555. return element.el() === relatedTarget;
  59556. })) {
  59557. const btn = this.menuButton_;
  59558. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  59559. btn.unpressButton();
  59560. }
  59561. }
  59562. }
  59563. handleTapClick(event2) {
  59564. if (this.menuButton_) {
  59565. this.menuButton_.unpressButton();
  59566. const childComponents = this.children();
  59567. if (!Array.isArray(childComponents)) {
  59568. return;
  59569. }
  59570. const foundComponent = childComponents.filter((component) => component.el() === event2.target)[0];
  59571. if (!foundComponent) {
  59572. return;
  59573. }
  59574. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  59575. this.menuButton_.focus();
  59576. }
  59577. }
  59578. }
  59579. handleKeyDown(event2) {
  59580. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  59581. event2.preventDefault();
  59582. event2.stopPropagation();
  59583. this.stepForward();
  59584. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  59585. event2.preventDefault();
  59586. event2.stopPropagation();
  59587. this.stepBack();
  59588. }
  59589. }
  59590. stepForward() {
  59591. let stepChild = 0;
  59592. if (this.focusedChild_ !== void 0) {
  59593. stepChild = this.focusedChild_ + 1;
  59594. }
  59595. this.focus(stepChild);
  59596. }
  59597. stepBack() {
  59598. let stepChild = 0;
  59599. if (this.focusedChild_ !== void 0) {
  59600. stepChild = this.focusedChild_ - 1;
  59601. }
  59602. this.focus(stepChild);
  59603. }
  59604. focus(item = 0) {
  59605. const children = this.children().slice();
  59606. const haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  59607. if (haveTitle) {
  59608. children.shift();
  59609. }
  59610. if (children.length > 0) {
  59611. if (item < 0) {
  59612. item = 0;
  59613. } else if (item >= children.length) {
  59614. item = children.length - 1;
  59615. }
  59616. this.focusedChild_ = item;
  59617. children[item].el_.focus();
  59618. }
  59619. }
  59620. }
  59621. Component$1$1.registerComponent("Menu", Menu$1);
  59622. class MenuButton$1 extends Component$1$1 {
  59623. constructor(player, options2 = {}) {
  59624. super(player, options2);
  59625. this.menuButton_ = new Button$1(player, options2);
  59626. this.menuButton_.controlText(this.controlText_);
  59627. this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  59628. const buttonClass = Button$1.prototype.buildCSSClass();
  59629. this.menuButton_.el_.className = this.buildCSSClass() + " " + buttonClass;
  59630. this.menuButton_.removeClass("vjs-control");
  59631. this.addChild(this.menuButton_);
  59632. this.update();
  59633. this.enabled_ = true;
  59634. const handleClick = (e) => this.handleClick(e);
  59635. this.handleMenuKeyUp_ = (e) => this.handleMenuKeyUp(e);
  59636. this.on(this.menuButton_, "tap", handleClick);
  59637. this.on(this.menuButton_, "click", handleClick);
  59638. this.on(this.menuButton_, "keydown", (e) => this.handleKeyDown(e));
  59639. this.on(this.menuButton_, "mouseenter", () => {
  59640. this.addClass("vjs-hover");
  59641. this.menu.show();
  59642. on$1(document_1, "keyup", this.handleMenuKeyUp_);
  59643. });
  59644. this.on("mouseleave", (e) => this.handleMouseLeave(e));
  59645. this.on("keydown", (e) => this.handleSubmenuKeyDown(e));
  59646. }
  59647. update() {
  59648. const menu = this.createMenu();
  59649. if (this.menu) {
  59650. this.menu.dispose();
  59651. this.removeChild(this.menu);
  59652. }
  59653. this.menu = menu;
  59654. this.addChild(menu);
  59655. this.buttonPressed_ = false;
  59656. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59657. if (this.items && this.items.length <= this.hideThreshold_) {
  59658. this.hide();
  59659. this.menu.contentEl_.removeAttribute("role");
  59660. } else {
  59661. this.show();
  59662. this.menu.contentEl_.setAttribute("role", "menu");
  59663. }
  59664. }
  59665. createMenu() {
  59666. const menu = new Menu$1(this.player_, {
  59667. menuButton: this
  59668. });
  59669. this.hideThreshold_ = 0;
  59670. if (this.options_.title) {
  59671. const titleEl = createEl$1("li", {
  59672. className: "vjs-menu-title",
  59673. textContent: toTitleCase$1$1(this.options_.title),
  59674. tabIndex: -1
  59675. });
  59676. const titleComponent = new Component$1$1(this.player_, {
  59677. el: titleEl
  59678. });
  59679. menu.addItem(titleComponent);
  59680. }
  59681. this.items = this.createItems();
  59682. if (this.items) {
  59683. for (let i2 = 0; i2 < this.items.length; i2++) {
  59684. menu.addItem(this.items[i2]);
  59685. }
  59686. }
  59687. return menu;
  59688. }
  59689. createItems() {
  59690. }
  59691. createEl() {
  59692. return super.createEl("div", {
  59693. className: this.buildWrapperCSSClass()
  59694. }, {});
  59695. }
  59696. buildWrapperCSSClass() {
  59697. let menuButtonClass = "vjs-menu-button";
  59698. if (this.options_.inline === true) {
  59699. menuButtonClass += "-inline";
  59700. } else {
  59701. menuButtonClass += "-popup";
  59702. }
  59703. const buttonClass = Button$1.prototype.buildCSSClass();
  59704. return `vjs-menu-button ${menuButtonClass} ${buttonClass} ${super.buildCSSClass()}`;
  59705. }
  59706. buildCSSClass() {
  59707. let menuButtonClass = "vjs-menu-button";
  59708. if (this.options_.inline === true) {
  59709. menuButtonClass += "-inline";
  59710. } else {
  59711. menuButtonClass += "-popup";
  59712. }
  59713. return `vjs-menu-button ${menuButtonClass} ${super.buildCSSClass()}`;
  59714. }
  59715. controlText(text, el = this.menuButton_.el()) {
  59716. return this.menuButton_.controlText(text, el);
  59717. }
  59718. dispose() {
  59719. this.handleMouseLeave();
  59720. super.dispose();
  59721. }
  59722. handleClick(event2) {
  59723. if (this.buttonPressed_) {
  59724. this.unpressButton();
  59725. } else {
  59726. this.pressButton();
  59727. }
  59728. }
  59729. handleMouseLeave(event2) {
  59730. this.removeClass("vjs-hover");
  59731. off$1(document_1, "keyup", this.handleMenuKeyUp_);
  59732. }
  59733. focus() {
  59734. this.menuButton_.focus();
  59735. }
  59736. blur() {
  59737. this.menuButton_.blur();
  59738. }
  59739. handleKeyDown(event2) {
  59740. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59741. if (this.buttonPressed_) {
  59742. this.unpressButton();
  59743. }
  59744. if (!keycode.isEventKey(event2, "Tab")) {
  59745. event2.preventDefault();
  59746. this.menuButton_.focus();
  59747. }
  59748. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  59749. if (!this.buttonPressed_) {
  59750. event2.preventDefault();
  59751. this.pressButton();
  59752. }
  59753. }
  59754. }
  59755. handleMenuKeyUp(event2) {
  59756. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59757. this.removeClass("vjs-hover");
  59758. }
  59759. }
  59760. handleSubmenuKeyPress(event2) {
  59761. this.handleSubmenuKeyDown(event2);
  59762. }
  59763. handleSubmenuKeyDown(event2) {
  59764. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59765. if (this.buttonPressed_) {
  59766. this.unpressButton();
  59767. }
  59768. if (!keycode.isEventKey(event2, "Tab")) {
  59769. event2.preventDefault();
  59770. this.menuButton_.focus();
  59771. }
  59772. }
  59773. }
  59774. pressButton() {
  59775. if (this.enabled_) {
  59776. this.buttonPressed_ = true;
  59777. this.menu.show();
  59778. this.menu.lockShowing();
  59779. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  59780. if (IS_IOS$1 && isInFrame$1()) {
  59781. return;
  59782. }
  59783. this.menu.focus();
  59784. }
  59785. }
  59786. unpressButton() {
  59787. if (this.enabled_) {
  59788. this.buttonPressed_ = false;
  59789. this.menu.unlockShowing();
  59790. this.menu.hide();
  59791. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59792. }
  59793. }
  59794. disable() {
  59795. this.unpressButton();
  59796. this.enabled_ = false;
  59797. this.addClass("vjs-disabled");
  59798. this.menuButton_.disable();
  59799. }
  59800. enable() {
  59801. this.enabled_ = true;
  59802. this.removeClass("vjs-disabled");
  59803. this.menuButton_.enable();
  59804. }
  59805. }
  59806. Component$1$1.registerComponent("MenuButton", MenuButton$1);
  59807. class TrackButton$1 extends MenuButton$1 {
  59808. constructor(player, options2) {
  59809. const tracks = options2.tracks;
  59810. super(player, options2);
  59811. if (this.items.length <= 1) {
  59812. this.hide();
  59813. }
  59814. if (!tracks) {
  59815. return;
  59816. }
  59817. const updateHandler = bind_(this, this.update);
  59818. tracks.addEventListener("removetrack", updateHandler);
  59819. tracks.addEventListener("addtrack", updateHandler);
  59820. tracks.addEventListener("labelchange", updateHandler);
  59821. this.player_.on("ready", updateHandler);
  59822. this.player_.on("dispose", function() {
  59823. tracks.removeEventListener("removetrack", updateHandler);
  59824. tracks.removeEventListener("addtrack", updateHandler);
  59825. tracks.removeEventListener("labelchange", updateHandler);
  59826. });
  59827. }
  59828. }
  59829. Component$1$1.registerComponent("TrackButton", TrackButton$1);
  59830. const MenuKeys$1 = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  59831. class MenuItem$1 extends ClickableComponent$1 {
  59832. constructor(player, options2) {
  59833. super(player, options2);
  59834. this.selectable = options2.selectable;
  59835. this.isSelected_ = options2.selected || false;
  59836. this.multiSelectable = options2.multiSelectable;
  59837. this.selected(this.isSelected_);
  59838. if (this.selectable) {
  59839. if (this.multiSelectable) {
  59840. this.el_.setAttribute("role", "menuitemcheckbox");
  59841. } else {
  59842. this.el_.setAttribute("role", "menuitemradio");
  59843. }
  59844. } else {
  59845. this.el_.setAttribute("role", "menuitem");
  59846. }
  59847. }
  59848. createEl(type2, props, attrs) {
  59849. this.nonIconControl = true;
  59850. const el = super.createEl("li", Object.assign({
  59851. className: "vjs-menu-item",
  59852. tabIndex: -1
  59853. }, props), attrs);
  59854. el.replaceChild(createEl$1("span", {
  59855. className: "vjs-menu-item-text",
  59856. textContent: this.localize(this.options_.label)
  59857. }), el.querySelector(".vjs-icon-placeholder"));
  59858. return el;
  59859. }
  59860. handleKeyDown(event2) {
  59861. if (!MenuKeys$1.some((key) => keycode.isEventKey(event2, key))) {
  59862. super.handleKeyDown(event2);
  59863. }
  59864. }
  59865. handleClick(event2) {
  59866. this.selected(true);
  59867. }
  59868. selected(selected) {
  59869. if (this.selectable) {
  59870. if (selected) {
  59871. this.addClass("vjs-selected");
  59872. this.el_.setAttribute("aria-checked", "true");
  59873. this.controlText(", selected");
  59874. this.isSelected_ = true;
  59875. } else {
  59876. this.removeClass("vjs-selected");
  59877. this.el_.setAttribute("aria-checked", "false");
  59878. this.controlText("");
  59879. this.isSelected_ = false;
  59880. }
  59881. }
  59882. }
  59883. }
  59884. Component$1$1.registerComponent("MenuItem", MenuItem$1);
  59885. class TextTrackMenuItem$1 extends MenuItem$1 {
  59886. constructor(player, options2) {
  59887. const track = options2.track;
  59888. const tracks = player.textTracks();
  59889. options2.label = track.label || track.language || "Unknown";
  59890. options2.selected = track.mode === "showing";
  59891. super(player, options2);
  59892. this.track = track;
  59893. this.kinds = (options2.kinds || [options2.kind || this.track.kind]).filter(Boolean);
  59894. const changeHandler = (...args) => {
  59895. this.handleTracksChange.apply(this, args);
  59896. };
  59897. const selectedLanguageChangeHandler = (...args) => {
  59898. this.handleSelectedLanguageChange.apply(this, args);
  59899. };
  59900. player.on(["loadstart", "texttrackchange"], changeHandler);
  59901. tracks.addEventListener("change", changeHandler);
  59902. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59903. this.on("dispose", function() {
  59904. player.off(["loadstart", "texttrackchange"], changeHandler);
  59905. tracks.removeEventListener("change", changeHandler);
  59906. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59907. });
  59908. if (tracks.onchange === void 0) {
  59909. let event2;
  59910. this.on(["tap", "click"], function() {
  59911. if (typeof window_1.Event !== "object") {
  59912. try {
  59913. event2 = new window_1.Event("change");
  59914. } catch (err) {
  59915. }
  59916. }
  59917. if (!event2) {
  59918. event2 = document_1.createEvent("Event");
  59919. event2.initEvent("change", true, true);
  59920. }
  59921. tracks.dispatchEvent(event2);
  59922. });
  59923. }
  59924. this.handleTracksChange();
  59925. }
  59926. handleClick(event2) {
  59927. const referenceTrack = this.track;
  59928. const tracks = this.player_.textTracks();
  59929. super.handleClick(event2);
  59930. if (!tracks) {
  59931. return;
  59932. }
  59933. for (let i2 = 0; i2 < tracks.length; i2++) {
  59934. const track = tracks[i2];
  59935. if (this.kinds.indexOf(track.kind) === -1) {
  59936. continue;
  59937. }
  59938. if (track === referenceTrack) {
  59939. if (track.mode !== "showing") {
  59940. track.mode = "showing";
  59941. }
  59942. } else if (track.mode !== "disabled") {
  59943. track.mode = "disabled";
  59944. }
  59945. }
  59946. }
  59947. handleTracksChange(event2) {
  59948. const shouldBeSelected = this.track.mode === "showing";
  59949. if (shouldBeSelected !== this.isSelected_) {
  59950. this.selected(shouldBeSelected);
  59951. }
  59952. }
  59953. handleSelectedLanguageChange(event2) {
  59954. if (this.track.mode === "showing") {
  59955. const selectedLanguage = this.player_.cache_.selectedLanguage;
  59956. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  59957. return;
  59958. }
  59959. this.player_.cache_.selectedLanguage = {
  59960. enabled: true,
  59961. language: this.track.language,
  59962. kind: this.track.kind
  59963. };
  59964. }
  59965. }
  59966. dispose() {
  59967. this.track = null;
  59968. super.dispose();
  59969. }
  59970. }
  59971. Component$1$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem$1);
  59972. class OffTextTrackMenuItem$1 extends TextTrackMenuItem$1 {
  59973. constructor(player, options2) {
  59974. options2.track = {
  59975. player,
  59976. kind: options2.kind,
  59977. kinds: options2.kinds,
  59978. default: false,
  59979. mode: "disabled"
  59980. };
  59981. if (!options2.kinds) {
  59982. options2.kinds = [options2.kind];
  59983. }
  59984. if (options2.label) {
  59985. options2.track.label = options2.label;
  59986. } else {
  59987. options2.track.label = options2.kinds.join(" and ") + " off";
  59988. }
  59989. options2.selectable = true;
  59990. options2.multiSelectable = false;
  59991. super(player, options2);
  59992. }
  59993. handleTracksChange(event2) {
  59994. const tracks = this.player().textTracks();
  59995. let shouldBeSelected = true;
  59996. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  59997. const track = tracks[i2];
  59998. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  59999. shouldBeSelected = false;
  60000. break;
  60001. }
  60002. }
  60003. if (shouldBeSelected !== this.isSelected_) {
  60004. this.selected(shouldBeSelected);
  60005. }
  60006. }
  60007. handleSelectedLanguageChange(event2) {
  60008. const tracks = this.player().textTracks();
  60009. let allHidden = true;
  60010. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60011. const track = tracks[i2];
  60012. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  60013. allHidden = false;
  60014. break;
  60015. }
  60016. }
  60017. if (allHidden) {
  60018. this.player_.cache_.selectedLanguage = {
  60019. enabled: false
  60020. };
  60021. }
  60022. }
  60023. handleLanguagechange() {
  60024. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.label);
  60025. super.handleLanguagechange();
  60026. }
  60027. }
  60028. Component$1$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem$1);
  60029. class TextTrackButton$1 extends TrackButton$1 {
  60030. constructor(player, options2 = {}) {
  60031. options2.tracks = player.textTracks();
  60032. super(player, options2);
  60033. }
  60034. createItems(items = [], TrackMenuItem = TextTrackMenuItem$1) {
  60035. let label2;
  60036. if (this.label_) {
  60037. label2 = `${this.label_} off`;
  60038. }
  60039. items.push(new OffTextTrackMenuItem$1(this.player_, {
  60040. kinds: this.kinds_,
  60041. kind: this.kind_,
  60042. label: label2
  60043. }));
  60044. this.hideThreshold_ += 1;
  60045. const tracks = this.player_.textTracks();
  60046. if (!Array.isArray(this.kinds_)) {
  60047. this.kinds_ = [this.kind_];
  60048. }
  60049. for (let i2 = 0; i2 < tracks.length; i2++) {
  60050. const track = tracks[i2];
  60051. if (this.kinds_.indexOf(track.kind) > -1) {
  60052. const item = new TrackMenuItem(this.player_, {
  60053. track,
  60054. kinds: this.kinds_,
  60055. kind: this.kind_,
  60056. selectable: true,
  60057. multiSelectable: false
  60058. });
  60059. item.addClass(`vjs-${track.kind}-menu-item`);
  60060. items.push(item);
  60061. }
  60062. }
  60063. return items;
  60064. }
  60065. }
  60066. Component$1$1.registerComponent("TextTrackButton", TextTrackButton$1);
  60067. class ChaptersTrackMenuItem$1 extends MenuItem$1 {
  60068. constructor(player, options2) {
  60069. const track = options2.track;
  60070. const cue = options2.cue;
  60071. const currentTime = player.currentTime();
  60072. options2.selectable = true;
  60073. options2.multiSelectable = false;
  60074. options2.label = cue.text;
  60075. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  60076. super(player, options2);
  60077. this.track = track;
  60078. this.cue = cue;
  60079. }
  60080. handleClick(event2) {
  60081. super.handleClick();
  60082. this.player_.currentTime(this.cue.startTime);
  60083. }
  60084. }
  60085. Component$1$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem$1);
  60086. class ChaptersButton$1 extends TextTrackButton$1 {
  60087. constructor(player, options2, ready) {
  60088. super(player, options2, ready);
  60089. this.selectCurrentItem_ = () => {
  60090. this.items.forEach((item) => {
  60091. item.selected(this.track_.activeCues[0] === item.cue);
  60092. });
  60093. };
  60094. }
  60095. buildCSSClass() {
  60096. return `vjs-chapters-button ${super.buildCSSClass()}`;
  60097. }
  60098. buildWrapperCSSClass() {
  60099. return `vjs-chapters-button ${super.buildWrapperCSSClass()}`;
  60100. }
  60101. update(event2) {
  60102. if (event2 && event2.track && event2.track.kind !== "chapters") {
  60103. return;
  60104. }
  60105. const track = this.findChaptersTrack();
  60106. if (track !== this.track_) {
  60107. this.setTrack(track);
  60108. super.update();
  60109. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  60110. super.update();
  60111. }
  60112. }
  60113. setTrack(track) {
  60114. if (this.track_ === track) {
  60115. return;
  60116. }
  60117. if (!this.updateHandler_) {
  60118. this.updateHandler_ = this.update.bind(this);
  60119. }
  60120. if (this.track_) {
  60121. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60122. if (remoteTextTrackEl) {
  60123. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  60124. }
  60125. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  60126. this.track_ = null;
  60127. }
  60128. this.track_ = track;
  60129. if (this.track_) {
  60130. this.track_.mode = "hidden";
  60131. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60132. if (remoteTextTrackEl) {
  60133. remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  60134. }
  60135. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  60136. }
  60137. }
  60138. findChaptersTrack() {
  60139. const tracks = this.player_.textTracks() || [];
  60140. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  60141. const track = tracks[i2];
  60142. if (track.kind === this.kind_) {
  60143. return track;
  60144. }
  60145. }
  60146. }
  60147. getMenuCaption() {
  60148. if (this.track_ && this.track_.label) {
  60149. return this.track_.label;
  60150. }
  60151. return this.localize(toTitleCase$1$1(this.kind_));
  60152. }
  60153. createMenu() {
  60154. this.options_.title = this.getMenuCaption();
  60155. return super.createMenu();
  60156. }
  60157. createItems() {
  60158. const items = [];
  60159. if (!this.track_) {
  60160. return items;
  60161. }
  60162. const cues = this.track_.cues;
  60163. if (!cues) {
  60164. return items;
  60165. }
  60166. for (let i2 = 0, l = cues.length; i2 < l; i2++) {
  60167. const cue = cues[i2];
  60168. const mi = new ChaptersTrackMenuItem$1(this.player_, {
  60169. track: this.track_,
  60170. cue
  60171. });
  60172. items.push(mi);
  60173. }
  60174. return items;
  60175. }
  60176. }
  60177. ChaptersButton$1.prototype.kind_ = "chapters";
  60178. ChaptersButton$1.prototype.controlText_ = "Chapters";
  60179. Component$1$1.registerComponent("ChaptersButton", ChaptersButton$1);
  60180. class DescriptionsButton$1 extends TextTrackButton$1 {
  60181. constructor(player, options2, ready) {
  60182. super(player, options2, ready);
  60183. const tracks = player.textTracks();
  60184. const changeHandler = bind_(this, this.handleTracksChange);
  60185. tracks.addEventListener("change", changeHandler);
  60186. this.on("dispose", function() {
  60187. tracks.removeEventListener("change", changeHandler);
  60188. });
  60189. }
  60190. handleTracksChange(event2) {
  60191. const tracks = this.player().textTracks();
  60192. let disabled = false;
  60193. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60194. const track = tracks[i2];
  60195. if (track.kind !== this.kind_ && track.mode === "showing") {
  60196. disabled = true;
  60197. break;
  60198. }
  60199. }
  60200. if (disabled) {
  60201. this.disable();
  60202. } else {
  60203. this.enable();
  60204. }
  60205. }
  60206. buildCSSClass() {
  60207. return `vjs-descriptions-button ${super.buildCSSClass()}`;
  60208. }
  60209. buildWrapperCSSClass() {
  60210. return `vjs-descriptions-button ${super.buildWrapperCSSClass()}`;
  60211. }
  60212. }
  60213. DescriptionsButton$1.prototype.kind_ = "descriptions";
  60214. DescriptionsButton$1.prototype.controlText_ = "Descriptions";
  60215. Component$1$1.registerComponent("DescriptionsButton", DescriptionsButton$1);
  60216. class SubtitlesButton$1 extends TextTrackButton$1 {
  60217. constructor(player, options2, ready) {
  60218. super(player, options2, ready);
  60219. }
  60220. buildCSSClass() {
  60221. return `vjs-subtitles-button ${super.buildCSSClass()}`;
  60222. }
  60223. buildWrapperCSSClass() {
  60224. return `vjs-subtitles-button ${super.buildWrapperCSSClass()}`;
  60225. }
  60226. }
  60227. SubtitlesButton$1.prototype.kind_ = "subtitles";
  60228. SubtitlesButton$1.prototype.controlText_ = "Subtitles";
  60229. Component$1$1.registerComponent("SubtitlesButton", SubtitlesButton$1);
  60230. class CaptionSettingsMenuItem$1 extends TextTrackMenuItem$1 {
  60231. constructor(player, options2) {
  60232. options2.track = {
  60233. player,
  60234. kind: options2.kind,
  60235. label: options2.kind + " settings",
  60236. selectable: false,
  60237. default: false,
  60238. mode: "disabled"
  60239. };
  60240. options2.selectable = false;
  60241. options2.name = "CaptionSettingsMenuItem";
  60242. super(player, options2);
  60243. this.addClass("vjs-texttrack-settings");
  60244. this.controlText(", opens " + options2.kind + " settings dialog");
  60245. }
  60246. handleClick(event2) {
  60247. this.player().getChild("textTrackSettings").open();
  60248. }
  60249. handleLanguagechange() {
  60250. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.kind + " settings");
  60251. super.handleLanguagechange();
  60252. }
  60253. }
  60254. Component$1$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem$1);
  60255. class CaptionsButton$1 extends TextTrackButton$1 {
  60256. constructor(player, options2, ready) {
  60257. super(player, options2, ready);
  60258. }
  60259. buildCSSClass() {
  60260. return `vjs-captions-button ${super.buildCSSClass()}`;
  60261. }
  60262. buildWrapperCSSClass() {
  60263. return `vjs-captions-button ${super.buildWrapperCSSClass()}`;
  60264. }
  60265. createItems() {
  60266. const items = [];
  60267. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60268. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60269. kind: this.kind_
  60270. }));
  60271. this.hideThreshold_ += 1;
  60272. }
  60273. return super.createItems(items);
  60274. }
  60275. }
  60276. CaptionsButton$1.prototype.kind_ = "captions";
  60277. CaptionsButton$1.prototype.controlText_ = "Captions";
  60278. Component$1$1.registerComponent("CaptionsButton", CaptionsButton$1);
  60279. class SubsCapsMenuItem$1 extends TextTrackMenuItem$1 {
  60280. createEl(type2, props, attrs) {
  60281. const el = super.createEl(type2, props, attrs);
  60282. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60283. if (this.options_.track.kind === "captions") {
  60284. parentSpan.appendChild(createEl$1("span", {
  60285. className: "vjs-icon-placeholder"
  60286. }, {
  60287. "aria-hidden": true
  60288. }));
  60289. parentSpan.appendChild(createEl$1("span", {
  60290. className: "vjs-control-text",
  60291. textContent: ` ${this.localize("Captions")}`
  60292. }));
  60293. }
  60294. return el;
  60295. }
  60296. }
  60297. Component$1$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem$1);
  60298. class SubsCapsButton$1 extends TextTrackButton$1 {
  60299. constructor(player, options2 = {}) {
  60300. super(player, options2);
  60301. this.label_ = "subtitles";
  60302. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(this.player_.language_) > -1) {
  60303. this.label_ = "captions";
  60304. }
  60305. this.menuButton_.controlText(toTitleCase$1$1(this.label_));
  60306. }
  60307. buildCSSClass() {
  60308. return `vjs-subs-caps-button ${super.buildCSSClass()}`;
  60309. }
  60310. buildWrapperCSSClass() {
  60311. return `vjs-subs-caps-button ${super.buildWrapperCSSClass()}`;
  60312. }
  60313. createItems() {
  60314. let items = [];
  60315. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60316. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60317. kind: this.label_
  60318. }));
  60319. this.hideThreshold_ += 1;
  60320. }
  60321. items = super.createItems(items, SubsCapsMenuItem$1);
  60322. return items;
  60323. }
  60324. }
  60325. SubsCapsButton$1.prototype.kinds_ = ["captions", "subtitles"];
  60326. SubsCapsButton$1.prototype.controlText_ = "Subtitles";
  60327. Component$1$1.registerComponent("SubsCapsButton", SubsCapsButton$1);
  60328. class AudioTrackMenuItem$1 extends MenuItem$1 {
  60329. constructor(player, options2) {
  60330. const track = options2.track;
  60331. const tracks = player.audioTracks();
  60332. options2.label = track.label || track.language || "Unknown";
  60333. options2.selected = track.enabled;
  60334. super(player, options2);
  60335. this.track = track;
  60336. this.addClass(`vjs-${track.kind}-menu-item`);
  60337. const changeHandler = (...args) => {
  60338. this.handleTracksChange.apply(this, args);
  60339. };
  60340. tracks.addEventListener("change", changeHandler);
  60341. this.on("dispose", () => {
  60342. tracks.removeEventListener("change", changeHandler);
  60343. });
  60344. }
  60345. createEl(type2, props, attrs) {
  60346. const el = super.createEl(type2, props, attrs);
  60347. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60348. if (this.options_.track.kind === "main-desc") {
  60349. parentSpan.appendChild(createEl$1("span", {
  60350. className: "vjs-icon-placeholder"
  60351. }, {
  60352. "aria-hidden": true
  60353. }));
  60354. parentSpan.appendChild(createEl$1("span", {
  60355. className: "vjs-control-text",
  60356. textContent: " " + this.localize("Descriptions")
  60357. }));
  60358. }
  60359. return el;
  60360. }
  60361. handleClick(event2) {
  60362. super.handleClick(event2);
  60363. this.track.enabled = true;
  60364. if (this.player_.tech_.featuresNativeAudioTracks) {
  60365. const tracks = this.player_.audioTracks();
  60366. for (let i2 = 0; i2 < tracks.length; i2++) {
  60367. const track = tracks[i2];
  60368. if (track === this.track) {
  60369. continue;
  60370. }
  60371. track.enabled = track === this.track;
  60372. }
  60373. }
  60374. }
  60375. handleTracksChange(event2) {
  60376. this.selected(this.track.enabled);
  60377. }
  60378. }
  60379. Component$1$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem$1);
  60380. class AudioTrackButton$1 extends TrackButton$1 {
  60381. constructor(player, options2 = {}) {
  60382. options2.tracks = player.audioTracks();
  60383. super(player, options2);
  60384. }
  60385. buildCSSClass() {
  60386. return `vjs-audio-button ${super.buildCSSClass()}`;
  60387. }
  60388. buildWrapperCSSClass() {
  60389. return `vjs-audio-button ${super.buildWrapperCSSClass()}`;
  60390. }
  60391. createItems(items = []) {
  60392. this.hideThreshold_ = 1;
  60393. const tracks = this.player_.audioTracks();
  60394. for (let i2 = 0; i2 < tracks.length; i2++) {
  60395. const track = tracks[i2];
  60396. items.push(new AudioTrackMenuItem$1(this.player_, {
  60397. track,
  60398. selectable: true,
  60399. multiSelectable: false
  60400. }));
  60401. }
  60402. return items;
  60403. }
  60404. }
  60405. AudioTrackButton$1.prototype.controlText_ = "Audio Track";
  60406. Component$1$1.registerComponent("AudioTrackButton", AudioTrackButton$1);
  60407. class PlaybackRateMenuItem$1 extends MenuItem$1 {
  60408. constructor(player, options2) {
  60409. const label2 = options2.rate;
  60410. const rate = parseFloat(label2, 10);
  60411. options2.label = label2;
  60412. options2.selected = rate === player.playbackRate();
  60413. options2.selectable = true;
  60414. options2.multiSelectable = false;
  60415. super(player, options2);
  60416. this.label = label2;
  60417. this.rate = rate;
  60418. this.on(player, "ratechange", (e) => this.update(e));
  60419. }
  60420. handleClick(event2) {
  60421. super.handleClick();
  60422. this.player().playbackRate(this.rate);
  60423. }
  60424. update(event2) {
  60425. this.selected(this.player().playbackRate() === this.rate);
  60426. }
  60427. }
  60428. PlaybackRateMenuItem$1.prototype.contentElType = "button";
  60429. Component$1$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem$1);
  60430. class PlaybackRateMenuButton$1 extends MenuButton$1 {
  60431. constructor(player, options2) {
  60432. super(player, options2);
  60433. this.menuButton_.el_.setAttribute("aria-describedby", this.labelElId_);
  60434. this.updateVisibility();
  60435. this.updateLabel();
  60436. this.on(player, "loadstart", (e) => this.updateVisibility(e));
  60437. this.on(player, "ratechange", (e) => this.updateLabel(e));
  60438. this.on(player, "playbackrateschange", (e) => this.handlePlaybackRateschange(e));
  60439. }
  60440. createEl() {
  60441. const el = super.createEl();
  60442. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  60443. this.labelEl_ = createEl$1("div", {
  60444. className: "vjs-playback-rate-value",
  60445. id: this.labelElId_,
  60446. textContent: "1x"
  60447. });
  60448. el.appendChild(this.labelEl_);
  60449. return el;
  60450. }
  60451. dispose() {
  60452. this.labelEl_ = null;
  60453. super.dispose();
  60454. }
  60455. buildCSSClass() {
  60456. return `vjs-playback-rate ${super.buildCSSClass()}`;
  60457. }
  60458. buildWrapperCSSClass() {
  60459. return `vjs-playback-rate ${super.buildWrapperCSSClass()}`;
  60460. }
  60461. createItems() {
  60462. const rates = this.playbackRates();
  60463. const items = [];
  60464. for (let i2 = rates.length - 1; i2 >= 0; i2--) {
  60465. items.push(new PlaybackRateMenuItem$1(this.player(), {
  60466. rate: rates[i2] + "x"
  60467. }));
  60468. }
  60469. return items;
  60470. }
  60471. handlePlaybackRateschange(event2) {
  60472. this.update();
  60473. }
  60474. playbackRates() {
  60475. const player = this.player();
  60476. return player.playbackRates && player.playbackRates() || [];
  60477. }
  60478. playbackRateSupported() {
  60479. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  60480. }
  60481. updateVisibility(event2) {
  60482. if (this.playbackRateSupported()) {
  60483. this.removeClass("vjs-hidden");
  60484. } else {
  60485. this.addClass("vjs-hidden");
  60486. }
  60487. }
  60488. updateLabel(event2) {
  60489. if (this.playbackRateSupported()) {
  60490. this.labelEl_.textContent = this.player().playbackRate() + "x";
  60491. }
  60492. }
  60493. }
  60494. PlaybackRateMenuButton$1.prototype.controlText_ = "Playback Rate";
  60495. Component$1$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton$1);
  60496. class Spacer$1 extends Component$1$1 {
  60497. buildCSSClass() {
  60498. return `vjs-spacer ${super.buildCSSClass()}`;
  60499. }
  60500. createEl(tag = "div", props = {}, attributes = {}) {
  60501. if (!props.className) {
  60502. props.className = this.buildCSSClass();
  60503. }
  60504. return super.createEl(tag, props, attributes);
  60505. }
  60506. }
  60507. Component$1$1.registerComponent("Spacer", Spacer$1);
  60508. class CustomControlSpacer$1 extends Spacer$1 {
  60509. buildCSSClass() {
  60510. return `vjs-custom-control-spacer ${super.buildCSSClass()}`;
  60511. }
  60512. createEl() {
  60513. return super.createEl("div", {
  60514. className: this.buildCSSClass(),
  60515. textContent: "\xA0"
  60516. });
  60517. }
  60518. }
  60519. Component$1$1.registerComponent("CustomControlSpacer", CustomControlSpacer$1);
  60520. class ControlBar$1 extends Component$1$1 {
  60521. createEl() {
  60522. return super.createEl("div", {
  60523. className: "vjs-control-bar",
  60524. dir: "ltr"
  60525. });
  60526. }
  60527. }
  60528. ControlBar$1.prototype.options_ = {
  60529. children: ["playToggle", "skipBackward", "skipForward", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  60530. };
  60531. if ("exitPictureInPicture" in document_1) {
  60532. ControlBar$1.prototype.options_.children.splice(ControlBar$1.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  60533. }
  60534. Component$1$1.registerComponent("ControlBar", ControlBar$1);
  60535. class ErrorDisplay$1 extends ModalDialog$1 {
  60536. constructor(player, options2) {
  60537. super(player, options2);
  60538. this.on(player, "error", (e) => this.open(e));
  60539. }
  60540. buildCSSClass() {
  60541. return `vjs-error-display ${super.buildCSSClass()}`;
  60542. }
  60543. content() {
  60544. const error = this.player().error();
  60545. return error ? this.localize(error.message) : "";
  60546. }
  60547. }
  60548. ErrorDisplay$1.prototype.options_ = Object.assign({}, ModalDialog$1.prototype.options_, {
  60549. pauseOnOpen: false,
  60550. fillAlways: true,
  60551. temporary: false,
  60552. uncloseable: true
  60553. });
  60554. Component$1$1.registerComponent("ErrorDisplay", ErrorDisplay$1);
  60555. const LOCAL_STORAGE_KEY$1$1 = "vjs-text-track-settings";
  60556. const COLOR_BLACK$1 = ["#000", "Black"];
  60557. const COLOR_BLUE$1 = ["#00F", "Blue"];
  60558. const COLOR_CYAN$1 = ["#0FF", "Cyan"];
  60559. const COLOR_GREEN$1 = ["#0F0", "Green"];
  60560. const COLOR_MAGENTA$1 = ["#F0F", "Magenta"];
  60561. const COLOR_RED$1 = ["#F00", "Red"];
  60562. const COLOR_WHITE$1 = ["#FFF", "White"];
  60563. const COLOR_YELLOW$1 = ["#FF0", "Yellow"];
  60564. const OPACITY_OPAQUE$1 = ["1", "Opaque"];
  60565. const OPACITY_SEMI$1 = ["0.5", "Semi-Transparent"];
  60566. const OPACITY_TRANS$1 = ["0", "Transparent"];
  60567. const selectConfigs$1 = {
  60568. backgroundColor: {
  60569. selector: ".vjs-bg-color > select",
  60570. id: "captions-background-color-%s",
  60571. label: "Color",
  60572. 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]
  60573. },
  60574. backgroundOpacity: {
  60575. selector: ".vjs-bg-opacity > select",
  60576. id: "captions-background-opacity-%s",
  60577. label: "Opacity",
  60578. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1, OPACITY_TRANS$1]
  60579. },
  60580. color: {
  60581. selector: ".vjs-text-color > select",
  60582. id: "captions-foreground-color-%s",
  60583. label: "Color",
  60584. 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]
  60585. },
  60586. edgeStyle: {
  60587. selector: ".vjs-edge-style > select",
  60588. id: "%s",
  60589. label: "Text Edge Style",
  60590. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  60591. },
  60592. fontFamily: {
  60593. selector: ".vjs-font-family > select",
  60594. id: "captions-font-family-%s",
  60595. label: "Font Family",
  60596. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  60597. },
  60598. fontPercent: {
  60599. selector: ".vjs-font-percent > select",
  60600. id: "captions-font-size-%s",
  60601. label: "Font Size",
  60602. 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%"]],
  60603. default: 2,
  60604. parser: (v) => v === "1.00" ? null : Number(v)
  60605. },
  60606. textOpacity: {
  60607. selector: ".vjs-text-opacity > select",
  60608. id: "captions-foreground-opacity-%s",
  60609. label: "Opacity",
  60610. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1]
  60611. },
  60612. windowColor: {
  60613. selector: ".vjs-window-color > select",
  60614. id: "captions-window-color-%s",
  60615. label: "Color"
  60616. },
  60617. windowOpacity: {
  60618. selector: ".vjs-window-opacity > select",
  60619. id: "captions-window-opacity-%s",
  60620. label: "Opacity",
  60621. options: [OPACITY_TRANS$1, OPACITY_SEMI$1, OPACITY_OPAQUE$1]
  60622. }
  60623. };
  60624. selectConfigs$1.windowColor.options = selectConfigs$1.backgroundColor.options;
  60625. function parseOptionValue$1(value, parser2) {
  60626. if (parser2) {
  60627. value = parser2(value);
  60628. }
  60629. if (value && value !== "none") {
  60630. return value;
  60631. }
  60632. }
  60633. function getSelectedOptionValue$1(el, parser2) {
  60634. const value = el.options[el.options.selectedIndex].value;
  60635. return parseOptionValue$1(value, parser2);
  60636. }
  60637. function setSelectedOption$1(el, value, parser2) {
  60638. if (!value) {
  60639. return;
  60640. }
  60641. for (let i2 = 0; i2 < el.options.length; i2++) {
  60642. if (parseOptionValue$1(el.options[i2].value, parser2) === value) {
  60643. el.selectedIndex = i2;
  60644. break;
  60645. }
  60646. }
  60647. }
  60648. class TextTrackSettings$1 extends ModalDialog$1 {
  60649. constructor(player, options2) {
  60650. options2.temporary = false;
  60651. super(player, options2);
  60652. this.updateDisplay = this.updateDisplay.bind(this);
  60653. this.fill();
  60654. this.hasBeenOpened_ = this.hasBeenFilled_ = true;
  60655. this.endDialog = createEl$1("p", {
  60656. className: "vjs-control-text",
  60657. textContent: this.localize("End of dialog window.")
  60658. });
  60659. this.el().appendChild(this.endDialog);
  60660. this.setDefaults();
  60661. if (options2.persistTextTrackSettings === void 0) {
  60662. this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings;
  60663. }
  60664. this.on(this.$(".vjs-done-button"), "click", () => {
  60665. this.saveSettings();
  60666. this.close();
  60667. });
  60668. this.on(this.$(".vjs-default-button"), "click", () => {
  60669. this.setDefaults();
  60670. this.updateDisplay();
  60671. });
  60672. each$1(selectConfigs$1, (config) => {
  60673. this.on(this.$(config.selector), "change", this.updateDisplay);
  60674. });
  60675. if (this.options_.persistTextTrackSettings) {
  60676. this.restoreSettings();
  60677. }
  60678. }
  60679. dispose() {
  60680. this.endDialog = null;
  60681. super.dispose();
  60682. }
  60683. createElSelect_(key, legendId = "", type2 = "label") {
  60684. const config = selectConfigs$1[key];
  60685. const id = config.id.replace("%s", this.id_);
  60686. const selectLabelledbyIds = [legendId, id].join(" ").trim();
  60687. return [`<${type2} id="${id}" class="${type2 === "label" ? "vjs-label" : ""}">`, this.localize(config.label), `</${type2}>`, `<select aria-labelledby="${selectLabelledbyIds}">`].concat(config.options.map((o) => {
  60688. const optionId = id + "-" + o[1].replace(/\W+/g, "");
  60689. return [`<option id="${optionId}" value="${o[0]}" `, `aria-labelledby="${selectLabelledbyIds} ${optionId}">`, this.localize(o[1]), "</option>"].join("");
  60690. })).concat("</select>").join("");
  60691. }
  60692. createElFgColor_() {
  60693. const legendId = `captions-text-legend-${this.id_}`;
  60694. 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("");
  60695. }
  60696. createElBgColor_() {
  60697. const legendId = `captions-background-${this.id_}`;
  60698. 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("");
  60699. }
  60700. createElWinColor_() {
  60701. const legendId = `captions-window-${this.id_}`;
  60702. 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("");
  60703. }
  60704. createElColors_() {
  60705. return createEl$1("div", {
  60706. className: "vjs-track-settings-colors",
  60707. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  60708. });
  60709. }
  60710. createElFont_() {
  60711. return createEl$1("div", {
  60712. className: "vjs-track-settings-font",
  60713. 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("")
  60714. });
  60715. }
  60716. createElControls_() {
  60717. const defaultsDescription = this.localize("restore all settings to the default values");
  60718. return createEl$1("div", {
  60719. className: "vjs-track-settings-controls",
  60720. 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("")
  60721. });
  60722. }
  60723. content() {
  60724. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  60725. }
  60726. label() {
  60727. return this.localize("Caption Settings Dialog");
  60728. }
  60729. description() {
  60730. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  60731. }
  60732. buildCSSClass() {
  60733. return super.buildCSSClass() + " vjs-text-track-settings";
  60734. }
  60735. getValues() {
  60736. return reduce$1(selectConfigs$1, (accum, config, key) => {
  60737. const value = getSelectedOptionValue$1(this.$(config.selector), config.parser);
  60738. if (value !== void 0) {
  60739. accum[key] = value;
  60740. }
  60741. return accum;
  60742. }, {});
  60743. }
  60744. setValues(values3) {
  60745. each$1(selectConfigs$1, (config, key) => {
  60746. setSelectedOption$1(this.$(config.selector), values3[key], config.parser);
  60747. });
  60748. }
  60749. setDefaults() {
  60750. each$1(selectConfigs$1, (config) => {
  60751. const index2 = config.hasOwnProperty("default") ? config.default : 0;
  60752. this.$(config.selector).selectedIndex = index2;
  60753. });
  60754. }
  60755. restoreSettings() {
  60756. let values3;
  60757. try {
  60758. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1$1));
  60759. } catch (err) {
  60760. log$1$1.warn(err);
  60761. }
  60762. if (values3) {
  60763. this.setValues(values3);
  60764. }
  60765. }
  60766. saveSettings() {
  60767. if (!this.options_.persistTextTrackSettings) {
  60768. return;
  60769. }
  60770. const values3 = this.getValues();
  60771. try {
  60772. if (Object.keys(values3).length) {
  60773. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1$1, JSON.stringify(values3));
  60774. } else {
  60775. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1$1);
  60776. }
  60777. } catch (err) {
  60778. log$1$1.warn(err);
  60779. }
  60780. }
  60781. updateDisplay() {
  60782. const ttDisplay = this.player_.getChild("textTrackDisplay");
  60783. if (ttDisplay) {
  60784. ttDisplay.updateDisplay();
  60785. }
  60786. }
  60787. conditionalBlur_() {
  60788. this.previouslyActiveEl_ = null;
  60789. const cb = this.player_.controlBar;
  60790. const subsCapsBtn = cb && cb.subsCapsButton;
  60791. const ccBtn = cb && cb.captionsButton;
  60792. if (subsCapsBtn) {
  60793. subsCapsBtn.focus();
  60794. } else if (ccBtn) {
  60795. ccBtn.focus();
  60796. }
  60797. }
  60798. handleLanguagechange() {
  60799. this.fill();
  60800. }
  60801. }
  60802. Component$1$1.registerComponent("TextTrackSettings", TextTrackSettings$1);
  60803. class ResizeManager$1 extends Component$1$1 {
  60804. constructor(player, options2) {
  60805. let RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  60806. if (options2.ResizeObserver === null) {
  60807. RESIZE_OBSERVER_AVAILABLE = false;
  60808. }
  60809. const options_ = merge$1({
  60810. createEl: !RESIZE_OBSERVER_AVAILABLE,
  60811. reportTouchActivity: false
  60812. }, options2);
  60813. super(player, options_);
  60814. this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  60815. this.loadListener_ = null;
  60816. this.resizeObserver_ = null;
  60817. this.debouncedHandler_ = debounce$1(() => {
  60818. this.resizeHandler();
  60819. }, 100, false, this);
  60820. if (RESIZE_OBSERVER_AVAILABLE) {
  60821. this.resizeObserver_ = new this.ResizeObserver(this.debouncedHandler_);
  60822. this.resizeObserver_.observe(player.el());
  60823. } else {
  60824. this.loadListener_ = () => {
  60825. if (!this.el_ || !this.el_.contentWindow) {
  60826. return;
  60827. }
  60828. const debouncedHandler_ = this.debouncedHandler_;
  60829. let unloadListener_ = this.unloadListener_ = function() {
  60830. off$1(this, "resize", debouncedHandler_);
  60831. off$1(this, "unload", unloadListener_);
  60832. unloadListener_ = null;
  60833. };
  60834. on$1(this.el_.contentWindow, "unload", unloadListener_);
  60835. on$1(this.el_.contentWindow, "resize", debouncedHandler_);
  60836. };
  60837. this.one("load", this.loadListener_);
  60838. }
  60839. }
  60840. createEl() {
  60841. return super.createEl("iframe", {
  60842. className: "vjs-resize-manager",
  60843. tabIndex: -1,
  60844. title: this.localize("No content")
  60845. }, {
  60846. "aria-hidden": "true"
  60847. });
  60848. }
  60849. resizeHandler() {
  60850. if (!this.player_ || !this.player_.trigger) {
  60851. return;
  60852. }
  60853. this.player_.trigger("playerresize");
  60854. }
  60855. dispose() {
  60856. if (this.debouncedHandler_) {
  60857. this.debouncedHandler_.cancel();
  60858. }
  60859. if (this.resizeObserver_) {
  60860. if (this.player_.el()) {
  60861. this.resizeObserver_.unobserve(this.player_.el());
  60862. }
  60863. this.resizeObserver_.disconnect();
  60864. }
  60865. if (this.loadListener_) {
  60866. this.off("load", this.loadListener_);
  60867. }
  60868. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  60869. this.unloadListener_.call(this.el_.contentWindow);
  60870. }
  60871. this.ResizeObserver = null;
  60872. this.resizeObserver = null;
  60873. this.debouncedHandler_ = null;
  60874. this.loadListener_ = null;
  60875. super.dispose();
  60876. }
  60877. }
  60878. Component$1$1.registerComponent("ResizeManager", ResizeManager$1);
  60879. const defaults$2 = {
  60880. trackingThreshold: 20,
  60881. liveTolerance: 15
  60882. };
  60883. class LiveTracker$1 extends Component$1$1 {
  60884. constructor(player, options2) {
  60885. const options_ = merge$1(defaults$2, options2, {
  60886. createEl: false
  60887. });
  60888. super(player, options_);
  60889. this.trackLiveHandler_ = () => this.trackLive_();
  60890. this.handlePlay_ = (e) => this.handlePlay(e);
  60891. this.handleFirstTimeupdate_ = (e) => this.handleFirstTimeupdate(e);
  60892. this.handleSeeked_ = (e) => this.handleSeeked(e);
  60893. this.seekToLiveEdge_ = (e) => this.seekToLiveEdge(e);
  60894. this.reset_();
  60895. this.on(this.player_, "durationchange", (e) => this.handleDurationchange(e));
  60896. this.on(this.player_, "canplay", () => this.toggleTracking());
  60897. }
  60898. trackLive_() {
  60899. const seekable3 = this.player_.seekable();
  60900. if (!seekable3 || !seekable3.length) {
  60901. return;
  60902. }
  60903. const newTime = Number(window_1.performance.now().toFixed(4));
  60904. const deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  60905. this.lastTime_ = newTime;
  60906. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  60907. const liveCurrentTime = this.liveCurrentTime();
  60908. const currentTime = this.player_.currentTime();
  60909. let isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  60910. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  60911. isBehind = false;
  60912. }
  60913. if (isBehind !== this.behindLiveEdge_) {
  60914. this.behindLiveEdge_ = isBehind;
  60915. this.trigger("liveedgechange");
  60916. }
  60917. }
  60918. handleDurationchange() {
  60919. this.toggleTracking();
  60920. }
  60921. toggleTracking() {
  60922. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  60923. if (this.player_.options_.liveui) {
  60924. this.player_.addClass("vjs-liveui");
  60925. }
  60926. this.startTracking();
  60927. } else {
  60928. this.player_.removeClass("vjs-liveui");
  60929. this.stopTracking();
  60930. }
  60931. }
  60932. startTracking() {
  60933. if (this.isTracking()) {
  60934. return;
  60935. }
  60936. if (!this.timeupdateSeen_) {
  60937. this.timeupdateSeen_ = this.player_.hasStarted();
  60938. }
  60939. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL$1);
  60940. this.trackLive_();
  60941. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60942. if (!this.timeupdateSeen_) {
  60943. this.one(this.player_, "play", this.handlePlay_);
  60944. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60945. } else {
  60946. this.on(this.player_, "seeked", this.handleSeeked_);
  60947. }
  60948. }
  60949. handleFirstTimeupdate() {
  60950. this.timeupdateSeen_ = true;
  60951. this.on(this.player_, "seeked", this.handleSeeked_);
  60952. }
  60953. handleSeeked() {
  60954. const timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  60955. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  60956. this.nextSeekedFromUser_ = false;
  60957. this.trackLive_();
  60958. }
  60959. handlePlay() {
  60960. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  60961. }
  60962. reset_() {
  60963. this.lastTime_ = -1;
  60964. this.pastSeekEnd_ = 0;
  60965. this.lastSeekEnd_ = -1;
  60966. this.behindLiveEdge_ = true;
  60967. this.timeupdateSeen_ = false;
  60968. this.seekedBehindLive_ = false;
  60969. this.nextSeekedFromUser_ = false;
  60970. this.clearInterval(this.trackingInterval_);
  60971. this.trackingInterval_ = null;
  60972. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60973. this.off(this.player_, "seeked", this.handleSeeked_);
  60974. this.off(this.player_, "play", this.handlePlay_);
  60975. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60976. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  60977. }
  60978. nextSeekedFromUser() {
  60979. this.nextSeekedFromUser_ = true;
  60980. }
  60981. stopTracking() {
  60982. if (!this.isTracking()) {
  60983. return;
  60984. }
  60985. this.reset_();
  60986. this.trigger("liveedgechange");
  60987. }
  60988. seekableEnd() {
  60989. const seekable3 = this.player_.seekable();
  60990. const seekableEnds = [];
  60991. let i2 = seekable3 ? seekable3.length : 0;
  60992. while (i2--) {
  60993. seekableEnds.push(seekable3.end(i2));
  60994. }
  60995. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  60996. }
  60997. seekableStart() {
  60998. const seekable3 = this.player_.seekable();
  60999. const seekableStarts = [];
  61000. let i2 = seekable3 ? seekable3.length : 0;
  61001. while (i2--) {
  61002. seekableStarts.push(seekable3.start(i2));
  61003. }
  61004. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  61005. }
  61006. liveWindow() {
  61007. const liveCurrentTime = this.liveCurrentTime();
  61008. if (liveCurrentTime === Infinity) {
  61009. return 0;
  61010. }
  61011. return liveCurrentTime - this.seekableStart();
  61012. }
  61013. isLive() {
  61014. return this.isTracking();
  61015. }
  61016. atLiveEdge() {
  61017. return !this.behindLiveEdge();
  61018. }
  61019. liveCurrentTime() {
  61020. return this.pastSeekEnd() + this.seekableEnd();
  61021. }
  61022. pastSeekEnd() {
  61023. const seekableEnd = this.seekableEnd();
  61024. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  61025. this.pastSeekEnd_ = 0;
  61026. }
  61027. this.lastSeekEnd_ = seekableEnd;
  61028. return this.pastSeekEnd_;
  61029. }
  61030. behindLiveEdge() {
  61031. return this.behindLiveEdge_;
  61032. }
  61033. isTracking() {
  61034. return typeof this.trackingInterval_ === "number";
  61035. }
  61036. seekToLiveEdge() {
  61037. this.seekedBehindLive_ = false;
  61038. if (this.atLiveEdge()) {
  61039. return;
  61040. }
  61041. this.nextSeekedFromUser_ = false;
  61042. this.player_.currentTime(this.liveCurrentTime());
  61043. }
  61044. dispose() {
  61045. this.stopTracking();
  61046. super.dispose();
  61047. }
  61048. }
  61049. Component$1$1.registerComponent("LiveTracker", LiveTracker$1);
  61050. class TitleBar extends Component$1$1 {
  61051. constructor(player, options2) {
  61052. super(player, options2);
  61053. this.on("statechanged", (e) => this.updateDom_());
  61054. this.updateDom_();
  61055. }
  61056. createEl() {
  61057. this.els = {
  61058. title: createEl$1("div", {
  61059. className: "vjs-title-bar-title",
  61060. id: `vjs-title-bar-title-${newGUID$1()}`
  61061. }),
  61062. description: createEl$1("div", {
  61063. className: "vjs-title-bar-description",
  61064. id: `vjs-title-bar-description-${newGUID$1()}`
  61065. })
  61066. };
  61067. return createEl$1("div", {
  61068. className: "vjs-title-bar"
  61069. }, {}, Object.values(this.els));
  61070. }
  61071. updateDom_() {
  61072. const tech = this.player_.tech_;
  61073. const techEl = tech && tech.el_;
  61074. const techAriaAttrs = {
  61075. title: "aria-labelledby",
  61076. description: "aria-describedby"
  61077. };
  61078. ["title", "description"].forEach((k) => {
  61079. const value = this.state[k];
  61080. const el = this.els[k];
  61081. const techAriaAttr = techAriaAttrs[k];
  61082. emptyEl$1(el);
  61083. if (value) {
  61084. textContent$1(el, value);
  61085. }
  61086. if (techEl) {
  61087. techEl.removeAttribute(techAriaAttr);
  61088. if (value) {
  61089. techEl.setAttribute(techAriaAttr, el.id);
  61090. }
  61091. }
  61092. });
  61093. if (this.state.title || this.state.description) {
  61094. this.show();
  61095. } else {
  61096. this.hide();
  61097. }
  61098. }
  61099. update(options2) {
  61100. this.setState(options2);
  61101. }
  61102. dispose() {
  61103. const tech = this.player_.tech_;
  61104. const techEl = tech && tech.el_;
  61105. if (techEl) {
  61106. techEl.removeAttribute("aria-labelledby");
  61107. techEl.removeAttribute("aria-describedby");
  61108. }
  61109. super.dispose();
  61110. this.els = null;
  61111. }
  61112. }
  61113. Component$1$1.registerComponent("TitleBar", TitleBar);
  61114. const sourcesetLoad$1 = (tech) => {
  61115. const el = tech.el();
  61116. if (el.hasAttribute("src")) {
  61117. tech.triggerSourceset(el.src);
  61118. return true;
  61119. }
  61120. const sources = tech.$$("source");
  61121. const srcUrls = [];
  61122. let src = "";
  61123. if (!sources.length) {
  61124. return false;
  61125. }
  61126. for (let i2 = 0; i2 < sources.length; i2++) {
  61127. const url = sources[i2].src;
  61128. if (url && srcUrls.indexOf(url) === -1) {
  61129. srcUrls.push(url);
  61130. }
  61131. }
  61132. if (!srcUrls.length) {
  61133. return false;
  61134. }
  61135. if (srcUrls.length === 1) {
  61136. src = srcUrls[0];
  61137. }
  61138. tech.triggerSourceset(src);
  61139. return true;
  61140. };
  61141. const innerHTMLDescriptorPolyfill$1 = Object.defineProperty({}, "innerHTML", {
  61142. get() {
  61143. return this.cloneNode(true).innerHTML;
  61144. },
  61145. set(v) {
  61146. const dummy = document_1.createElement(this.nodeName.toLowerCase());
  61147. dummy.innerHTML = v;
  61148. const docFrag = document_1.createDocumentFragment();
  61149. while (dummy.childNodes.length) {
  61150. docFrag.appendChild(dummy.childNodes[0]);
  61151. }
  61152. this.innerText = "";
  61153. window_1.Element.prototype.appendChild.call(this, docFrag);
  61154. return this.innerHTML;
  61155. }
  61156. });
  61157. const getDescriptor$1 = (priority, prop) => {
  61158. let descriptor = {};
  61159. for (let i2 = 0; i2 < priority.length; i2++) {
  61160. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  61161. if (descriptor && descriptor.set && descriptor.get) {
  61162. break;
  61163. }
  61164. }
  61165. descriptor.enumerable = true;
  61166. descriptor.configurable = true;
  61167. return descriptor;
  61168. };
  61169. const getInnerHTMLDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill$1], "innerHTML");
  61170. const firstSourceWatch$1 = function(tech) {
  61171. const el = tech.el();
  61172. if (el.resetSourceWatch_) {
  61173. return;
  61174. }
  61175. const old = {};
  61176. const innerDescriptor = getInnerHTMLDescriptor$1(tech);
  61177. const appendWrapper = (appendFn) => (...args) => {
  61178. const retval = appendFn.apply(el, args);
  61179. sourcesetLoad$1(tech);
  61180. return retval;
  61181. };
  61182. ["append", "appendChild", "insertAdjacentHTML"].forEach((k) => {
  61183. if (!el[k]) {
  61184. return;
  61185. }
  61186. old[k] = el[k];
  61187. el[k] = appendWrapper(old[k]);
  61188. });
  61189. Object.defineProperty(el, "innerHTML", merge$1(innerDescriptor, {
  61190. set: appendWrapper(innerDescriptor.set)
  61191. }));
  61192. el.resetSourceWatch_ = () => {
  61193. el.resetSourceWatch_ = null;
  61194. Object.keys(old).forEach((k) => {
  61195. el[k] = old[k];
  61196. });
  61197. Object.defineProperty(el, "innerHTML", innerDescriptor);
  61198. };
  61199. tech.one("sourceset", el.resetSourceWatch_);
  61200. };
  61201. const srcDescriptorPolyfill$1 = Object.defineProperty({}, "src", {
  61202. get() {
  61203. if (this.hasAttribute("src")) {
  61204. return getAbsoluteURL$1(window_1.Element.prototype.getAttribute.call(this, "src"));
  61205. }
  61206. return "";
  61207. },
  61208. set(v) {
  61209. window_1.Element.prototype.setAttribute.call(this, "src", v);
  61210. return v;
  61211. }
  61212. });
  61213. const getSrcDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill$1], "src");
  61214. const setupSourceset$1 = function(tech) {
  61215. if (!tech.featuresSourceset) {
  61216. return;
  61217. }
  61218. const el = tech.el();
  61219. if (el.resetSourceset_) {
  61220. return;
  61221. }
  61222. const srcDescriptor = getSrcDescriptor$1(tech);
  61223. const oldSetAttribute = el.setAttribute;
  61224. const oldLoad = el.load;
  61225. Object.defineProperty(el, "src", merge$1(srcDescriptor, {
  61226. set: (v) => {
  61227. const retval = srcDescriptor.set.call(el, v);
  61228. tech.triggerSourceset(el.src);
  61229. return retval;
  61230. }
  61231. }));
  61232. el.setAttribute = (n, v) => {
  61233. const retval = oldSetAttribute.call(el, n, v);
  61234. if (/src/i.test(n)) {
  61235. tech.triggerSourceset(el.src);
  61236. }
  61237. return retval;
  61238. };
  61239. el.load = () => {
  61240. const retval = oldLoad.call(el);
  61241. if (!sourcesetLoad$1(tech)) {
  61242. tech.triggerSourceset("");
  61243. firstSourceWatch$1(tech);
  61244. }
  61245. return retval;
  61246. };
  61247. if (el.currentSrc) {
  61248. tech.triggerSourceset(el.currentSrc);
  61249. } else if (!sourcesetLoad$1(tech)) {
  61250. firstSourceWatch$1(tech);
  61251. }
  61252. el.resetSourceset_ = () => {
  61253. el.resetSourceset_ = null;
  61254. el.load = oldLoad;
  61255. el.setAttribute = oldSetAttribute;
  61256. Object.defineProperty(el, "src", srcDescriptor);
  61257. if (el.resetSourceWatch_) {
  61258. el.resetSourceWatch_();
  61259. }
  61260. };
  61261. };
  61262. class Html5$2 extends Tech$2 {
  61263. constructor(options2, ready) {
  61264. super(options2, ready);
  61265. const source = options2.source;
  61266. let crossoriginTracks = false;
  61267. this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === "VIDEO";
  61268. if (source && (this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  61269. this.setSource(source);
  61270. } else {
  61271. this.handleLateInit_(this.el_);
  61272. }
  61273. if (options2.enableSourceset) {
  61274. this.setupSourcesetHandling_();
  61275. }
  61276. this.isScrubbing_ = false;
  61277. if (this.el_.hasChildNodes()) {
  61278. const nodes = this.el_.childNodes;
  61279. let nodesLength = nodes.length;
  61280. const removeNodes = [];
  61281. while (nodesLength--) {
  61282. const node = nodes[nodesLength];
  61283. const nodeName = node.nodeName.toLowerCase();
  61284. if (nodeName === "track") {
  61285. if (!this.featuresNativeTextTracks) {
  61286. removeNodes.push(node);
  61287. } else {
  61288. this.remoteTextTrackEls().addTrackElement_(node);
  61289. this.remoteTextTracks().addTrack(node.track);
  61290. this.textTracks().addTrack(node.track);
  61291. if (!crossoriginTracks && !this.el_.hasAttribute("crossorigin") && isCrossOrigin$1(node.src)) {
  61292. crossoriginTracks = true;
  61293. }
  61294. }
  61295. }
  61296. }
  61297. for (let i2 = 0; i2 < removeNodes.length; i2++) {
  61298. this.el_.removeChild(removeNodes[i2]);
  61299. }
  61300. }
  61301. this.proxyNativeTracks_();
  61302. if (this.featuresNativeTextTracks && crossoriginTracks) {
  61303. 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.");
  61304. }
  61305. this.restoreMetadataTracksInIOSNativePlayer_();
  61306. if ((TOUCH_ENABLED$1 || IS_IPHONE$1) && options2.nativeControlsForTouch === true) {
  61307. this.setControls(true);
  61308. }
  61309. this.proxyWebkitFullscreen_();
  61310. this.triggerReady();
  61311. }
  61312. dispose() {
  61313. if (this.el_ && this.el_.resetSourceset_) {
  61314. this.el_.resetSourceset_();
  61315. }
  61316. Html5$2.disposeMediaElement(this.el_);
  61317. this.options_ = null;
  61318. super.dispose();
  61319. }
  61320. setupSourcesetHandling_() {
  61321. setupSourceset$1(this);
  61322. }
  61323. restoreMetadataTracksInIOSNativePlayer_() {
  61324. const textTracks = this.textTracks();
  61325. let metadataTracksPreFullscreenState;
  61326. const takeMetadataTrackSnapshot = () => {
  61327. metadataTracksPreFullscreenState = [];
  61328. for (let i2 = 0; i2 < textTracks.length; i2++) {
  61329. const track = textTracks[i2];
  61330. if (track.kind === "metadata") {
  61331. metadataTracksPreFullscreenState.push({
  61332. track,
  61333. storedMode: track.mode
  61334. });
  61335. }
  61336. }
  61337. };
  61338. takeMetadataTrackSnapshot();
  61339. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61340. this.on("dispose", () => textTracks.removeEventListener("change", takeMetadataTrackSnapshot));
  61341. const restoreTrackMode = () => {
  61342. for (let i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  61343. const storedTrack = metadataTracksPreFullscreenState[i2];
  61344. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  61345. storedTrack.track.mode = storedTrack.storedMode;
  61346. }
  61347. }
  61348. textTracks.removeEventListener("change", restoreTrackMode);
  61349. };
  61350. this.on("webkitbeginfullscreen", () => {
  61351. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61352. textTracks.removeEventListener("change", restoreTrackMode);
  61353. textTracks.addEventListener("change", restoreTrackMode);
  61354. });
  61355. this.on("webkitendfullscreen", () => {
  61356. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61357. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61358. textTracks.removeEventListener("change", restoreTrackMode);
  61359. });
  61360. }
  61361. overrideNative_(type2, override) {
  61362. if (override !== this[`featuresNative${type2}Tracks`]) {
  61363. return;
  61364. }
  61365. const lowerCaseType = type2.toLowerCase();
  61366. if (this[`${lowerCaseType}TracksListeners_`]) {
  61367. Object.keys(this[`${lowerCaseType}TracksListeners_`]).forEach((eventName) => {
  61368. const elTracks = this.el()[`${lowerCaseType}Tracks`];
  61369. elTracks.removeEventListener(eventName, this[`${lowerCaseType}TracksListeners_`][eventName]);
  61370. });
  61371. }
  61372. this[`featuresNative${type2}Tracks`] = !override;
  61373. this[`${lowerCaseType}TracksListeners_`] = null;
  61374. this.proxyNativeTracksForType_(lowerCaseType);
  61375. }
  61376. overrideNativeAudioTracks(override) {
  61377. this.overrideNative_("Audio", override);
  61378. }
  61379. overrideNativeVideoTracks(override) {
  61380. this.overrideNative_("Video", override);
  61381. }
  61382. proxyNativeTracksForType_(name) {
  61383. const props = NORMAL$1[name];
  61384. const elTracks = this.el()[props.getterName];
  61385. const techTracks = this[props.getterName]();
  61386. if (!this[`featuresNative${props.capitalName}Tracks`] || !elTracks || !elTracks.addEventListener) {
  61387. return;
  61388. }
  61389. const listeners = {
  61390. change: (e) => {
  61391. const event2 = {
  61392. type: "change",
  61393. target: techTracks,
  61394. currentTarget: techTracks,
  61395. srcElement: techTracks
  61396. };
  61397. techTracks.trigger(event2);
  61398. if (name === "text") {
  61399. this[REMOTE$1.remoteText.getterName]().trigger(event2);
  61400. }
  61401. },
  61402. addtrack(e) {
  61403. techTracks.addTrack(e.track);
  61404. },
  61405. removetrack(e) {
  61406. techTracks.removeTrack(e.track);
  61407. }
  61408. };
  61409. const removeOldTracks = function() {
  61410. const removeTracks = [];
  61411. for (let i2 = 0; i2 < techTracks.length; i2++) {
  61412. let found = false;
  61413. for (let j = 0; j < elTracks.length; j++) {
  61414. if (elTracks[j] === techTracks[i2]) {
  61415. found = true;
  61416. break;
  61417. }
  61418. }
  61419. if (!found) {
  61420. removeTracks.push(techTracks[i2]);
  61421. }
  61422. }
  61423. while (removeTracks.length) {
  61424. techTracks.removeTrack(removeTracks.shift());
  61425. }
  61426. };
  61427. this[props.getterName + "Listeners_"] = listeners;
  61428. Object.keys(listeners).forEach((eventName) => {
  61429. const listener = listeners[eventName];
  61430. elTracks.addEventListener(eventName, listener);
  61431. this.on("dispose", (e) => elTracks.removeEventListener(eventName, listener));
  61432. });
  61433. this.on("loadstart", removeOldTracks);
  61434. this.on("dispose", (e) => this.off("loadstart", removeOldTracks));
  61435. }
  61436. proxyNativeTracks_() {
  61437. NORMAL$1.names.forEach((name) => {
  61438. this.proxyNativeTracksForType_(name);
  61439. });
  61440. }
  61441. createEl() {
  61442. let el = this.options_.tag;
  61443. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  61444. if (el) {
  61445. const clone = el.cloneNode(true);
  61446. if (el.parentNode) {
  61447. el.parentNode.insertBefore(clone, el);
  61448. }
  61449. Html5$2.disposeMediaElement(el);
  61450. el = clone;
  61451. } else {
  61452. el = document_1.createElement("video");
  61453. const tagAttributes = this.options_.tag && getAttributes$1(this.options_.tag);
  61454. const attributes = merge$1({}, tagAttributes);
  61455. if (!TOUCH_ENABLED$1 || this.options_.nativeControlsForTouch !== true) {
  61456. delete attributes.controls;
  61457. }
  61458. setAttributes$1(el, Object.assign(attributes, {
  61459. id: this.options_.techId,
  61460. class: "vjs-tech"
  61461. }));
  61462. }
  61463. el.playerId = this.options_.playerId;
  61464. }
  61465. if (typeof this.options_.preload !== "undefined") {
  61466. setAttribute$1(el, "preload", this.options_.preload);
  61467. }
  61468. if (this.options_.disablePictureInPicture !== void 0) {
  61469. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  61470. }
  61471. const settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  61472. for (let i2 = 0; i2 < settingsAttrs.length; i2++) {
  61473. const attr = settingsAttrs[i2];
  61474. const value = this.options_[attr];
  61475. if (typeof value !== "undefined") {
  61476. if (value) {
  61477. setAttribute$1(el, attr, attr);
  61478. } else {
  61479. removeAttribute$1(el, attr);
  61480. }
  61481. el[attr] = value;
  61482. }
  61483. }
  61484. return el;
  61485. }
  61486. handleLateInit_(el) {
  61487. if (el.networkState === 0 || el.networkState === 3) {
  61488. return;
  61489. }
  61490. if (el.readyState === 0) {
  61491. let loadstartFired = false;
  61492. const setLoadstartFired = function() {
  61493. loadstartFired = true;
  61494. };
  61495. this.on("loadstart", setLoadstartFired);
  61496. const triggerLoadstart = function() {
  61497. if (!loadstartFired) {
  61498. this.trigger("loadstart");
  61499. }
  61500. };
  61501. this.on("loadedmetadata", triggerLoadstart);
  61502. this.ready(function() {
  61503. this.off("loadstart", setLoadstartFired);
  61504. this.off("loadedmetadata", triggerLoadstart);
  61505. if (!loadstartFired) {
  61506. this.trigger("loadstart");
  61507. }
  61508. });
  61509. return;
  61510. }
  61511. const eventsToTrigger = ["loadstart"];
  61512. eventsToTrigger.push("loadedmetadata");
  61513. if (el.readyState >= 2) {
  61514. eventsToTrigger.push("loadeddata");
  61515. }
  61516. if (el.readyState >= 3) {
  61517. eventsToTrigger.push("canplay");
  61518. }
  61519. if (el.readyState >= 4) {
  61520. eventsToTrigger.push("canplaythrough");
  61521. }
  61522. this.ready(function() {
  61523. eventsToTrigger.forEach(function(type2) {
  61524. this.trigger(type2);
  61525. }, this);
  61526. });
  61527. }
  61528. setScrubbing(isScrubbing) {
  61529. this.isScrubbing_ = isScrubbing;
  61530. }
  61531. scrubbing() {
  61532. return this.isScrubbing_;
  61533. }
  61534. setCurrentTime(seconds) {
  61535. try {
  61536. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI$1) {
  61537. this.el_.fastSeek(seconds);
  61538. } else {
  61539. this.el_.currentTime = seconds;
  61540. }
  61541. } catch (e) {
  61542. log$1$1(e, "Video is not ready. (Video.js)");
  61543. }
  61544. }
  61545. duration() {
  61546. if (this.el_.duration === Infinity && IS_ANDROID$1 && IS_CHROME$1 && this.el_.currentTime === 0) {
  61547. const checkProgress = () => {
  61548. if (this.el_.currentTime > 0) {
  61549. if (this.el_.duration === Infinity) {
  61550. this.trigger("durationchange");
  61551. }
  61552. this.off("timeupdate", checkProgress);
  61553. }
  61554. };
  61555. this.on("timeupdate", checkProgress);
  61556. return NaN;
  61557. }
  61558. return this.el_.duration || NaN;
  61559. }
  61560. width() {
  61561. return this.el_.offsetWidth;
  61562. }
  61563. height() {
  61564. return this.el_.offsetHeight;
  61565. }
  61566. proxyWebkitFullscreen_() {
  61567. if (!("webkitDisplayingFullscreen" in this.el_)) {
  61568. return;
  61569. }
  61570. const endFn = function() {
  61571. this.trigger("fullscreenchange", {
  61572. isFullscreen: false
  61573. });
  61574. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  61575. this.el_.controls = false;
  61576. }
  61577. };
  61578. const beginFn = function() {
  61579. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  61580. this.one("webkitendfullscreen", endFn);
  61581. this.trigger("fullscreenchange", {
  61582. isFullscreen: true,
  61583. nativeIOSFullscreen: true
  61584. });
  61585. }
  61586. };
  61587. this.on("webkitbeginfullscreen", beginFn);
  61588. this.on("dispose", () => {
  61589. this.off("webkitbeginfullscreen", beginFn);
  61590. this.off("webkitendfullscreen", endFn);
  61591. });
  61592. }
  61593. supportsFullScreen() {
  61594. return typeof this.el_.webkitEnterFullScreen === "function";
  61595. }
  61596. enterFullScreen() {
  61597. const video = this.el_;
  61598. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  61599. silencePromise$1(this.el_.play());
  61600. this.setTimeout(function() {
  61601. video.pause();
  61602. try {
  61603. video.webkitEnterFullScreen();
  61604. } catch (e) {
  61605. this.trigger("fullscreenerror", e);
  61606. }
  61607. }, 0);
  61608. } else {
  61609. try {
  61610. video.webkitEnterFullScreen();
  61611. } catch (e) {
  61612. this.trigger("fullscreenerror", e);
  61613. }
  61614. }
  61615. }
  61616. exitFullScreen() {
  61617. if (!this.el_.webkitDisplayingFullscreen) {
  61618. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  61619. return;
  61620. }
  61621. this.el_.webkitExitFullScreen();
  61622. }
  61623. requestPictureInPicture() {
  61624. return this.el_.requestPictureInPicture();
  61625. }
  61626. requestVideoFrameCallback(cb) {
  61627. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61628. return this.el_.requestVideoFrameCallback(cb);
  61629. }
  61630. return super.requestVideoFrameCallback(cb);
  61631. }
  61632. cancelVideoFrameCallback(id) {
  61633. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61634. this.el_.cancelVideoFrameCallback(id);
  61635. } else {
  61636. super.cancelVideoFrameCallback(id);
  61637. }
  61638. }
  61639. src(src) {
  61640. if (src === void 0) {
  61641. return this.el_.src;
  61642. }
  61643. this.setSrc(src);
  61644. }
  61645. reset() {
  61646. Html5$2.resetMediaElement(this.el_);
  61647. }
  61648. currentSrc() {
  61649. if (this.currentSource_) {
  61650. return this.currentSource_.src;
  61651. }
  61652. return this.el_.currentSrc;
  61653. }
  61654. setControls(val) {
  61655. this.el_.controls = !!val;
  61656. }
  61657. addTextTrack(kind, label2, language) {
  61658. if (!this.featuresNativeTextTracks) {
  61659. return super.addTextTrack(kind, label2, language);
  61660. }
  61661. return this.el_.addTextTrack(kind, label2, language);
  61662. }
  61663. createRemoteTextTrack(options2) {
  61664. if (!this.featuresNativeTextTracks) {
  61665. return super.createRemoteTextTrack(options2);
  61666. }
  61667. const htmlTrackElement = document_1.createElement("track");
  61668. if (options2.kind) {
  61669. htmlTrackElement.kind = options2.kind;
  61670. }
  61671. if (options2.label) {
  61672. htmlTrackElement.label = options2.label;
  61673. }
  61674. if (options2.language || options2.srclang) {
  61675. htmlTrackElement.srclang = options2.language || options2.srclang;
  61676. }
  61677. if (options2.default) {
  61678. htmlTrackElement.default = options2.default;
  61679. }
  61680. if (options2.id) {
  61681. htmlTrackElement.id = options2.id;
  61682. }
  61683. if (options2.src) {
  61684. htmlTrackElement.src = options2.src;
  61685. }
  61686. return htmlTrackElement;
  61687. }
  61688. addRemoteTextTrack(options2, manualCleanup) {
  61689. const htmlTrackElement = super.addRemoteTextTrack(options2, manualCleanup);
  61690. if (this.featuresNativeTextTracks) {
  61691. this.el().appendChild(htmlTrackElement);
  61692. }
  61693. return htmlTrackElement;
  61694. }
  61695. removeRemoteTextTrack(track) {
  61696. super.removeRemoteTextTrack(track);
  61697. if (this.featuresNativeTextTracks) {
  61698. const tracks = this.$$("track");
  61699. let i2 = tracks.length;
  61700. while (i2--) {
  61701. if (track === tracks[i2] || track === tracks[i2].track) {
  61702. this.el().removeChild(tracks[i2]);
  61703. }
  61704. }
  61705. }
  61706. }
  61707. getVideoPlaybackQuality() {
  61708. if (typeof this.el().getVideoPlaybackQuality === "function") {
  61709. return this.el().getVideoPlaybackQuality();
  61710. }
  61711. const videoPlaybackQuality = {};
  61712. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  61713. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  61714. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  61715. }
  61716. if (window_1.performance) {
  61717. videoPlaybackQuality.creationTime = window_1.performance.now();
  61718. }
  61719. return videoPlaybackQuality;
  61720. }
  61721. }
  61722. defineLazyProperty$1(Html5$2, "TEST_VID", function() {
  61723. if (!isReal$1()) {
  61724. return;
  61725. }
  61726. const video = document_1.createElement("video");
  61727. const track = document_1.createElement("track");
  61728. track.kind = "captions";
  61729. track.srclang = "en";
  61730. track.label = "English";
  61731. video.appendChild(track);
  61732. return video;
  61733. });
  61734. Html5$2.isSupported = function() {
  61735. try {
  61736. Html5$2.TEST_VID.volume = 0.5;
  61737. } catch (e) {
  61738. return false;
  61739. }
  61740. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.canPlayType);
  61741. };
  61742. Html5$2.canPlayType = function(type2) {
  61743. return Html5$2.TEST_VID.canPlayType(type2);
  61744. };
  61745. Html5$2.canPlaySource = function(srcObj, options2) {
  61746. return Html5$2.canPlayType(srcObj.type);
  61747. };
  61748. Html5$2.canControlVolume = function() {
  61749. try {
  61750. const volume = Html5$2.TEST_VID.volume;
  61751. Html5$2.TEST_VID.volume = volume / 2 + 0.1;
  61752. const canControl = volume !== Html5$2.TEST_VID.volume;
  61753. if (canControl && IS_IOS$1) {
  61754. window_1.setTimeout(() => {
  61755. if (Html5$2 && Html5$2.prototype) {
  61756. Html5$2.prototype.featuresVolumeControl = volume !== Html5$2.TEST_VID.volume;
  61757. }
  61758. });
  61759. return false;
  61760. }
  61761. return canControl;
  61762. } catch (e) {
  61763. return false;
  61764. }
  61765. };
  61766. Html5$2.canMuteVolume = function() {
  61767. try {
  61768. const muted = Html5$2.TEST_VID.muted;
  61769. Html5$2.TEST_VID.muted = !muted;
  61770. if (Html5$2.TEST_VID.muted) {
  61771. setAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61772. } else {
  61773. removeAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61774. }
  61775. return muted !== Html5$2.TEST_VID.muted;
  61776. } catch (e) {
  61777. return false;
  61778. }
  61779. };
  61780. Html5$2.canControlPlaybackRate = function() {
  61781. if (IS_ANDROID$1 && IS_CHROME$1 && CHROME_VERSION$1 < 58) {
  61782. return false;
  61783. }
  61784. try {
  61785. const playbackRate = Html5$2.TEST_VID.playbackRate;
  61786. Html5$2.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  61787. return playbackRate !== Html5$2.TEST_VID.playbackRate;
  61788. } catch (e) {
  61789. return false;
  61790. }
  61791. };
  61792. Html5$2.canOverrideAttributes = function() {
  61793. try {
  61794. const noop2 = () => {
  61795. };
  61796. Object.defineProperty(document_1.createElement("video"), "src", {
  61797. get: noop2,
  61798. set: noop2
  61799. });
  61800. Object.defineProperty(document_1.createElement("audio"), "src", {
  61801. get: noop2,
  61802. set: noop2
  61803. });
  61804. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  61805. get: noop2,
  61806. set: noop2
  61807. });
  61808. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  61809. get: noop2,
  61810. set: noop2
  61811. });
  61812. } catch (e) {
  61813. return false;
  61814. }
  61815. return true;
  61816. };
  61817. Html5$2.supportsNativeTextTracks = function() {
  61818. return IS_ANY_SAFARI$1 || IS_IOS$1 && IS_CHROME$1;
  61819. };
  61820. Html5$2.supportsNativeVideoTracks = function() {
  61821. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.videoTracks);
  61822. };
  61823. Html5$2.supportsNativeAudioTracks = function() {
  61824. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.audioTracks);
  61825. };
  61826. 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"];
  61827. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function([key, fn2]) {
  61828. defineLazyProperty$1(Html5$2.prototype, key, () => Html5$2[fn2](), true);
  61829. });
  61830. Html5$2.prototype.featuresVolumeControl = Html5$2.canControlVolume();
  61831. Html5$2.prototype.movingMediaElementInDOM = !IS_IOS$1;
  61832. Html5$2.prototype.featuresFullscreenResize = true;
  61833. Html5$2.prototype.featuresProgressEvents = true;
  61834. Html5$2.prototype.featuresTimeupdateEvents = true;
  61835. Html5$2.prototype.featuresVideoFrameCallback = !!(Html5$2.TEST_VID && Html5$2.TEST_VID.requestVideoFrameCallback);
  61836. Html5$2.disposeMediaElement = function(el) {
  61837. if (!el) {
  61838. return;
  61839. }
  61840. if (el.parentNode) {
  61841. el.parentNode.removeChild(el);
  61842. }
  61843. while (el.hasChildNodes()) {
  61844. el.removeChild(el.firstChild);
  61845. }
  61846. el.removeAttribute("src");
  61847. if (typeof el.load === "function") {
  61848. (function() {
  61849. try {
  61850. el.load();
  61851. } catch (e) {
  61852. }
  61853. })();
  61854. }
  61855. };
  61856. Html5$2.resetMediaElement = function(el) {
  61857. if (!el) {
  61858. return;
  61859. }
  61860. const sources = el.querySelectorAll("source");
  61861. let i2 = sources.length;
  61862. while (i2--) {
  61863. el.removeChild(sources[i2]);
  61864. }
  61865. el.removeAttribute("src");
  61866. if (typeof el.load === "function") {
  61867. (function() {
  61868. try {
  61869. el.load();
  61870. } catch (e) {
  61871. }
  61872. })();
  61873. }
  61874. };
  61875. [
  61876. "muted",
  61877. "defaultMuted",
  61878. "autoplay",
  61879. "controls",
  61880. "loop",
  61881. "playsinline"
  61882. ].forEach(function(prop) {
  61883. Html5$2.prototype[prop] = function() {
  61884. return this.el_[prop] || this.el_.hasAttribute(prop);
  61885. };
  61886. });
  61887. [
  61888. "muted",
  61889. "defaultMuted",
  61890. "autoplay",
  61891. "loop",
  61892. "playsinline"
  61893. ].forEach(function(prop) {
  61894. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61895. this.el_[prop] = v;
  61896. if (v) {
  61897. this.el_.setAttribute(prop, prop);
  61898. } else {
  61899. this.el_.removeAttribute(prop);
  61900. }
  61901. };
  61902. });
  61903. [
  61904. "paused",
  61905. "currentTime",
  61906. "buffered",
  61907. "volume",
  61908. "poster",
  61909. "preload",
  61910. "error",
  61911. "seeking",
  61912. "seekable",
  61913. "ended",
  61914. "playbackRate",
  61915. "defaultPlaybackRate",
  61916. "disablePictureInPicture",
  61917. "played",
  61918. "networkState",
  61919. "readyState",
  61920. "videoWidth",
  61921. "videoHeight",
  61922. "crossOrigin"
  61923. ].forEach(function(prop) {
  61924. Html5$2.prototype[prop] = function() {
  61925. return this.el_[prop];
  61926. };
  61927. });
  61928. [
  61929. "volume",
  61930. "src",
  61931. "poster",
  61932. "preload",
  61933. "playbackRate",
  61934. "defaultPlaybackRate",
  61935. "disablePictureInPicture",
  61936. "crossOrigin"
  61937. ].forEach(function(prop) {
  61938. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61939. this.el_[prop] = v;
  61940. };
  61941. });
  61942. [
  61943. "pause",
  61944. "load",
  61945. "play"
  61946. ].forEach(function(prop) {
  61947. Html5$2.prototype[prop] = function() {
  61948. return this.el_[prop]();
  61949. };
  61950. });
  61951. Tech$2.withSourceHandlers(Html5$2);
  61952. Html5$2.nativeSourceHandler = {};
  61953. Html5$2.nativeSourceHandler.canPlayType = function(type2) {
  61954. try {
  61955. return Html5$2.TEST_VID.canPlayType(type2);
  61956. } catch (e) {
  61957. return "";
  61958. }
  61959. };
  61960. Html5$2.nativeSourceHandler.canHandleSource = function(source, options2) {
  61961. if (source.type) {
  61962. return Html5$2.nativeSourceHandler.canPlayType(source.type);
  61963. } else if (source.src) {
  61964. const ext = getFileExtension$1(source.src);
  61965. return Html5$2.nativeSourceHandler.canPlayType(`video/${ext}`);
  61966. }
  61967. return "";
  61968. };
  61969. Html5$2.nativeSourceHandler.handleSource = function(source, tech, options2) {
  61970. tech.setSrc(source.src);
  61971. };
  61972. Html5$2.nativeSourceHandler.dispose = function() {
  61973. };
  61974. Html5$2.registerSourceHandler(Html5$2.nativeSourceHandler);
  61975. Tech$2.registerTech("Html5", Html5$2);
  61976. const TECH_EVENTS_RETRIGGER$1 = [
  61977. "progress",
  61978. "abort",
  61979. "suspend",
  61980. "emptied",
  61981. "stalled",
  61982. "loadedmetadata",
  61983. "loadeddata",
  61984. "timeupdate",
  61985. "resize",
  61986. "volumechange",
  61987. "texttrackchange"
  61988. ];
  61989. const TECH_EVENTS_QUEUE$1 = {
  61990. canplay: "CanPlay",
  61991. canplaythrough: "CanPlayThrough",
  61992. playing: "Playing",
  61993. seeked: "Seeked"
  61994. };
  61995. const BREAKPOINT_ORDER$1 = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  61996. const BREAKPOINT_CLASSES$1 = {};
  61997. BREAKPOINT_ORDER$1.forEach((k) => {
  61998. const v = k.charAt(0) === "x" ? `x-${k.substring(1)}` : k;
  61999. BREAKPOINT_CLASSES$1[k] = `vjs-layout-${v}`;
  62000. });
  62001. const DEFAULT_BREAKPOINTS$1 = {
  62002. tiny: 210,
  62003. xsmall: 320,
  62004. small: 425,
  62005. medium: 768,
  62006. large: 1440,
  62007. xlarge: 2560,
  62008. huge: Infinity
  62009. };
  62010. class Player$1 extends Component$1$1 {
  62011. constructor(tag, options2, ready) {
  62012. tag.id = tag.id || options2.id || `vjs_video_${newGUID$1()}`;
  62013. options2 = Object.assign(Player$1.getTagSettings(tag), options2);
  62014. options2.initChildren = false;
  62015. options2.createEl = false;
  62016. options2.evented = false;
  62017. options2.reportTouchActivity = false;
  62018. if (!options2.language) {
  62019. const closest = tag.closest("[lang]");
  62020. if (closest) {
  62021. options2.language = closest.getAttribute("lang");
  62022. }
  62023. }
  62024. super(null, options2, ready);
  62025. this.boundDocumentFullscreenChange_ = (e) => this.documentFullscreenChange_(e);
  62026. this.boundFullWindowOnEscKey_ = (e) => this.fullWindowOnEscKey(e);
  62027. this.boundUpdateStyleEl_ = (e) => this.updateStyleEl_(e);
  62028. this.boundApplyInitTime_ = (e) => this.applyInitTime_(e);
  62029. this.boundUpdateCurrentBreakpoint_ = (e) => this.updateCurrentBreakpoint_(e);
  62030. this.boundHandleTechClick_ = (e) => this.handleTechClick_(e);
  62031. this.boundHandleTechDoubleClick_ = (e) => this.handleTechDoubleClick_(e);
  62032. this.boundHandleTechTouchStart_ = (e) => this.handleTechTouchStart_(e);
  62033. this.boundHandleTechTouchMove_ = (e) => this.handleTechTouchMove_(e);
  62034. this.boundHandleTechTouchEnd_ = (e) => this.handleTechTouchEnd_(e);
  62035. this.boundHandleTechTap_ = (e) => this.handleTechTap_(e);
  62036. this.isFullscreen_ = false;
  62037. this.log = createLogger$2(this.id_);
  62038. this.fsApi_ = FullscreenApi$1;
  62039. this.isPosterFromTech_ = false;
  62040. this.queuedCallbacks_ = [];
  62041. this.isReady_ = false;
  62042. this.hasStarted_ = false;
  62043. this.userActive_ = false;
  62044. this.debugEnabled_ = false;
  62045. this.audioOnlyMode_ = false;
  62046. this.audioPosterMode_ = false;
  62047. this.audioOnlyCache_ = {
  62048. playerHeight: null,
  62049. hiddenChildren: []
  62050. };
  62051. if (!this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) {
  62052. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  62053. }
  62054. this.tag = tag;
  62055. this.tagAttributes = tag && getAttributes$1(tag);
  62056. this.language(this.options_.language);
  62057. if (options2.languages) {
  62058. const languagesToLower = {};
  62059. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  62060. languagesToLower[name.toLowerCase()] = options2.languages[name];
  62061. });
  62062. this.languages_ = languagesToLower;
  62063. } else {
  62064. this.languages_ = Player$1.prototype.options_.languages;
  62065. }
  62066. this.resetCache_();
  62067. this.poster_ = options2.poster || "";
  62068. this.controls_ = !!options2.controls;
  62069. tag.controls = false;
  62070. tag.removeAttribute("controls");
  62071. this.changingSrc_ = false;
  62072. this.playCallbacks_ = [];
  62073. this.playTerminatedQueue_ = [];
  62074. if (tag.hasAttribute("autoplay")) {
  62075. this.autoplay(true);
  62076. } else {
  62077. this.autoplay(this.options_.autoplay);
  62078. }
  62079. if (options2.plugins) {
  62080. Object.keys(options2.plugins).forEach((name) => {
  62081. if (typeof this[name] !== "function") {
  62082. throw new Error(`plugin "${name}" does not exist`);
  62083. }
  62084. });
  62085. }
  62086. this.scrubbing_ = false;
  62087. this.el_ = this.createEl();
  62088. evented$1(this, {
  62089. eventBusKey: "el_"
  62090. });
  62091. if (this.fsApi_.requestFullscreen) {
  62092. on$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62093. this.on(this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62094. }
  62095. if (this.fluid_) {
  62096. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62097. }
  62098. const playerOptionsCopy = merge$1(this.options_);
  62099. if (options2.plugins) {
  62100. Object.keys(options2.plugins).forEach((name) => {
  62101. this[name](options2.plugins[name]);
  62102. });
  62103. }
  62104. if (options2.debug) {
  62105. this.debug(true);
  62106. }
  62107. this.options_.playerOptions = playerOptionsCopy;
  62108. this.middleware_ = [];
  62109. this.playbackRates(options2.playbackRates);
  62110. this.initChildren();
  62111. this.isAudio(tag.nodeName.toLowerCase() === "audio");
  62112. if (this.controls()) {
  62113. this.addClass("vjs-controls-enabled");
  62114. } else {
  62115. this.addClass("vjs-controls-disabled");
  62116. }
  62117. this.el_.setAttribute("role", "region");
  62118. if (this.isAudio()) {
  62119. this.el_.setAttribute("aria-label", this.localize("Audio Player"));
  62120. } else {
  62121. this.el_.setAttribute("aria-label", this.localize("Video Player"));
  62122. }
  62123. if (this.isAudio()) {
  62124. this.addClass("vjs-audio");
  62125. }
  62126. if (TOUCH_ENABLED$1) {
  62127. this.addClass("vjs-touch-enabled");
  62128. }
  62129. if (!IS_IOS$1) {
  62130. this.addClass("vjs-workinghover");
  62131. }
  62132. Player$1.players[this.id_] = this;
  62133. const majorVersion = version$6$1.split(".")[0];
  62134. this.addClass(`vjs-v${majorVersion}`);
  62135. this.userActive(true);
  62136. this.reportUserActivity();
  62137. this.one("play", (e) => this.listenForUserActivity_(e));
  62138. this.on("keydown", (e) => this.handleKeyDown(e));
  62139. this.on("languagechange", (e) => this.handleLanguagechange(e));
  62140. this.breakpoints(this.options_.breakpoints);
  62141. this.responsive(this.options_.responsive);
  62142. this.on("ready", () => {
  62143. this.audioPosterMode(this.options_.audioPosterMode);
  62144. this.audioOnlyMode(this.options_.audioOnlyMode);
  62145. });
  62146. }
  62147. dispose() {
  62148. this.trigger("dispose");
  62149. this.off("dispose");
  62150. off$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62151. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  62152. if (this.styleEl_ && this.styleEl_.parentNode) {
  62153. this.styleEl_.parentNode.removeChild(this.styleEl_);
  62154. this.styleEl_ = null;
  62155. }
  62156. Player$1.players[this.id_] = null;
  62157. if (this.tag && this.tag.player) {
  62158. this.tag.player = null;
  62159. }
  62160. if (this.el_ && this.el_.player) {
  62161. this.el_.player = null;
  62162. }
  62163. if (this.tech_) {
  62164. this.tech_.dispose();
  62165. this.isPosterFromTech_ = false;
  62166. this.poster_ = "";
  62167. }
  62168. if (this.playerElIngest_) {
  62169. this.playerElIngest_ = null;
  62170. }
  62171. if (this.tag) {
  62172. this.tag = null;
  62173. }
  62174. clearCacheForPlayer$1(this);
  62175. ALL$1.names.forEach((name) => {
  62176. const props = ALL$1[name];
  62177. const list = this[props.getterName]();
  62178. if (list && list.off) {
  62179. list.off();
  62180. }
  62181. });
  62182. super.dispose({
  62183. restoreEl: this.options_.restoreEl
  62184. });
  62185. }
  62186. createEl() {
  62187. let tag = this.tag;
  62188. let el;
  62189. let playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  62190. const divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  62191. if (playerElIngest) {
  62192. el = this.el_ = tag.parentNode;
  62193. } else if (!divEmbed) {
  62194. el = this.el_ = super.createEl("div");
  62195. }
  62196. const attrs = getAttributes$1(tag);
  62197. if (divEmbed) {
  62198. el = this.el_ = tag;
  62199. tag = this.tag = document_1.createElement("video");
  62200. while (el.children.length) {
  62201. tag.appendChild(el.firstChild);
  62202. }
  62203. if (!hasClass$1(el, "video-js")) {
  62204. addClass$1(el, "video-js");
  62205. }
  62206. el.appendChild(tag);
  62207. playerElIngest = this.playerElIngest_ = el;
  62208. Object.keys(el).forEach((k) => {
  62209. try {
  62210. tag[k] = el[k];
  62211. } catch (e) {
  62212. }
  62213. });
  62214. }
  62215. tag.setAttribute("tabindex", "-1");
  62216. attrs.tabindex = "-1";
  62217. if (IS_CHROME$1 && IS_WINDOWS$1) {
  62218. tag.setAttribute("role", "application");
  62219. attrs.role = "application";
  62220. }
  62221. tag.removeAttribute("width");
  62222. tag.removeAttribute("height");
  62223. if ("width" in attrs) {
  62224. delete attrs.width;
  62225. }
  62226. if ("height" in attrs) {
  62227. delete attrs.height;
  62228. }
  62229. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  62230. if (!(divEmbed && attr === "class")) {
  62231. el.setAttribute(attr, attrs[attr]);
  62232. }
  62233. if (divEmbed) {
  62234. tag.setAttribute(attr, attrs[attr]);
  62235. }
  62236. });
  62237. tag.playerId = tag.id;
  62238. tag.id += "_html5_api";
  62239. tag.className = "vjs-tech";
  62240. tag.player = el.player = this;
  62241. this.addClass("vjs-paused");
  62242. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  62243. this.styleEl_ = createStyleElement$1("vjs-styles-dimensions");
  62244. const defaultsStyleEl = $$1(".vjs-styles-defaults");
  62245. const head = $$1("head");
  62246. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  62247. }
  62248. this.fill_ = false;
  62249. this.fluid_ = false;
  62250. this.width(this.options_.width);
  62251. this.height(this.options_.height);
  62252. this.fill(this.options_.fill);
  62253. this.fluid(this.options_.fluid);
  62254. this.aspectRatio(this.options_.aspectRatio);
  62255. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  62256. const links = tag.getElementsByTagName("a");
  62257. for (let i2 = 0; i2 < links.length; i2++) {
  62258. const linkEl = links.item(i2);
  62259. addClass$1(linkEl, "vjs-hidden");
  62260. linkEl.setAttribute("hidden", "hidden");
  62261. }
  62262. tag.initNetworkState_ = tag.networkState;
  62263. if (tag.parentNode && !playerElIngest) {
  62264. tag.parentNode.insertBefore(el, tag);
  62265. }
  62266. prependTo$1(tag, el);
  62267. this.children_.unshift(tag);
  62268. this.el_.setAttribute("lang", this.language_);
  62269. this.el_.setAttribute("translate", "no");
  62270. this.el_ = el;
  62271. return el;
  62272. }
  62273. crossOrigin(value) {
  62274. if (typeof value === "undefined") {
  62275. return this.techGet_("crossOrigin");
  62276. }
  62277. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  62278. log$1$1.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  62279. return;
  62280. }
  62281. this.techCall_("setCrossOrigin", value);
  62282. if (this.posterImage) {
  62283. this.posterImage.crossOrigin(value);
  62284. }
  62285. return;
  62286. }
  62287. width(value) {
  62288. return this.dimension("width", value);
  62289. }
  62290. height(value) {
  62291. return this.dimension("height", value);
  62292. }
  62293. dimension(dimension, value) {
  62294. const privDimension = dimension + "_";
  62295. if (value === void 0) {
  62296. return this[privDimension] || 0;
  62297. }
  62298. if (value === "" || value === "auto") {
  62299. this[privDimension] = void 0;
  62300. this.updateStyleEl_();
  62301. return;
  62302. }
  62303. const parsedVal = parseFloat(value);
  62304. if (isNaN(parsedVal)) {
  62305. log$1$1.error(`Improper value "${value}" supplied for for ${dimension}`);
  62306. return;
  62307. }
  62308. this[privDimension] = parsedVal;
  62309. this.updateStyleEl_();
  62310. }
  62311. fluid(bool) {
  62312. if (bool === void 0) {
  62313. return !!this.fluid_;
  62314. }
  62315. this.fluid_ = !!bool;
  62316. if (isEvented$1(this)) {
  62317. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62318. }
  62319. if (bool) {
  62320. this.addClass("vjs-fluid");
  62321. this.fill(false);
  62322. addEventedCallback$1(this, () => {
  62323. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62324. });
  62325. } else {
  62326. this.removeClass("vjs-fluid");
  62327. }
  62328. this.updateStyleEl_();
  62329. }
  62330. fill(bool) {
  62331. if (bool === void 0) {
  62332. return !!this.fill_;
  62333. }
  62334. this.fill_ = !!bool;
  62335. if (bool) {
  62336. this.addClass("vjs-fill");
  62337. this.fluid(false);
  62338. } else {
  62339. this.removeClass("vjs-fill");
  62340. }
  62341. }
  62342. aspectRatio(ratio) {
  62343. if (ratio === void 0) {
  62344. return this.aspectRatio_;
  62345. }
  62346. if (!/^\d+\:\d+$/.test(ratio)) {
  62347. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  62348. }
  62349. this.aspectRatio_ = ratio;
  62350. this.fluid(true);
  62351. this.updateStyleEl_();
  62352. }
  62353. updateStyleEl_() {
  62354. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  62355. const width3 = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  62356. const height3 = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  62357. const techEl = this.tech_ && this.tech_.el();
  62358. if (techEl) {
  62359. if (width3 >= 0) {
  62360. techEl.width = width3;
  62361. }
  62362. if (height3 >= 0) {
  62363. techEl.height = height3;
  62364. }
  62365. }
  62366. return;
  62367. }
  62368. let width2;
  62369. let height2;
  62370. let aspectRatio;
  62371. let idClass;
  62372. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  62373. aspectRatio = this.aspectRatio_;
  62374. } else if (this.videoWidth() > 0) {
  62375. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  62376. } else {
  62377. aspectRatio = "16:9";
  62378. }
  62379. const ratioParts = aspectRatio.split(":");
  62380. const ratioMultiplier = ratioParts[1] / ratioParts[0];
  62381. if (this.width_ !== void 0) {
  62382. width2 = this.width_;
  62383. } else if (this.height_ !== void 0) {
  62384. width2 = this.height_ / ratioMultiplier;
  62385. } else {
  62386. width2 = this.videoWidth() || 300;
  62387. }
  62388. if (this.height_ !== void 0) {
  62389. height2 = this.height_;
  62390. } else {
  62391. height2 = width2 * ratioMultiplier;
  62392. }
  62393. if (/^[^a-zA-Z]/.test(this.id())) {
  62394. idClass = "dimensions-" + this.id();
  62395. } else {
  62396. idClass = this.id() + "-dimensions";
  62397. }
  62398. this.addClass(idClass);
  62399. setTextContent$1(this.styleEl_, `
  62400. .${idClass} {
  62401. width: ${width2}px;
  62402. height: ${height2}px;
  62403. }
  62404. .${idClass}.vjs-fluid:not(.vjs-audio-only-mode) {
  62405. padding-top: ${ratioMultiplier * 100}%;
  62406. }
  62407. `);
  62408. }
  62409. loadTech_(techName, source) {
  62410. if (this.tech_) {
  62411. this.unloadTech_();
  62412. }
  62413. const titleTechName = toTitleCase$1$1(techName);
  62414. const camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  62415. if (titleTechName !== "Html5" && this.tag) {
  62416. Tech$2.getTech("Html5").disposeMediaElement(this.tag);
  62417. this.tag.player = null;
  62418. this.tag = null;
  62419. }
  62420. this.techName_ = titleTechName;
  62421. this.isReady_ = false;
  62422. let autoplay = this.autoplay();
  62423. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  62424. autoplay = false;
  62425. }
  62426. const techOptions = {
  62427. source,
  62428. autoplay,
  62429. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  62430. "playerId": this.id(),
  62431. "techId": `${this.id()}_${camelTechName}_api`,
  62432. "playsinline": this.options_.playsinline,
  62433. "preload": this.options_.preload,
  62434. "loop": this.options_.loop,
  62435. "disablePictureInPicture": this.options_.disablePictureInPicture,
  62436. "muted": this.options_.muted,
  62437. "poster": this.poster(),
  62438. "language": this.language(),
  62439. "playerElIngest": this.playerElIngest_ || false,
  62440. "vtt.js": this.options_["vtt.js"],
  62441. "canOverridePoster": !!this.options_.techCanOverridePoster,
  62442. "enableSourceset": this.options_.enableSourceset
  62443. };
  62444. ALL$1.names.forEach((name) => {
  62445. const props = ALL$1[name];
  62446. techOptions[props.getterName] = this[props.privateName];
  62447. });
  62448. Object.assign(techOptions, this.options_[titleTechName]);
  62449. Object.assign(techOptions, this.options_[camelTechName]);
  62450. Object.assign(techOptions, this.options_[techName.toLowerCase()]);
  62451. if (this.tag) {
  62452. techOptions.tag = this.tag;
  62453. }
  62454. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  62455. techOptions.startTime = this.cache_.currentTime;
  62456. }
  62457. const TechClass = Tech$2.getTech(techName);
  62458. if (!TechClass) {
  62459. throw new Error(`No Tech named '${titleTechName}' exists! '${titleTechName}' should be registered using videojs.registerTech()'`);
  62460. }
  62461. this.tech_ = new TechClass(techOptions);
  62462. this.tech_.ready(bind_(this, this.handleTechReady_), true);
  62463. textTrackConverter$1.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  62464. TECH_EVENTS_RETRIGGER$1.forEach((event2) => {
  62465. this.on(this.tech_, event2, (e) => this[`handleTech${toTitleCase$1$1(event2)}_`](e));
  62466. });
  62467. Object.keys(TECH_EVENTS_QUEUE$1).forEach((event2) => {
  62468. this.on(this.tech_, event2, (eventObj) => {
  62469. if (this.tech_.playbackRate() === 0 && this.tech_.seeking()) {
  62470. this.queuedCallbacks_.push({
  62471. callback: this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`].bind(this),
  62472. event: eventObj
  62473. });
  62474. return;
  62475. }
  62476. this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`](eventObj);
  62477. });
  62478. });
  62479. this.on(this.tech_, "loadstart", (e) => this.handleTechLoadStart_(e));
  62480. this.on(this.tech_, "sourceset", (e) => this.handleTechSourceset_(e));
  62481. this.on(this.tech_, "waiting", (e) => this.handleTechWaiting_(e));
  62482. this.on(this.tech_, "ended", (e) => this.handleTechEnded_(e));
  62483. this.on(this.tech_, "seeking", (e) => this.handleTechSeeking_(e));
  62484. this.on(this.tech_, "play", (e) => this.handleTechPlay_(e));
  62485. this.on(this.tech_, "pause", (e) => this.handleTechPause_(e));
  62486. this.on(this.tech_, "durationchange", (e) => this.handleTechDurationChange_(e));
  62487. this.on(this.tech_, "fullscreenchange", (e, data) => this.handleTechFullscreenChange_(e, data));
  62488. this.on(this.tech_, "fullscreenerror", (e, err) => this.handleTechFullscreenError_(e, err));
  62489. this.on(this.tech_, "enterpictureinpicture", (e) => this.handleTechEnterPictureInPicture_(e));
  62490. this.on(this.tech_, "leavepictureinpicture", (e) => this.handleTechLeavePictureInPicture_(e));
  62491. this.on(this.tech_, "error", (e) => this.handleTechError_(e));
  62492. this.on(this.tech_, "posterchange", (e) => this.handleTechPosterChange_(e));
  62493. this.on(this.tech_, "textdata", (e) => this.handleTechTextData_(e));
  62494. this.on(this.tech_, "ratechange", (e) => this.handleTechRateChange_(e));
  62495. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  62496. this.usingNativeControls(this.techGet_("controls"));
  62497. if (this.controls() && !this.usingNativeControls()) {
  62498. this.addTechControlsListeners_();
  62499. }
  62500. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  62501. prependTo$1(this.tech_.el(), this.el());
  62502. }
  62503. if (this.tag) {
  62504. this.tag.player = null;
  62505. this.tag = null;
  62506. }
  62507. }
  62508. unloadTech_() {
  62509. ALL$1.names.forEach((name) => {
  62510. const props = ALL$1[name];
  62511. this[props.privateName] = this[props.getterName]();
  62512. });
  62513. this.textTracksJson_ = textTrackConverter$1.textTracksToJson(this.tech_);
  62514. this.isReady_ = false;
  62515. this.tech_.dispose();
  62516. this.tech_ = false;
  62517. if (this.isPosterFromTech_) {
  62518. this.poster_ = "";
  62519. this.trigger("posterchange");
  62520. }
  62521. this.isPosterFromTech_ = false;
  62522. }
  62523. tech(safety) {
  62524. if (safety === void 0) {
  62525. 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");
  62526. }
  62527. return this.tech_;
  62528. }
  62529. addTechControlsListeners_() {
  62530. this.removeTechControlsListeners_();
  62531. this.on(this.tech_, "click", this.boundHandleTechClick_);
  62532. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62533. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62534. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62535. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62536. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  62537. }
  62538. removeTechControlsListeners_() {
  62539. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  62540. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62541. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62542. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62543. this.off(this.tech_, "click", this.boundHandleTechClick_);
  62544. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62545. }
  62546. handleTechReady_() {
  62547. this.triggerReady();
  62548. if (this.cache_.volume) {
  62549. this.techCall_("setVolume", this.cache_.volume);
  62550. }
  62551. this.handleTechPosterChange_();
  62552. this.handleTechDurationChange_();
  62553. }
  62554. handleTechLoadStart_() {
  62555. this.removeClass("vjs-ended", "vjs-seeking");
  62556. this.error(null);
  62557. this.handleTechDurationChange_();
  62558. if (!this.paused()) {
  62559. this.trigger("loadstart");
  62560. } else {
  62561. this.hasStarted(false);
  62562. this.trigger("loadstart");
  62563. }
  62564. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  62565. }
  62566. manualAutoplay_(type2) {
  62567. if (!this.tech_ || typeof type2 !== "string") {
  62568. return;
  62569. }
  62570. const resolveMuted = () => {
  62571. const previouslyMuted = this.muted();
  62572. this.muted(true);
  62573. const restoreMuted = () => {
  62574. this.muted(previouslyMuted);
  62575. };
  62576. this.playTerminatedQueue_.push(restoreMuted);
  62577. const mutedPromise = this.play();
  62578. if (!isPromise$1(mutedPromise)) {
  62579. return;
  62580. }
  62581. return mutedPromise.catch((err) => {
  62582. restoreMuted();
  62583. throw new Error(`Rejection at manualAutoplay. Restoring muted value. ${err ? err : ""}`);
  62584. });
  62585. };
  62586. let promise;
  62587. if (type2 === "any" && !this.muted()) {
  62588. promise = this.play();
  62589. if (isPromise$1(promise)) {
  62590. promise = promise.catch(resolveMuted);
  62591. }
  62592. } else if (type2 === "muted" && !this.muted()) {
  62593. promise = resolveMuted();
  62594. } else {
  62595. promise = this.play();
  62596. }
  62597. if (!isPromise$1(promise)) {
  62598. return;
  62599. }
  62600. return promise.then(() => {
  62601. this.trigger({
  62602. type: "autoplay-success",
  62603. autoplay: type2
  62604. });
  62605. }).catch(() => {
  62606. this.trigger({
  62607. type: "autoplay-failure",
  62608. autoplay: type2
  62609. });
  62610. });
  62611. }
  62612. updateSourceCaches_(srcObj = "") {
  62613. let src = srcObj;
  62614. let type2 = "";
  62615. if (typeof src !== "string") {
  62616. src = srcObj.src;
  62617. type2 = srcObj.type;
  62618. }
  62619. this.cache_.source = this.cache_.source || {};
  62620. this.cache_.sources = this.cache_.sources || [];
  62621. if (src && !type2) {
  62622. type2 = findMimetype$1(this, src);
  62623. }
  62624. this.cache_.source = merge$1({}, srcObj, {
  62625. src,
  62626. type: type2
  62627. });
  62628. const matchingSources = this.cache_.sources.filter((s) => s.src && s.src === src);
  62629. const sourceElSources = [];
  62630. const sourceEls = this.$$("source");
  62631. const matchingSourceEls = [];
  62632. for (let i2 = 0; i2 < sourceEls.length; i2++) {
  62633. const sourceObj = getAttributes$1(sourceEls[i2]);
  62634. sourceElSources.push(sourceObj);
  62635. if (sourceObj.src && sourceObj.src === src) {
  62636. matchingSourceEls.push(sourceObj.src);
  62637. }
  62638. }
  62639. if (matchingSourceEls.length && !matchingSources.length) {
  62640. this.cache_.sources = sourceElSources;
  62641. } else if (!matchingSources.length) {
  62642. this.cache_.sources = [this.cache_.source];
  62643. }
  62644. this.cache_.src = src;
  62645. }
  62646. handleTechSourceset_(event2) {
  62647. if (!this.changingSrc_) {
  62648. let updateSourceCaches = (src) => this.updateSourceCaches_(src);
  62649. const playerSrc = this.currentSource().src;
  62650. const eventSrc = event2.src;
  62651. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  62652. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  62653. updateSourceCaches = () => {
  62654. };
  62655. }
  62656. }
  62657. updateSourceCaches(eventSrc);
  62658. if (!event2.src) {
  62659. this.tech_.any(["sourceset", "loadstart"], (e) => {
  62660. if (e.type === "sourceset") {
  62661. return;
  62662. }
  62663. const techSrc = this.techGet("currentSrc");
  62664. this.lastSource_.tech = techSrc;
  62665. this.updateSourceCaches_(techSrc);
  62666. });
  62667. }
  62668. }
  62669. this.lastSource_ = {
  62670. player: this.currentSource().src,
  62671. tech: event2.src
  62672. };
  62673. this.trigger({
  62674. src: event2.src,
  62675. type: "sourceset"
  62676. });
  62677. }
  62678. hasStarted(request) {
  62679. if (request === void 0) {
  62680. return this.hasStarted_;
  62681. }
  62682. if (request === this.hasStarted_) {
  62683. return;
  62684. }
  62685. this.hasStarted_ = request;
  62686. if (this.hasStarted_) {
  62687. this.addClass("vjs-has-started");
  62688. } else {
  62689. this.removeClass("vjs-has-started");
  62690. }
  62691. }
  62692. handleTechPlay_() {
  62693. this.removeClass("vjs-ended", "vjs-paused");
  62694. this.addClass("vjs-playing");
  62695. this.hasStarted(true);
  62696. this.trigger("play");
  62697. }
  62698. handleTechRateChange_() {
  62699. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  62700. this.queuedCallbacks_.forEach((queued) => queued.callback(queued.event));
  62701. this.queuedCallbacks_ = [];
  62702. }
  62703. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  62704. this.trigger("ratechange");
  62705. }
  62706. handleTechWaiting_() {
  62707. this.addClass("vjs-waiting");
  62708. this.trigger("waiting");
  62709. const timeWhenWaiting = this.currentTime();
  62710. const timeUpdateListener = () => {
  62711. if (timeWhenWaiting !== this.currentTime()) {
  62712. this.removeClass("vjs-waiting");
  62713. this.off("timeupdate", timeUpdateListener);
  62714. }
  62715. };
  62716. this.on("timeupdate", timeUpdateListener);
  62717. }
  62718. handleTechCanPlay_() {
  62719. this.removeClass("vjs-waiting");
  62720. this.trigger("canplay");
  62721. }
  62722. handleTechCanPlayThrough_() {
  62723. this.removeClass("vjs-waiting");
  62724. this.trigger("canplaythrough");
  62725. }
  62726. handleTechPlaying_() {
  62727. this.removeClass("vjs-waiting");
  62728. this.trigger("playing");
  62729. }
  62730. handleTechSeeking_() {
  62731. this.addClass("vjs-seeking");
  62732. this.trigger("seeking");
  62733. }
  62734. handleTechSeeked_() {
  62735. this.removeClass("vjs-seeking", "vjs-ended");
  62736. this.trigger("seeked");
  62737. }
  62738. handleTechPause_() {
  62739. this.removeClass("vjs-playing");
  62740. this.addClass("vjs-paused");
  62741. this.trigger("pause");
  62742. }
  62743. handleTechEnded_() {
  62744. this.addClass("vjs-ended");
  62745. this.removeClass("vjs-waiting");
  62746. if (this.options_.loop) {
  62747. this.currentTime(0);
  62748. this.play();
  62749. } else if (!this.paused()) {
  62750. this.pause();
  62751. }
  62752. this.trigger("ended");
  62753. }
  62754. handleTechDurationChange_() {
  62755. this.duration(this.techGet_("duration"));
  62756. }
  62757. handleTechClick_(event2) {
  62758. if (!this.controls_) {
  62759. return;
  62760. }
  62761. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  62762. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  62763. this.options_.userActions.click.call(this, event2);
  62764. } else if (this.paused()) {
  62765. silencePromise$1(this.play());
  62766. } else {
  62767. this.pause();
  62768. }
  62769. }
  62770. }
  62771. handleTechDoubleClick_(event2) {
  62772. if (!this.controls_) {
  62773. return;
  62774. }
  62775. const inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), (el) => el.contains(event2.target));
  62776. if (!inAllowedEls) {
  62777. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  62778. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  62779. this.options_.userActions.doubleClick.call(this, event2);
  62780. } else if (this.isFullscreen()) {
  62781. this.exitFullscreen();
  62782. } else {
  62783. this.requestFullscreen();
  62784. }
  62785. }
  62786. }
  62787. }
  62788. handleTechTap_() {
  62789. this.userActive(!this.userActive());
  62790. }
  62791. handleTechTouchStart_() {
  62792. this.userWasActive = this.userActive();
  62793. }
  62794. handleTechTouchMove_() {
  62795. if (this.userWasActive) {
  62796. this.reportUserActivity();
  62797. }
  62798. }
  62799. handleTechTouchEnd_(event2) {
  62800. if (event2.cancelable) {
  62801. event2.preventDefault();
  62802. }
  62803. }
  62804. toggleFullscreenClass_() {
  62805. if (this.isFullscreen()) {
  62806. this.addClass("vjs-fullscreen");
  62807. } else {
  62808. this.removeClass("vjs-fullscreen");
  62809. }
  62810. }
  62811. documentFullscreenChange_(e) {
  62812. const targetPlayer = e.target.player;
  62813. if (targetPlayer && targetPlayer !== this) {
  62814. return;
  62815. }
  62816. const el = this.el();
  62817. let isFs = document_1[this.fsApi_.fullscreenElement] === el;
  62818. if (!isFs && el.matches) {
  62819. isFs = el.matches(":" + this.fsApi_.fullscreen);
  62820. } else if (!isFs && el.msMatchesSelector) {
  62821. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  62822. }
  62823. this.isFullscreen(isFs);
  62824. }
  62825. handleTechFullscreenChange_(event2, data) {
  62826. if (data) {
  62827. if (data.nativeIOSFullscreen) {
  62828. this.addClass("vjs-ios-native-fs");
  62829. this.tech_.one("webkitendfullscreen", () => {
  62830. this.removeClass("vjs-ios-native-fs");
  62831. });
  62832. }
  62833. this.isFullscreen(data.isFullscreen);
  62834. }
  62835. }
  62836. handleTechFullscreenError_(event2, err) {
  62837. this.trigger("fullscreenerror", err);
  62838. }
  62839. togglePictureInPictureClass_() {
  62840. if (this.isInPictureInPicture()) {
  62841. this.addClass("vjs-picture-in-picture");
  62842. } else {
  62843. this.removeClass("vjs-picture-in-picture");
  62844. }
  62845. }
  62846. handleTechEnterPictureInPicture_(event2) {
  62847. this.isInPictureInPicture(true);
  62848. }
  62849. handleTechLeavePictureInPicture_(event2) {
  62850. this.isInPictureInPicture(false);
  62851. }
  62852. handleTechError_() {
  62853. const error = this.tech_.error();
  62854. this.error(error);
  62855. }
  62856. handleTechTextData_() {
  62857. let data = null;
  62858. if (arguments.length > 1) {
  62859. data = arguments[1];
  62860. }
  62861. this.trigger("textdata", data);
  62862. }
  62863. getCache() {
  62864. return this.cache_;
  62865. }
  62866. resetCache_() {
  62867. this.cache_ = {
  62868. currentTime: 0,
  62869. initTime: 0,
  62870. inactivityTimeout: this.options_.inactivityTimeout,
  62871. duration: NaN,
  62872. lastVolume: 1,
  62873. lastPlaybackRate: this.defaultPlaybackRate(),
  62874. media: null,
  62875. src: "",
  62876. source: {},
  62877. sources: [],
  62878. playbackRates: [],
  62879. volume: 1
  62880. };
  62881. }
  62882. techCall_(method, arg) {
  62883. this.ready(function() {
  62884. if (method in allowedSetters$1) {
  62885. return set$1(this.middleware_, this.tech_, method, arg);
  62886. } else if (method in allowedMediators$1) {
  62887. return mediate$1(this.middleware_, this.tech_, method, arg);
  62888. }
  62889. try {
  62890. if (this.tech_) {
  62891. this.tech_[method](arg);
  62892. }
  62893. } catch (e) {
  62894. log$1$1(e);
  62895. throw e;
  62896. }
  62897. }, true);
  62898. }
  62899. techGet_(method) {
  62900. if (!this.tech_ || !this.tech_.isReady_) {
  62901. return;
  62902. }
  62903. if (method in allowedGetters$1) {
  62904. return get$1(this.middleware_, this.tech_, method);
  62905. } else if (method in allowedMediators$1) {
  62906. return mediate$1(this.middleware_, this.tech_, method);
  62907. }
  62908. try {
  62909. return this.tech_[method]();
  62910. } catch (e) {
  62911. if (this.tech_[method] === void 0) {
  62912. log$1$1(`Video.js: ${method} method not defined for ${this.techName_} playback technology.`, e);
  62913. throw e;
  62914. }
  62915. if (e.name === "TypeError") {
  62916. log$1$1(`Video.js: ${method} unavailable on ${this.techName_} playback technology element.`, e);
  62917. this.tech_.isReady_ = false;
  62918. throw e;
  62919. }
  62920. log$1$1(e);
  62921. throw e;
  62922. }
  62923. }
  62924. play() {
  62925. return new Promise((resolve2) => {
  62926. this.play_(resolve2);
  62927. });
  62928. }
  62929. play_(callback2 = silencePromise$1) {
  62930. this.playCallbacks_.push(callback2);
  62931. const isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  62932. const isSafariOrIOS = Boolean(IS_ANY_SAFARI$1 || IS_IOS$1);
  62933. if (this.waitToPlay_) {
  62934. this.off(["ready", "loadstart"], this.waitToPlay_);
  62935. this.waitToPlay_ = null;
  62936. }
  62937. if (!this.isReady_ || !isSrcReady) {
  62938. this.waitToPlay_ = (e) => {
  62939. this.play_();
  62940. };
  62941. this.one(["ready", "loadstart"], this.waitToPlay_);
  62942. if (!isSrcReady && isSafariOrIOS) {
  62943. this.load();
  62944. }
  62945. return;
  62946. }
  62947. const val = this.techGet_("play");
  62948. const isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  62949. if (isNativeReplay) {
  62950. this.resetProgressBar_();
  62951. }
  62952. if (val === null) {
  62953. this.runPlayTerminatedQueue_();
  62954. } else {
  62955. this.runPlayCallbacks_(val);
  62956. }
  62957. }
  62958. runPlayTerminatedQueue_() {
  62959. const queue = this.playTerminatedQueue_.slice(0);
  62960. this.playTerminatedQueue_ = [];
  62961. queue.forEach(function(q2) {
  62962. q2();
  62963. });
  62964. }
  62965. runPlayCallbacks_(val) {
  62966. const callbacks = this.playCallbacks_.slice(0);
  62967. this.playCallbacks_ = [];
  62968. this.playTerminatedQueue_ = [];
  62969. callbacks.forEach(function(cb) {
  62970. cb(val);
  62971. });
  62972. }
  62973. pause() {
  62974. this.techCall_("pause");
  62975. }
  62976. paused() {
  62977. return this.techGet_("paused") === false ? false : true;
  62978. }
  62979. played() {
  62980. return this.techGet_("played") || createTimeRanges$1(0, 0);
  62981. }
  62982. scrubbing(isScrubbing) {
  62983. if (typeof isScrubbing === "undefined") {
  62984. return this.scrubbing_;
  62985. }
  62986. this.scrubbing_ = !!isScrubbing;
  62987. this.techCall_("setScrubbing", this.scrubbing_);
  62988. if (isScrubbing) {
  62989. this.addClass("vjs-scrubbing");
  62990. } else {
  62991. this.removeClass("vjs-scrubbing");
  62992. }
  62993. }
  62994. currentTime(seconds) {
  62995. if (typeof seconds !== "undefined") {
  62996. if (seconds < 0) {
  62997. seconds = 0;
  62998. }
  62999. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  63000. this.cache_.initTime = seconds;
  63001. this.off("canplay", this.boundApplyInitTime_);
  63002. this.one("canplay", this.boundApplyInitTime_);
  63003. return;
  63004. }
  63005. this.techCall_("setCurrentTime", seconds);
  63006. this.cache_.initTime = 0;
  63007. return;
  63008. }
  63009. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  63010. return this.cache_.currentTime;
  63011. }
  63012. applyInitTime_() {
  63013. this.currentTime(this.cache_.initTime);
  63014. }
  63015. duration(seconds) {
  63016. if (seconds === void 0) {
  63017. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  63018. }
  63019. seconds = parseFloat(seconds);
  63020. if (seconds < 0) {
  63021. seconds = Infinity;
  63022. }
  63023. if (seconds !== this.cache_.duration) {
  63024. this.cache_.duration = seconds;
  63025. if (seconds === Infinity) {
  63026. this.addClass("vjs-live");
  63027. } else {
  63028. this.removeClass("vjs-live");
  63029. }
  63030. if (!isNaN(seconds)) {
  63031. this.trigger("durationchange");
  63032. }
  63033. }
  63034. }
  63035. remainingTime() {
  63036. return this.duration() - this.currentTime();
  63037. }
  63038. remainingTimeDisplay() {
  63039. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  63040. }
  63041. buffered() {
  63042. let buffered = this.techGet_("buffered");
  63043. if (!buffered || !buffered.length) {
  63044. buffered = createTimeRanges$1(0, 0);
  63045. }
  63046. return buffered;
  63047. }
  63048. bufferedPercent() {
  63049. return bufferedPercent$1(this.buffered(), this.duration());
  63050. }
  63051. bufferedEnd() {
  63052. const buffered = this.buffered();
  63053. const duration5 = this.duration();
  63054. let end = buffered.end(buffered.length - 1);
  63055. if (end > duration5) {
  63056. end = duration5;
  63057. }
  63058. return end;
  63059. }
  63060. volume(percentAsDecimal) {
  63061. let vol;
  63062. if (percentAsDecimal !== void 0) {
  63063. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  63064. this.cache_.volume = vol;
  63065. this.techCall_("setVolume", vol);
  63066. if (vol > 0) {
  63067. this.lastVolume_(vol);
  63068. }
  63069. return;
  63070. }
  63071. vol = parseFloat(this.techGet_("volume"));
  63072. return isNaN(vol) ? 1 : vol;
  63073. }
  63074. muted(muted) {
  63075. if (muted !== void 0) {
  63076. this.techCall_("setMuted", muted);
  63077. return;
  63078. }
  63079. return this.techGet_("muted") || false;
  63080. }
  63081. defaultMuted(defaultMuted) {
  63082. if (defaultMuted !== void 0) {
  63083. return this.techCall_("setDefaultMuted", defaultMuted);
  63084. }
  63085. return this.techGet_("defaultMuted") || false;
  63086. }
  63087. lastVolume_(percentAsDecimal) {
  63088. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  63089. this.cache_.lastVolume = percentAsDecimal;
  63090. return;
  63091. }
  63092. return this.cache_.lastVolume;
  63093. }
  63094. supportsFullScreen() {
  63095. return this.techGet_("supportsFullScreen") || false;
  63096. }
  63097. isFullscreen(isFS) {
  63098. if (isFS !== void 0) {
  63099. const oldValue = this.isFullscreen_;
  63100. this.isFullscreen_ = Boolean(isFS);
  63101. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  63102. this.trigger("fullscreenchange");
  63103. }
  63104. this.toggleFullscreenClass_();
  63105. return;
  63106. }
  63107. return this.isFullscreen_;
  63108. }
  63109. requestFullscreen(fullscreenOptions) {
  63110. if (this.isInPictureInPicture()) {
  63111. this.exitPictureInPicture();
  63112. }
  63113. const self2 = this;
  63114. return new Promise((resolve2, reject2) => {
  63115. function offHandler() {
  63116. self2.off("fullscreenerror", errorHandler);
  63117. self2.off("fullscreenchange", changeHandler);
  63118. }
  63119. function changeHandler() {
  63120. offHandler();
  63121. resolve2();
  63122. }
  63123. function errorHandler(e, err) {
  63124. offHandler();
  63125. reject2(err);
  63126. }
  63127. self2.one("fullscreenchange", changeHandler);
  63128. self2.one("fullscreenerror", errorHandler);
  63129. const promise = self2.requestFullscreenHelper_(fullscreenOptions);
  63130. if (promise) {
  63131. promise.then(offHandler, offHandler);
  63132. promise.then(resolve2, reject2);
  63133. }
  63134. });
  63135. }
  63136. requestFullscreenHelper_(fullscreenOptions) {
  63137. let fsOptions;
  63138. if (!this.fsApi_.prefixed) {
  63139. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  63140. if (fullscreenOptions !== void 0) {
  63141. fsOptions = fullscreenOptions;
  63142. }
  63143. }
  63144. if (this.fsApi_.requestFullscreen) {
  63145. const promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  63146. if (promise) {
  63147. promise.then(() => this.isFullscreen(true), () => this.isFullscreen(false));
  63148. }
  63149. return promise;
  63150. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63151. this.techCall_("enterFullScreen");
  63152. } else {
  63153. this.enterFullWindow();
  63154. }
  63155. }
  63156. exitFullscreen() {
  63157. const self2 = this;
  63158. return new Promise((resolve2, reject2) => {
  63159. function offHandler() {
  63160. self2.off("fullscreenerror", errorHandler);
  63161. self2.off("fullscreenchange", changeHandler);
  63162. }
  63163. function changeHandler() {
  63164. offHandler();
  63165. resolve2();
  63166. }
  63167. function errorHandler(e, err) {
  63168. offHandler();
  63169. reject2(err);
  63170. }
  63171. self2.one("fullscreenchange", changeHandler);
  63172. self2.one("fullscreenerror", errorHandler);
  63173. const promise = self2.exitFullscreenHelper_();
  63174. if (promise) {
  63175. promise.then(offHandler, offHandler);
  63176. promise.then(resolve2, reject2);
  63177. }
  63178. });
  63179. }
  63180. exitFullscreenHelper_() {
  63181. if (this.fsApi_.requestFullscreen) {
  63182. const promise = document_1[this.fsApi_.exitFullscreen]();
  63183. if (promise) {
  63184. silencePromise$1(promise.then(() => this.isFullscreen(false)));
  63185. }
  63186. return promise;
  63187. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63188. this.techCall_("exitFullScreen");
  63189. } else {
  63190. this.exitFullWindow();
  63191. }
  63192. }
  63193. enterFullWindow() {
  63194. this.isFullscreen(true);
  63195. this.isFullWindow = true;
  63196. this.docOrigOverflow = document_1.documentElement.style.overflow;
  63197. on$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63198. document_1.documentElement.style.overflow = "hidden";
  63199. addClass$1(document_1.body, "vjs-full-window");
  63200. this.trigger("enterFullWindow");
  63201. }
  63202. fullWindowOnEscKey(event2) {
  63203. if (keycode.isEventKey(event2, "Esc")) {
  63204. if (this.isFullscreen() === true) {
  63205. if (!this.isFullWindow) {
  63206. this.exitFullscreen();
  63207. } else {
  63208. this.exitFullWindow();
  63209. }
  63210. }
  63211. }
  63212. }
  63213. exitFullWindow() {
  63214. this.isFullscreen(false);
  63215. this.isFullWindow = false;
  63216. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63217. document_1.documentElement.style.overflow = this.docOrigOverflow;
  63218. removeClass$1(document_1.body, "vjs-full-window");
  63219. this.trigger("exitFullWindow");
  63220. }
  63221. disablePictureInPicture(value) {
  63222. if (value === void 0) {
  63223. return this.techGet_("disablePictureInPicture");
  63224. }
  63225. this.techCall_("setDisablePictureInPicture", value);
  63226. this.options_.disablePictureInPicture = value;
  63227. this.trigger("disablepictureinpicturechanged");
  63228. }
  63229. isInPictureInPicture(isPiP) {
  63230. if (isPiP !== void 0) {
  63231. this.isInPictureInPicture_ = !!isPiP;
  63232. this.togglePictureInPictureClass_();
  63233. return;
  63234. }
  63235. return !!this.isInPictureInPicture_;
  63236. }
  63237. requestPictureInPicture() {
  63238. if (this.options_.enableDocumentPictureInPicture && window_1.documentPictureInPicture) {
  63239. const pipContainer = document_1.createElement(this.el().tagName);
  63240. pipContainer.classList = this.el().classList;
  63241. pipContainer.classList.add("vjs-pip-container");
  63242. if (this.posterImage) {
  63243. pipContainer.appendChild(this.posterImage.el().cloneNode(true));
  63244. }
  63245. if (this.titleBar) {
  63246. pipContainer.appendChild(this.titleBar.el().cloneNode(true));
  63247. }
  63248. pipContainer.appendChild(createEl$1("p", {
  63249. className: "vjs-pip-text"
  63250. }, {}, this.localize("Playing in picture-in-picture")));
  63251. return window_1.documentPictureInPicture.requestWindow({
  63252. initialAspectRatio: this.videoWidth() / this.videoHeight(),
  63253. copyStyleSheets: true
  63254. }).then((pipWindow) => {
  63255. this.el_.parentNode.insertBefore(pipContainer, this.el_);
  63256. pipWindow.document.body.append(this.el_);
  63257. pipWindow.document.body.classList.add("vjs-pip-window");
  63258. this.player_.isInPictureInPicture(true);
  63259. this.player_.trigger("enterpictureinpicture");
  63260. pipWindow.addEventListener("unload", (event2) => {
  63261. const pipVideo = event2.target.querySelector(".video-js");
  63262. pipContainer.replaceWith(pipVideo);
  63263. this.player_.isInPictureInPicture(false);
  63264. this.player_.trigger("leavepictureinpicture");
  63265. });
  63266. return pipWindow;
  63267. });
  63268. }
  63269. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  63270. return this.techGet_("requestPictureInPicture");
  63271. }
  63272. return Promise.reject("No PiP mode is available");
  63273. }
  63274. exitPictureInPicture() {
  63275. if (window_1.documentPictureInPicture && window_1.documentPictureInPicture.window) {
  63276. window_1.documentPictureInPicture.window.close();
  63277. return Promise.resolve();
  63278. }
  63279. if ("pictureInPictureEnabled" in document_1) {
  63280. return document_1.exitPictureInPicture();
  63281. }
  63282. }
  63283. handleKeyDown(event2) {
  63284. const {
  63285. userActions
  63286. } = this.options_;
  63287. if (!userActions || !userActions.hotkeys) {
  63288. return;
  63289. }
  63290. const excludeElement = (el) => {
  63291. const tagName = el.tagName.toLowerCase();
  63292. if (el.isContentEditable) {
  63293. return true;
  63294. }
  63295. const allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  63296. if (tagName === "input") {
  63297. return allowedInputTypes.indexOf(el.type) === -1;
  63298. }
  63299. const excludedTags = ["textarea"];
  63300. return excludedTags.indexOf(tagName) !== -1;
  63301. };
  63302. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  63303. return;
  63304. }
  63305. if (typeof userActions.hotkeys === "function") {
  63306. userActions.hotkeys.call(this, event2);
  63307. } else {
  63308. this.handleHotkeys(event2);
  63309. }
  63310. }
  63311. handleHotkeys(event2) {
  63312. const hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  63313. const {
  63314. fullscreenKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "f"),
  63315. muteKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "m"),
  63316. playPauseKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space")
  63317. } = hotkeys;
  63318. if (fullscreenKey.call(this, event2)) {
  63319. event2.preventDefault();
  63320. event2.stopPropagation();
  63321. const FSToggle = Component$1$1.getComponent("FullscreenToggle");
  63322. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  63323. FSToggle.prototype.handleClick.call(this, event2);
  63324. }
  63325. } else if (muteKey.call(this, event2)) {
  63326. event2.preventDefault();
  63327. event2.stopPropagation();
  63328. const MuteToggle2 = Component$1$1.getComponent("MuteToggle");
  63329. MuteToggle2.prototype.handleClick.call(this, event2);
  63330. } else if (playPauseKey.call(this, event2)) {
  63331. event2.preventDefault();
  63332. event2.stopPropagation();
  63333. const PlayToggle2 = Component$1$1.getComponent("PlayToggle");
  63334. PlayToggle2.prototype.handleClick.call(this, event2);
  63335. }
  63336. }
  63337. canPlayType(type2) {
  63338. let can;
  63339. for (let i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  63340. const techName = j[i2];
  63341. let tech = Tech$2.getTech(techName);
  63342. if (!tech) {
  63343. tech = Component$1$1.getComponent(techName);
  63344. }
  63345. if (!tech) {
  63346. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63347. continue;
  63348. }
  63349. if (tech.isSupported()) {
  63350. can = tech.canPlayType(type2);
  63351. if (can) {
  63352. return can;
  63353. }
  63354. }
  63355. }
  63356. return "";
  63357. }
  63358. selectSource(sources) {
  63359. const techs = this.options_.techOrder.map((techName) => {
  63360. return [techName, Tech$2.getTech(techName)];
  63361. }).filter(([techName, tech]) => {
  63362. if (tech) {
  63363. return tech.isSupported();
  63364. }
  63365. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63366. return false;
  63367. });
  63368. const findFirstPassingTechSourcePair = function(outerArray, innerArray, tester) {
  63369. let found;
  63370. outerArray.some((outerChoice) => {
  63371. return innerArray.some((innerChoice) => {
  63372. found = tester(outerChoice, innerChoice);
  63373. if (found) {
  63374. return true;
  63375. }
  63376. });
  63377. });
  63378. return found;
  63379. };
  63380. let foundSourceAndTech;
  63381. const flip = (fn2) => (a, b) => fn2(b, a);
  63382. const finder = ([techName, tech], source) => {
  63383. if (tech.canPlaySource(source, this.options_[techName.toLowerCase()])) {
  63384. return {
  63385. source,
  63386. tech: techName
  63387. };
  63388. }
  63389. };
  63390. if (this.options_.sourceOrder) {
  63391. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  63392. } else {
  63393. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  63394. }
  63395. return foundSourceAndTech || false;
  63396. }
  63397. handleSrc_(source, isRetry) {
  63398. if (typeof source === "undefined") {
  63399. return this.cache_.src || "";
  63400. }
  63401. if (this.resetRetryOnError_) {
  63402. this.resetRetryOnError_();
  63403. }
  63404. const sources = filterSource$1(source);
  63405. if (!sources.length) {
  63406. this.setTimeout(function() {
  63407. this.error({
  63408. code: 4,
  63409. message: this.options_.notSupportedMessage
  63410. });
  63411. }, 0);
  63412. return;
  63413. }
  63414. this.changingSrc_ = true;
  63415. if (!isRetry) {
  63416. this.cache_.sources = sources;
  63417. }
  63418. this.updateSourceCaches_(sources[0]);
  63419. setSource$1(this, sources[0], (middlewareSource, mws) => {
  63420. this.middleware_ = mws;
  63421. if (!isRetry) {
  63422. this.cache_.sources = sources;
  63423. }
  63424. this.updateSourceCaches_(middlewareSource);
  63425. const err = this.src_(middlewareSource);
  63426. if (err) {
  63427. if (sources.length > 1) {
  63428. return this.handleSrc_(sources.slice(1));
  63429. }
  63430. this.changingSrc_ = false;
  63431. this.setTimeout(function() {
  63432. this.error({
  63433. code: 4,
  63434. message: this.options_.notSupportedMessage
  63435. });
  63436. }, 0);
  63437. this.triggerReady();
  63438. return;
  63439. }
  63440. setTech$1(mws, this.tech_);
  63441. });
  63442. if (sources.length > 1) {
  63443. const retry = () => {
  63444. this.error(null);
  63445. this.handleSrc_(sources.slice(1), true);
  63446. };
  63447. const stopListeningForErrors = () => {
  63448. this.off("error", retry);
  63449. };
  63450. this.one("error", retry);
  63451. this.one("playing", stopListeningForErrors);
  63452. this.resetRetryOnError_ = () => {
  63453. this.off("error", retry);
  63454. this.off("playing", stopListeningForErrors);
  63455. };
  63456. }
  63457. }
  63458. src(source) {
  63459. return this.handleSrc_(source, false);
  63460. }
  63461. src_(source) {
  63462. const sourceTech = this.selectSource([source]);
  63463. if (!sourceTech) {
  63464. return true;
  63465. }
  63466. if (!titleCaseEquals$1(sourceTech.tech, this.techName_)) {
  63467. this.changingSrc_ = true;
  63468. this.loadTech_(sourceTech.tech, sourceTech.source);
  63469. this.tech_.ready(() => {
  63470. this.changingSrc_ = false;
  63471. });
  63472. return false;
  63473. }
  63474. this.ready(function() {
  63475. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  63476. this.techCall_("setSource", source);
  63477. } else {
  63478. this.techCall_("src", source.src);
  63479. }
  63480. this.changingSrc_ = false;
  63481. }, true);
  63482. return false;
  63483. }
  63484. load() {
  63485. this.techCall_("load");
  63486. }
  63487. reset() {
  63488. if (this.paused()) {
  63489. this.doReset_();
  63490. } else {
  63491. const playPromise = this.play();
  63492. silencePromise$1(playPromise.then(() => this.doReset_()));
  63493. }
  63494. }
  63495. doReset_() {
  63496. if (this.tech_) {
  63497. this.tech_.clearTracks("text");
  63498. }
  63499. this.resetCache_();
  63500. this.poster("");
  63501. this.loadTech_(this.options_.techOrder[0], null);
  63502. this.techCall_("reset");
  63503. this.resetControlBarUI_();
  63504. if (isEvented$1(this)) {
  63505. this.trigger("playerreset");
  63506. }
  63507. }
  63508. resetControlBarUI_() {
  63509. this.resetProgressBar_();
  63510. this.resetPlaybackRate_();
  63511. this.resetVolumeBar_();
  63512. }
  63513. resetProgressBar_() {
  63514. this.currentTime(0);
  63515. const {
  63516. currentTimeDisplay,
  63517. durationDisplay,
  63518. progressControl,
  63519. remainingTimeDisplay
  63520. } = this.controlBar || {};
  63521. const {
  63522. seekBar
  63523. } = progressControl || {};
  63524. if (currentTimeDisplay) {
  63525. currentTimeDisplay.updateContent();
  63526. }
  63527. if (durationDisplay) {
  63528. durationDisplay.updateContent();
  63529. }
  63530. if (remainingTimeDisplay) {
  63531. remainingTimeDisplay.updateContent();
  63532. }
  63533. if (seekBar) {
  63534. seekBar.update();
  63535. if (seekBar.loadProgressBar) {
  63536. seekBar.loadProgressBar.update();
  63537. }
  63538. }
  63539. }
  63540. resetPlaybackRate_() {
  63541. this.playbackRate(this.defaultPlaybackRate());
  63542. this.handleTechRateChange_();
  63543. }
  63544. resetVolumeBar_() {
  63545. this.volume(1);
  63546. this.trigger("volumechange");
  63547. }
  63548. currentSources() {
  63549. const source = this.currentSource();
  63550. const sources = [];
  63551. if (Object.keys(source).length !== 0) {
  63552. sources.push(source);
  63553. }
  63554. return this.cache_.sources || sources;
  63555. }
  63556. currentSource() {
  63557. return this.cache_.source || {};
  63558. }
  63559. currentSrc() {
  63560. return this.currentSource() && this.currentSource().src || "";
  63561. }
  63562. currentType() {
  63563. return this.currentSource() && this.currentSource().type || "";
  63564. }
  63565. preload(value) {
  63566. if (value !== void 0) {
  63567. this.techCall_("setPreload", value);
  63568. this.options_.preload = value;
  63569. return;
  63570. }
  63571. return this.techGet_("preload");
  63572. }
  63573. autoplay(value) {
  63574. if (value === void 0) {
  63575. return this.options_.autoplay || false;
  63576. }
  63577. let techAutoplay;
  63578. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  63579. this.options_.autoplay = value;
  63580. this.manualAutoplay_(typeof value === "string" ? value : "play");
  63581. techAutoplay = false;
  63582. } else if (!value) {
  63583. this.options_.autoplay = false;
  63584. } else {
  63585. this.options_.autoplay = true;
  63586. }
  63587. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  63588. if (this.tech_) {
  63589. this.techCall_("setAutoplay", techAutoplay);
  63590. }
  63591. }
  63592. playsinline(value) {
  63593. if (value !== void 0) {
  63594. this.techCall_("setPlaysinline", value);
  63595. this.options_.playsinline = value;
  63596. return this;
  63597. }
  63598. return this.techGet_("playsinline");
  63599. }
  63600. loop(value) {
  63601. if (value !== void 0) {
  63602. this.techCall_("setLoop", value);
  63603. this.options_.loop = value;
  63604. return;
  63605. }
  63606. return this.techGet_("loop");
  63607. }
  63608. poster(src) {
  63609. if (src === void 0) {
  63610. return this.poster_;
  63611. }
  63612. if (!src) {
  63613. src = "";
  63614. }
  63615. if (src === this.poster_) {
  63616. return;
  63617. }
  63618. this.poster_ = src;
  63619. this.techCall_("setPoster", src);
  63620. this.isPosterFromTech_ = false;
  63621. this.trigger("posterchange");
  63622. }
  63623. handleTechPosterChange_() {
  63624. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  63625. const newPoster = this.tech_.poster() || "";
  63626. if (newPoster !== this.poster_) {
  63627. this.poster_ = newPoster;
  63628. this.isPosterFromTech_ = true;
  63629. this.trigger("posterchange");
  63630. }
  63631. }
  63632. }
  63633. controls(bool) {
  63634. if (bool === void 0) {
  63635. return !!this.controls_;
  63636. }
  63637. bool = !!bool;
  63638. if (this.controls_ === bool) {
  63639. return;
  63640. }
  63641. this.controls_ = bool;
  63642. if (this.usingNativeControls()) {
  63643. this.techCall_("setControls", bool);
  63644. }
  63645. if (this.controls_) {
  63646. this.removeClass("vjs-controls-disabled");
  63647. this.addClass("vjs-controls-enabled");
  63648. this.trigger("controlsenabled");
  63649. if (!this.usingNativeControls()) {
  63650. this.addTechControlsListeners_();
  63651. }
  63652. } else {
  63653. this.removeClass("vjs-controls-enabled");
  63654. this.addClass("vjs-controls-disabled");
  63655. this.trigger("controlsdisabled");
  63656. if (!this.usingNativeControls()) {
  63657. this.removeTechControlsListeners_();
  63658. }
  63659. }
  63660. }
  63661. usingNativeControls(bool) {
  63662. if (bool === void 0) {
  63663. return !!this.usingNativeControls_;
  63664. }
  63665. bool = !!bool;
  63666. if (this.usingNativeControls_ === bool) {
  63667. return;
  63668. }
  63669. this.usingNativeControls_ = bool;
  63670. if (this.usingNativeControls_) {
  63671. this.addClass("vjs-using-native-controls");
  63672. this.trigger("usingnativecontrols");
  63673. } else {
  63674. this.removeClass("vjs-using-native-controls");
  63675. this.trigger("usingcustomcontrols");
  63676. }
  63677. }
  63678. error(err) {
  63679. if (err === void 0) {
  63680. return this.error_ || null;
  63681. }
  63682. hooks$1("beforeerror").forEach((hookFunction) => {
  63683. const newErr = hookFunction(this, err);
  63684. if (!(isObject$2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  63685. this.log.error("please return a value that MediaError expects in beforeerror hooks");
  63686. return;
  63687. }
  63688. err = newErr;
  63689. });
  63690. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  63691. const triggerSuppressedError = function() {
  63692. this.error(err);
  63693. };
  63694. this.options_.suppressNotSupportedError = false;
  63695. this.any(["click", "touchstart"], triggerSuppressedError);
  63696. this.one("loadstart", function() {
  63697. this.off(["click", "touchstart"], triggerSuppressedError);
  63698. });
  63699. return;
  63700. }
  63701. if (err === null) {
  63702. this.error_ = err;
  63703. this.removeClass("vjs-error");
  63704. if (this.errorDisplay) {
  63705. this.errorDisplay.close();
  63706. }
  63707. return;
  63708. }
  63709. this.error_ = new MediaError$1(err);
  63710. this.addClass("vjs-error");
  63711. log$1$1.error(`(CODE:${this.error_.code} ${MediaError$1.errorTypes[this.error_.code]})`, this.error_.message, this.error_);
  63712. this.trigger("error");
  63713. hooks$1("error").forEach((hookFunction) => hookFunction(this, this.error_));
  63714. return;
  63715. }
  63716. reportUserActivity(event2) {
  63717. this.userActivity_ = true;
  63718. }
  63719. userActive(bool) {
  63720. if (bool === void 0) {
  63721. return this.userActive_;
  63722. }
  63723. bool = !!bool;
  63724. if (bool === this.userActive_) {
  63725. return;
  63726. }
  63727. this.userActive_ = bool;
  63728. if (this.userActive_) {
  63729. this.userActivity_ = true;
  63730. this.removeClass("vjs-user-inactive");
  63731. this.addClass("vjs-user-active");
  63732. this.trigger("useractive");
  63733. return;
  63734. }
  63735. if (this.tech_) {
  63736. this.tech_.one("mousemove", function(e) {
  63737. e.stopPropagation();
  63738. e.preventDefault();
  63739. });
  63740. }
  63741. this.userActivity_ = false;
  63742. this.removeClass("vjs-user-active");
  63743. this.addClass("vjs-user-inactive");
  63744. this.trigger("userinactive");
  63745. }
  63746. listenForUserActivity_() {
  63747. let mouseInProgress;
  63748. let lastMoveX;
  63749. let lastMoveY;
  63750. const handleActivity = bind_(this, this.reportUserActivity);
  63751. const handleMouseMove = function(e) {
  63752. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  63753. lastMoveX = e.screenX;
  63754. lastMoveY = e.screenY;
  63755. handleActivity();
  63756. }
  63757. };
  63758. const handleMouseDown = function() {
  63759. handleActivity();
  63760. this.clearInterval(mouseInProgress);
  63761. mouseInProgress = this.setInterval(handleActivity, 250);
  63762. };
  63763. const handleMouseUpAndMouseLeave = function(event2) {
  63764. handleActivity();
  63765. this.clearInterval(mouseInProgress);
  63766. };
  63767. this.on("mousedown", handleMouseDown);
  63768. this.on("mousemove", handleMouseMove);
  63769. this.on("mouseup", handleMouseUpAndMouseLeave);
  63770. this.on("mouseleave", handleMouseUpAndMouseLeave);
  63771. const controlBar = this.getChild("controlBar");
  63772. if (controlBar && !IS_IOS$1 && !IS_ANDROID$1) {
  63773. controlBar.on("mouseenter", function(event2) {
  63774. if (this.player().options_.inactivityTimeout !== 0) {
  63775. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  63776. }
  63777. this.player().options_.inactivityTimeout = 0;
  63778. });
  63779. controlBar.on("mouseleave", function(event2) {
  63780. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  63781. });
  63782. }
  63783. this.on("keydown", handleActivity);
  63784. this.on("keyup", handleActivity);
  63785. let inactivityTimeout;
  63786. this.setInterval(function() {
  63787. if (!this.userActivity_) {
  63788. return;
  63789. }
  63790. this.userActivity_ = false;
  63791. this.userActive(true);
  63792. this.clearTimeout(inactivityTimeout);
  63793. const timeout = this.options_.inactivityTimeout;
  63794. if (timeout <= 0) {
  63795. return;
  63796. }
  63797. inactivityTimeout = this.setTimeout(function() {
  63798. if (!this.userActivity_) {
  63799. this.userActive(false);
  63800. }
  63801. }, timeout);
  63802. }, 250);
  63803. }
  63804. playbackRate(rate) {
  63805. if (rate !== void 0) {
  63806. this.techCall_("setPlaybackRate", rate);
  63807. return;
  63808. }
  63809. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63810. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  63811. }
  63812. return 1;
  63813. }
  63814. defaultPlaybackRate(rate) {
  63815. if (rate !== void 0) {
  63816. return this.techCall_("setDefaultPlaybackRate", rate);
  63817. }
  63818. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63819. return this.techGet_("defaultPlaybackRate");
  63820. }
  63821. return 1;
  63822. }
  63823. isAudio(bool) {
  63824. if (bool !== void 0) {
  63825. this.isAudio_ = !!bool;
  63826. return;
  63827. }
  63828. return !!this.isAudio_;
  63829. }
  63830. enableAudioOnlyUI_() {
  63831. this.addClass("vjs-audio-only-mode");
  63832. const playerChildren = this.children();
  63833. const controlBar = this.getChild("ControlBar");
  63834. const controlBarHeight = controlBar && controlBar.currentHeight();
  63835. playerChildren.forEach((child) => {
  63836. if (child === controlBar) {
  63837. return;
  63838. }
  63839. if (child.el_ && !child.hasClass("vjs-hidden")) {
  63840. child.hide();
  63841. this.audioOnlyCache_.hiddenChildren.push(child);
  63842. }
  63843. });
  63844. this.audioOnlyCache_.playerHeight = this.currentHeight();
  63845. this.height(controlBarHeight);
  63846. this.trigger("audioonlymodechange");
  63847. }
  63848. disableAudioOnlyUI_() {
  63849. this.removeClass("vjs-audio-only-mode");
  63850. this.audioOnlyCache_.hiddenChildren.forEach((child) => child.show());
  63851. this.height(this.audioOnlyCache_.playerHeight);
  63852. this.trigger("audioonlymodechange");
  63853. }
  63854. audioOnlyMode(value) {
  63855. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  63856. return this.audioOnlyMode_;
  63857. }
  63858. this.audioOnlyMode_ = value;
  63859. if (value) {
  63860. const exitPromises = [];
  63861. if (this.isInPictureInPicture()) {
  63862. exitPromises.push(this.exitPictureInPicture());
  63863. }
  63864. if (this.isFullscreen()) {
  63865. exitPromises.push(this.exitFullscreen());
  63866. }
  63867. if (this.audioPosterMode()) {
  63868. exitPromises.push(this.audioPosterMode(false));
  63869. }
  63870. return Promise.all(exitPromises).then(() => this.enableAudioOnlyUI_());
  63871. }
  63872. return Promise.resolve().then(() => this.disableAudioOnlyUI_());
  63873. }
  63874. enablePosterModeUI_() {
  63875. const tech = this.tech_ && this.tech_;
  63876. tech.hide();
  63877. this.addClass("vjs-audio-poster-mode");
  63878. this.trigger("audiopostermodechange");
  63879. }
  63880. disablePosterModeUI_() {
  63881. const tech = this.tech_ && this.tech_;
  63882. tech.show();
  63883. this.removeClass("vjs-audio-poster-mode");
  63884. this.trigger("audiopostermodechange");
  63885. }
  63886. audioPosterMode(value) {
  63887. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  63888. return this.audioPosterMode_;
  63889. }
  63890. this.audioPosterMode_ = value;
  63891. if (value) {
  63892. if (this.audioOnlyMode()) {
  63893. const audioOnlyModePromise = this.audioOnlyMode(false);
  63894. return audioOnlyModePromise.then(() => {
  63895. this.enablePosterModeUI_();
  63896. });
  63897. }
  63898. return Promise.resolve().then(() => {
  63899. this.enablePosterModeUI_();
  63900. });
  63901. }
  63902. return Promise.resolve().then(() => {
  63903. this.disablePosterModeUI_();
  63904. });
  63905. }
  63906. addTextTrack(kind, label2, language) {
  63907. if (this.tech_) {
  63908. return this.tech_.addTextTrack(kind, label2, language);
  63909. }
  63910. }
  63911. addRemoteTextTrack(options2, manualCleanup) {
  63912. if (this.tech_) {
  63913. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  63914. }
  63915. }
  63916. removeRemoteTextTrack(obj = {}) {
  63917. let {
  63918. track
  63919. } = obj;
  63920. if (!track) {
  63921. track = obj;
  63922. }
  63923. if (this.tech_) {
  63924. return this.tech_.removeRemoteTextTrack(track);
  63925. }
  63926. }
  63927. getVideoPlaybackQuality() {
  63928. return this.techGet_("getVideoPlaybackQuality");
  63929. }
  63930. videoWidth() {
  63931. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  63932. }
  63933. videoHeight() {
  63934. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  63935. }
  63936. language(code) {
  63937. if (code === void 0) {
  63938. return this.language_;
  63939. }
  63940. if (this.language_ !== String(code).toLowerCase()) {
  63941. this.language_ = String(code).toLowerCase();
  63942. if (isEvented$1(this)) {
  63943. this.trigger("languagechange");
  63944. }
  63945. }
  63946. }
  63947. languages() {
  63948. return merge$1(Player$1.prototype.options_.languages, this.languages_);
  63949. }
  63950. toJSON() {
  63951. const options2 = merge$1(this.options_);
  63952. const tracks = options2.tracks;
  63953. options2.tracks = [];
  63954. for (let i2 = 0; i2 < tracks.length; i2++) {
  63955. let track = tracks[i2];
  63956. track = merge$1(track);
  63957. track.player = void 0;
  63958. options2.tracks[i2] = track;
  63959. }
  63960. return options2;
  63961. }
  63962. createModal(content, options2) {
  63963. options2 = options2 || {};
  63964. options2.content = content || "";
  63965. const modal = new ModalDialog$1(this, options2);
  63966. this.addChild(modal);
  63967. modal.on("dispose", () => {
  63968. this.removeChild(modal);
  63969. });
  63970. modal.open();
  63971. return modal;
  63972. }
  63973. updateCurrentBreakpoint_() {
  63974. if (!this.responsive()) {
  63975. return;
  63976. }
  63977. const currentBreakpoint = this.currentBreakpoint();
  63978. const currentWidth = this.currentWidth();
  63979. for (let i2 = 0; i2 < BREAKPOINT_ORDER$1.length; i2++) {
  63980. const candidateBreakpoint = BREAKPOINT_ORDER$1[i2];
  63981. const maxWidth = this.breakpoints_[candidateBreakpoint];
  63982. if (currentWidth <= maxWidth) {
  63983. if (currentBreakpoint === candidateBreakpoint) {
  63984. return;
  63985. }
  63986. if (currentBreakpoint) {
  63987. this.removeClass(BREAKPOINT_CLASSES$1[currentBreakpoint]);
  63988. }
  63989. this.addClass(BREAKPOINT_CLASSES$1[candidateBreakpoint]);
  63990. this.breakpoint_ = candidateBreakpoint;
  63991. break;
  63992. }
  63993. }
  63994. }
  63995. removeCurrentBreakpoint_() {
  63996. const className = this.currentBreakpointClass();
  63997. this.breakpoint_ = "";
  63998. if (className) {
  63999. this.removeClass(className);
  64000. }
  64001. }
  64002. breakpoints(breakpoints) {
  64003. if (breakpoints === void 0) {
  64004. return Object.assign(this.breakpoints_);
  64005. }
  64006. this.breakpoint_ = "";
  64007. this.breakpoints_ = Object.assign({}, DEFAULT_BREAKPOINTS$1, breakpoints);
  64008. this.updateCurrentBreakpoint_();
  64009. return Object.assign(this.breakpoints_);
  64010. }
  64011. responsive(value) {
  64012. if (value === void 0) {
  64013. return this.responsive_;
  64014. }
  64015. value = Boolean(value);
  64016. const current = this.responsive_;
  64017. if (value === current) {
  64018. return;
  64019. }
  64020. this.responsive_ = value;
  64021. if (value) {
  64022. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  64023. this.updateCurrentBreakpoint_();
  64024. } else {
  64025. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  64026. this.removeCurrentBreakpoint_();
  64027. }
  64028. return value;
  64029. }
  64030. currentBreakpoint() {
  64031. return this.breakpoint_;
  64032. }
  64033. currentBreakpointClass() {
  64034. return BREAKPOINT_CLASSES$1[this.breakpoint_] || "";
  64035. }
  64036. loadMedia(media, ready) {
  64037. if (!media || typeof media !== "object") {
  64038. return;
  64039. }
  64040. this.reset();
  64041. this.cache_.media = merge$1(media);
  64042. const {
  64043. artist,
  64044. artwork,
  64045. description,
  64046. poster,
  64047. src,
  64048. textTracks,
  64049. title
  64050. } = this.cache_.media;
  64051. if (!artwork && poster) {
  64052. this.cache_.media.artwork = [{
  64053. src: poster,
  64054. type: getMimetype$1(poster)
  64055. }];
  64056. }
  64057. if (src) {
  64058. this.src(src);
  64059. }
  64060. if (poster) {
  64061. this.poster(poster);
  64062. }
  64063. if (Array.isArray(textTracks)) {
  64064. textTracks.forEach((tt2) => this.addRemoteTextTrack(tt2, false));
  64065. }
  64066. if (this.titleBar) {
  64067. this.titleBar.update({
  64068. title,
  64069. description: description || artist || ""
  64070. });
  64071. }
  64072. this.ready(ready);
  64073. }
  64074. getMedia() {
  64075. if (!this.cache_.media) {
  64076. const poster = this.poster();
  64077. const src = this.currentSources();
  64078. const textTracks = Array.prototype.map.call(this.remoteTextTracks(), (tt2) => ({
  64079. kind: tt2.kind,
  64080. label: tt2.label,
  64081. language: tt2.language,
  64082. src: tt2.src
  64083. }));
  64084. const media = {
  64085. src,
  64086. textTracks
  64087. };
  64088. if (poster) {
  64089. media.poster = poster;
  64090. media.artwork = [{
  64091. src: media.poster,
  64092. type: getMimetype$1(media.poster)
  64093. }];
  64094. }
  64095. return media;
  64096. }
  64097. return merge$1(this.cache_.media);
  64098. }
  64099. static getTagSettings(tag) {
  64100. const baseOptions = {
  64101. sources: [],
  64102. tracks: []
  64103. };
  64104. const tagOptions = getAttributes$1(tag);
  64105. const dataSetup = tagOptions["data-setup"];
  64106. if (hasClass$1(tag, "vjs-fill")) {
  64107. tagOptions.fill = true;
  64108. }
  64109. if (hasClass$1(tag, "vjs-fluid")) {
  64110. tagOptions.fluid = true;
  64111. }
  64112. if (dataSetup !== null) {
  64113. const [err, data] = tuple(dataSetup || "{}");
  64114. if (err) {
  64115. log$1$1.error(err);
  64116. }
  64117. Object.assign(tagOptions, data);
  64118. }
  64119. Object.assign(baseOptions, tagOptions);
  64120. if (tag.hasChildNodes()) {
  64121. const children = tag.childNodes;
  64122. for (let i2 = 0, j = children.length; i2 < j; i2++) {
  64123. const child = children[i2];
  64124. const childName = child.nodeName.toLowerCase();
  64125. if (childName === "source") {
  64126. baseOptions.sources.push(getAttributes$1(child));
  64127. } else if (childName === "track") {
  64128. baseOptions.tracks.push(getAttributes$1(child));
  64129. }
  64130. }
  64131. }
  64132. return baseOptions;
  64133. }
  64134. debug(enabled) {
  64135. if (enabled === void 0) {
  64136. return this.debugEnabled_;
  64137. }
  64138. if (enabled) {
  64139. this.trigger("debugon");
  64140. this.previousLogLevel_ = this.log.level;
  64141. this.log.level("debug");
  64142. this.debugEnabled_ = true;
  64143. } else {
  64144. this.trigger("debugoff");
  64145. this.log.level(this.previousLogLevel_);
  64146. this.previousLogLevel_ = void 0;
  64147. this.debugEnabled_ = false;
  64148. }
  64149. }
  64150. playbackRates(newRates) {
  64151. if (newRates === void 0) {
  64152. return this.cache_.playbackRates;
  64153. }
  64154. if (!Array.isArray(newRates)) {
  64155. return;
  64156. }
  64157. if (!newRates.every((rate) => typeof rate === "number")) {
  64158. return;
  64159. }
  64160. this.cache_.playbackRates = newRates;
  64161. this.trigger("playbackrateschange");
  64162. }
  64163. }
  64164. ALL$1.names.forEach(function(name) {
  64165. const props = ALL$1[name];
  64166. Player$1.prototype[props.getterName] = function() {
  64167. if (this.tech_) {
  64168. return this.tech_[props.getterName]();
  64169. }
  64170. this[props.privateName] = this[props.privateName] || new props.ListClass();
  64171. return this[props.privateName];
  64172. };
  64173. });
  64174. Player$1.prototype.crossorigin = Player$1.prototype.crossOrigin;
  64175. Player$1.players = {};
  64176. const navigator$3 = window_1.navigator;
  64177. Player$1.prototype.options_ = {
  64178. techOrder: Tech$2.defaultTechOrder_,
  64179. html5: {},
  64180. enableSourceset: true,
  64181. inactivityTimeout: 2e3,
  64182. playbackRates: [],
  64183. liveui: false,
  64184. children: ["mediaLoader", "posterImage", "titleBar", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  64185. language: navigator$3 && (navigator$3.languages && navigator$3.languages[0] || navigator$3.userLanguage || navigator$3.language) || "en",
  64186. languages: {},
  64187. notSupportedMessage: "No compatible source was found for this media.",
  64188. normalizeAutoplay: false,
  64189. fullscreen: {
  64190. options: {
  64191. navigationUI: "hide"
  64192. }
  64193. },
  64194. breakpoints: {},
  64195. responsive: false,
  64196. audioOnlyMode: false,
  64197. audioPosterMode: false
  64198. };
  64199. [
  64200. "ended",
  64201. "seeking",
  64202. "seekable",
  64203. "networkState",
  64204. "readyState"
  64205. ].forEach(function(fn2) {
  64206. Player$1.prototype[fn2] = function() {
  64207. return this.techGet_(fn2);
  64208. };
  64209. });
  64210. TECH_EVENTS_RETRIGGER$1.forEach(function(event2) {
  64211. Player$1.prototype[`handleTech${toTitleCase$1$1(event2)}_`] = function() {
  64212. return this.trigger(event2);
  64213. };
  64214. });
  64215. Component$1$1.registerComponent("Player", Player$1);
  64216. const BASE_PLUGIN_NAME$1 = "plugin";
  64217. const PLUGIN_CACHE_KEY$1 = "activePlugins_";
  64218. const pluginStorage$1 = {};
  64219. const pluginExists$1 = (name) => pluginStorage$1.hasOwnProperty(name);
  64220. const getPlugin$1 = (name) => pluginExists$1(name) ? pluginStorage$1[name] : void 0;
  64221. const markPluginAsActive$1 = (player, name) => {
  64222. player[PLUGIN_CACHE_KEY$1] = player[PLUGIN_CACHE_KEY$1] || {};
  64223. player[PLUGIN_CACHE_KEY$1][name] = true;
  64224. };
  64225. const triggerSetupEvent$1 = (player, hash, before) => {
  64226. const eventName = (before ? "before" : "") + "pluginsetup";
  64227. player.trigger(eventName, hash);
  64228. player.trigger(eventName + ":" + hash.name, hash);
  64229. };
  64230. const createBasicPlugin$1 = function(name, plugin) {
  64231. const basicPluginWrapper = function() {
  64232. triggerSetupEvent$1(this, {
  64233. name,
  64234. plugin,
  64235. instance: null
  64236. }, true);
  64237. const instance = plugin.apply(this, arguments);
  64238. markPluginAsActive$1(this, name);
  64239. triggerSetupEvent$1(this, {
  64240. name,
  64241. plugin,
  64242. instance
  64243. });
  64244. return instance;
  64245. };
  64246. Object.keys(plugin).forEach(function(prop) {
  64247. basicPluginWrapper[prop] = plugin[prop];
  64248. });
  64249. return basicPluginWrapper;
  64250. };
  64251. const createPluginFactory$1 = (name, PluginSubClass) => {
  64252. PluginSubClass.prototype.name = name;
  64253. return function(...args) {
  64254. triggerSetupEvent$1(this, {
  64255. name,
  64256. plugin: PluginSubClass,
  64257. instance: null
  64258. }, true);
  64259. const instance = new PluginSubClass(...[this, ...args]);
  64260. this[name] = () => instance;
  64261. triggerSetupEvent$1(this, instance.getEventHash());
  64262. return instance;
  64263. };
  64264. };
  64265. class Plugin$1 {
  64266. constructor(player) {
  64267. if (this.constructor === Plugin$1) {
  64268. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  64269. }
  64270. this.player = player;
  64271. if (!this.log) {
  64272. this.log = this.player.log.createLogger(this.name);
  64273. }
  64274. evented$1(this);
  64275. delete this.trigger;
  64276. stateful$1(this, this.constructor.defaultState);
  64277. markPluginAsActive$1(player, this.name);
  64278. this.dispose = this.dispose.bind(this);
  64279. player.on("dispose", this.dispose);
  64280. }
  64281. version() {
  64282. return this.constructor.VERSION;
  64283. }
  64284. getEventHash(hash = {}) {
  64285. hash.name = this.name;
  64286. hash.plugin = this.constructor;
  64287. hash.instance = this;
  64288. return hash;
  64289. }
  64290. trigger(event2, hash = {}) {
  64291. return trigger$1(this.eventBusEl_, event2, this.getEventHash(hash));
  64292. }
  64293. handleStateChanged(e) {
  64294. }
  64295. dispose() {
  64296. const {
  64297. name,
  64298. player
  64299. } = this;
  64300. this.trigger("dispose");
  64301. this.off();
  64302. player.off("dispose", this.dispose);
  64303. player[PLUGIN_CACHE_KEY$1][name] = false;
  64304. this.player = this.state = null;
  64305. player[name] = createPluginFactory$1(name, pluginStorage$1[name]);
  64306. }
  64307. static isBasic(plugin) {
  64308. const p = typeof plugin === "string" ? getPlugin$1(plugin) : plugin;
  64309. return typeof p === "function" && !Plugin$1.prototype.isPrototypeOf(p.prototype);
  64310. }
  64311. static registerPlugin(name, plugin) {
  64312. if (typeof name !== "string") {
  64313. throw new Error(`Illegal plugin name, "${name}", must be a string, was ${typeof name}.`);
  64314. }
  64315. if (pluginExists$1(name)) {
  64316. log$1$1.warn(`A plugin named "${name}" already exists. You may want to avoid re-registering plugins!`);
  64317. } else if (Player$1.prototype.hasOwnProperty(name)) {
  64318. throw new Error(`Illegal plugin name, "${name}", cannot share a name with an existing player method!`);
  64319. }
  64320. if (typeof plugin !== "function") {
  64321. throw new Error(`Illegal plugin for "${name}", must be a function, was ${typeof plugin}.`);
  64322. }
  64323. pluginStorage$1[name] = plugin;
  64324. if (name !== BASE_PLUGIN_NAME$1) {
  64325. if (Plugin$1.isBasic(plugin)) {
  64326. Player$1.prototype[name] = createBasicPlugin$1(name, plugin);
  64327. } else {
  64328. Player$1.prototype[name] = createPluginFactory$1(name, plugin);
  64329. }
  64330. }
  64331. return plugin;
  64332. }
  64333. static deregisterPlugin(name) {
  64334. if (name === BASE_PLUGIN_NAME$1) {
  64335. throw new Error("Cannot de-register base plugin.");
  64336. }
  64337. if (pluginExists$1(name)) {
  64338. delete pluginStorage$1[name];
  64339. delete Player$1.prototype[name];
  64340. }
  64341. }
  64342. static getPlugins(names2 = Object.keys(pluginStorage$1)) {
  64343. let result;
  64344. names2.forEach((name) => {
  64345. const plugin = getPlugin$1(name);
  64346. if (plugin) {
  64347. result = result || {};
  64348. result[name] = plugin;
  64349. }
  64350. });
  64351. return result;
  64352. }
  64353. static getPluginVersion(name) {
  64354. const plugin = getPlugin$1(name);
  64355. return plugin && plugin.VERSION || "";
  64356. }
  64357. }
  64358. Plugin$1.getPlugin = getPlugin$1;
  64359. Plugin$1.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME$1;
  64360. Plugin$1.registerPlugin(BASE_PLUGIN_NAME$1, Plugin$1);
  64361. Player$1.prototype.usingPlugin = function(name) {
  64362. return !!this[PLUGIN_CACHE_KEY$1] && this[PLUGIN_CACHE_KEY$1][name] === true;
  64363. };
  64364. Player$1.prototype.hasPlugin = function(name) {
  64365. return !!pluginExists$1(name);
  64366. };
  64367. function deprecate(message, fn2) {
  64368. let warned = false;
  64369. return function(...args) {
  64370. if (!warned) {
  64371. log$1$1.warn(message);
  64372. }
  64373. warned = true;
  64374. return fn2.apply(this, args);
  64375. };
  64376. }
  64377. function deprecateForMajor(major, oldName, newName, fn2) {
  64378. return deprecate(`${oldName} is deprecated and will be removed in ${major}.0; please use ${newName} instead.`, fn2);
  64379. }
  64380. const normalizeId$1 = (id) => id.indexOf("#") === 0 ? id.slice(1) : id;
  64381. function videojs$2(id, options2, ready) {
  64382. let player = videojs$2.getPlayer(id);
  64383. if (player) {
  64384. if (options2) {
  64385. log$1$1.warn(`Player "${id}" is already initialised. Options will not be applied.`);
  64386. }
  64387. if (ready) {
  64388. player.ready(ready);
  64389. }
  64390. return player;
  64391. }
  64392. const el = typeof id === "string" ? $$1("#" + normalizeId$1(id)) : id;
  64393. if (!isEl$1(el)) {
  64394. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  64395. }
  64396. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  64397. log$1$1.warn("The element supplied is not included in the DOM");
  64398. }
  64399. options2 = options2 || {};
  64400. if (options2.restoreEl === true) {
  64401. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  64402. }
  64403. hooks$1("beforesetup").forEach((hookFunction) => {
  64404. const opts = hookFunction(el, merge$1(options2));
  64405. if (!isObject$2(opts) || Array.isArray(opts)) {
  64406. log$1$1.error("please return an object in beforesetup hooks");
  64407. return;
  64408. }
  64409. options2 = merge$1(options2, opts);
  64410. });
  64411. const PlayerComponent = Component$1$1.getComponent("Player");
  64412. player = new PlayerComponent(el, options2, ready);
  64413. hooks$1("setup").forEach((hookFunction) => hookFunction(player));
  64414. return player;
  64415. }
  64416. videojs$2.hooks_ = hooks_$1;
  64417. videojs$2.hooks = hooks$1;
  64418. videojs$2.hook = hook$1;
  64419. videojs$2.hookOnce = hookOnce$1;
  64420. videojs$2.removeHook = removeHook$1;
  64421. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal$1()) {
  64422. let style = $$1(".vjs-styles-defaults");
  64423. if (!style) {
  64424. style = createStyleElement$1("vjs-styles-defaults");
  64425. const head = $$1("head");
  64426. if (head) {
  64427. head.insertBefore(style, head.firstChild);
  64428. }
  64429. setTextContent$1(style, `
  64430. .video-js {
  64431. width: 300px;
  64432. height: 150px;
  64433. }
  64434. .vjs-fluid:not(.vjs-audio-only-mode) {
  64435. padding-top: 56.25%
  64436. }
  64437. `);
  64438. }
  64439. }
  64440. autoSetupTimeout$1(1, videojs$2);
  64441. videojs$2.VERSION = version$6$1;
  64442. videojs$2.options = Player$1.prototype.options_;
  64443. videojs$2.getPlayers = () => Player$1.players;
  64444. videojs$2.getPlayer = (id) => {
  64445. const players = Player$1.players;
  64446. let tag;
  64447. if (typeof id === "string") {
  64448. const nId = normalizeId$1(id);
  64449. const player = players[nId];
  64450. if (player) {
  64451. return player;
  64452. }
  64453. tag = $$1("#" + nId);
  64454. } else {
  64455. tag = id;
  64456. }
  64457. if (isEl$1(tag)) {
  64458. const {
  64459. player,
  64460. playerId
  64461. } = tag;
  64462. if (player || players[playerId]) {
  64463. return player || players[playerId];
  64464. }
  64465. }
  64466. };
  64467. videojs$2.getAllPlayers = () => Object.keys(Player$1.players).map((k) => Player$1.players[k]).filter(Boolean);
  64468. videojs$2.players = Player$1.players;
  64469. videojs$2.getComponent = Component$1$1.getComponent;
  64470. videojs$2.registerComponent = (name, comp) => {
  64471. if (Tech$2.isTech(comp)) {
  64472. log$1$1.warn(`The ${name} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);
  64473. }
  64474. Component$1$1.registerComponent.call(Component$1$1, name, comp);
  64475. };
  64476. videojs$2.getTech = Tech$2.getTech;
  64477. videojs$2.registerTech = Tech$2.registerTech;
  64478. videojs$2.use = use$1;
  64479. Object.defineProperty(videojs$2, "middleware", {
  64480. value: {},
  64481. writeable: false,
  64482. enumerable: true
  64483. });
  64484. Object.defineProperty(videojs$2.middleware, "TERMINATOR", {
  64485. value: TERMINATOR$1,
  64486. writeable: false,
  64487. enumerable: true
  64488. });
  64489. videojs$2.browser = browser$1;
  64490. videojs$2.obj = Obj;
  64491. videojs$2.mergeOptions = deprecateForMajor(9, "videojs.mergeOptions", "videojs.obj.merge", merge$1);
  64492. videojs$2.defineLazyProperty = deprecateForMajor(9, "videojs.defineLazyProperty", "videojs.obj.defineLazyProperty", defineLazyProperty$1);
  64493. videojs$2.bind = deprecateForMajor(9, "videojs.bind", "native Function.prototype.bind", bind_);
  64494. videojs$2.registerPlugin = Plugin$1.registerPlugin;
  64495. videojs$2.deregisterPlugin = Plugin$1.deregisterPlugin;
  64496. videojs$2.plugin = (name, plugin) => {
  64497. log$1$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  64498. return Plugin$1.registerPlugin(name, plugin);
  64499. };
  64500. videojs$2.getPlugins = Plugin$1.getPlugins;
  64501. videojs$2.getPlugin = Plugin$1.getPlugin;
  64502. videojs$2.getPluginVersion = Plugin$1.getPluginVersion;
  64503. videojs$2.addLanguage = function(code, data) {
  64504. code = ("" + code).toLowerCase();
  64505. videojs$2.options.languages = merge$1(videojs$2.options.languages, {
  64506. [code]: data
  64507. });
  64508. return videojs$2.options.languages[code];
  64509. };
  64510. videojs$2.log = log$1$1;
  64511. videojs$2.createLogger = createLogger$2;
  64512. videojs$2.time = Time;
  64513. videojs$2.createTimeRange = deprecateForMajor(9, "videojs.createTimeRange", "videojs.time.createTimeRanges", createTimeRanges$1);
  64514. videojs$2.createTimeRanges = deprecateForMajor(9, "videojs.createTimeRanges", "videojs.time.createTimeRanges", createTimeRanges$1);
  64515. videojs$2.formatTime = deprecateForMajor(9, "videojs.formatTime", "videojs.time.formatTime", formatTime$1);
  64516. videojs$2.setFormatTime = deprecateForMajor(9, "videojs.setFormatTime", "videojs.time.setFormatTime", setFormatTime$1);
  64517. videojs$2.resetFormatTime = deprecateForMajor(9, "videojs.resetFormatTime", "videojs.time.resetFormatTime", resetFormatTime$1);
  64518. videojs$2.parseUrl = deprecateForMajor(9, "videojs.parseUrl", "videojs.url.parseUrl", parseUrl$1);
  64519. videojs$2.isCrossOrigin = deprecateForMajor(9, "videojs.isCrossOrigin", "videojs.url.isCrossOrigin", isCrossOrigin$1);
  64520. videojs$2.EventTarget = EventTarget$2$1;
  64521. videojs$2.any = any$1;
  64522. videojs$2.on = on$1;
  64523. videojs$2.one = one$1;
  64524. videojs$2.off = off$1;
  64525. videojs$2.trigger = trigger$1;
  64526. videojs$2.xhr = XHR;
  64527. videojs$2.TextTrack = TextTrack$1;
  64528. videojs$2.AudioTrack = AudioTrack$1;
  64529. videojs$2.VideoTrack = VideoTrack$1;
  64530. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach((k) => {
  64531. videojs$2[k] = function() {
  64532. log$1$1.warn(`videojs.${k}() is deprecated; use videojs.dom.${k}() instead`);
  64533. return Dom$2[k].apply(null, arguments);
  64534. };
  64535. });
  64536. videojs$2.computedStyle = deprecateForMajor(9, "videojs.computedStyle", "videojs.dom.computedStyle", computedStyle$1);
  64537. videojs$2.dom = Dom$2;
  64538. videojs$2.fn = Fn;
  64539. videojs$2.num = Num;
  64540. videojs$2.str = Str;
  64541. videojs$2.url = Url$2;
  64542. /*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
  64543. class QualityLevel {
  64544. constructor(representation) {
  64545. let level = this;
  64546. level.id = representation.id;
  64547. level.label = level.id;
  64548. level.width = representation.width;
  64549. level.height = representation.height;
  64550. level.bitrate = representation.bandwidth;
  64551. level.frameRate = representation.frameRate;
  64552. level.enabled_ = representation.enabled;
  64553. Object.defineProperty(level, "enabled", {
  64554. get() {
  64555. return level.enabled_();
  64556. },
  64557. set(enable) {
  64558. level.enabled_(enable);
  64559. }
  64560. });
  64561. return level;
  64562. }
  64563. }
  64564. class QualityLevelList extends videojs$2.EventTarget {
  64565. constructor() {
  64566. super();
  64567. let list = this;
  64568. list.levels_ = [];
  64569. list.selectedIndex_ = -1;
  64570. Object.defineProperty(list, "selectedIndex", {
  64571. get() {
  64572. return list.selectedIndex_;
  64573. }
  64574. });
  64575. Object.defineProperty(list, "length", {
  64576. get() {
  64577. return list.levels_.length;
  64578. }
  64579. });
  64580. return list;
  64581. }
  64582. addQualityLevel(representation) {
  64583. let qualityLevel = this.getQualityLevelById(representation.id);
  64584. if (qualityLevel) {
  64585. return qualityLevel;
  64586. }
  64587. const index2 = this.levels_.length;
  64588. qualityLevel = new QualityLevel(representation);
  64589. if (!("" + index2 in this)) {
  64590. Object.defineProperty(this, index2, {
  64591. get() {
  64592. return this.levels_[index2];
  64593. }
  64594. });
  64595. }
  64596. this.levels_.push(qualityLevel);
  64597. this.trigger({
  64598. qualityLevel,
  64599. type: "addqualitylevel"
  64600. });
  64601. return qualityLevel;
  64602. }
  64603. removeQualityLevel(qualityLevel) {
  64604. let removed = null;
  64605. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64606. if (this[i2] === qualityLevel) {
  64607. removed = this.levels_.splice(i2, 1)[0];
  64608. if (this.selectedIndex_ === i2) {
  64609. this.selectedIndex_ = -1;
  64610. } else if (this.selectedIndex_ > i2) {
  64611. this.selectedIndex_--;
  64612. }
  64613. break;
  64614. }
  64615. }
  64616. if (removed) {
  64617. this.trigger({
  64618. qualityLevel,
  64619. type: "removequalitylevel"
  64620. });
  64621. }
  64622. return removed;
  64623. }
  64624. getQualityLevelById(id) {
  64625. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64626. const level = this[i2];
  64627. if (level.id === id) {
  64628. return level;
  64629. }
  64630. }
  64631. return null;
  64632. }
  64633. dispose() {
  64634. this.selectedIndex_ = -1;
  64635. this.levels_.length = 0;
  64636. }
  64637. }
  64638. QualityLevelList.prototype.allowedEvents_ = {
  64639. change: "change",
  64640. addqualitylevel: "addqualitylevel",
  64641. removequalitylevel: "removequalitylevel"
  64642. };
  64643. for (const event2 in QualityLevelList.prototype.allowedEvents_) {
  64644. QualityLevelList.prototype["on" + event2] = null;
  64645. }
  64646. var version$5$1 = "3.0.0";
  64647. const registerPlugin$1 = videojs$2.registerPlugin || videojs$2.plugin;
  64648. const initPlugin$1 = function(player, options2) {
  64649. const originalPluginFn = player.qualityLevels;
  64650. const qualityLevelList = new QualityLevelList();
  64651. const disposeHandler = function() {
  64652. qualityLevelList.dispose();
  64653. player.qualityLevels = originalPluginFn;
  64654. player.off("dispose", disposeHandler);
  64655. };
  64656. player.on("dispose", disposeHandler);
  64657. player.qualityLevels = () => qualityLevelList;
  64658. player.qualityLevels.VERSION = version$5$1;
  64659. return qualityLevelList;
  64660. };
  64661. const qualityLevels = function(options2) {
  64662. return initPlugin$1(this, videojs$2.mergeOptions({}, options2));
  64663. };
  64664. registerPlugin$1("qualityLevels", qualityLevels);
  64665. qualityLevels.VERSION = version$5$1;
  64666. /*! @name @videojs/http-streaming @version 3.0.2 @license Apache-2.0 */
  64667. const resolveUrl$2 = resolveUrl$4;
  64668. const resolveManifestRedirect$1 = (url, req) => {
  64669. if (req && req.responseURL && url !== req.responseURL) {
  64670. return req.responseURL;
  64671. }
  64672. return url;
  64673. };
  64674. const logger$1 = (source) => {
  64675. if (videojs$2.log.debug) {
  64676. return videojs$2.log.debug.bind(videojs$2, "VHS:", `${source} >`);
  64677. }
  64678. return function() {
  64679. };
  64680. };
  64681. function merge$2(...args) {
  64682. const context = videojs$2.obj || videojs$2;
  64683. const fn2 = context.merge || context.mergeOptions;
  64684. return fn2.apply(context, args);
  64685. }
  64686. function createTimeRanges$2(...args) {
  64687. const context = videojs$2.time || videojs$2;
  64688. const fn2 = context.createTimeRanges || context.createTimeRanges;
  64689. return fn2.apply(context, args);
  64690. }
  64691. const TIME_FUDGE_FACTOR$1 = 1 / 30;
  64692. const SAFE_TIME_DELTA$1 = TIME_FUDGE_FACTOR$1 * 3;
  64693. const filterRanges$1 = function(timeRanges, predicate) {
  64694. const results = [];
  64695. let i2;
  64696. if (timeRanges && timeRanges.length) {
  64697. for (i2 = 0; i2 < timeRanges.length; i2++) {
  64698. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  64699. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  64700. }
  64701. }
  64702. }
  64703. return createTimeRanges$2(results);
  64704. };
  64705. const findRange$1 = function(buffered, time) {
  64706. return filterRanges$1(buffered, function(start2, end) {
  64707. return start2 - SAFE_TIME_DELTA$1 <= time && end + SAFE_TIME_DELTA$1 >= time;
  64708. });
  64709. };
  64710. const findNextRange$1 = function(timeRanges, time) {
  64711. return filterRanges$1(timeRanges, function(start2) {
  64712. return start2 - TIME_FUDGE_FACTOR$1 >= time;
  64713. });
  64714. };
  64715. const findGaps$1 = function(buffered) {
  64716. if (buffered.length < 2) {
  64717. return createTimeRanges$2();
  64718. }
  64719. const ranges = [];
  64720. for (let i2 = 1; i2 < buffered.length; i2++) {
  64721. const start2 = buffered.end(i2 - 1);
  64722. const end = buffered.start(i2);
  64723. ranges.push([start2, end]);
  64724. }
  64725. return createTimeRanges$2(ranges);
  64726. };
  64727. const bufferIntersection$1 = function(bufferA, bufferB) {
  64728. let start2 = null;
  64729. let end = null;
  64730. let arity = 0;
  64731. const extents = [];
  64732. const ranges = [];
  64733. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  64734. return createTimeRanges$2();
  64735. }
  64736. let count = bufferA.length;
  64737. while (count--) {
  64738. extents.push({
  64739. time: bufferA.start(count),
  64740. type: "start"
  64741. });
  64742. extents.push({
  64743. time: bufferA.end(count),
  64744. type: "end"
  64745. });
  64746. }
  64747. count = bufferB.length;
  64748. while (count--) {
  64749. extents.push({
  64750. time: bufferB.start(count),
  64751. type: "start"
  64752. });
  64753. extents.push({
  64754. time: bufferB.end(count),
  64755. type: "end"
  64756. });
  64757. }
  64758. extents.sort(function(a, b) {
  64759. return a.time - b.time;
  64760. });
  64761. for (count = 0; count < extents.length; count++) {
  64762. if (extents[count].type === "start") {
  64763. arity++;
  64764. if (arity === 2) {
  64765. start2 = extents[count].time;
  64766. }
  64767. } else if (extents[count].type === "end") {
  64768. arity--;
  64769. if (arity === 1) {
  64770. end = extents[count].time;
  64771. }
  64772. }
  64773. if (start2 !== null && end !== null) {
  64774. ranges.push([start2, end]);
  64775. start2 = null;
  64776. end = null;
  64777. }
  64778. }
  64779. return createTimeRanges$2(ranges);
  64780. };
  64781. const printableRange$1 = (range3) => {
  64782. const strArr = [];
  64783. if (!range3 || !range3.length) {
  64784. return "";
  64785. }
  64786. for (let i2 = 0; i2 < range3.length; i2++) {
  64787. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  64788. }
  64789. return strArr.join(", ");
  64790. };
  64791. const timeUntilRebuffer$1 = function(buffered, currentTime, playbackRate = 1) {
  64792. const bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  64793. return (bufferedEnd - currentTime) / playbackRate;
  64794. };
  64795. const timeRangesToArray$1 = (timeRanges) => {
  64796. const timeRangesList = [];
  64797. for (let i2 = 0; i2 < timeRanges.length; i2++) {
  64798. timeRangesList.push({
  64799. start: timeRanges.start(i2),
  64800. end: timeRanges.end(i2)
  64801. });
  64802. }
  64803. return timeRangesList;
  64804. };
  64805. const isRangeDifferent$1 = function(a, b) {
  64806. if (a === b) {
  64807. return false;
  64808. }
  64809. if (!a && b || !b && a) {
  64810. return true;
  64811. }
  64812. if (a.length !== b.length) {
  64813. return true;
  64814. }
  64815. for (let i2 = 0; i2 < a.length; i2++) {
  64816. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  64817. return true;
  64818. }
  64819. }
  64820. return false;
  64821. };
  64822. const lastBufferedEnd$1 = function(a) {
  64823. if (!a || !a.length || !a.end) {
  64824. return;
  64825. }
  64826. return a.end(a.length - 1);
  64827. };
  64828. const timeAheadOf$1 = function(range3, startTime) {
  64829. let time = 0;
  64830. if (!range3 || !range3.length) {
  64831. return time;
  64832. }
  64833. for (let i2 = 0; i2 < range3.length; i2++) {
  64834. const start2 = range3.start(i2);
  64835. const end = range3.end(i2);
  64836. if (startTime > end) {
  64837. continue;
  64838. }
  64839. if (startTime > start2 && startTime <= end) {
  64840. time += end - startTime;
  64841. continue;
  64842. }
  64843. time += end - start2;
  64844. }
  64845. return time;
  64846. };
  64847. const segmentDurationWithParts$1 = (playlist, segment) => {
  64848. if (!segment.preload) {
  64849. return segment.duration;
  64850. }
  64851. let result = 0;
  64852. (segment.parts || []).forEach(function(p) {
  64853. result += p.duration;
  64854. });
  64855. (segment.preloadHints || []).forEach(function(p) {
  64856. if (p.type === "PART") {
  64857. result += playlist.partTargetDuration;
  64858. }
  64859. });
  64860. return result;
  64861. };
  64862. const getPartsAndSegments$1 = (playlist) => (playlist.segments || []).reduce((acc, segment, si) => {
  64863. if (segment.parts) {
  64864. segment.parts.forEach(function(part, pi) {
  64865. acc.push({
  64866. duration: part.duration,
  64867. segmentIndex: si,
  64868. partIndex: pi,
  64869. part,
  64870. segment
  64871. });
  64872. });
  64873. } else {
  64874. acc.push({
  64875. duration: segment.duration,
  64876. segmentIndex: si,
  64877. partIndex: null,
  64878. segment,
  64879. part: null
  64880. });
  64881. }
  64882. return acc;
  64883. }, []);
  64884. const getLastParts$1 = (media) => {
  64885. const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  64886. return lastSegment && lastSegment.parts || [];
  64887. };
  64888. const getKnownPartCount$1 = ({
  64889. preloadSegment
  64890. }) => {
  64891. if (!preloadSegment) {
  64892. return;
  64893. }
  64894. const {
  64895. parts,
  64896. preloadHints
  64897. } = preloadSegment;
  64898. let partCount = (preloadHints || []).reduce((count, hint) => count + (hint.type === "PART" ? 1 : 0), 0);
  64899. partCount += parts && parts.length ? parts.length : 0;
  64900. return partCount;
  64901. };
  64902. const liveEdgeDelay$1 = (main, media) => {
  64903. if (media.endList) {
  64904. return 0;
  64905. }
  64906. if (main && main.suggestedPresentationDelay) {
  64907. return main.suggestedPresentationDelay;
  64908. }
  64909. const hasParts = getLastParts$1(media).length > 0;
  64910. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  64911. return media.serverControl.partHoldBack;
  64912. } else if (hasParts && media.partTargetDuration) {
  64913. return media.partTargetDuration * 3;
  64914. } else if (media.serverControl && media.serverControl.holdBack) {
  64915. return media.serverControl.holdBack;
  64916. } else if (media.targetDuration) {
  64917. return media.targetDuration * 3;
  64918. }
  64919. return 0;
  64920. };
  64921. const backwardDuration$1 = function(playlist, endSequence) {
  64922. let result = 0;
  64923. let i2 = endSequence - playlist.mediaSequence;
  64924. let segment = playlist.segments[i2];
  64925. if (segment) {
  64926. if (typeof segment.start !== "undefined") {
  64927. return {
  64928. result: segment.start,
  64929. precise: true
  64930. };
  64931. }
  64932. if (typeof segment.end !== "undefined") {
  64933. return {
  64934. result: segment.end - segment.duration,
  64935. precise: true
  64936. };
  64937. }
  64938. }
  64939. while (i2--) {
  64940. segment = playlist.segments[i2];
  64941. if (typeof segment.end !== "undefined") {
  64942. return {
  64943. result: result + segment.end,
  64944. precise: true
  64945. };
  64946. }
  64947. result += segmentDurationWithParts$1(playlist, segment);
  64948. if (typeof segment.start !== "undefined") {
  64949. return {
  64950. result: result + segment.start,
  64951. precise: true
  64952. };
  64953. }
  64954. }
  64955. return {
  64956. result,
  64957. precise: false
  64958. };
  64959. };
  64960. const forwardDuration$1 = function(playlist, endSequence) {
  64961. let result = 0;
  64962. let segment;
  64963. let i2 = endSequence - playlist.mediaSequence;
  64964. for (; i2 < playlist.segments.length; i2++) {
  64965. segment = playlist.segments[i2];
  64966. if (typeof segment.start !== "undefined") {
  64967. return {
  64968. result: segment.start - result,
  64969. precise: true
  64970. };
  64971. }
  64972. result += segmentDurationWithParts$1(playlist, segment);
  64973. if (typeof segment.end !== "undefined") {
  64974. return {
  64975. result: segment.end - result,
  64976. precise: true
  64977. };
  64978. }
  64979. }
  64980. return {
  64981. result: -1,
  64982. precise: false
  64983. };
  64984. };
  64985. const intervalDuration$1 = function(playlist, endSequence, expired) {
  64986. if (typeof endSequence === "undefined") {
  64987. endSequence = playlist.mediaSequence + playlist.segments.length;
  64988. }
  64989. if (endSequence < playlist.mediaSequence) {
  64990. return 0;
  64991. }
  64992. const backward = backwardDuration$1(playlist, endSequence);
  64993. if (backward.precise) {
  64994. return backward.result;
  64995. }
  64996. const forward = forwardDuration$1(playlist, endSequence);
  64997. if (forward.precise) {
  64998. return forward.result;
  64999. }
  65000. return backward.result + expired;
  65001. };
  65002. const duration$1 = function(playlist, endSequence, expired) {
  65003. if (!playlist) {
  65004. return 0;
  65005. }
  65006. if (typeof expired !== "number") {
  65007. expired = 0;
  65008. }
  65009. if (typeof endSequence === "undefined") {
  65010. if (playlist.totalDuration) {
  65011. return playlist.totalDuration;
  65012. }
  65013. if (!playlist.endList) {
  65014. return window_1.Infinity;
  65015. }
  65016. }
  65017. return intervalDuration$1(playlist, endSequence, expired);
  65018. };
  65019. const sumDurations$1 = function({
  65020. defaultDuration,
  65021. durationList,
  65022. startIndex,
  65023. endIndex
  65024. }) {
  65025. let durations = 0;
  65026. if (startIndex > endIndex) {
  65027. [startIndex, endIndex] = [endIndex, startIndex];
  65028. }
  65029. if (startIndex < 0) {
  65030. for (let i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  65031. durations += defaultDuration;
  65032. }
  65033. startIndex = 0;
  65034. }
  65035. for (let i2 = startIndex; i2 < endIndex; i2++) {
  65036. durations += durationList[i2].duration;
  65037. }
  65038. return durations;
  65039. };
  65040. const playlistEnd$1 = function(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  65041. if (!playlist || !playlist.segments) {
  65042. return null;
  65043. }
  65044. if (playlist.endList) {
  65045. return duration$1(playlist);
  65046. }
  65047. if (expired === null) {
  65048. return null;
  65049. }
  65050. expired = expired || 0;
  65051. let lastSegmentEndTime = intervalDuration$1(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  65052. if (useSafeLiveEnd) {
  65053. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay$1(null, playlist);
  65054. lastSegmentEndTime -= liveEdgePadding;
  65055. }
  65056. return Math.max(0, lastSegmentEndTime);
  65057. };
  65058. const seekable$1 = function(playlist, expired, liveEdgePadding) {
  65059. const useSafeLiveEnd = true;
  65060. const seekableStart = expired || 0;
  65061. const seekableEnd = playlistEnd$1(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  65062. if (seekableEnd === null) {
  65063. return createTimeRanges$2();
  65064. }
  65065. return createTimeRanges$2(seekableStart, seekableEnd);
  65066. };
  65067. const getMediaInfoForTime$1 = function({
  65068. playlist,
  65069. currentTime,
  65070. startingSegmentIndex,
  65071. startingPartIndex,
  65072. startTime,
  65073. exactManifestTimings
  65074. }) {
  65075. let time = currentTime - startTime;
  65076. const partsAndSegments = getPartsAndSegments$1(playlist);
  65077. let startIndex = 0;
  65078. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  65079. const partAndSegment = partsAndSegments[i2];
  65080. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  65081. continue;
  65082. }
  65083. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  65084. continue;
  65085. }
  65086. startIndex = i2;
  65087. break;
  65088. }
  65089. if (time < 0) {
  65090. if (startIndex > 0) {
  65091. for (let i2 = startIndex - 1; i2 >= 0; i2--) {
  65092. const partAndSegment = partsAndSegments[i2];
  65093. time += partAndSegment.duration;
  65094. if (exactManifestTimings) {
  65095. if (time < 0) {
  65096. continue;
  65097. }
  65098. } else if (time + TIME_FUDGE_FACTOR$1 <= 0) {
  65099. continue;
  65100. }
  65101. return {
  65102. partIndex: partAndSegment.partIndex,
  65103. segmentIndex: partAndSegment.segmentIndex,
  65104. startTime: startTime - sumDurations$1({
  65105. defaultDuration: playlist.targetDuration,
  65106. durationList: partsAndSegments,
  65107. startIndex,
  65108. endIndex: i2
  65109. })
  65110. };
  65111. }
  65112. }
  65113. return {
  65114. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65115. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65116. startTime: currentTime
  65117. };
  65118. }
  65119. if (startIndex < 0) {
  65120. for (let i2 = startIndex; i2 < 0; i2++) {
  65121. time -= playlist.targetDuration;
  65122. if (time < 0) {
  65123. return {
  65124. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65125. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65126. startTime: currentTime
  65127. };
  65128. }
  65129. }
  65130. startIndex = 0;
  65131. }
  65132. for (let i2 = startIndex; i2 < partsAndSegments.length; i2++) {
  65133. const partAndSegment = partsAndSegments[i2];
  65134. time -= partAndSegment.duration;
  65135. if (exactManifestTimings) {
  65136. if (time > 0) {
  65137. continue;
  65138. }
  65139. } else if (time - TIME_FUDGE_FACTOR$1 >= 0) {
  65140. continue;
  65141. }
  65142. return {
  65143. partIndex: partAndSegment.partIndex,
  65144. segmentIndex: partAndSegment.segmentIndex,
  65145. startTime: startTime + sumDurations$1({
  65146. defaultDuration: playlist.targetDuration,
  65147. durationList: partsAndSegments,
  65148. startIndex,
  65149. endIndex: i2
  65150. })
  65151. };
  65152. }
  65153. return {
  65154. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  65155. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  65156. startTime: currentTime
  65157. };
  65158. };
  65159. const isExcluded = function(playlist) {
  65160. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  65161. };
  65162. const isIncompatible$1 = function(playlist) {
  65163. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  65164. };
  65165. const isEnabled$1 = function(playlist) {
  65166. const excluded = isExcluded(playlist);
  65167. return !playlist.disabled && !excluded;
  65168. };
  65169. const isDisabled$1 = function(playlist) {
  65170. return playlist.disabled;
  65171. };
  65172. const isAes$1 = function(media) {
  65173. for (let i2 = 0; i2 < media.segments.length; i2++) {
  65174. if (media.segments[i2].key) {
  65175. return true;
  65176. }
  65177. }
  65178. return false;
  65179. };
  65180. const hasAttribute$1 = function(attr, playlist) {
  65181. return playlist.attributes && playlist.attributes[attr];
  65182. };
  65183. const estimateSegmentRequestTime$1 = function(segmentDuration, bandwidth2, playlist, bytesReceived = 0) {
  65184. if (!hasAttribute$1("BANDWIDTH", playlist)) {
  65185. return NaN;
  65186. }
  65187. const size = segmentDuration * playlist.attributes.BANDWIDTH;
  65188. return (size - bytesReceived * 8) / bandwidth2;
  65189. };
  65190. const isLowestEnabledRendition$1 = (main, media) => {
  65191. if (main.playlists.length === 1) {
  65192. return true;
  65193. }
  65194. const currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  65195. return main.playlists.filter((playlist) => {
  65196. if (!isEnabled$1(playlist)) {
  65197. return false;
  65198. }
  65199. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  65200. }).length === 0;
  65201. };
  65202. const playlistMatch$1 = (a, b) => {
  65203. if (!a && !b || !a && b || a && !b) {
  65204. return false;
  65205. }
  65206. if (a === b) {
  65207. return true;
  65208. }
  65209. if (a.id && b.id && a.id === b.id) {
  65210. return true;
  65211. }
  65212. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  65213. return true;
  65214. }
  65215. if (a.uri && b.uri && a.uri === b.uri) {
  65216. return true;
  65217. }
  65218. return false;
  65219. };
  65220. const someAudioVariant$1 = function(main, callback2) {
  65221. const AUDIO5 = main && main.mediaGroups && main.mediaGroups.AUDIO || {};
  65222. let found = false;
  65223. for (const groupName in AUDIO5) {
  65224. for (const label2 in AUDIO5[groupName]) {
  65225. found = callback2(AUDIO5[groupName][label2]);
  65226. if (found) {
  65227. break;
  65228. }
  65229. }
  65230. if (found) {
  65231. break;
  65232. }
  65233. }
  65234. return !!found;
  65235. };
  65236. const isAudioOnly$1 = (main) => {
  65237. if (!main || !main.playlists || !main.playlists.length) {
  65238. const found = someAudioVariant$1(main, (variant) => variant.playlists && variant.playlists.length || variant.uri);
  65239. return found;
  65240. }
  65241. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65242. const playlist = main.playlists[i2];
  65243. const CODECS = playlist.attributes && playlist.attributes.CODECS;
  65244. if (CODECS && CODECS.split(",").every((c) => isAudioCodec$1(c))) {
  65245. continue;
  65246. }
  65247. const found = someAudioVariant$1(main, (variant) => playlistMatch$1(playlist, variant));
  65248. if (found) {
  65249. continue;
  65250. }
  65251. return false;
  65252. }
  65253. return true;
  65254. };
  65255. var Playlist$1 = {
  65256. liveEdgeDelay: liveEdgeDelay$1,
  65257. duration: duration$1,
  65258. seekable: seekable$1,
  65259. getMediaInfoForTime: getMediaInfoForTime$1,
  65260. isEnabled: isEnabled$1,
  65261. isDisabled: isDisabled$1,
  65262. isExcluded,
  65263. isIncompatible: isIncompatible$1,
  65264. playlistEnd: playlistEnd$1,
  65265. isAes: isAes$1,
  65266. hasAttribute: hasAttribute$1,
  65267. estimateSegmentRequestTime: estimateSegmentRequestTime$1,
  65268. isLowestEnabledRendition: isLowestEnabledRendition$1,
  65269. isAudioOnly: isAudioOnly$1,
  65270. playlistMatch: playlistMatch$1,
  65271. segmentDurationWithParts: segmentDurationWithParts$1
  65272. };
  65273. const {
  65274. log: log$2
  65275. } = videojs$2;
  65276. const createPlaylistID$1 = (index2, uri) => {
  65277. return `${index2}-${uri}`;
  65278. };
  65279. const groupID$1 = (type2, group, label2) => {
  65280. return `placeholder-uri-${type2}-${group}-${label2}`;
  65281. };
  65282. const parseManifest$1 = ({
  65283. onwarn,
  65284. oninfo,
  65285. manifestString,
  65286. customTagParsers = [],
  65287. customTagMappers = [],
  65288. llhls
  65289. }) => {
  65290. const parser2 = new Parser$1();
  65291. if (onwarn) {
  65292. parser2.on("warn", onwarn);
  65293. }
  65294. if (oninfo) {
  65295. parser2.on("info", oninfo);
  65296. }
  65297. customTagParsers.forEach((customParser) => parser2.addParser(customParser));
  65298. customTagMappers.forEach((mapper) => parser2.addTagMapper(mapper));
  65299. parser2.push(manifestString);
  65300. parser2.end();
  65301. const manifest = parser2.manifest;
  65302. if (!llhls) {
  65303. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  65304. if (manifest.hasOwnProperty(k)) {
  65305. delete manifest[k];
  65306. }
  65307. });
  65308. if (manifest.segments) {
  65309. manifest.segments.forEach(function(segment) {
  65310. ["parts", "preloadHints"].forEach(function(k) {
  65311. if (segment.hasOwnProperty(k)) {
  65312. delete segment[k];
  65313. }
  65314. });
  65315. });
  65316. }
  65317. }
  65318. if (!manifest.targetDuration) {
  65319. let targetDuration = 10;
  65320. if (manifest.segments && manifest.segments.length) {
  65321. targetDuration = manifest.segments.reduce((acc, s) => Math.max(acc, s.duration), 0);
  65322. }
  65323. if (onwarn) {
  65324. onwarn(`manifest has no targetDuration defaulting to ${targetDuration}`);
  65325. }
  65326. manifest.targetDuration = targetDuration;
  65327. }
  65328. const parts = getLastParts$1(manifest);
  65329. if (parts.length && !manifest.partTargetDuration) {
  65330. const partTargetDuration = parts.reduce((acc, p) => Math.max(acc, p.duration), 0);
  65331. if (onwarn) {
  65332. onwarn(`manifest has no partTargetDuration defaulting to ${partTargetDuration}`);
  65333. 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.");
  65334. }
  65335. manifest.partTargetDuration = partTargetDuration;
  65336. }
  65337. return manifest;
  65338. };
  65339. const forEachMediaGroup$2 = (main, callback2) => {
  65340. if (!main.mediaGroups) {
  65341. return;
  65342. }
  65343. ["AUDIO", "SUBTITLES"].forEach((mediaType) => {
  65344. if (!main.mediaGroups[mediaType]) {
  65345. return;
  65346. }
  65347. for (const groupKey in main.mediaGroups[mediaType]) {
  65348. for (const labelKey in main.mediaGroups[mediaType][groupKey]) {
  65349. const mediaProperties = main.mediaGroups[mediaType][groupKey][labelKey];
  65350. callback2(mediaProperties, mediaType, groupKey, labelKey);
  65351. }
  65352. }
  65353. });
  65354. };
  65355. const setupMediaPlaylist$1 = ({
  65356. playlist,
  65357. uri,
  65358. id
  65359. }) => {
  65360. playlist.id = id;
  65361. playlist.playlistErrors_ = 0;
  65362. if (uri) {
  65363. playlist.uri = uri;
  65364. }
  65365. playlist.attributes = playlist.attributes || {};
  65366. };
  65367. const setupMediaPlaylists$1 = (main) => {
  65368. let i2 = main.playlists.length;
  65369. while (i2--) {
  65370. const playlist = main.playlists[i2];
  65371. setupMediaPlaylist$1({
  65372. playlist,
  65373. id: createPlaylistID$1(i2, playlist.uri)
  65374. });
  65375. playlist.resolvedUri = resolveUrl$2(main.uri, playlist.uri);
  65376. main.playlists[playlist.id] = playlist;
  65377. main.playlists[playlist.uri] = playlist;
  65378. if (!playlist.attributes.BANDWIDTH) {
  65379. log$2.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  65380. }
  65381. }
  65382. };
  65383. const resolveMediaGroupUris$1 = (main) => {
  65384. forEachMediaGroup$2(main, (properties) => {
  65385. if (properties.uri) {
  65386. properties.resolvedUri = resolveUrl$2(main.uri, properties.uri);
  65387. }
  65388. });
  65389. };
  65390. const mainForMedia = (media, uri) => {
  65391. const id = createPlaylistID$1(0, uri);
  65392. const main = {
  65393. mediaGroups: {
  65394. "AUDIO": {},
  65395. "VIDEO": {},
  65396. "CLOSED-CAPTIONS": {},
  65397. "SUBTITLES": {}
  65398. },
  65399. uri: window_1.location.href,
  65400. resolvedUri: window_1.location.href,
  65401. playlists: [{
  65402. uri,
  65403. id,
  65404. resolvedUri: uri,
  65405. attributes: {}
  65406. }]
  65407. };
  65408. main.playlists[id] = main.playlists[0];
  65409. main.playlists[uri] = main.playlists[0];
  65410. return main;
  65411. };
  65412. const addPropertiesToMain = (main, uri, createGroupID = groupID$1) => {
  65413. main.uri = uri;
  65414. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65415. if (!main.playlists[i2].uri) {
  65416. const phonyUri = `placeholder-uri-${i2}`;
  65417. main.playlists[i2].uri = phonyUri;
  65418. }
  65419. }
  65420. const audioOnlyMain = isAudioOnly$1(main);
  65421. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65422. if (!properties.playlists || !properties.playlists.length) {
  65423. if (audioOnlyMain && mediaType === "AUDIO" && !properties.uri) {
  65424. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65425. const p = main.playlists[i2];
  65426. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  65427. return;
  65428. }
  65429. }
  65430. }
  65431. properties.playlists = [_extends$2({}, properties)];
  65432. }
  65433. properties.playlists.forEach(function(p, i2) {
  65434. const groupId = createGroupID(mediaType, groupKey, labelKey, p);
  65435. const id = createPlaylistID$1(i2, groupId);
  65436. if (p.uri) {
  65437. p.resolvedUri = p.resolvedUri || resolveUrl$2(main.uri, p.uri);
  65438. } else {
  65439. p.uri = i2 === 0 ? groupId : id;
  65440. p.resolvedUri = p.uri;
  65441. }
  65442. p.id = p.id || id;
  65443. p.attributes = p.attributes || {};
  65444. main.playlists[p.id] = p;
  65445. main.playlists[p.uri] = p;
  65446. });
  65447. });
  65448. setupMediaPlaylists$1(main);
  65449. resolveMediaGroupUris$1(main);
  65450. };
  65451. const {
  65452. EventTarget: EventTarget$1$1
  65453. } = videojs$2;
  65454. const addLLHLSQueryDirectives$1 = (uri, media) => {
  65455. if (media.endList || !media.serverControl) {
  65456. return uri;
  65457. }
  65458. const parameters = {};
  65459. if (media.serverControl.canBlockReload) {
  65460. const {
  65461. preloadSegment
  65462. } = media;
  65463. let nextMSN = media.mediaSequence + media.segments.length;
  65464. if (preloadSegment) {
  65465. const parts = preloadSegment.parts || [];
  65466. const nextPart = getKnownPartCount$1(media) - 1;
  65467. if (nextPart > -1 && nextPart !== parts.length - 1) {
  65468. parameters._HLS_part = nextPart;
  65469. }
  65470. if (nextPart > -1 || parts.length) {
  65471. nextMSN--;
  65472. }
  65473. }
  65474. parameters._HLS_msn = nextMSN;
  65475. }
  65476. if (media.serverControl && media.serverControl.canSkipUntil) {
  65477. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  65478. }
  65479. if (Object.keys(parameters).length) {
  65480. const parsedUri = new window_1.URL(uri);
  65481. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  65482. if (!parameters.hasOwnProperty(name)) {
  65483. return;
  65484. }
  65485. parsedUri.searchParams.set(name, parameters[name]);
  65486. });
  65487. uri = parsedUri.toString();
  65488. }
  65489. return uri;
  65490. };
  65491. const updateSegment$1 = (a, b) => {
  65492. if (!a) {
  65493. return b;
  65494. }
  65495. const result = merge$2(a, b);
  65496. if (a.preloadHints && !b.preloadHints) {
  65497. delete result.preloadHints;
  65498. }
  65499. if (a.parts && !b.parts) {
  65500. delete result.parts;
  65501. } else if (a.parts && b.parts) {
  65502. for (let i2 = 0; i2 < b.parts.length; i2++) {
  65503. if (a.parts && a.parts[i2]) {
  65504. result.parts[i2] = merge$2(a.parts[i2], b.parts[i2]);
  65505. }
  65506. }
  65507. }
  65508. if (!a.skipped && b.skipped) {
  65509. result.skipped = false;
  65510. }
  65511. if (a.preload && !b.preload) {
  65512. result.preload = false;
  65513. }
  65514. return result;
  65515. };
  65516. const updateSegments$1 = (original, update, offset) => {
  65517. const oldSegments = original.slice();
  65518. const newSegments = update.slice();
  65519. offset = offset || 0;
  65520. const result = [];
  65521. let currentMap;
  65522. for (let newIndex = 0; newIndex < newSegments.length; newIndex++) {
  65523. const oldSegment = oldSegments[newIndex + offset];
  65524. const newSegment = newSegments[newIndex];
  65525. if (oldSegment) {
  65526. currentMap = oldSegment.map || currentMap;
  65527. result.push(updateSegment$1(oldSegment, newSegment));
  65528. } else {
  65529. if (currentMap && !newSegment.map) {
  65530. newSegment.map = currentMap;
  65531. }
  65532. result.push(newSegment);
  65533. }
  65534. }
  65535. return result;
  65536. };
  65537. const resolveSegmentUris$1 = (segment, baseUri) => {
  65538. if (!segment.resolvedUri && segment.uri) {
  65539. segment.resolvedUri = resolveUrl$2(baseUri, segment.uri);
  65540. }
  65541. if (segment.key && !segment.key.resolvedUri) {
  65542. segment.key.resolvedUri = resolveUrl$2(baseUri, segment.key.uri);
  65543. }
  65544. if (segment.map && !segment.map.resolvedUri) {
  65545. segment.map.resolvedUri = resolveUrl$2(baseUri, segment.map.uri);
  65546. }
  65547. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  65548. segment.map.key.resolvedUri = resolveUrl$2(baseUri, segment.map.key.uri);
  65549. }
  65550. if (segment.parts && segment.parts.length) {
  65551. segment.parts.forEach((p) => {
  65552. if (p.resolvedUri) {
  65553. return;
  65554. }
  65555. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65556. });
  65557. }
  65558. if (segment.preloadHints && segment.preloadHints.length) {
  65559. segment.preloadHints.forEach((p) => {
  65560. if (p.resolvedUri) {
  65561. return;
  65562. }
  65563. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65564. });
  65565. }
  65566. };
  65567. const getAllSegments$1 = function(media) {
  65568. const segments = media.segments || [];
  65569. const preloadSegment = media.preloadSegment;
  65570. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  65571. if (preloadSegment.preloadHints) {
  65572. for (let i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  65573. if (preloadSegment.preloadHints[i2].type === "MAP") {
  65574. return segments;
  65575. }
  65576. }
  65577. }
  65578. preloadSegment.duration = media.targetDuration;
  65579. preloadSegment.preload = true;
  65580. segments.push(preloadSegment);
  65581. }
  65582. return segments;
  65583. };
  65584. 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;
  65585. const updateMain$1 = (main, newMedia, unchangedCheck = isPlaylistUnchanged$1) => {
  65586. const result = merge$2(main, {});
  65587. const oldMedia = result.playlists[newMedia.id];
  65588. if (!oldMedia) {
  65589. return null;
  65590. }
  65591. if (unchangedCheck(oldMedia, newMedia)) {
  65592. return null;
  65593. }
  65594. newMedia.segments = getAllSegments$1(newMedia);
  65595. const mergedPlaylist = merge$2(oldMedia, newMedia);
  65596. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  65597. delete mergedPlaylist.preloadSegment;
  65598. }
  65599. if (oldMedia.segments) {
  65600. if (newMedia.skip) {
  65601. newMedia.segments = newMedia.segments || [];
  65602. for (let i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  65603. newMedia.segments.unshift({
  65604. skipped: true
  65605. });
  65606. }
  65607. }
  65608. mergedPlaylist.segments = updateSegments$1(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  65609. }
  65610. mergedPlaylist.segments.forEach((segment) => {
  65611. resolveSegmentUris$1(segment, mergedPlaylist.resolvedUri);
  65612. });
  65613. for (let i2 = 0; i2 < result.playlists.length; i2++) {
  65614. if (result.playlists[i2].id === newMedia.id) {
  65615. result.playlists[i2] = mergedPlaylist;
  65616. }
  65617. }
  65618. result.playlists[newMedia.id] = mergedPlaylist;
  65619. result.playlists[newMedia.uri] = mergedPlaylist;
  65620. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65621. if (!properties.playlists) {
  65622. return;
  65623. }
  65624. for (let i2 = 0; i2 < properties.playlists.length; i2++) {
  65625. if (newMedia.id === properties.playlists[i2].id) {
  65626. properties.playlists[i2] = mergedPlaylist;
  65627. }
  65628. }
  65629. });
  65630. return result;
  65631. };
  65632. const refreshDelay$1 = (media, update) => {
  65633. const segments = media.segments || [];
  65634. const lastSegment = segments[segments.length - 1];
  65635. const lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  65636. const lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  65637. if (update && lastDuration) {
  65638. return lastDuration * 1e3;
  65639. }
  65640. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  65641. };
  65642. class PlaylistLoader$1 extends EventTarget$1$1 {
  65643. constructor(src, vhs, options2 = {}) {
  65644. super();
  65645. if (!src) {
  65646. throw new Error("A non-empty playlist URL or object is required");
  65647. }
  65648. this.logger_ = logger$1("PlaylistLoader");
  65649. const {
  65650. withCredentials = false
  65651. } = options2;
  65652. this.src = src;
  65653. this.vhs_ = vhs;
  65654. this.withCredentials = withCredentials;
  65655. const vhsOptions = vhs.options_;
  65656. this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  65657. this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  65658. this.llhls = vhsOptions && vhsOptions.llhls;
  65659. this.state = "HAVE_NOTHING";
  65660. this.handleMediaupdatetimeout_ = this.handleMediaupdatetimeout_.bind(this);
  65661. this.on("mediaupdatetimeout", this.handleMediaupdatetimeout_);
  65662. }
  65663. handleMediaupdatetimeout_() {
  65664. if (this.state !== "HAVE_METADATA") {
  65665. return;
  65666. }
  65667. const media = this.media();
  65668. let uri = resolveUrl$2(this.main.uri, media.uri);
  65669. if (this.llhls) {
  65670. uri = addLLHLSQueryDirectives$1(uri, media);
  65671. }
  65672. this.state = "HAVE_CURRENT_METADATA";
  65673. this.request = this.vhs_.xhr({
  65674. uri,
  65675. withCredentials: this.withCredentials
  65676. }, (error, req) => {
  65677. if (!this.request) {
  65678. return;
  65679. }
  65680. if (error) {
  65681. return this.playlistRequestError(this.request, this.media(), "HAVE_METADATA");
  65682. }
  65683. this.haveMetadata({
  65684. playlistString: this.request.responseText,
  65685. url: this.media().uri,
  65686. id: this.media().id
  65687. });
  65688. });
  65689. }
  65690. playlistRequestError(xhr, playlist, startingState) {
  65691. const {
  65692. uri,
  65693. id
  65694. } = playlist;
  65695. this.request = null;
  65696. if (startingState) {
  65697. this.state = startingState;
  65698. }
  65699. this.error = {
  65700. playlist: this.main.playlists[id],
  65701. status: xhr.status,
  65702. message: `HLS playlist request error at URL: ${uri}.`,
  65703. responseText: xhr.responseText,
  65704. code: xhr.status >= 500 ? 4 : 2
  65705. };
  65706. this.trigger("error");
  65707. }
  65708. parseManifest_({
  65709. url,
  65710. manifestString
  65711. }) {
  65712. return parseManifest$1({
  65713. onwarn: ({
  65714. message
  65715. }) => this.logger_(`m3u8-parser warn for ${url}: ${message}`),
  65716. oninfo: ({
  65717. message
  65718. }) => this.logger_(`m3u8-parser info for ${url}: ${message}`),
  65719. manifestString,
  65720. customTagParsers: this.customTagParsers,
  65721. customTagMappers: this.customTagMappers,
  65722. llhls: this.llhls
  65723. });
  65724. }
  65725. haveMetadata({
  65726. playlistString,
  65727. playlistObject,
  65728. url,
  65729. id
  65730. }) {
  65731. this.request = null;
  65732. this.state = "HAVE_METADATA";
  65733. const playlist = playlistObject || this.parseManifest_({
  65734. url,
  65735. manifestString: playlistString
  65736. });
  65737. playlist.lastRequest = Date.now();
  65738. setupMediaPlaylist$1({
  65739. playlist,
  65740. uri: url,
  65741. id
  65742. });
  65743. const update = updateMain$1(this.main, playlist);
  65744. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  65745. this.pendingMedia_ = null;
  65746. if (update) {
  65747. this.main = update;
  65748. this.media_ = this.main.playlists[id];
  65749. } else {
  65750. this.trigger("playlistunchanged");
  65751. }
  65752. this.updateMediaUpdateTimeout_(refreshDelay$1(this.media(), !!update));
  65753. this.trigger("loadedplaylist");
  65754. }
  65755. dispose() {
  65756. this.trigger("dispose");
  65757. this.stopRequest();
  65758. window_1.clearTimeout(this.mediaUpdateTimeout);
  65759. window_1.clearTimeout(this.finalRenditionTimeout);
  65760. this.off();
  65761. }
  65762. stopRequest() {
  65763. if (this.request) {
  65764. const oldRequest = this.request;
  65765. this.request = null;
  65766. oldRequest.onreadystatechange = null;
  65767. oldRequest.abort();
  65768. }
  65769. }
  65770. media(playlist, shouldDelay) {
  65771. if (!playlist) {
  65772. return this.media_;
  65773. }
  65774. if (this.state === "HAVE_NOTHING") {
  65775. throw new Error("Cannot switch media playlist from " + this.state);
  65776. }
  65777. if (typeof playlist === "string") {
  65778. if (!this.main.playlists[playlist]) {
  65779. throw new Error("Unknown playlist URI: " + playlist);
  65780. }
  65781. playlist = this.main.playlists[playlist];
  65782. }
  65783. window_1.clearTimeout(this.finalRenditionTimeout);
  65784. if (shouldDelay) {
  65785. const delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  65786. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  65787. return;
  65788. }
  65789. const startingState = this.state;
  65790. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  65791. const mainPlaylistRef = this.main.playlists[playlist.id];
  65792. if (mainPlaylistRef && mainPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  65793. if (this.request) {
  65794. this.request.onreadystatechange = null;
  65795. this.request.abort();
  65796. this.request = null;
  65797. }
  65798. this.state = "HAVE_METADATA";
  65799. this.media_ = playlist;
  65800. if (mediaChange) {
  65801. this.trigger("mediachanging");
  65802. if (startingState === "HAVE_MAIN_MANIFEST") {
  65803. this.trigger("loadedmetadata");
  65804. } else {
  65805. this.trigger("mediachange");
  65806. }
  65807. }
  65808. return;
  65809. }
  65810. this.updateMediaUpdateTimeout_(refreshDelay$1(playlist, true));
  65811. if (!mediaChange) {
  65812. return;
  65813. }
  65814. this.state = "SWITCHING_MEDIA";
  65815. if (this.request) {
  65816. if (playlist.resolvedUri === this.request.url) {
  65817. return;
  65818. }
  65819. this.request.onreadystatechange = null;
  65820. this.request.abort();
  65821. this.request = null;
  65822. }
  65823. if (this.media_) {
  65824. this.trigger("mediachanging");
  65825. }
  65826. this.pendingMedia_ = playlist;
  65827. this.request = this.vhs_.xhr({
  65828. uri: playlist.resolvedUri,
  65829. withCredentials: this.withCredentials
  65830. }, (error, req) => {
  65831. if (!this.request) {
  65832. return;
  65833. }
  65834. playlist.lastRequest = Date.now();
  65835. playlist.resolvedUri = resolveManifestRedirect$1(playlist.resolvedUri, req);
  65836. if (error) {
  65837. return this.playlistRequestError(this.request, playlist, startingState);
  65838. }
  65839. this.haveMetadata({
  65840. playlistString: req.responseText,
  65841. url: playlist.uri,
  65842. id: playlist.id
  65843. });
  65844. if (startingState === "HAVE_MAIN_MANIFEST") {
  65845. this.trigger("loadedmetadata");
  65846. } else {
  65847. this.trigger("mediachange");
  65848. }
  65849. });
  65850. }
  65851. pause() {
  65852. if (this.mediaUpdateTimeout) {
  65853. window_1.clearTimeout(this.mediaUpdateTimeout);
  65854. this.mediaUpdateTimeout = null;
  65855. }
  65856. this.stopRequest();
  65857. if (this.state === "HAVE_NOTHING") {
  65858. this.started = false;
  65859. }
  65860. if (this.state === "SWITCHING_MEDIA") {
  65861. if (this.media_) {
  65862. this.state = "HAVE_METADATA";
  65863. } else {
  65864. this.state = "HAVE_MAIN_MANIFEST";
  65865. }
  65866. } else if (this.state === "HAVE_CURRENT_METADATA") {
  65867. this.state = "HAVE_METADATA";
  65868. }
  65869. }
  65870. load(shouldDelay) {
  65871. if (this.mediaUpdateTimeout) {
  65872. window_1.clearTimeout(this.mediaUpdateTimeout);
  65873. this.mediaUpdateTimeout = null;
  65874. }
  65875. const media = this.media();
  65876. if (shouldDelay) {
  65877. const delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  65878. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65879. this.mediaUpdateTimeout = null;
  65880. this.load();
  65881. }, delay);
  65882. return;
  65883. }
  65884. if (!this.started) {
  65885. this.start();
  65886. return;
  65887. }
  65888. if (media && !media.endList) {
  65889. this.trigger("mediaupdatetimeout");
  65890. } else {
  65891. this.trigger("loadedplaylist");
  65892. }
  65893. }
  65894. updateMediaUpdateTimeout_(delay) {
  65895. if (this.mediaUpdateTimeout) {
  65896. window_1.clearTimeout(this.mediaUpdateTimeout);
  65897. this.mediaUpdateTimeout = null;
  65898. }
  65899. if (!this.media() || this.media().endList) {
  65900. return;
  65901. }
  65902. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65903. this.mediaUpdateTimeout = null;
  65904. this.trigger("mediaupdatetimeout");
  65905. this.updateMediaUpdateTimeout_(delay);
  65906. }, delay);
  65907. }
  65908. start() {
  65909. this.started = true;
  65910. if (typeof this.src === "object") {
  65911. if (!this.src.uri) {
  65912. this.src.uri = window_1.location.href;
  65913. }
  65914. this.src.resolvedUri = this.src.uri;
  65915. setTimeout(() => {
  65916. this.setupInitialPlaylist(this.src);
  65917. }, 0);
  65918. return;
  65919. }
  65920. this.request = this.vhs_.xhr({
  65921. uri: this.src,
  65922. withCredentials: this.withCredentials
  65923. }, (error, req) => {
  65924. if (!this.request) {
  65925. return;
  65926. }
  65927. this.request = null;
  65928. if (error) {
  65929. this.error = {
  65930. status: req.status,
  65931. message: `HLS playlist request error at URL: ${this.src}.`,
  65932. responseText: req.responseText,
  65933. code: 2
  65934. };
  65935. if (this.state === "HAVE_NOTHING") {
  65936. this.started = false;
  65937. }
  65938. return this.trigger("error");
  65939. }
  65940. this.src = resolveManifestRedirect$1(this.src, req);
  65941. const manifest = this.parseManifest_({
  65942. manifestString: req.responseText,
  65943. url: this.src
  65944. });
  65945. this.setupInitialPlaylist(manifest);
  65946. });
  65947. }
  65948. srcUri() {
  65949. return typeof this.src === "string" ? this.src : this.src.uri;
  65950. }
  65951. setupInitialPlaylist(manifest) {
  65952. this.state = "HAVE_MAIN_MANIFEST";
  65953. if (manifest.playlists) {
  65954. this.main = manifest;
  65955. addPropertiesToMain(this.main, this.srcUri());
  65956. manifest.playlists.forEach((playlist) => {
  65957. playlist.segments = getAllSegments$1(playlist);
  65958. playlist.segments.forEach((segment) => {
  65959. resolveSegmentUris$1(segment, playlist.resolvedUri);
  65960. });
  65961. });
  65962. this.trigger("loadedplaylist");
  65963. if (!this.request) {
  65964. this.media(this.main.playlists[0]);
  65965. }
  65966. return;
  65967. }
  65968. const uri = this.srcUri() || window_1.location.href;
  65969. this.main = mainForMedia(manifest, uri);
  65970. this.haveMetadata({
  65971. playlistObject: manifest,
  65972. url: uri,
  65973. id: this.main.playlists[0].id
  65974. });
  65975. this.trigger("loadedmetadata");
  65976. }
  65977. }
  65978. const {
  65979. xhr: videojsXHR$1
  65980. } = videojs$2;
  65981. const callbackWrapper$1 = function(request, error, response, callback2) {
  65982. const reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  65983. if (!error && reqResponse) {
  65984. request.responseTime = Date.now();
  65985. request.roundTripTime = request.responseTime - request.requestTime;
  65986. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  65987. if (!request.bandwidth) {
  65988. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  65989. }
  65990. }
  65991. if (response.headers) {
  65992. request.responseHeaders = response.headers;
  65993. }
  65994. if (error && error.code === "ETIMEDOUT") {
  65995. request.timedout = true;
  65996. }
  65997. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  65998. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  65999. }
  66000. callback2(error, request);
  66001. };
  66002. const xhrFactory$1 = function() {
  66003. const xhr = function XhrFunction(options2, callback2) {
  66004. options2 = merge$2({
  66005. timeout: 45e3
  66006. }, options2);
  66007. const beforeRequest = XhrFunction.beforeRequest || videojs$2.Vhs.xhr.beforeRequest;
  66008. if (beforeRequest && typeof beforeRequest === "function") {
  66009. const newOptions = beforeRequest(options2);
  66010. if (newOptions) {
  66011. options2 = newOptions;
  66012. }
  66013. }
  66014. const xhrMethod = videojs$2.Vhs.xhr.original === true ? videojsXHR$1 : videojs$2.Vhs.xhr;
  66015. const request = xhrMethod(options2, function(error, response) {
  66016. return callbackWrapper$1(request, error, response, callback2);
  66017. });
  66018. const originalAbort = request.abort;
  66019. request.abort = function() {
  66020. request.aborted = true;
  66021. return originalAbort.apply(request, arguments);
  66022. };
  66023. request.uri = options2.uri;
  66024. request.requestTime = Date.now();
  66025. return request;
  66026. };
  66027. xhr.original = true;
  66028. return xhr;
  66029. };
  66030. const byterangeStr$1 = function(byterange) {
  66031. let byterangeEnd;
  66032. const byterangeStart = byterange.offset;
  66033. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  66034. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  66035. } else {
  66036. byterangeEnd = byterange.offset + byterange.length - 1;
  66037. }
  66038. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  66039. };
  66040. const segmentXhrHeaders$1 = function(segment) {
  66041. const headers = {};
  66042. if (segment.byterange) {
  66043. headers.Range = byterangeStr$1(segment.byterange);
  66044. }
  66045. return headers;
  66046. };
  66047. const textRange$1 = function(range3, i2) {
  66048. return range3.start(i2) + "-" + range3.end(i2);
  66049. };
  66050. const formatHexString$1 = function(e, i2) {
  66051. const value = e.toString(16);
  66052. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  66053. };
  66054. const formatAsciiString$1 = function(e) {
  66055. if (e >= 32 && e < 126) {
  66056. return String.fromCharCode(e);
  66057. }
  66058. return ".";
  66059. };
  66060. const createTransferableMessage$1 = function(message) {
  66061. const transferable = {};
  66062. Object.keys(message).forEach((key) => {
  66063. const value = message[key];
  66064. if (isArrayBufferView$1(value)) {
  66065. transferable[key] = {
  66066. bytes: value.buffer,
  66067. byteOffset: value.byteOffset,
  66068. byteLength: value.byteLength
  66069. };
  66070. } else {
  66071. transferable[key] = value;
  66072. }
  66073. });
  66074. return transferable;
  66075. };
  66076. const initSegmentId$1 = function(initSegment) {
  66077. const byterange = initSegment.byterange || {
  66078. length: Infinity,
  66079. offset: 0
  66080. };
  66081. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  66082. };
  66083. const segmentKeyId$1 = function(key) {
  66084. return key.resolvedUri;
  66085. };
  66086. const hexDump$1 = (data) => {
  66087. const bytes = Array.prototype.slice.call(data);
  66088. const step = 16;
  66089. let result = "";
  66090. let hex;
  66091. let ascii;
  66092. for (let j = 0; j < bytes.length / step; j++) {
  66093. hex = bytes.slice(j * step, j * step + step).map(formatHexString$1).join("");
  66094. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString$1).join("");
  66095. result += hex + " " + ascii + "\n";
  66096. }
  66097. return result;
  66098. };
  66099. const tagDump$1 = ({
  66100. bytes
  66101. }) => hexDump$1(bytes);
  66102. const textRanges$1 = (ranges) => {
  66103. let result = "";
  66104. let i2;
  66105. for (i2 = 0; i2 < ranges.length; i2++) {
  66106. result += textRange$1(ranges, i2) + " ";
  66107. }
  66108. return result;
  66109. };
  66110. var utils$1 = /* @__PURE__ */ Object.freeze({
  66111. __proto__: null,
  66112. createTransferableMessage: createTransferableMessage$1,
  66113. initSegmentId: initSegmentId$1,
  66114. segmentKeyId: segmentKeyId$1,
  66115. hexDump: hexDump$1,
  66116. tagDump: tagDump$1,
  66117. textRanges: textRanges$1
  66118. });
  66119. const SEGMENT_END_FUDGE_PERCENT$1 = 0.25;
  66120. const playerTimeToProgramTime$1 = (playerTime, segment) => {
  66121. if (!segment.dateTimeObject) {
  66122. return null;
  66123. }
  66124. const transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  66125. const transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  66126. const startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  66127. const offsetFromSegmentStart = playerTime - startOfSegment;
  66128. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  66129. };
  66130. const originalSegmentVideoDuration$1 = (videoTimingInfo) => {
  66131. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  66132. };
  66133. const findSegmentForProgramTime$1 = (programTime, playlist) => {
  66134. let dateTimeObject;
  66135. try {
  66136. dateTimeObject = new Date(programTime);
  66137. } catch (e) {
  66138. return null;
  66139. }
  66140. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66141. return null;
  66142. }
  66143. let segment = playlist.segments[0];
  66144. if (dateTimeObject < segment.dateTimeObject) {
  66145. return null;
  66146. }
  66147. for (let i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  66148. segment = playlist.segments[i2];
  66149. const nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  66150. if (dateTimeObject < nextSegmentStart) {
  66151. break;
  66152. }
  66153. }
  66154. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66155. const lastSegmentStart = lastSegment.dateTimeObject;
  66156. const lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration$1(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1;
  66157. const lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  66158. if (dateTimeObject > lastSegmentEnd) {
  66159. return null;
  66160. }
  66161. if (dateTimeObject > lastSegmentStart) {
  66162. segment = lastSegment;
  66163. }
  66164. return {
  66165. segment,
  66166. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist$1.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  66167. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66168. };
  66169. };
  66170. const findSegmentForPlayerTime$1 = (time, playlist) => {
  66171. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66172. return null;
  66173. }
  66174. let segmentEnd = 0;
  66175. let segment;
  66176. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66177. segment = playlist.segments[i2];
  66178. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  66179. if (time <= segmentEnd) {
  66180. break;
  66181. }
  66182. }
  66183. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66184. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  66185. return null;
  66186. }
  66187. if (time > segmentEnd) {
  66188. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1) {
  66189. return null;
  66190. }
  66191. segment = lastSegment;
  66192. }
  66193. return {
  66194. segment,
  66195. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  66196. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66197. };
  66198. };
  66199. const getOffsetFromTimestamp$1 = (comparisonTimeStamp, programTime) => {
  66200. let segmentDateTime;
  66201. let programDateTime;
  66202. try {
  66203. segmentDateTime = new Date(comparisonTimeStamp);
  66204. programDateTime = new Date(programTime);
  66205. } catch (e) {
  66206. }
  66207. const segmentTimeEpoch = segmentDateTime.getTime();
  66208. const programTimeEpoch = programDateTime.getTime();
  66209. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  66210. };
  66211. const verifyProgramDateTimeTags$1 = (playlist) => {
  66212. if (!playlist.segments || playlist.segments.length === 0) {
  66213. return false;
  66214. }
  66215. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66216. const segment = playlist.segments[i2];
  66217. if (!segment.dateTimeObject) {
  66218. return false;
  66219. }
  66220. }
  66221. return true;
  66222. };
  66223. const getProgramTime$1 = ({
  66224. playlist,
  66225. time = void 0,
  66226. callback: callback2
  66227. }) => {
  66228. if (!callback2) {
  66229. throw new Error("getProgramTime: callback must be provided");
  66230. }
  66231. if (!playlist || time === void 0) {
  66232. return callback2({
  66233. message: "getProgramTime: playlist and time must be provided"
  66234. });
  66235. }
  66236. const matchedSegment = findSegmentForPlayerTime$1(time, playlist);
  66237. if (!matchedSegment) {
  66238. return callback2({
  66239. message: "valid programTime was not found"
  66240. });
  66241. }
  66242. if (matchedSegment.type === "estimate") {
  66243. return callback2({
  66244. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  66245. seekTime: matchedSegment.estimatedStart
  66246. });
  66247. }
  66248. const programTimeObject = {
  66249. mediaSeconds: time
  66250. };
  66251. const programTime = playerTimeToProgramTime$1(time, matchedSegment.segment);
  66252. if (programTime) {
  66253. programTimeObject.programDateTime = programTime.toISOString();
  66254. }
  66255. return callback2(null, programTimeObject);
  66256. };
  66257. const seekToProgramTime$1 = ({
  66258. programTime,
  66259. playlist,
  66260. retryCount = 2,
  66261. seekTo,
  66262. pauseAfterSeek = true,
  66263. tech,
  66264. callback: callback2
  66265. }) => {
  66266. if (!callback2) {
  66267. throw new Error("seekToProgramTime: callback must be provided");
  66268. }
  66269. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  66270. return callback2({
  66271. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  66272. });
  66273. }
  66274. if (!playlist.endList && !tech.hasStarted_) {
  66275. return callback2({
  66276. message: "player must be playing a live stream to start buffering"
  66277. });
  66278. }
  66279. if (!verifyProgramDateTimeTags$1(playlist)) {
  66280. return callback2({
  66281. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  66282. });
  66283. }
  66284. const matchedSegment = findSegmentForProgramTime$1(programTime, playlist);
  66285. if (!matchedSegment) {
  66286. return callback2({
  66287. message: `${programTime} was not found in the stream`
  66288. });
  66289. }
  66290. const segment = matchedSegment.segment;
  66291. const mediaOffset = getOffsetFromTimestamp$1(segment.dateTimeObject, programTime);
  66292. if (matchedSegment.type === "estimate") {
  66293. if (retryCount === 0) {
  66294. return callback2({
  66295. message: `${programTime} is not buffered yet. Try again`
  66296. });
  66297. }
  66298. seekTo(matchedSegment.estimatedStart + mediaOffset);
  66299. tech.one("seeked", () => {
  66300. seekToProgramTime$1({
  66301. programTime,
  66302. playlist,
  66303. retryCount: retryCount - 1,
  66304. seekTo,
  66305. pauseAfterSeek,
  66306. tech,
  66307. callback: callback2
  66308. });
  66309. });
  66310. return;
  66311. }
  66312. const seekToTime = segment.start + mediaOffset;
  66313. const seekedCallback = () => {
  66314. return callback2(null, tech.currentTime());
  66315. };
  66316. tech.one("seeked", seekedCallback);
  66317. if (pauseAfterSeek) {
  66318. tech.pause();
  66319. }
  66320. seekTo(seekToTime);
  66321. };
  66322. const callbackOnCompleted$1 = (request, cb) => {
  66323. if (request.readyState === 4) {
  66324. return cb();
  66325. }
  66326. return;
  66327. };
  66328. const containerRequest$1 = (uri, xhr, cb) => {
  66329. let bytes = [];
  66330. let id3Offset;
  66331. let finished = false;
  66332. const endRequestAndCallback = function(err, req, type2, _bytes) {
  66333. req.abort();
  66334. finished = true;
  66335. return cb(err, req, type2, _bytes);
  66336. };
  66337. const progressListener = function(error, request2) {
  66338. if (finished) {
  66339. return;
  66340. }
  66341. if (error) {
  66342. return endRequestAndCallback(error, request2, "", bytes);
  66343. }
  66344. const newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  66345. bytes = concatTypedArrays$1(bytes, stringToBytes$1(newPart, true));
  66346. id3Offset = id3Offset || getId3Offset$1(bytes);
  66347. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  66348. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66349. }
  66350. const type2 = detectContainerForBytes$1(bytes);
  66351. if (type2 === "ts" && bytes.length < 188) {
  66352. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66353. }
  66354. if (!type2 && bytes.length < 376) {
  66355. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66356. }
  66357. return endRequestAndCallback(null, request2, type2, bytes);
  66358. };
  66359. const options2 = {
  66360. uri,
  66361. beforeSend(request2) {
  66362. request2.overrideMimeType("text/plain; charset=x-user-defined");
  66363. request2.addEventListener("progress", function({
  66364. total,
  66365. loaded
  66366. }) {
  66367. return callbackWrapper$1(request2, null, {
  66368. statusCode: request2.status
  66369. }, progressListener);
  66370. });
  66371. }
  66372. };
  66373. const request = xhr(options2, function(error, response) {
  66374. return callbackWrapper$1(request, error, response, progressListener);
  66375. });
  66376. return request;
  66377. };
  66378. const {
  66379. EventTarget: EventTarget$3
  66380. } = videojs$2;
  66381. const dashPlaylistUnchanged$1 = function(a, b) {
  66382. if (!isPlaylistUnchanged$1(a, b)) {
  66383. return false;
  66384. }
  66385. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  66386. return false;
  66387. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  66388. return false;
  66389. }
  66390. if (a.segments && !b.segments || !a.segments && b.segments) {
  66391. return false;
  66392. }
  66393. if (!a.segments && !b.segments) {
  66394. return true;
  66395. }
  66396. for (let i2 = 0; i2 < a.segments.length; i2++) {
  66397. const aSegment = a.segments[i2];
  66398. const bSegment = b.segments[i2];
  66399. if (aSegment.uri !== bSegment.uri) {
  66400. return false;
  66401. }
  66402. if (!aSegment.byterange && !bSegment.byterange) {
  66403. continue;
  66404. }
  66405. const aByterange = aSegment.byterange;
  66406. const bByterange = bSegment.byterange;
  66407. if (aByterange && !bByterange || !aByterange && bByterange) {
  66408. return false;
  66409. }
  66410. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  66411. return false;
  66412. }
  66413. }
  66414. return true;
  66415. };
  66416. const dashGroupId$1 = (type2, group, label2, playlist) => {
  66417. const playlistId = playlist.attributes.NAME || label2;
  66418. return `placeholder-uri-${type2}-${group}-${playlistId}`;
  66419. };
  66420. const parseMainXml = ({
  66421. mainXml,
  66422. srcUrl,
  66423. clientOffset,
  66424. sidxMapping,
  66425. previousManifest
  66426. }) => {
  66427. const manifest = parse$1(mainXml, {
  66428. manifestUri: srcUrl,
  66429. clientOffset,
  66430. sidxMapping,
  66431. previousManifest
  66432. });
  66433. addPropertiesToMain(manifest, srcUrl, dashGroupId$1);
  66434. return manifest;
  66435. };
  66436. const removeOldMediaGroupLabels$1 = (update, newMain) => {
  66437. forEachMediaGroup$2(update, (properties, type2, group, label2) => {
  66438. if (!(label2 in newMain.mediaGroups[type2][group])) {
  66439. delete update.mediaGroups[type2][group][label2];
  66440. }
  66441. });
  66442. };
  66443. const updateMain = (oldMain, newMain, sidxMapping) => {
  66444. let noChanges = true;
  66445. let update = merge$2(oldMain, {
  66446. duration: newMain.duration,
  66447. minimumUpdatePeriod: newMain.minimumUpdatePeriod,
  66448. timelineStarts: newMain.timelineStarts
  66449. });
  66450. for (let i2 = 0; i2 < newMain.playlists.length; i2++) {
  66451. const playlist = newMain.playlists[i2];
  66452. if (playlist.sidx) {
  66453. const sidxKey = generateSidxKey$1(playlist.sidx);
  66454. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  66455. addSidxSegmentsToPlaylist$1$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  66456. }
  66457. }
  66458. const playlistUpdate = updateMain$1(update, playlist, dashPlaylistUnchanged$1);
  66459. if (playlistUpdate) {
  66460. update = playlistUpdate;
  66461. noChanges = false;
  66462. }
  66463. }
  66464. forEachMediaGroup$2(newMain, (properties, type2, group, label2) => {
  66465. if (properties.playlists && properties.playlists.length) {
  66466. const id = properties.playlists[0].id;
  66467. const playlistUpdate = updateMain$1(update, properties.playlists[0], dashPlaylistUnchanged$1);
  66468. if (playlistUpdate) {
  66469. update = playlistUpdate;
  66470. if (!(label2 in update.mediaGroups[type2][group])) {
  66471. update.mediaGroups[type2][group][label2] = properties;
  66472. }
  66473. update.mediaGroups[type2][group][label2].playlists[0] = update.playlists[id];
  66474. noChanges = false;
  66475. }
  66476. }
  66477. });
  66478. removeOldMediaGroupLabels$1(update, newMain);
  66479. if (newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66480. noChanges = false;
  66481. }
  66482. if (noChanges) {
  66483. return null;
  66484. }
  66485. return update;
  66486. };
  66487. const equivalentSidx$1 = (a, b) => {
  66488. const neitherMap = Boolean(!a.map && !b.map);
  66489. const equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  66490. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  66491. };
  66492. const compareSidxEntry$1 = (playlists, oldSidxMapping) => {
  66493. const newSidxMapping = {};
  66494. for (const id in playlists) {
  66495. const playlist = playlists[id];
  66496. const currentSidxInfo = playlist.sidx;
  66497. if (currentSidxInfo) {
  66498. const key = generateSidxKey$1(currentSidxInfo);
  66499. if (!oldSidxMapping[key]) {
  66500. break;
  66501. }
  66502. const savedSidxInfo = oldSidxMapping[key].sidxInfo;
  66503. if (equivalentSidx$1(savedSidxInfo, currentSidxInfo)) {
  66504. newSidxMapping[key] = oldSidxMapping[key];
  66505. }
  66506. }
  66507. }
  66508. return newSidxMapping;
  66509. };
  66510. const filterChangedSidxMappings$1 = (main, oldSidxMapping) => {
  66511. const videoSidx = compareSidxEntry$1(main.playlists, oldSidxMapping);
  66512. let mediaGroupSidx = videoSidx;
  66513. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  66514. if (properties.playlists && properties.playlists.length) {
  66515. const playlists = properties.playlists;
  66516. mediaGroupSidx = merge$2(mediaGroupSidx, compareSidxEntry$1(playlists, oldSidxMapping));
  66517. }
  66518. });
  66519. return mediaGroupSidx;
  66520. };
  66521. class DashPlaylistLoader$1 extends EventTarget$3 {
  66522. constructor(srcUrlOrPlaylist, vhs, options2 = {}, mainPlaylistLoader) {
  66523. super();
  66524. this.mainPlaylistLoader_ = mainPlaylistLoader || this;
  66525. if (!mainPlaylistLoader) {
  66526. this.isMain_ = true;
  66527. }
  66528. const {
  66529. withCredentials = false
  66530. } = options2;
  66531. this.vhs_ = vhs;
  66532. this.withCredentials = withCredentials;
  66533. if (!srcUrlOrPlaylist) {
  66534. throw new Error("A non-empty playlist URL or object is required");
  66535. }
  66536. this.on("minimumUpdatePeriod", () => {
  66537. this.refreshXml_();
  66538. });
  66539. this.on("mediaupdatetimeout", () => {
  66540. this.refreshMedia_(this.media().id);
  66541. });
  66542. this.state = "HAVE_NOTHING";
  66543. this.loadedPlaylists_ = {};
  66544. this.logger_ = logger$1("DashPlaylistLoader");
  66545. if (this.isMain_) {
  66546. this.mainPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  66547. this.mainPlaylistLoader_.sidxMapping_ = {};
  66548. } else {
  66549. this.childPlaylist_ = srcUrlOrPlaylist;
  66550. }
  66551. }
  66552. requestErrored_(err, request, startingState) {
  66553. if (!this.request) {
  66554. return true;
  66555. }
  66556. this.request = null;
  66557. if (err) {
  66558. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  66559. status: request.status,
  66560. message: "DASH request error at URL: " + request.uri,
  66561. response: request.response,
  66562. code: 2
  66563. };
  66564. if (startingState) {
  66565. this.state = startingState;
  66566. }
  66567. this.trigger("error");
  66568. return true;
  66569. }
  66570. }
  66571. addSidxSegments_(playlist, startingState, cb) {
  66572. const sidxKey = playlist.sidx && generateSidxKey$1(playlist.sidx);
  66573. if (!playlist.sidx || !sidxKey || this.mainPlaylistLoader_.sidxMapping_[sidxKey]) {
  66574. this.mediaRequest_ = window_1.setTimeout(() => cb(false), 0);
  66575. return;
  66576. }
  66577. const uri = resolveManifestRedirect$1(playlist.sidx.resolvedUri);
  66578. const fin = (err, request) => {
  66579. if (this.requestErrored_(err, request, startingState)) {
  66580. return;
  66581. }
  66582. const sidxMapping = this.mainPlaylistLoader_.sidxMapping_;
  66583. let sidx;
  66584. try {
  66585. sidx = parseSidx_1$1(toUint8$1(request.response).subarray(8));
  66586. } catch (e) {
  66587. this.requestErrored_(e, request, startingState);
  66588. return;
  66589. }
  66590. sidxMapping[sidxKey] = {
  66591. sidxInfo: playlist.sidx,
  66592. sidx
  66593. };
  66594. addSidxSegmentsToPlaylist$1$1(playlist, sidx, playlist.sidx.resolvedUri);
  66595. return cb(true);
  66596. };
  66597. this.request = containerRequest$1(uri, this.vhs_.xhr, (err, request, container, bytes) => {
  66598. if (err) {
  66599. return fin(err, request);
  66600. }
  66601. if (!container || container !== "mp4") {
  66602. return fin({
  66603. status: request.status,
  66604. message: `Unsupported ${container || "unknown"} container type for sidx segment at URL: ${uri}`,
  66605. response: "",
  66606. playlist,
  66607. internal: true,
  66608. playlistExclusionDuration: Infinity,
  66609. code: 2
  66610. }, request);
  66611. }
  66612. const {
  66613. offset,
  66614. length
  66615. } = playlist.sidx.byterange;
  66616. if (bytes.length >= length + offset) {
  66617. return fin(err, {
  66618. response: bytes.subarray(offset, offset + length),
  66619. status: request.status,
  66620. uri: request.uri
  66621. });
  66622. }
  66623. this.request = this.vhs_.xhr({
  66624. uri,
  66625. responseType: "arraybuffer",
  66626. headers: segmentXhrHeaders$1({
  66627. byterange: playlist.sidx.byterange
  66628. })
  66629. }, fin);
  66630. });
  66631. }
  66632. dispose() {
  66633. this.trigger("dispose");
  66634. this.stopRequest();
  66635. this.loadedPlaylists_ = {};
  66636. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  66637. window_1.clearTimeout(this.mediaRequest_);
  66638. window_1.clearTimeout(this.mediaUpdateTimeout);
  66639. this.mediaUpdateTimeout = null;
  66640. this.mediaRequest_ = null;
  66641. this.minimumUpdatePeriodTimeout_ = null;
  66642. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66643. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66644. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66645. }
  66646. this.off();
  66647. }
  66648. hasPendingRequest() {
  66649. return this.request || this.mediaRequest_;
  66650. }
  66651. stopRequest() {
  66652. if (this.request) {
  66653. const oldRequest = this.request;
  66654. this.request = null;
  66655. oldRequest.onreadystatechange = null;
  66656. oldRequest.abort();
  66657. }
  66658. }
  66659. media(playlist) {
  66660. if (!playlist) {
  66661. return this.media_;
  66662. }
  66663. if (this.state === "HAVE_NOTHING") {
  66664. throw new Error("Cannot switch media playlist from " + this.state);
  66665. }
  66666. const startingState = this.state;
  66667. if (typeof playlist === "string") {
  66668. if (!this.mainPlaylistLoader_.main.playlists[playlist]) {
  66669. throw new Error("Unknown playlist URI: " + playlist);
  66670. }
  66671. playlist = this.mainPlaylistLoader_.main.playlists[playlist];
  66672. }
  66673. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  66674. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  66675. this.state = "HAVE_METADATA";
  66676. this.media_ = playlist;
  66677. if (mediaChange) {
  66678. this.trigger("mediachanging");
  66679. this.trigger("mediachange");
  66680. }
  66681. return;
  66682. }
  66683. if (!mediaChange) {
  66684. return;
  66685. }
  66686. if (this.media_) {
  66687. this.trigger("mediachanging");
  66688. }
  66689. this.addSidxSegments_(playlist, startingState, (sidxChanged) => {
  66690. this.haveMetadata({
  66691. startingState,
  66692. playlist
  66693. });
  66694. });
  66695. }
  66696. haveMetadata({
  66697. startingState,
  66698. playlist
  66699. }) {
  66700. this.state = "HAVE_METADATA";
  66701. this.loadedPlaylists_[playlist.id] = playlist;
  66702. this.mediaRequest_ = null;
  66703. this.refreshMedia_(playlist.id);
  66704. if (startingState === "HAVE_MAIN_MANIFEST") {
  66705. this.trigger("loadedmetadata");
  66706. } else {
  66707. this.trigger("mediachange");
  66708. }
  66709. }
  66710. pause() {
  66711. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66712. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66713. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66714. }
  66715. this.stopRequest();
  66716. window_1.clearTimeout(this.mediaUpdateTimeout);
  66717. this.mediaUpdateTimeout = null;
  66718. if (this.isMain_) {
  66719. window_1.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_);
  66720. this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  66721. }
  66722. if (this.state === "HAVE_NOTHING") {
  66723. this.started = false;
  66724. }
  66725. }
  66726. load(isFinalRendition) {
  66727. window_1.clearTimeout(this.mediaUpdateTimeout);
  66728. this.mediaUpdateTimeout = null;
  66729. const media = this.media();
  66730. if (isFinalRendition) {
  66731. const delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  66732. this.mediaUpdateTimeout = window_1.setTimeout(() => this.load(), delay);
  66733. return;
  66734. }
  66735. if (!this.started) {
  66736. this.start();
  66737. return;
  66738. }
  66739. if (media && !media.endList) {
  66740. if (this.isMain_ && !this.minimumUpdatePeriodTimeout_) {
  66741. this.trigger("minimumUpdatePeriod");
  66742. this.updateMinimumUpdatePeriodTimeout_();
  66743. }
  66744. this.trigger("mediaupdatetimeout");
  66745. } else {
  66746. this.trigger("loadedplaylist");
  66747. }
  66748. }
  66749. start() {
  66750. this.started = true;
  66751. if (!this.isMain_) {
  66752. this.mediaRequest_ = window_1.setTimeout(() => this.haveMain_(), 0);
  66753. return;
  66754. }
  66755. this.requestMain_((req, mainChanged) => {
  66756. this.haveMain_();
  66757. if (!this.hasPendingRequest() && !this.media_) {
  66758. this.media(this.mainPlaylistLoader_.main.playlists[0]);
  66759. }
  66760. });
  66761. }
  66762. requestMain_(cb) {
  66763. this.request = this.vhs_.xhr({
  66764. uri: this.mainPlaylistLoader_.srcUrl,
  66765. withCredentials: this.withCredentials
  66766. }, (error, req) => {
  66767. if (this.requestErrored_(error, req)) {
  66768. if (this.state === "HAVE_NOTHING") {
  66769. this.started = false;
  66770. }
  66771. return;
  66772. }
  66773. const mainChanged = req.responseText !== this.mainPlaylistLoader_.mainXml_;
  66774. this.mainPlaylistLoader_.mainXml_ = req.responseText;
  66775. if (req.responseHeaders && req.responseHeaders.date) {
  66776. this.mainLoaded_ = Date.parse(req.responseHeaders.date);
  66777. } else {
  66778. this.mainLoaded_ = Date.now();
  66779. }
  66780. this.mainPlaylistLoader_.srcUrl = resolveManifestRedirect$1(this.mainPlaylistLoader_.srcUrl, req);
  66781. if (mainChanged) {
  66782. this.handleMain_();
  66783. this.syncClientServerClock_(() => {
  66784. return cb(req, mainChanged);
  66785. });
  66786. return;
  66787. }
  66788. return cb(req, mainChanged);
  66789. });
  66790. }
  66791. syncClientServerClock_(done) {
  66792. const utcTiming = parseUTCTiming$1(this.mainPlaylistLoader_.mainXml_);
  66793. if (utcTiming === null) {
  66794. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66795. return done();
  66796. }
  66797. if (utcTiming.method === "DIRECT") {
  66798. this.mainPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  66799. return done();
  66800. }
  66801. this.request = this.vhs_.xhr({
  66802. uri: resolveUrl$2(this.mainPlaylistLoader_.srcUrl, utcTiming.value),
  66803. method: utcTiming.method,
  66804. withCredentials: this.withCredentials
  66805. }, (error, req) => {
  66806. if (!this.request) {
  66807. return;
  66808. }
  66809. if (error) {
  66810. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66811. return done();
  66812. }
  66813. let serverTime;
  66814. if (utcTiming.method === "HEAD") {
  66815. if (!req.responseHeaders || !req.responseHeaders.date) {
  66816. serverTime = this.mainLoaded_;
  66817. } else {
  66818. serverTime = Date.parse(req.responseHeaders.date);
  66819. }
  66820. } else {
  66821. serverTime = Date.parse(req.responseText);
  66822. }
  66823. this.mainPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  66824. done();
  66825. });
  66826. }
  66827. haveMain_() {
  66828. this.state = "HAVE_MAIN_MANIFEST";
  66829. if (this.isMain_) {
  66830. this.trigger("loadedplaylist");
  66831. } else if (!this.media_) {
  66832. this.media(this.childPlaylist_);
  66833. }
  66834. }
  66835. handleMain_() {
  66836. this.mediaRequest_ = null;
  66837. const oldMain = this.mainPlaylistLoader_.main;
  66838. let newMain = parseMainXml({
  66839. mainXml: this.mainPlaylistLoader_.mainXml_,
  66840. srcUrl: this.mainPlaylistLoader_.srcUrl,
  66841. clientOffset: this.mainPlaylistLoader_.clientOffset_,
  66842. sidxMapping: this.mainPlaylistLoader_.sidxMapping_,
  66843. previousManifest: oldMain
  66844. });
  66845. if (oldMain) {
  66846. newMain = updateMain(oldMain, newMain, this.mainPlaylistLoader_.sidxMapping_);
  66847. }
  66848. this.mainPlaylistLoader_.main = newMain ? newMain : oldMain;
  66849. const location = this.mainPlaylistLoader_.main.locations && this.mainPlaylistLoader_.main.locations[0];
  66850. if (location && location !== this.mainPlaylistLoader_.srcUrl) {
  66851. this.mainPlaylistLoader_.srcUrl = location;
  66852. }
  66853. if (!oldMain || newMain && newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66854. this.updateMinimumUpdatePeriodTimeout_();
  66855. }
  66856. return Boolean(newMain);
  66857. }
  66858. updateMinimumUpdatePeriodTimeout_() {
  66859. const mpl = this.mainPlaylistLoader_;
  66860. if (mpl.createMupOnMedia_) {
  66861. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  66862. mpl.createMupOnMedia_ = null;
  66863. }
  66864. if (mpl.minimumUpdatePeriodTimeout_) {
  66865. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  66866. mpl.minimumUpdatePeriodTimeout_ = null;
  66867. }
  66868. let mup = mpl.main && mpl.main.minimumUpdatePeriod;
  66869. if (mup === 0) {
  66870. if (mpl.media()) {
  66871. mup = mpl.media().targetDuration * 1e3;
  66872. } else {
  66873. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  66874. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  66875. }
  66876. }
  66877. if (typeof mup !== "number" || mup <= 0) {
  66878. if (mup < 0) {
  66879. this.logger_(`found invalid minimumUpdatePeriod of ${mup}, not setting a timeout`);
  66880. }
  66881. return;
  66882. }
  66883. this.createMUPTimeout_(mup);
  66884. }
  66885. createMUPTimeout_(mup) {
  66886. const mpl = this.mainPlaylistLoader_;
  66887. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(() => {
  66888. mpl.minimumUpdatePeriodTimeout_ = null;
  66889. mpl.trigger("minimumUpdatePeriod");
  66890. mpl.createMUPTimeout_(mup);
  66891. }, mup);
  66892. }
  66893. refreshXml_() {
  66894. this.requestMain_((req, mainChanged) => {
  66895. if (!mainChanged) {
  66896. return;
  66897. }
  66898. if (this.media_) {
  66899. this.media_ = this.mainPlaylistLoader_.main.playlists[this.media_.id];
  66900. }
  66901. this.mainPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.sidxMapping_);
  66902. this.addSidxSegments_(this.media(), this.state, (sidxChanged) => {
  66903. this.refreshMedia_(this.media().id);
  66904. });
  66905. });
  66906. }
  66907. refreshMedia_(mediaID) {
  66908. if (!mediaID) {
  66909. throw new Error("refreshMedia_ must take a media id");
  66910. }
  66911. if (this.media_ && this.isMain_) {
  66912. this.handleMain_();
  66913. }
  66914. const playlists = this.mainPlaylistLoader_.main.playlists;
  66915. const mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  66916. if (mediaChanged) {
  66917. this.media_ = playlists[mediaID];
  66918. } else {
  66919. this.trigger("playlistunchanged");
  66920. }
  66921. if (!this.mediaUpdateTimeout) {
  66922. const createMediaUpdateTimeout = () => {
  66923. if (this.media().endList) {
  66924. return;
  66925. }
  66926. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  66927. this.trigger("mediaupdatetimeout");
  66928. createMediaUpdateTimeout();
  66929. }, refreshDelay$1(this.media(), Boolean(mediaChanged)));
  66930. };
  66931. createMediaUpdateTimeout();
  66932. }
  66933. this.trigger("loadedplaylist");
  66934. }
  66935. }
  66936. var Config$1 = {
  66937. GOAL_BUFFER_LENGTH: 30,
  66938. MAX_GOAL_BUFFER_LENGTH: 60,
  66939. BACK_BUFFER_LENGTH: 30,
  66940. GOAL_BUFFER_LENGTH_RATE: 1,
  66941. INITIAL_BANDWIDTH: 4194304,
  66942. BANDWIDTH_VARIANCE: 1.2,
  66943. BUFFER_LOW_WATER_LINE: 0,
  66944. MAX_BUFFER_LOW_WATER_LINE: 30,
  66945. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  66946. BUFFER_LOW_WATER_LINE_RATE: 1,
  66947. BUFFER_HIGH_WATER_LINE: 30
  66948. };
  66949. const stringToArrayBuffer$1 = (string) => {
  66950. const view = new Uint8Array(new ArrayBuffer(string.length));
  66951. for (let i2 = 0; i2 < string.length; i2++) {
  66952. view[i2] = string.charCodeAt(i2);
  66953. }
  66954. return view.buffer;
  66955. };
  66956. const browserWorkerPolyFill$1 = function(workerObj) {
  66957. workerObj.on = workerObj.addEventListener;
  66958. workerObj.off = workerObj.removeEventListener;
  66959. return workerObj;
  66960. };
  66961. const createObjectURL$1 = function(str) {
  66962. try {
  66963. return URL.createObjectURL(new Blob([str], {
  66964. type: "application/javascript"
  66965. }));
  66966. } catch (e) {
  66967. const blob = new BlobBuilder();
  66968. blob.append(str);
  66969. return URL.createObjectURL(blob.getBlob());
  66970. }
  66971. };
  66972. const factory$1 = function(code) {
  66973. return function() {
  66974. const objectUrl = createObjectURL$1(code);
  66975. const worker = browserWorkerPolyFill$1(new Worker(objectUrl));
  66976. worker.objURL = objectUrl;
  66977. const terminate = worker.terminate;
  66978. worker.on = worker.addEventListener;
  66979. worker.off = worker.removeEventListener;
  66980. worker.terminate = function() {
  66981. URL.revokeObjectURL(objectUrl);
  66982. return terminate.call(this);
  66983. };
  66984. return worker;
  66985. };
  66986. };
  66987. const transform$1 = function(code) {
  66988. return `var browserWorkerPolyFill = ${browserWorkerPolyFill$1.toString()};
  66989. browserWorkerPolyFill(self);
  66990. ` + code;
  66991. };
  66992. const getWorkerString$1 = function(fn2) {
  66993. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  66994. };
  66995. const workerCode$1$1 = transform$1(getWorkerString$1(function() {
  66996. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  66997. var Stream$8 = function() {
  66998. this.init = function() {
  66999. var listeners = {};
  67000. this.on = function(type3, listener) {
  67001. if (!listeners[type3]) {
  67002. listeners[type3] = [];
  67003. }
  67004. listeners[type3] = listeners[type3].concat(listener);
  67005. };
  67006. this.off = function(type3, listener) {
  67007. var index2;
  67008. if (!listeners[type3]) {
  67009. return false;
  67010. }
  67011. index2 = listeners[type3].indexOf(listener);
  67012. listeners[type3] = listeners[type3].slice();
  67013. listeners[type3].splice(index2, 1);
  67014. return index2 > -1;
  67015. };
  67016. this.trigger = function(type3) {
  67017. var callbacks, i2, length, args;
  67018. callbacks = listeners[type3];
  67019. if (!callbacks) {
  67020. return;
  67021. }
  67022. if (arguments.length === 2) {
  67023. length = callbacks.length;
  67024. for (i2 = 0; i2 < length; ++i2) {
  67025. callbacks[i2].call(this, arguments[1]);
  67026. }
  67027. } else {
  67028. args = [];
  67029. i2 = arguments.length;
  67030. for (i2 = 1; i2 < arguments.length; ++i2) {
  67031. args.push(arguments[i2]);
  67032. }
  67033. length = callbacks.length;
  67034. for (i2 = 0; i2 < length; ++i2) {
  67035. callbacks[i2].apply(this, args);
  67036. }
  67037. }
  67038. };
  67039. this.dispose = function() {
  67040. listeners = {};
  67041. };
  67042. };
  67043. };
  67044. Stream$8.prototype.pipe = function(destination2) {
  67045. this.on("data", function(data) {
  67046. destination2.push(data);
  67047. });
  67048. this.on("done", function(flushSource) {
  67049. destination2.flush(flushSource);
  67050. });
  67051. this.on("partialdone", function(flushSource) {
  67052. destination2.partialFlush(flushSource);
  67053. });
  67054. this.on("endedtimeline", function(flushSource) {
  67055. destination2.endTimeline(flushSource);
  67056. });
  67057. this.on("reset", function(flushSource) {
  67058. destination2.reset(flushSource);
  67059. });
  67060. return destination2;
  67061. };
  67062. Stream$8.prototype.push = function(data) {
  67063. this.trigger("data", data);
  67064. };
  67065. Stream$8.prototype.flush = function(flushSource) {
  67066. this.trigger("done", flushSource);
  67067. };
  67068. Stream$8.prototype.partialFlush = function(flushSource) {
  67069. this.trigger("partialdone", flushSource);
  67070. };
  67071. Stream$8.prototype.endTimeline = function(flushSource) {
  67072. this.trigger("endedtimeline", flushSource);
  67073. };
  67074. Stream$8.prototype.reset = function(flushSource) {
  67075. this.trigger("reset", flushSource);
  67076. };
  67077. var stream = Stream$8;
  67078. var MAX_UINT32$12 = Math.pow(2, 32);
  67079. var getUint64$32 = function(uint8) {
  67080. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  67081. var value;
  67082. if (dv.getBigUint64) {
  67083. value = dv.getBigUint64(0);
  67084. if (value < Number.MAX_SAFE_INTEGER) {
  67085. return Number(value);
  67086. }
  67087. return value;
  67088. }
  67089. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  67090. };
  67091. var numbers2 = {
  67092. getUint64: getUint64$32,
  67093. MAX_UINT32: MAX_UINT32$12
  67094. };
  67095. var MAX_UINT322 = numbers2.MAX_UINT32;
  67096. 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;
  67097. (function() {
  67098. var i2;
  67099. types = {
  67100. avc1: [],
  67101. avcC: [],
  67102. btrt: [],
  67103. dinf: [],
  67104. dref: [],
  67105. esds: [],
  67106. ftyp: [],
  67107. hdlr: [],
  67108. mdat: [],
  67109. mdhd: [],
  67110. mdia: [],
  67111. mfhd: [],
  67112. minf: [],
  67113. moof: [],
  67114. moov: [],
  67115. mp4a: [],
  67116. mvex: [],
  67117. mvhd: [],
  67118. pasp: [],
  67119. sdtp: [],
  67120. smhd: [],
  67121. stbl: [],
  67122. stco: [],
  67123. stsc: [],
  67124. stsd: [],
  67125. stsz: [],
  67126. stts: [],
  67127. styp: [],
  67128. tfdt: [],
  67129. tfhd: [],
  67130. traf: [],
  67131. trak: [],
  67132. trun: [],
  67133. trex: [],
  67134. tkhd: [],
  67135. vmhd: []
  67136. };
  67137. if (typeof Uint8Array === "undefined") {
  67138. return;
  67139. }
  67140. for (i2 in types) {
  67141. if (types.hasOwnProperty(i2)) {
  67142. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  67143. }
  67144. }
  67145. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  67146. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  67147. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  67148. VIDEO_HDLR = new Uint8Array([
  67149. 0,
  67150. 0,
  67151. 0,
  67152. 0,
  67153. 0,
  67154. 0,
  67155. 0,
  67156. 0,
  67157. 118,
  67158. 105,
  67159. 100,
  67160. 101,
  67161. 0,
  67162. 0,
  67163. 0,
  67164. 0,
  67165. 0,
  67166. 0,
  67167. 0,
  67168. 0,
  67169. 0,
  67170. 0,
  67171. 0,
  67172. 0,
  67173. 86,
  67174. 105,
  67175. 100,
  67176. 101,
  67177. 111,
  67178. 72,
  67179. 97,
  67180. 110,
  67181. 100,
  67182. 108,
  67183. 101,
  67184. 114,
  67185. 0
  67186. ]);
  67187. AUDIO_HDLR = new Uint8Array([
  67188. 0,
  67189. 0,
  67190. 0,
  67191. 0,
  67192. 0,
  67193. 0,
  67194. 0,
  67195. 0,
  67196. 115,
  67197. 111,
  67198. 117,
  67199. 110,
  67200. 0,
  67201. 0,
  67202. 0,
  67203. 0,
  67204. 0,
  67205. 0,
  67206. 0,
  67207. 0,
  67208. 0,
  67209. 0,
  67210. 0,
  67211. 0,
  67212. 83,
  67213. 111,
  67214. 117,
  67215. 110,
  67216. 100,
  67217. 72,
  67218. 97,
  67219. 110,
  67220. 100,
  67221. 108,
  67222. 101,
  67223. 114,
  67224. 0
  67225. ]);
  67226. HDLR_TYPES = {
  67227. video: VIDEO_HDLR,
  67228. audio: AUDIO_HDLR
  67229. };
  67230. DREF = new Uint8Array([
  67231. 0,
  67232. 0,
  67233. 0,
  67234. 0,
  67235. 0,
  67236. 0,
  67237. 0,
  67238. 1,
  67239. 0,
  67240. 0,
  67241. 0,
  67242. 12,
  67243. 117,
  67244. 114,
  67245. 108,
  67246. 32,
  67247. 0,
  67248. 0,
  67249. 0,
  67250. 1
  67251. ]);
  67252. SMHD = new Uint8Array([
  67253. 0,
  67254. 0,
  67255. 0,
  67256. 0,
  67257. 0,
  67258. 0,
  67259. 0,
  67260. 0
  67261. ]);
  67262. STCO = new Uint8Array([
  67263. 0,
  67264. 0,
  67265. 0,
  67266. 0,
  67267. 0,
  67268. 0,
  67269. 0,
  67270. 0
  67271. ]);
  67272. STSC = STCO;
  67273. STSZ = new Uint8Array([
  67274. 0,
  67275. 0,
  67276. 0,
  67277. 0,
  67278. 0,
  67279. 0,
  67280. 0,
  67281. 0,
  67282. 0,
  67283. 0,
  67284. 0,
  67285. 0
  67286. ]);
  67287. STTS = STCO;
  67288. VMHD = new Uint8Array([
  67289. 0,
  67290. 0,
  67291. 0,
  67292. 1,
  67293. 0,
  67294. 0,
  67295. 0,
  67296. 0,
  67297. 0,
  67298. 0,
  67299. 0,
  67300. 0
  67301. ]);
  67302. })();
  67303. box = function(type3) {
  67304. var payload = [], size = 0, i2, result, view;
  67305. for (i2 = 1; i2 < arguments.length; i2++) {
  67306. payload.push(arguments[i2]);
  67307. }
  67308. i2 = payload.length;
  67309. while (i2--) {
  67310. size += payload[i2].byteLength;
  67311. }
  67312. result = new Uint8Array(size + 8);
  67313. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  67314. view.setUint32(0, result.byteLength);
  67315. result.set(type3, 4);
  67316. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  67317. result.set(payload[i2], size);
  67318. size += payload[i2].byteLength;
  67319. }
  67320. return result;
  67321. };
  67322. dinf = function() {
  67323. return box(types.dinf, box(types.dref, DREF));
  67324. };
  67325. esds = function(track) {
  67326. return box(types.esds, new Uint8Array([
  67327. 0,
  67328. 0,
  67329. 0,
  67330. 0,
  67331. 3,
  67332. 25,
  67333. 0,
  67334. 0,
  67335. 0,
  67336. 4,
  67337. 17,
  67338. 64,
  67339. 21,
  67340. 0,
  67341. 6,
  67342. 0,
  67343. 0,
  67344. 0,
  67345. 218,
  67346. 192,
  67347. 0,
  67348. 0,
  67349. 218,
  67350. 192,
  67351. 5,
  67352. 2,
  67353. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  67354. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  67355. 6,
  67356. 1,
  67357. 2
  67358. ]));
  67359. };
  67360. ftyp = function() {
  67361. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  67362. };
  67363. hdlr = function(type3) {
  67364. return box(types.hdlr, HDLR_TYPES[type3]);
  67365. };
  67366. mdat = function(data) {
  67367. return box(types.mdat, data);
  67368. };
  67369. mdhd = function(track) {
  67370. var result = new Uint8Array([
  67371. 0,
  67372. 0,
  67373. 0,
  67374. 0,
  67375. 0,
  67376. 0,
  67377. 0,
  67378. 2,
  67379. 0,
  67380. 0,
  67381. 0,
  67382. 3,
  67383. 0,
  67384. 1,
  67385. 95,
  67386. 144,
  67387. track.duration >>> 24 & 255,
  67388. track.duration >>> 16 & 255,
  67389. track.duration >>> 8 & 255,
  67390. track.duration & 255,
  67391. 85,
  67392. 196,
  67393. 0,
  67394. 0
  67395. ]);
  67396. if (track.samplerate) {
  67397. result[12] = track.samplerate >>> 24 & 255;
  67398. result[13] = track.samplerate >>> 16 & 255;
  67399. result[14] = track.samplerate >>> 8 & 255;
  67400. result[15] = track.samplerate & 255;
  67401. }
  67402. return box(types.mdhd, result);
  67403. };
  67404. mdia = function(track) {
  67405. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  67406. };
  67407. mfhd = function(sequenceNumber) {
  67408. return box(types.mfhd, new Uint8Array([
  67409. 0,
  67410. 0,
  67411. 0,
  67412. 0,
  67413. (sequenceNumber & 4278190080) >> 24,
  67414. (sequenceNumber & 16711680) >> 16,
  67415. (sequenceNumber & 65280) >> 8,
  67416. sequenceNumber & 255
  67417. ]));
  67418. };
  67419. minf = function(track) {
  67420. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  67421. };
  67422. moof = function(sequenceNumber, tracks) {
  67423. var trackFragments = [], i2 = tracks.length;
  67424. while (i2--) {
  67425. trackFragments[i2] = traf(tracks[i2]);
  67426. }
  67427. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  67428. };
  67429. moov = function(tracks) {
  67430. var i2 = tracks.length, boxes = [];
  67431. while (i2--) {
  67432. boxes[i2] = trak(tracks[i2]);
  67433. }
  67434. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  67435. };
  67436. mvex = function(tracks) {
  67437. var i2 = tracks.length, boxes = [];
  67438. while (i2--) {
  67439. boxes[i2] = trex(tracks[i2]);
  67440. }
  67441. return box.apply(null, [types.mvex].concat(boxes));
  67442. };
  67443. mvhd = function(duration5) {
  67444. var bytes = new Uint8Array([
  67445. 0,
  67446. 0,
  67447. 0,
  67448. 0,
  67449. 0,
  67450. 0,
  67451. 0,
  67452. 1,
  67453. 0,
  67454. 0,
  67455. 0,
  67456. 2,
  67457. 0,
  67458. 1,
  67459. 95,
  67460. 144,
  67461. (duration5 & 4278190080) >> 24,
  67462. (duration5 & 16711680) >> 16,
  67463. (duration5 & 65280) >> 8,
  67464. duration5 & 255,
  67465. 0,
  67466. 1,
  67467. 0,
  67468. 0,
  67469. 1,
  67470. 0,
  67471. 0,
  67472. 0,
  67473. 0,
  67474. 0,
  67475. 0,
  67476. 0,
  67477. 0,
  67478. 0,
  67479. 0,
  67480. 0,
  67481. 0,
  67482. 1,
  67483. 0,
  67484. 0,
  67485. 0,
  67486. 0,
  67487. 0,
  67488. 0,
  67489. 0,
  67490. 0,
  67491. 0,
  67492. 0,
  67493. 0,
  67494. 0,
  67495. 0,
  67496. 0,
  67497. 0,
  67498. 1,
  67499. 0,
  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. 64,
  67514. 0,
  67515. 0,
  67516. 0,
  67517. 0,
  67518. 0,
  67519. 0,
  67520. 0,
  67521. 0,
  67522. 0,
  67523. 0,
  67524. 0,
  67525. 0,
  67526. 0,
  67527. 0,
  67528. 0,
  67529. 0,
  67530. 0,
  67531. 0,
  67532. 0,
  67533. 0,
  67534. 0,
  67535. 0,
  67536. 0,
  67537. 0,
  67538. 0,
  67539. 0,
  67540. 0,
  67541. 255,
  67542. 255,
  67543. 255,
  67544. 255
  67545. ]);
  67546. return box(types.mvhd, bytes);
  67547. };
  67548. sdtp = function(track) {
  67549. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  67550. for (i2 = 0; i2 < samples.length; i2++) {
  67551. flags = samples[i2].flags;
  67552. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  67553. }
  67554. return box(types.sdtp, bytes);
  67555. };
  67556. stbl = function(track) {
  67557. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  67558. };
  67559. (function() {
  67560. var videoSample, audioSample;
  67561. stsd = function(track) {
  67562. return box(types.stsd, new Uint8Array([
  67563. 0,
  67564. 0,
  67565. 0,
  67566. 0,
  67567. 0,
  67568. 0,
  67569. 0,
  67570. 1
  67571. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  67572. };
  67573. videoSample = function(track) {
  67574. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  67575. for (i2 = 0; i2 < sps.length; i2++) {
  67576. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  67577. sequenceParameterSets.push(sps[i2].byteLength & 255);
  67578. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  67579. }
  67580. for (i2 = 0; i2 < pps.length; i2++) {
  67581. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  67582. pictureParameterSets.push(pps[i2].byteLength & 255);
  67583. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  67584. }
  67585. avc1Box = [types.avc1, new Uint8Array([
  67586. 0,
  67587. 0,
  67588. 0,
  67589. 0,
  67590. 0,
  67591. 0,
  67592. 0,
  67593. 1,
  67594. 0,
  67595. 0,
  67596. 0,
  67597. 0,
  67598. 0,
  67599. 0,
  67600. 0,
  67601. 0,
  67602. 0,
  67603. 0,
  67604. 0,
  67605. 0,
  67606. 0,
  67607. 0,
  67608. 0,
  67609. 0,
  67610. (track.width & 65280) >> 8,
  67611. track.width & 255,
  67612. (track.height & 65280) >> 8,
  67613. track.height & 255,
  67614. 0,
  67615. 72,
  67616. 0,
  67617. 0,
  67618. 0,
  67619. 72,
  67620. 0,
  67621. 0,
  67622. 0,
  67623. 0,
  67624. 0,
  67625. 0,
  67626. 0,
  67627. 1,
  67628. 19,
  67629. 118,
  67630. 105,
  67631. 100,
  67632. 101,
  67633. 111,
  67634. 106,
  67635. 115,
  67636. 45,
  67637. 99,
  67638. 111,
  67639. 110,
  67640. 116,
  67641. 114,
  67642. 105,
  67643. 98,
  67644. 45,
  67645. 104,
  67646. 108,
  67647. 115,
  67648. 0,
  67649. 0,
  67650. 0,
  67651. 0,
  67652. 0,
  67653. 0,
  67654. 0,
  67655. 0,
  67656. 0,
  67657. 0,
  67658. 0,
  67659. 0,
  67660. 0,
  67661. 24,
  67662. 17,
  67663. 17
  67664. ]), box(types.avcC, new Uint8Array([
  67665. 1,
  67666. track.profileIdc,
  67667. track.profileCompatibility,
  67668. track.levelIdc,
  67669. 255
  67670. ].concat(
  67671. [sps.length],
  67672. sequenceParameterSets,
  67673. [pps.length],
  67674. pictureParameterSets
  67675. ))), box(types.btrt, new Uint8Array([
  67676. 0,
  67677. 28,
  67678. 156,
  67679. 128,
  67680. 0,
  67681. 45,
  67682. 198,
  67683. 192,
  67684. 0,
  67685. 45,
  67686. 198,
  67687. 192
  67688. ]))];
  67689. if (track.sarRatio) {
  67690. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  67691. 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])));
  67692. }
  67693. return box.apply(null, avc1Box);
  67694. };
  67695. audioSample = function(track) {
  67696. return box(types.mp4a, new Uint8Array([
  67697. 0,
  67698. 0,
  67699. 0,
  67700. 0,
  67701. 0,
  67702. 0,
  67703. 0,
  67704. 1,
  67705. 0,
  67706. 0,
  67707. 0,
  67708. 0,
  67709. 0,
  67710. 0,
  67711. 0,
  67712. 0,
  67713. (track.channelcount & 65280) >> 8,
  67714. track.channelcount & 255,
  67715. (track.samplesize & 65280) >> 8,
  67716. track.samplesize & 255,
  67717. 0,
  67718. 0,
  67719. 0,
  67720. 0,
  67721. (track.samplerate & 65280) >> 8,
  67722. track.samplerate & 255,
  67723. 0,
  67724. 0
  67725. ]), esds(track));
  67726. };
  67727. })();
  67728. tkhd = function(track) {
  67729. var result = new Uint8Array([
  67730. 0,
  67731. 0,
  67732. 0,
  67733. 7,
  67734. 0,
  67735. 0,
  67736. 0,
  67737. 0,
  67738. 0,
  67739. 0,
  67740. 0,
  67741. 0,
  67742. (track.id & 4278190080) >> 24,
  67743. (track.id & 16711680) >> 16,
  67744. (track.id & 65280) >> 8,
  67745. track.id & 255,
  67746. 0,
  67747. 0,
  67748. 0,
  67749. 0,
  67750. (track.duration & 4278190080) >> 24,
  67751. (track.duration & 16711680) >> 16,
  67752. (track.duration & 65280) >> 8,
  67753. track.duration & 255,
  67754. 0,
  67755. 0,
  67756. 0,
  67757. 0,
  67758. 0,
  67759. 0,
  67760. 0,
  67761. 0,
  67762. 0,
  67763. 0,
  67764. 0,
  67765. 0,
  67766. 1,
  67767. 0,
  67768. 0,
  67769. 0,
  67770. 0,
  67771. 1,
  67772. 0,
  67773. 0,
  67774. 0,
  67775. 0,
  67776. 0,
  67777. 0,
  67778. 0,
  67779. 0,
  67780. 0,
  67781. 0,
  67782. 0,
  67783. 0,
  67784. 0,
  67785. 0,
  67786. 0,
  67787. 1,
  67788. 0,
  67789. 0,
  67790. 0,
  67791. 0,
  67792. 0,
  67793. 0,
  67794. 0,
  67795. 0,
  67796. 0,
  67797. 0,
  67798. 0,
  67799. 0,
  67800. 0,
  67801. 0,
  67802. 64,
  67803. 0,
  67804. 0,
  67805. 0,
  67806. (track.width & 65280) >> 8,
  67807. track.width & 255,
  67808. 0,
  67809. 0,
  67810. (track.height & 65280) >> 8,
  67811. track.height & 255,
  67812. 0,
  67813. 0
  67814. ]);
  67815. return box(types.tkhd, result);
  67816. };
  67817. traf = function(track) {
  67818. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  67819. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  67820. 0,
  67821. 0,
  67822. 0,
  67823. 58,
  67824. (track.id & 4278190080) >> 24,
  67825. (track.id & 16711680) >> 16,
  67826. (track.id & 65280) >> 8,
  67827. track.id & 255,
  67828. 0,
  67829. 0,
  67830. 0,
  67831. 1,
  67832. 0,
  67833. 0,
  67834. 0,
  67835. 0,
  67836. 0,
  67837. 0,
  67838. 0,
  67839. 0,
  67840. 0,
  67841. 0,
  67842. 0,
  67843. 0
  67844. ]));
  67845. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  67846. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  67847. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  67848. 1,
  67849. 0,
  67850. 0,
  67851. 0,
  67852. upperWordBaseMediaDecodeTime >>> 24 & 255,
  67853. upperWordBaseMediaDecodeTime >>> 16 & 255,
  67854. upperWordBaseMediaDecodeTime >>> 8 & 255,
  67855. upperWordBaseMediaDecodeTime & 255,
  67856. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  67857. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  67858. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  67859. lowerWordBaseMediaDecodeTime & 255
  67860. ]));
  67861. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  67862. if (track.type === "audio") {
  67863. trackFragmentRun = trun$1(track, dataOffset);
  67864. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  67865. }
  67866. sampleDependencyTable = sdtp(track);
  67867. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  67868. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  67869. };
  67870. trak = function(track) {
  67871. track.duration = track.duration || 4294967295;
  67872. return box(types.trak, tkhd(track), mdia(track));
  67873. };
  67874. trex = function(track) {
  67875. var result = new Uint8Array([
  67876. 0,
  67877. 0,
  67878. 0,
  67879. 0,
  67880. (track.id & 4278190080) >> 24,
  67881. (track.id & 16711680) >> 16,
  67882. (track.id & 65280) >> 8,
  67883. track.id & 255,
  67884. 0,
  67885. 0,
  67886. 0,
  67887. 1,
  67888. 0,
  67889. 0,
  67890. 0,
  67891. 0,
  67892. 0,
  67893. 0,
  67894. 0,
  67895. 0,
  67896. 0,
  67897. 1,
  67898. 0,
  67899. 1
  67900. ]);
  67901. if (track.type !== "video") {
  67902. result[result.length - 1] = 0;
  67903. }
  67904. return box(types.trex, result);
  67905. };
  67906. (function() {
  67907. var audioTrun, videoTrun, trunHeader;
  67908. trunHeader = function(samples, offset) {
  67909. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  67910. if (samples.length) {
  67911. if (samples[0].duration !== void 0) {
  67912. durationPresent = 1;
  67913. }
  67914. if (samples[0].size !== void 0) {
  67915. sizePresent = 2;
  67916. }
  67917. if (samples[0].flags !== void 0) {
  67918. flagsPresent = 4;
  67919. }
  67920. if (samples[0].compositionTimeOffset !== void 0) {
  67921. compositionTimeOffset = 8;
  67922. }
  67923. }
  67924. return [
  67925. 0,
  67926. 0,
  67927. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  67928. 1,
  67929. (samples.length & 4278190080) >>> 24,
  67930. (samples.length & 16711680) >>> 16,
  67931. (samples.length & 65280) >>> 8,
  67932. samples.length & 255,
  67933. (offset & 4278190080) >>> 24,
  67934. (offset & 16711680) >>> 16,
  67935. (offset & 65280) >>> 8,
  67936. offset & 255
  67937. ];
  67938. };
  67939. videoTrun = function(track, offset) {
  67940. var bytesOffest, bytes, header, samples, sample, i2;
  67941. samples = track.samples || [];
  67942. offset += 8 + 12 + 16 * samples.length;
  67943. header = trunHeader(samples, offset);
  67944. bytes = new Uint8Array(header.length + samples.length * 16);
  67945. bytes.set(header);
  67946. bytesOffest = header.length;
  67947. for (i2 = 0; i2 < samples.length; i2++) {
  67948. sample = samples[i2];
  67949. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  67950. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  67951. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  67952. bytes[bytesOffest++] = sample.duration & 255;
  67953. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  67954. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  67955. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  67956. bytes[bytesOffest++] = sample.size & 255;
  67957. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  67958. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  67959. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  67960. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  67961. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  67962. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  67963. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  67964. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  67965. }
  67966. return box(types.trun, bytes);
  67967. };
  67968. audioTrun = function(track, offset) {
  67969. var bytes, bytesOffest, header, samples, sample, i2;
  67970. samples = track.samples || [];
  67971. offset += 8 + 12 + 8 * samples.length;
  67972. header = trunHeader(samples, offset);
  67973. bytes = new Uint8Array(header.length + samples.length * 8);
  67974. bytes.set(header);
  67975. bytesOffest = header.length;
  67976. for (i2 = 0; i2 < samples.length; i2++) {
  67977. sample = samples[i2];
  67978. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  67979. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  67980. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  67981. bytes[bytesOffest++] = sample.duration & 255;
  67982. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  67983. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  67984. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  67985. bytes[bytesOffest++] = sample.size & 255;
  67986. }
  67987. return box(types.trun, bytes);
  67988. };
  67989. trun$1 = function(track, offset) {
  67990. if (track.type === "audio") {
  67991. return audioTrun(track, offset);
  67992. }
  67993. return videoTrun(track, offset);
  67994. };
  67995. })();
  67996. var mp4Generator = {
  67997. ftyp,
  67998. mdat,
  67999. moof,
  68000. moov,
  68001. initSegment: function(tracks) {
  68002. var fileType = ftyp(), movie = moov(tracks), result;
  68003. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  68004. result.set(fileType);
  68005. result.set(movie, fileType.byteLength);
  68006. return result;
  68007. }
  68008. };
  68009. var groupNalsIntoFrames = function(nalUnits) {
  68010. var i2, currentNal, currentFrame = [], frames = [];
  68011. frames.byteLength = 0;
  68012. frames.nalCount = 0;
  68013. frames.duration = 0;
  68014. currentFrame.byteLength = 0;
  68015. for (i2 = 0; i2 < nalUnits.length; i2++) {
  68016. currentNal = nalUnits[i2];
  68017. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  68018. if (currentFrame.length) {
  68019. currentFrame.duration = currentNal.dts - currentFrame.dts;
  68020. frames.byteLength += currentFrame.byteLength;
  68021. frames.nalCount += currentFrame.length;
  68022. frames.duration += currentFrame.duration;
  68023. frames.push(currentFrame);
  68024. }
  68025. currentFrame = [currentNal];
  68026. currentFrame.byteLength = currentNal.data.byteLength;
  68027. currentFrame.pts = currentNal.pts;
  68028. currentFrame.dts = currentNal.dts;
  68029. } else {
  68030. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  68031. currentFrame.keyFrame = true;
  68032. }
  68033. currentFrame.duration = currentNal.dts - currentFrame.dts;
  68034. currentFrame.byteLength += currentNal.data.byteLength;
  68035. currentFrame.push(currentNal);
  68036. }
  68037. }
  68038. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  68039. currentFrame.duration = frames[frames.length - 1].duration;
  68040. }
  68041. frames.byteLength += currentFrame.byteLength;
  68042. frames.nalCount += currentFrame.length;
  68043. frames.duration += currentFrame.duration;
  68044. frames.push(currentFrame);
  68045. return frames;
  68046. };
  68047. var groupFramesIntoGops = function(frames) {
  68048. var i2, currentFrame, currentGop = [], gops = [];
  68049. currentGop.byteLength = 0;
  68050. currentGop.nalCount = 0;
  68051. currentGop.duration = 0;
  68052. currentGop.pts = frames[0].pts;
  68053. currentGop.dts = frames[0].dts;
  68054. gops.byteLength = 0;
  68055. gops.nalCount = 0;
  68056. gops.duration = 0;
  68057. gops.pts = frames[0].pts;
  68058. gops.dts = frames[0].dts;
  68059. for (i2 = 0; i2 < frames.length; i2++) {
  68060. currentFrame = frames[i2];
  68061. if (currentFrame.keyFrame) {
  68062. if (currentGop.length) {
  68063. gops.push(currentGop);
  68064. gops.byteLength += currentGop.byteLength;
  68065. gops.nalCount += currentGop.nalCount;
  68066. gops.duration += currentGop.duration;
  68067. }
  68068. currentGop = [currentFrame];
  68069. currentGop.nalCount = currentFrame.length;
  68070. currentGop.byteLength = currentFrame.byteLength;
  68071. currentGop.pts = currentFrame.pts;
  68072. currentGop.dts = currentFrame.dts;
  68073. currentGop.duration = currentFrame.duration;
  68074. } else {
  68075. currentGop.duration += currentFrame.duration;
  68076. currentGop.nalCount += currentFrame.length;
  68077. currentGop.byteLength += currentFrame.byteLength;
  68078. currentGop.push(currentFrame);
  68079. }
  68080. }
  68081. if (gops.length && currentGop.duration <= 0) {
  68082. currentGop.duration = gops[gops.length - 1].duration;
  68083. }
  68084. gops.byteLength += currentGop.byteLength;
  68085. gops.nalCount += currentGop.nalCount;
  68086. gops.duration += currentGop.duration;
  68087. gops.push(currentGop);
  68088. return gops;
  68089. };
  68090. var extendFirstKeyFrame = function(gops) {
  68091. var currentGop;
  68092. if (!gops[0][0].keyFrame && gops.length > 1) {
  68093. currentGop = gops.shift();
  68094. gops.byteLength -= currentGop.byteLength;
  68095. gops.nalCount -= currentGop.nalCount;
  68096. gops[0][0].dts = currentGop.dts;
  68097. gops[0][0].pts = currentGop.pts;
  68098. gops[0][0].duration += currentGop.duration;
  68099. }
  68100. return gops;
  68101. };
  68102. var createDefaultSample = function() {
  68103. return {
  68104. size: 0,
  68105. flags: {
  68106. isLeading: 0,
  68107. dependsOn: 1,
  68108. isDependedOn: 0,
  68109. hasRedundancy: 0,
  68110. degradationPriority: 0,
  68111. isNonSyncSample: 1
  68112. }
  68113. };
  68114. };
  68115. var sampleForFrame = function(frame, dataOffset) {
  68116. var sample = createDefaultSample();
  68117. sample.dataOffset = dataOffset;
  68118. sample.compositionTimeOffset = frame.pts - frame.dts;
  68119. sample.duration = frame.duration;
  68120. sample.size = 4 * frame.length;
  68121. sample.size += frame.byteLength;
  68122. if (frame.keyFrame) {
  68123. sample.flags.dependsOn = 2;
  68124. sample.flags.isNonSyncSample = 0;
  68125. }
  68126. return sample;
  68127. };
  68128. var generateSampleTable$1 = function(gops, baseDataOffset) {
  68129. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  68130. for (h2 = 0; h2 < gops.length; h2++) {
  68131. currentGop = gops[h2];
  68132. for (i2 = 0; i2 < currentGop.length; i2++) {
  68133. currentFrame = currentGop[i2];
  68134. sample = sampleForFrame(currentFrame, dataOffset);
  68135. dataOffset += sample.size;
  68136. samples.push(sample);
  68137. }
  68138. }
  68139. return samples;
  68140. };
  68141. var concatenateNalData = function(gops) {
  68142. 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);
  68143. for (h2 = 0; h2 < gops.length; h2++) {
  68144. currentGop = gops[h2];
  68145. for (i2 = 0; i2 < currentGop.length; i2++) {
  68146. currentFrame = currentGop[i2];
  68147. for (j = 0; j < currentFrame.length; j++) {
  68148. currentNal = currentFrame[j];
  68149. view.setUint32(dataOffset, currentNal.data.byteLength);
  68150. dataOffset += 4;
  68151. data.set(currentNal.data, dataOffset);
  68152. dataOffset += currentNal.data.byteLength;
  68153. }
  68154. }
  68155. }
  68156. return data;
  68157. };
  68158. var generateSampleTableForFrame = function(frame, baseDataOffset) {
  68159. var sample, dataOffset = baseDataOffset || 0, samples = [];
  68160. sample = sampleForFrame(frame, dataOffset);
  68161. samples.push(sample);
  68162. return samples;
  68163. };
  68164. var concatenateNalDataForFrame = function(frame) {
  68165. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  68166. for (i2 = 0; i2 < frame.length; i2++) {
  68167. currentNal = frame[i2];
  68168. view.setUint32(dataOffset, currentNal.data.byteLength);
  68169. dataOffset += 4;
  68170. data.set(currentNal.data, dataOffset);
  68171. dataOffset += currentNal.data.byteLength;
  68172. }
  68173. return data;
  68174. };
  68175. var frameUtils$1 = {
  68176. groupNalsIntoFrames,
  68177. groupFramesIntoGops,
  68178. extendFirstKeyFrame,
  68179. generateSampleTable: generateSampleTable$1,
  68180. concatenateNalData,
  68181. generateSampleTableForFrame,
  68182. concatenateNalDataForFrame
  68183. };
  68184. var highPrefix = [33, 16, 5, 32, 164, 27];
  68185. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  68186. var zeroFill = function(count) {
  68187. var a = [];
  68188. while (count--) {
  68189. a.push(0);
  68190. }
  68191. return a;
  68192. };
  68193. var makeTable = function(metaTable) {
  68194. return Object.keys(metaTable).reduce(function(obj, key) {
  68195. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  68196. return arr.concat(part);
  68197. }, []));
  68198. return obj;
  68199. }, {});
  68200. };
  68201. var silence;
  68202. var silence_1 = function() {
  68203. if (!silence) {
  68204. var coneOfSilence2 = {
  68205. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  68206. 88200: [highPrefix, [231], zeroFill(170), [56]],
  68207. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  68208. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  68209. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  68210. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  68211. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  68212. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  68213. 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]],
  68214. 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]],
  68215. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  68216. };
  68217. silence = makeTable(coneOfSilence2);
  68218. }
  68219. return silence;
  68220. };
  68221. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  68222. secondsToVideoTs2 = function(seconds) {
  68223. return seconds * ONE_SECOND_IN_TS$4;
  68224. };
  68225. secondsToAudioTs2 = function(seconds, sampleRate) {
  68226. return seconds * sampleRate;
  68227. };
  68228. videoTsToSeconds2 = function(timestamp) {
  68229. return timestamp / ONE_SECOND_IN_TS$4;
  68230. };
  68231. audioTsToSeconds2 = function(timestamp, sampleRate) {
  68232. return timestamp / sampleRate;
  68233. };
  68234. audioTsToVideoTs2 = function(timestamp, sampleRate) {
  68235. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  68236. };
  68237. videoTsToAudioTs2 = function(timestamp, sampleRate) {
  68238. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  68239. };
  68240. metadataTsToSeconds2 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  68241. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  68242. };
  68243. var clock$2 = {
  68244. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  68245. secondsToVideoTs: secondsToVideoTs2,
  68246. secondsToAudioTs: secondsToAudioTs2,
  68247. videoTsToSeconds: videoTsToSeconds2,
  68248. audioTsToSeconds: audioTsToSeconds2,
  68249. audioTsToVideoTs: audioTsToVideoTs2,
  68250. videoTsToAudioTs: videoTsToAudioTs2,
  68251. metadataTsToSeconds: metadataTsToSeconds2
  68252. };
  68253. var coneOfSilence = silence_1;
  68254. var clock$12 = clock$2;
  68255. var sumFrameByteLengths = function(array) {
  68256. var i2, currentObj, sum = 0;
  68257. for (i2 = 0; i2 < array.length; i2++) {
  68258. currentObj = array[i2];
  68259. sum += currentObj.data.byteLength;
  68260. }
  68261. return sum;
  68262. };
  68263. var prefixWithSilence = function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  68264. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  68265. if (!frames.length) {
  68266. return;
  68267. }
  68268. baseMediaDecodeTimeTs = clock$12.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  68269. frameDuration = Math.ceil(clock$12.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  68270. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  68271. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  68272. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  68273. audioFillDuration = audioFillFrameCount * frameDuration;
  68274. }
  68275. if (audioFillFrameCount < 1 || audioFillDuration > clock$12.ONE_SECOND_IN_TS / 2) {
  68276. return;
  68277. }
  68278. silentFrame = coneOfSilence()[track.samplerate];
  68279. if (!silentFrame) {
  68280. silentFrame = frames[0].data;
  68281. }
  68282. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  68283. firstFrame = frames[0];
  68284. frames.splice(0, 0, {
  68285. data: silentFrame,
  68286. dts: firstFrame.dts - frameDuration,
  68287. pts: firstFrame.pts - frameDuration
  68288. });
  68289. }
  68290. track.baseMediaDecodeTime -= Math.floor(clock$12.videoTsToAudioTs(audioFillDuration, track.samplerate));
  68291. return audioFillDuration;
  68292. };
  68293. var trimAdtsFramesByEarliestDts = function(adtsFrames, track, earliestAllowedDts) {
  68294. if (track.minSegmentDts >= earliestAllowedDts) {
  68295. return adtsFrames;
  68296. }
  68297. track.minSegmentDts = Infinity;
  68298. return adtsFrames.filter(function(currentFrame) {
  68299. if (currentFrame.dts >= earliestAllowedDts) {
  68300. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  68301. track.minSegmentPts = track.minSegmentDts;
  68302. return true;
  68303. }
  68304. return false;
  68305. });
  68306. };
  68307. var generateSampleTable = function(frames) {
  68308. var i2, currentFrame, samples = [];
  68309. for (i2 = 0; i2 < frames.length; i2++) {
  68310. currentFrame = frames[i2];
  68311. samples.push({
  68312. size: currentFrame.data.byteLength,
  68313. duration: 1024
  68314. });
  68315. }
  68316. return samples;
  68317. };
  68318. var concatenateFrameData = function(frames) {
  68319. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  68320. for (i2 = 0; i2 < frames.length; i2++) {
  68321. currentFrame = frames[i2];
  68322. data.set(currentFrame.data, dataOffset);
  68323. dataOffset += currentFrame.data.byteLength;
  68324. }
  68325. return data;
  68326. };
  68327. var audioFrameUtils$1 = {
  68328. prefixWithSilence,
  68329. trimAdtsFramesByEarliestDts,
  68330. generateSampleTable,
  68331. concatenateFrameData
  68332. };
  68333. var ONE_SECOND_IN_TS$3 = clock$2.ONE_SECOND_IN_TS;
  68334. var collectDtsInfo = function(track, data) {
  68335. if (typeof data.pts === "number") {
  68336. if (track.timelineStartInfo.pts === void 0) {
  68337. track.timelineStartInfo.pts = data.pts;
  68338. }
  68339. if (track.minSegmentPts === void 0) {
  68340. track.minSegmentPts = data.pts;
  68341. } else {
  68342. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  68343. }
  68344. if (track.maxSegmentPts === void 0) {
  68345. track.maxSegmentPts = data.pts;
  68346. } else {
  68347. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  68348. }
  68349. }
  68350. if (typeof data.dts === "number") {
  68351. if (track.timelineStartInfo.dts === void 0) {
  68352. track.timelineStartInfo.dts = data.dts;
  68353. }
  68354. if (track.minSegmentDts === void 0) {
  68355. track.minSegmentDts = data.dts;
  68356. } else {
  68357. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  68358. }
  68359. if (track.maxSegmentDts === void 0) {
  68360. track.maxSegmentDts = data.dts;
  68361. } else {
  68362. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  68363. }
  68364. }
  68365. };
  68366. var clearDtsInfo = function(track) {
  68367. delete track.minSegmentDts;
  68368. delete track.maxSegmentDts;
  68369. delete track.minSegmentPts;
  68370. delete track.maxSegmentPts;
  68371. };
  68372. var calculateTrackBaseMediaDecodeTime = function(track, keepOriginalTimestamps) {
  68373. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  68374. if (!keepOriginalTimestamps) {
  68375. minSegmentDts -= track.timelineStartInfo.dts;
  68376. }
  68377. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  68378. baseMediaDecodeTime += minSegmentDts;
  68379. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  68380. if (track.type === "audio") {
  68381. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  68382. baseMediaDecodeTime *= scale;
  68383. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  68384. }
  68385. return baseMediaDecodeTime;
  68386. };
  68387. var trackDecodeInfo$1 = {
  68388. clearDtsInfo,
  68389. calculateTrackBaseMediaDecodeTime,
  68390. collectDtsInfo
  68391. };
  68392. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  68393. var parseSei = function(bytes) {
  68394. var i2 = 0, result = {
  68395. payloadType: -1,
  68396. payloadSize: 0
  68397. }, payloadType = 0, payloadSize = 0;
  68398. while (i2 < bytes.byteLength) {
  68399. if (bytes[i2] === RBSP_TRAILING_BITS) {
  68400. break;
  68401. }
  68402. while (bytes[i2] === 255) {
  68403. payloadType += 255;
  68404. i2++;
  68405. }
  68406. payloadType += bytes[i2++];
  68407. while (bytes[i2] === 255) {
  68408. payloadSize += 255;
  68409. i2++;
  68410. }
  68411. payloadSize += bytes[i2++];
  68412. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  68413. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  68414. if (userIdentifier === "GA94") {
  68415. result.payloadType = payloadType;
  68416. result.payloadSize = payloadSize;
  68417. result.payload = bytes.subarray(i2, i2 + payloadSize);
  68418. break;
  68419. } else {
  68420. result.payload = void 0;
  68421. }
  68422. }
  68423. i2 += payloadSize;
  68424. payloadType = 0;
  68425. payloadSize = 0;
  68426. }
  68427. return result;
  68428. };
  68429. var parseUserData = function(sei) {
  68430. if (sei.payload[0] !== 181) {
  68431. return null;
  68432. }
  68433. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  68434. return null;
  68435. }
  68436. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  68437. return null;
  68438. }
  68439. if (sei.payload[7] !== 3) {
  68440. return null;
  68441. }
  68442. return sei.payload.subarray(8, sei.payload.length - 1);
  68443. };
  68444. var parseCaptionPackets = function(pts, userData) {
  68445. var results = [], i2, count, offset, data;
  68446. if (!(userData[0] & 64)) {
  68447. return results;
  68448. }
  68449. count = userData[0] & 31;
  68450. for (i2 = 0; i2 < count; i2++) {
  68451. offset = i2 * 3;
  68452. data = {
  68453. type: userData[offset + 2] & 3,
  68454. pts
  68455. };
  68456. if (userData[offset + 2] & 4) {
  68457. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  68458. results.push(data);
  68459. }
  68460. }
  68461. return results;
  68462. };
  68463. var discardEmulationPreventionBytes$12 = function(data) {
  68464. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  68465. while (i2 < length - 2) {
  68466. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  68467. emulationPreventionBytesPositions.push(i2 + 2);
  68468. i2 += 2;
  68469. } else {
  68470. i2++;
  68471. }
  68472. }
  68473. if (emulationPreventionBytesPositions.length === 0) {
  68474. return data;
  68475. }
  68476. newLength = length - emulationPreventionBytesPositions.length;
  68477. newData = new Uint8Array(newLength);
  68478. var sourceIndex = 0;
  68479. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  68480. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  68481. sourceIndex++;
  68482. emulationPreventionBytesPositions.shift();
  68483. }
  68484. newData[i2] = data[sourceIndex];
  68485. }
  68486. return newData;
  68487. };
  68488. var captionPacketParser = {
  68489. parseSei,
  68490. parseUserData,
  68491. parseCaptionPackets,
  68492. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  68493. USER_DATA_REGISTERED_ITU_T_T35
  68494. };
  68495. var Stream$7 = stream;
  68496. var cea708Parser = captionPacketParser;
  68497. var CaptionStream$2 = function(options2) {
  68498. options2 = options2 || {};
  68499. CaptionStream$2.prototype.init.call(this);
  68500. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  68501. this.captionPackets_ = [];
  68502. this.ccStreams_ = [
  68503. new Cea608Stream(0, 0),
  68504. new Cea608Stream(0, 1),
  68505. new Cea608Stream(1, 0),
  68506. new Cea608Stream(1, 1)
  68507. ];
  68508. if (this.parse708captions_) {
  68509. this.cc708Stream_ = new Cea708Stream({
  68510. captionServices: options2.captionServices
  68511. });
  68512. }
  68513. this.reset();
  68514. this.ccStreams_.forEach(function(cc) {
  68515. cc.on("data", this.trigger.bind(this, "data"));
  68516. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  68517. cc.on("done", this.trigger.bind(this, "done"));
  68518. }, this);
  68519. if (this.parse708captions_) {
  68520. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  68521. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  68522. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  68523. }
  68524. };
  68525. CaptionStream$2.prototype = new Stream$7();
  68526. CaptionStream$2.prototype.push = function(event2) {
  68527. var sei, userData, newCaptionPackets;
  68528. if (event2.nalUnitType !== "sei_rbsp") {
  68529. return;
  68530. }
  68531. sei = cea708Parser.parseSei(event2.escapedRBSP);
  68532. if (!sei.payload) {
  68533. return;
  68534. }
  68535. if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) {
  68536. return;
  68537. }
  68538. userData = cea708Parser.parseUserData(sei);
  68539. if (!userData) {
  68540. return;
  68541. }
  68542. if (event2.dts < this.latestDts_) {
  68543. this.ignoreNextEqualDts_ = true;
  68544. return;
  68545. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  68546. this.numSameDts_--;
  68547. if (!this.numSameDts_) {
  68548. this.ignoreNextEqualDts_ = false;
  68549. }
  68550. return;
  68551. }
  68552. newCaptionPackets = cea708Parser.parseCaptionPackets(event2.pts, userData);
  68553. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  68554. if (this.latestDts_ !== event2.dts) {
  68555. this.numSameDts_ = 0;
  68556. }
  68557. this.numSameDts_++;
  68558. this.latestDts_ = event2.dts;
  68559. };
  68560. CaptionStream$2.prototype.flushCCStreams = function(flushType) {
  68561. this.ccStreams_.forEach(function(cc) {
  68562. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  68563. }, this);
  68564. };
  68565. CaptionStream$2.prototype.flushStream = function(flushType) {
  68566. if (!this.captionPackets_.length) {
  68567. this.flushCCStreams(flushType);
  68568. return;
  68569. }
  68570. this.captionPackets_.forEach(function(elem, idx) {
  68571. elem.presortIndex = idx;
  68572. });
  68573. this.captionPackets_.sort(function(a, b) {
  68574. if (a.pts === b.pts) {
  68575. return a.presortIndex - b.presortIndex;
  68576. }
  68577. return a.pts - b.pts;
  68578. });
  68579. this.captionPackets_.forEach(function(packet) {
  68580. if (packet.type < 2) {
  68581. this.dispatchCea608Packet(packet);
  68582. } else {
  68583. this.dispatchCea708Packet(packet);
  68584. }
  68585. }, this);
  68586. this.captionPackets_.length = 0;
  68587. this.flushCCStreams(flushType);
  68588. };
  68589. CaptionStream$2.prototype.flush = function() {
  68590. return this.flushStream("flush");
  68591. };
  68592. CaptionStream$2.prototype.partialFlush = function() {
  68593. return this.flushStream("partialFlush");
  68594. };
  68595. CaptionStream$2.prototype.reset = function() {
  68596. this.latestDts_ = null;
  68597. this.ignoreNextEqualDts_ = false;
  68598. this.numSameDts_ = 0;
  68599. this.activeCea608Channel_ = [null, null];
  68600. this.ccStreams_.forEach(function(ccStream) {
  68601. ccStream.reset();
  68602. });
  68603. };
  68604. CaptionStream$2.prototype.dispatchCea608Packet = function(packet) {
  68605. if (this.setsTextOrXDSActive(packet)) {
  68606. this.activeCea608Channel_[packet.type] = null;
  68607. } else if (this.setsChannel1Active(packet)) {
  68608. this.activeCea608Channel_[packet.type] = 0;
  68609. } else if (this.setsChannel2Active(packet)) {
  68610. this.activeCea608Channel_[packet.type] = 1;
  68611. }
  68612. if (this.activeCea608Channel_[packet.type] === null) {
  68613. return;
  68614. }
  68615. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  68616. };
  68617. CaptionStream$2.prototype.setsChannel1Active = function(packet) {
  68618. return (packet.ccData & 30720) === 4096;
  68619. };
  68620. CaptionStream$2.prototype.setsChannel2Active = function(packet) {
  68621. return (packet.ccData & 30720) === 6144;
  68622. };
  68623. CaptionStream$2.prototype.setsTextOrXDSActive = function(packet) {
  68624. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  68625. };
  68626. CaptionStream$2.prototype.dispatchCea708Packet = function(packet) {
  68627. if (this.parse708captions_) {
  68628. this.cc708Stream_.push(packet);
  68629. }
  68630. };
  68631. var CHARACTER_TRANSLATION_708 = {
  68632. 127: 9834,
  68633. 4128: 32,
  68634. 4129: 160,
  68635. 4133: 8230,
  68636. 4138: 352,
  68637. 4140: 338,
  68638. 4144: 9608,
  68639. 4145: 8216,
  68640. 4146: 8217,
  68641. 4147: 8220,
  68642. 4148: 8221,
  68643. 4149: 8226,
  68644. 4153: 8482,
  68645. 4154: 353,
  68646. 4156: 339,
  68647. 4157: 8480,
  68648. 4159: 376,
  68649. 4214: 8539,
  68650. 4215: 8540,
  68651. 4216: 8541,
  68652. 4217: 8542,
  68653. 4218: 9168,
  68654. 4219: 9124,
  68655. 4220: 9123,
  68656. 4221: 9135,
  68657. 4222: 9126,
  68658. 4223: 9121,
  68659. 4256: 12600
  68660. };
  68661. var get708CharFromCode = function(code) {
  68662. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  68663. if (code & 4096 && code === newCode) {
  68664. return "";
  68665. }
  68666. return String.fromCharCode(newCode);
  68667. };
  68668. var within708TextBlock = function(b) {
  68669. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  68670. };
  68671. var Cea708Window = function(windowNum) {
  68672. this.windowNum = windowNum;
  68673. this.reset();
  68674. };
  68675. Cea708Window.prototype.reset = function() {
  68676. this.clearText();
  68677. this.pendingNewLine = false;
  68678. this.winAttr = {};
  68679. this.penAttr = {};
  68680. this.penLoc = {};
  68681. this.penColor = {};
  68682. this.visible = 0;
  68683. this.rowLock = 0;
  68684. this.columnLock = 0;
  68685. this.priority = 0;
  68686. this.relativePositioning = 0;
  68687. this.anchorVertical = 0;
  68688. this.anchorHorizontal = 0;
  68689. this.anchorPoint = 0;
  68690. this.rowCount = 1;
  68691. this.virtualRowCount = this.rowCount + 1;
  68692. this.columnCount = 41;
  68693. this.windowStyle = 0;
  68694. this.penStyle = 0;
  68695. };
  68696. Cea708Window.prototype.getText = function() {
  68697. return this.rows.join("\n");
  68698. };
  68699. Cea708Window.prototype.clearText = function() {
  68700. this.rows = [""];
  68701. this.rowIdx = 0;
  68702. };
  68703. Cea708Window.prototype.newLine = function(pts) {
  68704. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  68705. this.beforeRowOverflow(pts);
  68706. }
  68707. if (this.rows.length > 0) {
  68708. this.rows.push("");
  68709. this.rowIdx++;
  68710. }
  68711. while (this.rows.length > this.virtualRowCount) {
  68712. this.rows.shift();
  68713. this.rowIdx--;
  68714. }
  68715. };
  68716. Cea708Window.prototype.isEmpty = function() {
  68717. if (this.rows.length === 0) {
  68718. return true;
  68719. } else if (this.rows.length === 1) {
  68720. return this.rows[0] === "";
  68721. }
  68722. return false;
  68723. };
  68724. Cea708Window.prototype.addText = function(text) {
  68725. this.rows[this.rowIdx] += text;
  68726. };
  68727. Cea708Window.prototype.backspace = function() {
  68728. if (!this.isEmpty()) {
  68729. var row = this.rows[this.rowIdx];
  68730. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  68731. }
  68732. };
  68733. var Cea708Service = function(serviceNum, encoding, stream2) {
  68734. this.serviceNum = serviceNum;
  68735. this.text = "";
  68736. this.currentWindow = new Cea708Window(-1);
  68737. this.windows = [];
  68738. this.stream = stream2;
  68739. if (typeof encoding === "string") {
  68740. this.createTextDecoder(encoding);
  68741. }
  68742. };
  68743. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  68744. this.startPts = pts;
  68745. for (var win3 = 0; win3 < 8; win3++) {
  68746. this.windows[win3] = new Cea708Window(win3);
  68747. if (typeof beforeRowOverflow === "function") {
  68748. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  68749. }
  68750. }
  68751. };
  68752. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  68753. this.currentWindow = this.windows[windowNum];
  68754. };
  68755. Cea708Service.prototype.createTextDecoder = function(encoding) {
  68756. if (typeof TextDecoder === "undefined") {
  68757. this.stream.trigger("log", {
  68758. level: "warn",
  68759. message: "The `encoding` option is unsupported without TextDecoder support"
  68760. });
  68761. } else {
  68762. try {
  68763. this.textDecoder_ = new TextDecoder(encoding);
  68764. } catch (error) {
  68765. this.stream.trigger("log", {
  68766. level: "warn",
  68767. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  68768. });
  68769. }
  68770. }
  68771. };
  68772. var Cea708Stream = function(options2) {
  68773. options2 = options2 || {};
  68774. Cea708Stream.prototype.init.call(this);
  68775. var self2 = this;
  68776. var captionServices = options2.captionServices || {};
  68777. var captionServiceEncodings = {};
  68778. var serviceProps;
  68779. Object.keys(captionServices).forEach((serviceName) => {
  68780. serviceProps = captionServices[serviceName];
  68781. if (/^SERVICE/.test(serviceName)) {
  68782. captionServiceEncodings[serviceName] = serviceProps.encoding;
  68783. }
  68784. });
  68785. this.serviceEncodings = captionServiceEncodings;
  68786. this.current708Packet = null;
  68787. this.services = {};
  68788. this.push = function(packet) {
  68789. if (packet.type === 3) {
  68790. self2.new708Packet();
  68791. self2.add708Bytes(packet);
  68792. } else {
  68793. if (self2.current708Packet === null) {
  68794. self2.new708Packet();
  68795. }
  68796. self2.add708Bytes(packet);
  68797. }
  68798. };
  68799. };
  68800. Cea708Stream.prototype = new Stream$7();
  68801. Cea708Stream.prototype.new708Packet = function() {
  68802. if (this.current708Packet !== null) {
  68803. this.push708Packet();
  68804. }
  68805. this.current708Packet = {
  68806. data: [],
  68807. ptsVals: []
  68808. };
  68809. };
  68810. Cea708Stream.prototype.add708Bytes = function(packet) {
  68811. var data = packet.ccData;
  68812. var byte0 = data >>> 8;
  68813. var byte1 = data & 255;
  68814. this.current708Packet.ptsVals.push(packet.pts);
  68815. this.current708Packet.data.push(byte0);
  68816. this.current708Packet.data.push(byte1);
  68817. };
  68818. Cea708Stream.prototype.push708Packet = function() {
  68819. var packet708 = this.current708Packet;
  68820. var packetData = packet708.data;
  68821. var serviceNum = null;
  68822. var blockSize = null;
  68823. var i2 = 0;
  68824. var b = packetData[i2++];
  68825. packet708.seq = b >> 6;
  68826. packet708.sizeCode = b & 63;
  68827. for (; i2 < packetData.length; i2++) {
  68828. b = packetData[i2++];
  68829. serviceNum = b >> 5;
  68830. blockSize = b & 31;
  68831. if (serviceNum === 7 && blockSize > 0) {
  68832. b = packetData[i2++];
  68833. serviceNum = b;
  68834. }
  68835. this.pushServiceBlock(serviceNum, i2, blockSize);
  68836. if (blockSize > 0) {
  68837. i2 += blockSize - 1;
  68838. }
  68839. }
  68840. };
  68841. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  68842. var b;
  68843. var i2 = start2;
  68844. var packetData = this.current708Packet.data;
  68845. var service = this.services[serviceNum];
  68846. if (!service) {
  68847. service = this.initService(serviceNum, i2);
  68848. }
  68849. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  68850. b = packetData[i2];
  68851. if (within708TextBlock(b)) {
  68852. i2 = this.handleText(i2, service);
  68853. } else if (b === 24) {
  68854. i2 = this.multiByteCharacter(i2, service);
  68855. } else if (b === 16) {
  68856. i2 = this.extendedCommands(i2, service);
  68857. } else if (128 <= b && b <= 135) {
  68858. i2 = this.setCurrentWindow(i2, service);
  68859. } else if (152 <= b && b <= 159) {
  68860. i2 = this.defineWindow(i2, service);
  68861. } else if (b === 136) {
  68862. i2 = this.clearWindows(i2, service);
  68863. } else if (b === 140) {
  68864. i2 = this.deleteWindows(i2, service);
  68865. } else if (b === 137) {
  68866. i2 = this.displayWindows(i2, service);
  68867. } else if (b === 138) {
  68868. i2 = this.hideWindows(i2, service);
  68869. } else if (b === 139) {
  68870. i2 = this.toggleWindows(i2, service);
  68871. } else if (b === 151) {
  68872. i2 = this.setWindowAttributes(i2, service);
  68873. } else if (b === 144) {
  68874. i2 = this.setPenAttributes(i2, service);
  68875. } else if (b === 145) {
  68876. i2 = this.setPenColor(i2, service);
  68877. } else if (b === 146) {
  68878. i2 = this.setPenLocation(i2, service);
  68879. } else if (b === 143) {
  68880. service = this.reset(i2, service);
  68881. } else if (b === 8) {
  68882. service.currentWindow.backspace();
  68883. } else if (b === 12) {
  68884. service.currentWindow.clearText();
  68885. } else if (b === 13) {
  68886. service.currentWindow.pendingNewLine = true;
  68887. } else if (b === 14) {
  68888. service.currentWindow.clearText();
  68889. } else if (b === 141) {
  68890. i2++;
  68891. } else
  68892. ;
  68893. }
  68894. };
  68895. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  68896. var packetData = this.current708Packet.data;
  68897. var b = packetData[++i2];
  68898. if (within708TextBlock(b)) {
  68899. i2 = this.handleText(i2, service, {
  68900. isExtended: true
  68901. });
  68902. }
  68903. return i2;
  68904. };
  68905. Cea708Stream.prototype.getPts = function(byteIndex) {
  68906. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  68907. };
  68908. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  68909. var serviceName = "SERVICE" + serviceNum;
  68910. var self2 = this;
  68911. var serviceName;
  68912. var encoding;
  68913. if (serviceName in this.serviceEncodings) {
  68914. encoding = this.serviceEncodings[serviceName];
  68915. }
  68916. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  68917. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  68918. self2.flushDisplayed(pts, self2.services[serviceNum]);
  68919. });
  68920. return this.services[serviceNum];
  68921. };
  68922. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  68923. var isExtended = options2 && options2.isExtended;
  68924. var isMultiByte = options2 && options2.isMultiByte;
  68925. var packetData = this.current708Packet.data;
  68926. var extended = isExtended ? 4096 : 0;
  68927. var currentByte = packetData[i2];
  68928. var nextByte = packetData[i2 + 1];
  68929. var win3 = service.currentWindow;
  68930. var char;
  68931. var charCodeArray;
  68932. if (service.textDecoder_ && !isExtended) {
  68933. if (isMultiByte) {
  68934. charCodeArray = [currentByte, nextByte];
  68935. i2++;
  68936. } else {
  68937. charCodeArray = [currentByte];
  68938. }
  68939. char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  68940. } else {
  68941. char = get708CharFromCode(extended | currentByte);
  68942. }
  68943. if (win3.pendingNewLine && !win3.isEmpty()) {
  68944. win3.newLine(this.getPts(i2));
  68945. }
  68946. win3.pendingNewLine = false;
  68947. win3.addText(char);
  68948. return i2;
  68949. };
  68950. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  68951. var packetData = this.current708Packet.data;
  68952. var firstByte = packetData[i2 + 1];
  68953. var secondByte = packetData[i2 + 2];
  68954. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  68955. i2 = this.handleText(++i2, service, {
  68956. isMultiByte: true
  68957. });
  68958. }
  68959. return i2;
  68960. };
  68961. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  68962. var packetData = this.current708Packet.data;
  68963. var b = packetData[i2];
  68964. var windowNum = b & 7;
  68965. service.setCurrentWindow(windowNum);
  68966. return i2;
  68967. };
  68968. Cea708Stream.prototype.defineWindow = function(i2, service) {
  68969. var packetData = this.current708Packet.data;
  68970. var b = packetData[i2];
  68971. var windowNum = b & 7;
  68972. service.setCurrentWindow(windowNum);
  68973. var win3 = service.currentWindow;
  68974. b = packetData[++i2];
  68975. win3.visible = (b & 32) >> 5;
  68976. win3.rowLock = (b & 16) >> 4;
  68977. win3.columnLock = (b & 8) >> 3;
  68978. win3.priority = b & 7;
  68979. b = packetData[++i2];
  68980. win3.relativePositioning = (b & 128) >> 7;
  68981. win3.anchorVertical = b & 127;
  68982. b = packetData[++i2];
  68983. win3.anchorHorizontal = b;
  68984. b = packetData[++i2];
  68985. win3.anchorPoint = (b & 240) >> 4;
  68986. win3.rowCount = b & 15;
  68987. b = packetData[++i2];
  68988. win3.columnCount = b & 63;
  68989. b = packetData[++i2];
  68990. win3.windowStyle = (b & 56) >> 3;
  68991. win3.penStyle = b & 7;
  68992. win3.virtualRowCount = win3.rowCount + 1;
  68993. return i2;
  68994. };
  68995. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  68996. var packetData = this.current708Packet.data;
  68997. var b = packetData[i2];
  68998. var winAttr = service.currentWindow.winAttr;
  68999. b = packetData[++i2];
  69000. winAttr.fillOpacity = (b & 192) >> 6;
  69001. winAttr.fillRed = (b & 48) >> 4;
  69002. winAttr.fillGreen = (b & 12) >> 2;
  69003. winAttr.fillBlue = b & 3;
  69004. b = packetData[++i2];
  69005. winAttr.borderType = (b & 192) >> 6;
  69006. winAttr.borderRed = (b & 48) >> 4;
  69007. winAttr.borderGreen = (b & 12) >> 2;
  69008. winAttr.borderBlue = b & 3;
  69009. b = packetData[++i2];
  69010. winAttr.borderType += (b & 128) >> 5;
  69011. winAttr.wordWrap = (b & 64) >> 6;
  69012. winAttr.printDirection = (b & 48) >> 4;
  69013. winAttr.scrollDirection = (b & 12) >> 2;
  69014. winAttr.justify = b & 3;
  69015. b = packetData[++i2];
  69016. winAttr.effectSpeed = (b & 240) >> 4;
  69017. winAttr.effectDirection = (b & 12) >> 2;
  69018. winAttr.displayEffect = b & 3;
  69019. return i2;
  69020. };
  69021. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  69022. var displayedText = [];
  69023. for (var winId = 0; winId < 8; winId++) {
  69024. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  69025. displayedText.push(service.windows[winId].getText());
  69026. }
  69027. }
  69028. service.endPts = pts;
  69029. service.text = displayedText.join("\n\n");
  69030. this.pushCaption(service);
  69031. service.startPts = pts;
  69032. };
  69033. Cea708Stream.prototype.pushCaption = function(service) {
  69034. if (service.text !== "") {
  69035. this.trigger("data", {
  69036. startPts: service.startPts,
  69037. endPts: service.endPts,
  69038. text: service.text,
  69039. stream: "cc708_" + service.serviceNum
  69040. });
  69041. service.text = "";
  69042. service.startPts = service.endPts;
  69043. }
  69044. };
  69045. Cea708Stream.prototype.displayWindows = function(i2, service) {
  69046. var packetData = this.current708Packet.data;
  69047. var b = packetData[++i2];
  69048. var pts = this.getPts(i2);
  69049. this.flushDisplayed(pts, service);
  69050. for (var winId = 0; winId < 8; winId++) {
  69051. if (b & 1 << winId) {
  69052. service.windows[winId].visible = 1;
  69053. }
  69054. }
  69055. return i2;
  69056. };
  69057. Cea708Stream.prototype.hideWindows = function(i2, service) {
  69058. var packetData = this.current708Packet.data;
  69059. var b = packetData[++i2];
  69060. var pts = this.getPts(i2);
  69061. this.flushDisplayed(pts, service);
  69062. for (var winId = 0; winId < 8; winId++) {
  69063. if (b & 1 << winId) {
  69064. service.windows[winId].visible = 0;
  69065. }
  69066. }
  69067. return i2;
  69068. };
  69069. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  69070. var packetData = this.current708Packet.data;
  69071. var b = packetData[++i2];
  69072. var pts = this.getPts(i2);
  69073. this.flushDisplayed(pts, service);
  69074. for (var winId = 0; winId < 8; winId++) {
  69075. if (b & 1 << winId) {
  69076. service.windows[winId].visible ^= 1;
  69077. }
  69078. }
  69079. return i2;
  69080. };
  69081. Cea708Stream.prototype.clearWindows = function(i2, service) {
  69082. var packetData = this.current708Packet.data;
  69083. var b = packetData[++i2];
  69084. var pts = this.getPts(i2);
  69085. this.flushDisplayed(pts, service);
  69086. for (var winId = 0; winId < 8; winId++) {
  69087. if (b & 1 << winId) {
  69088. service.windows[winId].clearText();
  69089. }
  69090. }
  69091. return i2;
  69092. };
  69093. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  69094. var packetData = this.current708Packet.data;
  69095. var b = packetData[++i2];
  69096. var pts = this.getPts(i2);
  69097. this.flushDisplayed(pts, service);
  69098. for (var winId = 0; winId < 8; winId++) {
  69099. if (b & 1 << winId) {
  69100. service.windows[winId].reset();
  69101. }
  69102. }
  69103. return i2;
  69104. };
  69105. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  69106. var packetData = this.current708Packet.data;
  69107. var b = packetData[i2];
  69108. var penAttr = service.currentWindow.penAttr;
  69109. b = packetData[++i2];
  69110. penAttr.textTag = (b & 240) >> 4;
  69111. penAttr.offset = (b & 12) >> 2;
  69112. penAttr.penSize = b & 3;
  69113. b = packetData[++i2];
  69114. penAttr.italics = (b & 128) >> 7;
  69115. penAttr.underline = (b & 64) >> 6;
  69116. penAttr.edgeType = (b & 56) >> 3;
  69117. penAttr.fontStyle = b & 7;
  69118. return i2;
  69119. };
  69120. Cea708Stream.prototype.setPenColor = function(i2, service) {
  69121. var packetData = this.current708Packet.data;
  69122. var b = packetData[i2];
  69123. var penColor = service.currentWindow.penColor;
  69124. b = packetData[++i2];
  69125. penColor.fgOpacity = (b & 192) >> 6;
  69126. penColor.fgRed = (b & 48) >> 4;
  69127. penColor.fgGreen = (b & 12) >> 2;
  69128. penColor.fgBlue = b & 3;
  69129. b = packetData[++i2];
  69130. penColor.bgOpacity = (b & 192) >> 6;
  69131. penColor.bgRed = (b & 48) >> 4;
  69132. penColor.bgGreen = (b & 12) >> 2;
  69133. penColor.bgBlue = b & 3;
  69134. b = packetData[++i2];
  69135. penColor.edgeRed = (b & 48) >> 4;
  69136. penColor.edgeGreen = (b & 12) >> 2;
  69137. penColor.edgeBlue = b & 3;
  69138. return i2;
  69139. };
  69140. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  69141. var packetData = this.current708Packet.data;
  69142. var b = packetData[i2];
  69143. var penLoc = service.currentWindow.penLoc;
  69144. service.currentWindow.pendingNewLine = true;
  69145. b = packetData[++i2];
  69146. penLoc.row = b & 15;
  69147. b = packetData[++i2];
  69148. penLoc.column = b & 63;
  69149. return i2;
  69150. };
  69151. Cea708Stream.prototype.reset = function(i2, service) {
  69152. var pts = this.getPts(i2);
  69153. this.flushDisplayed(pts, service);
  69154. return this.initService(service.serviceNum, i2);
  69155. };
  69156. var CHARACTER_TRANSLATION = {
  69157. 42: 225,
  69158. 92: 233,
  69159. 94: 237,
  69160. 95: 243,
  69161. 96: 250,
  69162. 123: 231,
  69163. 124: 247,
  69164. 125: 209,
  69165. 126: 241,
  69166. 127: 9608,
  69167. 304: 174,
  69168. 305: 176,
  69169. 306: 189,
  69170. 307: 191,
  69171. 308: 8482,
  69172. 309: 162,
  69173. 310: 163,
  69174. 311: 9834,
  69175. 312: 224,
  69176. 313: 160,
  69177. 314: 232,
  69178. 315: 226,
  69179. 316: 234,
  69180. 317: 238,
  69181. 318: 244,
  69182. 319: 251,
  69183. 544: 193,
  69184. 545: 201,
  69185. 546: 211,
  69186. 547: 218,
  69187. 548: 220,
  69188. 549: 252,
  69189. 550: 8216,
  69190. 551: 161,
  69191. 552: 42,
  69192. 553: 39,
  69193. 554: 8212,
  69194. 555: 169,
  69195. 556: 8480,
  69196. 557: 8226,
  69197. 558: 8220,
  69198. 559: 8221,
  69199. 560: 192,
  69200. 561: 194,
  69201. 562: 199,
  69202. 563: 200,
  69203. 564: 202,
  69204. 565: 203,
  69205. 566: 235,
  69206. 567: 206,
  69207. 568: 207,
  69208. 569: 239,
  69209. 570: 212,
  69210. 571: 217,
  69211. 572: 249,
  69212. 573: 219,
  69213. 574: 171,
  69214. 575: 187,
  69215. 800: 195,
  69216. 801: 227,
  69217. 802: 205,
  69218. 803: 204,
  69219. 804: 236,
  69220. 805: 210,
  69221. 806: 242,
  69222. 807: 213,
  69223. 808: 245,
  69224. 809: 123,
  69225. 810: 125,
  69226. 811: 92,
  69227. 812: 94,
  69228. 813: 95,
  69229. 814: 124,
  69230. 815: 126,
  69231. 816: 196,
  69232. 817: 228,
  69233. 818: 214,
  69234. 819: 246,
  69235. 820: 223,
  69236. 821: 165,
  69237. 822: 164,
  69238. 823: 9474,
  69239. 824: 197,
  69240. 825: 229,
  69241. 826: 216,
  69242. 827: 248,
  69243. 828: 9484,
  69244. 829: 9488,
  69245. 830: 9492,
  69246. 831: 9496
  69247. };
  69248. var getCharFromCode = function(code) {
  69249. if (code === null) {
  69250. return "";
  69251. }
  69252. code = CHARACTER_TRANSLATION[code] || code;
  69253. return String.fromCharCode(code);
  69254. };
  69255. var BOTTOM_ROW = 14;
  69256. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  69257. var createDisplayBuffer = function() {
  69258. var result = [], i2 = BOTTOM_ROW + 1;
  69259. while (i2--) {
  69260. result.push("");
  69261. }
  69262. return result;
  69263. };
  69264. var Cea608Stream = function(field, dataChannel) {
  69265. Cea608Stream.prototype.init.call(this);
  69266. this.field_ = field || 0;
  69267. this.dataChannel_ = dataChannel || 0;
  69268. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  69269. this.setConstants();
  69270. this.reset();
  69271. this.push = function(packet) {
  69272. var data, swap, char0, char1, text;
  69273. data = packet.ccData & 32639;
  69274. if (data === this.lastControlCode_) {
  69275. this.lastControlCode_ = null;
  69276. return;
  69277. }
  69278. if ((data & 61440) === 4096) {
  69279. this.lastControlCode_ = data;
  69280. } else if (data !== this.PADDING_) {
  69281. this.lastControlCode_ = null;
  69282. }
  69283. char0 = data >>> 8;
  69284. char1 = data & 255;
  69285. if (data === this.PADDING_) {
  69286. return;
  69287. } else if (data === this.RESUME_CAPTION_LOADING_) {
  69288. this.mode_ = "popOn";
  69289. } else if (data === this.END_OF_CAPTION_) {
  69290. this.mode_ = "popOn";
  69291. this.clearFormatting(packet.pts);
  69292. this.flushDisplayed(packet.pts);
  69293. swap = this.displayed_;
  69294. this.displayed_ = this.nonDisplayed_;
  69295. this.nonDisplayed_ = swap;
  69296. this.startPts_ = packet.pts;
  69297. } else if (data === this.ROLL_UP_2_ROWS_) {
  69298. this.rollUpRows_ = 2;
  69299. this.setRollUp(packet.pts);
  69300. } else if (data === this.ROLL_UP_3_ROWS_) {
  69301. this.rollUpRows_ = 3;
  69302. this.setRollUp(packet.pts);
  69303. } else if (data === this.ROLL_UP_4_ROWS_) {
  69304. this.rollUpRows_ = 4;
  69305. this.setRollUp(packet.pts);
  69306. } else if (data === this.CARRIAGE_RETURN_) {
  69307. this.clearFormatting(packet.pts);
  69308. this.flushDisplayed(packet.pts);
  69309. this.shiftRowsUp_();
  69310. this.startPts_ = packet.pts;
  69311. } else if (data === this.BACKSPACE_) {
  69312. if (this.mode_ === "popOn") {
  69313. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69314. } else {
  69315. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69316. }
  69317. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  69318. this.flushDisplayed(packet.pts);
  69319. this.displayed_ = createDisplayBuffer();
  69320. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  69321. this.nonDisplayed_ = createDisplayBuffer();
  69322. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  69323. if (this.mode_ !== "paintOn") {
  69324. this.flushDisplayed(packet.pts);
  69325. this.displayed_ = createDisplayBuffer();
  69326. }
  69327. this.mode_ = "paintOn";
  69328. this.startPts_ = packet.pts;
  69329. } else if (this.isSpecialCharacter(char0, char1)) {
  69330. char0 = (char0 & 3) << 8;
  69331. text = getCharFromCode(char0 | char1);
  69332. this[this.mode_](packet.pts, text);
  69333. this.column_++;
  69334. } else if (this.isExtCharacter(char0, char1)) {
  69335. if (this.mode_ === "popOn") {
  69336. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69337. } else {
  69338. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69339. }
  69340. char0 = (char0 & 3) << 8;
  69341. text = getCharFromCode(char0 | char1);
  69342. this[this.mode_](packet.pts, text);
  69343. this.column_++;
  69344. } else if (this.isMidRowCode(char0, char1)) {
  69345. this.clearFormatting(packet.pts);
  69346. this[this.mode_](packet.pts, " ");
  69347. this.column_++;
  69348. if ((char1 & 14) === 14) {
  69349. this.addFormatting(packet.pts, ["i"]);
  69350. }
  69351. if ((char1 & 1) === 1) {
  69352. this.addFormatting(packet.pts, ["u"]);
  69353. }
  69354. } else if (this.isOffsetControlCode(char0, char1)) {
  69355. this.column_ += char1 & 3;
  69356. } else if (this.isPAC(char0, char1)) {
  69357. var row = ROWS.indexOf(data & 7968);
  69358. if (this.mode_ === "rollUp") {
  69359. if (row - this.rollUpRows_ + 1 < 0) {
  69360. row = this.rollUpRows_ - 1;
  69361. }
  69362. this.setRollUp(packet.pts, row);
  69363. }
  69364. if (row !== this.row_) {
  69365. this.clearFormatting(packet.pts);
  69366. this.row_ = row;
  69367. }
  69368. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  69369. this.addFormatting(packet.pts, ["u"]);
  69370. }
  69371. if ((data & 16) === 16) {
  69372. this.column_ = ((data & 14) >> 1) * 4;
  69373. }
  69374. if (this.isColorPAC(char1)) {
  69375. if ((char1 & 14) === 14) {
  69376. this.addFormatting(packet.pts, ["i"]);
  69377. }
  69378. }
  69379. } else if (this.isNormalChar(char0)) {
  69380. if (char1 === 0) {
  69381. char1 = null;
  69382. }
  69383. text = getCharFromCode(char0);
  69384. text += getCharFromCode(char1);
  69385. this[this.mode_](packet.pts, text);
  69386. this.column_ += text.length;
  69387. }
  69388. };
  69389. };
  69390. Cea608Stream.prototype = new Stream$7();
  69391. Cea608Stream.prototype.flushDisplayed = function(pts) {
  69392. var content = this.displayed_.map(function(row, index2) {
  69393. try {
  69394. return row.trim();
  69395. } catch (e) {
  69396. this.trigger("log", {
  69397. level: "warn",
  69398. message: "Skipping a malformed 608 caption at index " + index2 + "."
  69399. });
  69400. return "";
  69401. }
  69402. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  69403. if (content.length) {
  69404. this.trigger("data", {
  69405. startPts: this.startPts_,
  69406. endPts: pts,
  69407. text: content,
  69408. stream: this.name_
  69409. });
  69410. }
  69411. };
  69412. Cea608Stream.prototype.reset = function() {
  69413. this.mode_ = "popOn";
  69414. this.topRow_ = 0;
  69415. this.startPts_ = 0;
  69416. this.displayed_ = createDisplayBuffer();
  69417. this.nonDisplayed_ = createDisplayBuffer();
  69418. this.lastControlCode_ = null;
  69419. this.column_ = 0;
  69420. this.row_ = BOTTOM_ROW;
  69421. this.rollUpRows_ = 2;
  69422. this.formatting_ = [];
  69423. };
  69424. Cea608Stream.prototype.setConstants = function() {
  69425. if (this.dataChannel_ === 0) {
  69426. this.BASE_ = 16;
  69427. this.EXT_ = 17;
  69428. this.CONTROL_ = (20 | this.field_) << 8;
  69429. this.OFFSET_ = 23;
  69430. } else if (this.dataChannel_ === 1) {
  69431. this.BASE_ = 24;
  69432. this.EXT_ = 25;
  69433. this.CONTROL_ = (28 | this.field_) << 8;
  69434. this.OFFSET_ = 31;
  69435. }
  69436. this.PADDING_ = 0;
  69437. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  69438. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  69439. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  69440. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  69441. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  69442. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  69443. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  69444. this.BACKSPACE_ = this.CONTROL_ | 33;
  69445. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  69446. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  69447. };
  69448. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  69449. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  69450. };
  69451. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  69452. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  69453. };
  69454. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  69455. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  69456. };
  69457. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  69458. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  69459. };
  69460. Cea608Stream.prototype.isPAC = function(char0, char1) {
  69461. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  69462. };
  69463. Cea608Stream.prototype.isColorPAC = function(char1) {
  69464. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  69465. };
  69466. Cea608Stream.prototype.isNormalChar = function(char) {
  69467. return char >= 32 && char <= 127;
  69468. };
  69469. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  69470. if (this.mode_ !== "rollUp") {
  69471. this.row_ = BOTTOM_ROW;
  69472. this.mode_ = "rollUp";
  69473. this.flushDisplayed(pts);
  69474. this.nonDisplayed_ = createDisplayBuffer();
  69475. this.displayed_ = createDisplayBuffer();
  69476. }
  69477. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  69478. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  69479. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  69480. this.displayed_[this.row_ - i2] = "";
  69481. }
  69482. }
  69483. if (newBaseRow === void 0) {
  69484. newBaseRow = this.row_;
  69485. }
  69486. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  69487. };
  69488. Cea608Stream.prototype.addFormatting = function(pts, format) {
  69489. this.formatting_ = this.formatting_.concat(format);
  69490. var text = format.reduce(function(text2, format2) {
  69491. return text2 + "<" + format2 + ">";
  69492. }, "");
  69493. this[this.mode_](pts, text);
  69494. };
  69495. Cea608Stream.prototype.clearFormatting = function(pts) {
  69496. if (!this.formatting_.length) {
  69497. return;
  69498. }
  69499. var text = this.formatting_.reverse().reduce(function(text2, format) {
  69500. return text2 + "</" + format + ">";
  69501. }, "");
  69502. this.formatting_ = [];
  69503. this[this.mode_](pts, text);
  69504. };
  69505. Cea608Stream.prototype.popOn = function(pts, text) {
  69506. var baseRow = this.nonDisplayed_[this.row_];
  69507. baseRow += text;
  69508. this.nonDisplayed_[this.row_] = baseRow;
  69509. };
  69510. Cea608Stream.prototype.rollUp = function(pts, text) {
  69511. var baseRow = this.displayed_[this.row_];
  69512. baseRow += text;
  69513. this.displayed_[this.row_] = baseRow;
  69514. };
  69515. Cea608Stream.prototype.shiftRowsUp_ = function() {
  69516. var i2;
  69517. for (i2 = 0; i2 < this.topRow_; i2++) {
  69518. this.displayed_[i2] = "";
  69519. }
  69520. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  69521. this.displayed_[i2] = "";
  69522. }
  69523. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  69524. this.displayed_[i2] = this.displayed_[i2 + 1];
  69525. }
  69526. this.displayed_[this.row_] = "";
  69527. };
  69528. Cea608Stream.prototype.paintOn = function(pts, text) {
  69529. var baseRow = this.displayed_[this.row_];
  69530. baseRow += text;
  69531. this.displayed_[this.row_] = baseRow;
  69532. };
  69533. var captionStream = {
  69534. CaptionStream: CaptionStream$2,
  69535. Cea608Stream,
  69536. Cea708Stream
  69537. };
  69538. var streamTypes = {
  69539. H264_STREAM_TYPE: 27,
  69540. ADTS_STREAM_TYPE: 15,
  69541. METADATA_STREAM_TYPE: 21
  69542. };
  69543. var Stream$6 = stream;
  69544. var MAX_TS = 8589934592;
  69545. var RO_THRESH = 4294967296;
  69546. var TYPE_SHARED = "shared";
  69547. var handleRollover$1 = function(value, reference) {
  69548. var direction = 1;
  69549. if (value > reference) {
  69550. direction = -1;
  69551. }
  69552. while (Math.abs(reference - value) > RO_THRESH) {
  69553. value += direction * MAX_TS;
  69554. }
  69555. return value;
  69556. };
  69557. var TimestampRolloverStream$1 = function(type3) {
  69558. var lastDTS, referenceDTS;
  69559. TimestampRolloverStream$1.prototype.init.call(this);
  69560. this.type_ = type3 || TYPE_SHARED;
  69561. this.push = function(data) {
  69562. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  69563. return;
  69564. }
  69565. if (referenceDTS === void 0) {
  69566. referenceDTS = data.dts;
  69567. }
  69568. data.dts = handleRollover$1(data.dts, referenceDTS);
  69569. data.pts = handleRollover$1(data.pts, referenceDTS);
  69570. lastDTS = data.dts;
  69571. this.trigger("data", data);
  69572. };
  69573. this.flush = function() {
  69574. referenceDTS = lastDTS;
  69575. this.trigger("done");
  69576. };
  69577. this.endTimeline = function() {
  69578. this.flush();
  69579. this.trigger("endedtimeline");
  69580. };
  69581. this.discontinuity = function() {
  69582. referenceDTS = void 0;
  69583. lastDTS = void 0;
  69584. };
  69585. this.reset = function() {
  69586. this.discontinuity();
  69587. this.trigger("reset");
  69588. };
  69589. };
  69590. TimestampRolloverStream$1.prototype = new Stream$6();
  69591. var timestampRolloverStream = {
  69592. TimestampRolloverStream: TimestampRolloverStream$1,
  69593. handleRollover: handleRollover$1
  69594. };
  69595. var typedArrayIndexOf$1 = (typedArray2, element, fromIndex) => {
  69596. if (!typedArray2) {
  69597. return -1;
  69598. }
  69599. var currentIndex = fromIndex;
  69600. for (; currentIndex < typedArray2.length; currentIndex++) {
  69601. if (typedArray2[currentIndex] === element) {
  69602. return currentIndex;
  69603. }
  69604. }
  69605. return -1;
  69606. };
  69607. var typedArray = {
  69608. typedArrayIndexOf: typedArrayIndexOf$1
  69609. };
  69610. var typedArrayIndexOf = typedArray.typedArrayIndexOf, textEncodingDescriptionByte = {
  69611. Iso88591: 0,
  69612. Utf16: 1,
  69613. Utf16be: 2,
  69614. Utf8: 3
  69615. }, percentEncode$1 = function(bytes, start2, end) {
  69616. var i2, result = "";
  69617. for (i2 = start2; i2 < end; i2++) {
  69618. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  69619. }
  69620. return result;
  69621. }, parseUtf8 = function(bytes, start2, end) {
  69622. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  69623. }, parseIso88591$1 = function(bytes, start2, end) {
  69624. return unescape(percentEncode$1(bytes, start2, end));
  69625. }, parseSyncSafeInteger$1 = function(data) {
  69626. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  69627. }, frameParsers = {
  69628. "APIC": function(frame) {
  69629. var i2 = 1, mimeTypeEndIndex, descriptionEndIndex, LINK_MIME_TYPE = "-->";
  69630. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69631. return;
  69632. }
  69633. mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69634. if (mimeTypeEndIndex < 0) {
  69635. return;
  69636. }
  69637. frame.mimeType = parseIso88591$1(frame.data, i2, mimeTypeEndIndex);
  69638. i2 = mimeTypeEndIndex + 1;
  69639. frame.pictureType = frame.data[i2];
  69640. i2++;
  69641. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69642. if (descriptionEndIndex < 0) {
  69643. return;
  69644. }
  69645. frame.description = parseUtf8(frame.data, i2, descriptionEndIndex);
  69646. i2 = descriptionEndIndex + 1;
  69647. if (frame.mimeType === LINK_MIME_TYPE) {
  69648. frame.url = parseIso88591$1(frame.data, i2, frame.data.length);
  69649. } else {
  69650. frame.pictureData = frame.data.subarray(i2, frame.data.length);
  69651. }
  69652. },
  69653. "T*": function(frame) {
  69654. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69655. return;
  69656. }
  69657. frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, "");
  69658. frame.values = frame.value.split("\0");
  69659. },
  69660. "TXXX": function(frame) {
  69661. var descriptionEndIndex;
  69662. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69663. return;
  69664. }
  69665. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69666. if (descriptionEndIndex === -1) {
  69667. return;
  69668. }
  69669. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69670. frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, "");
  69671. frame.data = frame.value;
  69672. },
  69673. "W*": function(frame) {
  69674. frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\0.*$/, "");
  69675. },
  69676. "WXXX": function(frame) {
  69677. var descriptionEndIndex;
  69678. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69679. return;
  69680. }
  69681. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69682. if (descriptionEndIndex === -1) {
  69683. return;
  69684. }
  69685. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69686. frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, "");
  69687. },
  69688. "PRIV": function(frame) {
  69689. var i2;
  69690. for (i2 = 0; i2 < frame.data.length; i2++) {
  69691. if (frame.data[i2] === 0) {
  69692. frame.owner = parseIso88591$1(frame.data, 0, i2);
  69693. break;
  69694. }
  69695. }
  69696. frame.privateData = frame.data.subarray(i2 + 1);
  69697. frame.data = frame.privateData;
  69698. }
  69699. };
  69700. var parseId3Frames$1 = function(data) {
  69701. var frameSize, frameHeader, frameStart = 10, tagSize = 0, frames = [];
  69702. if (data.length < 10 || data[0] !== "I".charCodeAt(0) || data[1] !== "D".charCodeAt(0) || data[2] !== "3".charCodeAt(0)) {
  69703. return;
  69704. }
  69705. tagSize = parseSyncSafeInteger$1(data.subarray(6, 10));
  69706. tagSize += 10;
  69707. var hasExtendedHeader = data[5] & 64;
  69708. if (hasExtendedHeader) {
  69709. frameStart += 4;
  69710. frameStart += parseSyncSafeInteger$1(data.subarray(10, 14));
  69711. tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20));
  69712. }
  69713. do {
  69714. frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8));
  69715. if (frameSize < 1) {
  69716. break;
  69717. }
  69718. frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]);
  69719. var frame = {
  69720. id: frameHeader,
  69721. data: data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69722. };
  69723. frame.key = frame.id;
  69724. if (frameParsers[frame.id]) {
  69725. frameParsers[frame.id](frame);
  69726. } else if (frame.id[0] === "T") {
  69727. frameParsers["T*"](frame);
  69728. } else if (frame.id[0] === "W") {
  69729. frameParsers["W*"](frame);
  69730. }
  69731. frames.push(frame);
  69732. frameStart += 10;
  69733. frameStart += frameSize;
  69734. } while (frameStart < tagSize);
  69735. return frames;
  69736. };
  69737. var parseId3 = {
  69738. parseId3Frames: parseId3Frames$1,
  69739. parseSyncSafeInteger: parseSyncSafeInteger$1,
  69740. frameParsers
  69741. };
  69742. var Stream$5 = stream, StreamTypes$3 = streamTypes, id3 = parseId3, MetadataStream;
  69743. MetadataStream = function(options2) {
  69744. var settings = {
  69745. descriptor: options2 && options2.descriptor
  69746. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  69747. MetadataStream.prototype.init.call(this);
  69748. this.dispatchType = StreamTypes$3.METADATA_STREAM_TYPE.toString(16);
  69749. if (settings.descriptor) {
  69750. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  69751. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  69752. }
  69753. }
  69754. this.push = function(chunk) {
  69755. var tag, frameStart, frameSize, frame, i3, frameHeader;
  69756. if (chunk.type !== "timed-metadata") {
  69757. return;
  69758. }
  69759. if (chunk.dataAlignmentIndicator) {
  69760. bufferSize = 0;
  69761. buffer.length = 0;
  69762. }
  69763. 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))) {
  69764. this.trigger("log", {
  69765. level: "warn",
  69766. message: "Skipping unrecognized metadata packet"
  69767. });
  69768. return;
  69769. }
  69770. buffer.push(chunk);
  69771. bufferSize += chunk.data.byteLength;
  69772. if (buffer.length === 1) {
  69773. tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10));
  69774. tagSize += 10;
  69775. }
  69776. if (bufferSize < tagSize) {
  69777. return;
  69778. }
  69779. tag = {
  69780. data: new Uint8Array(tagSize),
  69781. frames: [],
  69782. pts: buffer[0].pts,
  69783. dts: buffer[0].dts
  69784. };
  69785. for (i3 = 0; i3 < tagSize; ) {
  69786. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  69787. i3 += buffer[0].data.byteLength;
  69788. bufferSize -= buffer[0].data.byteLength;
  69789. buffer.shift();
  69790. }
  69791. frameStart = 10;
  69792. if (tag.data[5] & 64) {
  69793. frameStart += 4;
  69794. frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14));
  69795. tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20));
  69796. }
  69797. do {
  69798. frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8));
  69799. if (frameSize < 1) {
  69800. this.trigger("log", {
  69801. level: "warn",
  69802. message: "Malformed ID3 frame encountered. Skipping remaining metadata parsing."
  69803. });
  69804. break;
  69805. }
  69806. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  69807. frame = {
  69808. id: frameHeader,
  69809. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69810. };
  69811. frame.key = frame.id;
  69812. if (id3.frameParsers[frame.id]) {
  69813. id3.frameParsers[frame.id](frame);
  69814. } else if (frame.id[0] === "T") {
  69815. id3.frameParsers["T*"](frame);
  69816. } else if (frame.id[0] === "W") {
  69817. id3.frameParsers["W*"](frame);
  69818. }
  69819. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  69820. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  69821. size *= 4;
  69822. size += d2[7] & 3;
  69823. frame.timeStamp = size;
  69824. if (tag.pts === void 0 && tag.dts === void 0) {
  69825. tag.pts = frame.timeStamp;
  69826. tag.dts = frame.timeStamp;
  69827. }
  69828. this.trigger("timestamp", frame);
  69829. }
  69830. tag.frames.push(frame);
  69831. frameStart += 10;
  69832. frameStart += frameSize;
  69833. } while (frameStart < tagSize);
  69834. this.trigger("data", tag);
  69835. };
  69836. };
  69837. MetadataStream.prototype = new Stream$5();
  69838. var metadataStream = MetadataStream;
  69839. var Stream$4 = stream, CaptionStream$1 = captionStream, StreamTypes$2 = streamTypes, TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  69840. var TransportPacketStream, TransportParseStream, ElementaryStream;
  69841. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  69842. TransportPacketStream = function() {
  69843. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  69844. TransportPacketStream.prototype.init.call(this);
  69845. this.push = function(bytes) {
  69846. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  69847. if (bytesInBuffer) {
  69848. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  69849. everything.set(buffer.subarray(0, bytesInBuffer));
  69850. everything.set(bytes, bytesInBuffer);
  69851. bytesInBuffer = 0;
  69852. } else {
  69853. everything = bytes;
  69854. }
  69855. while (endIndex < everything.byteLength) {
  69856. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  69857. this.trigger("data", everything.subarray(startIndex, endIndex));
  69858. startIndex += MP2T_PACKET_LENGTH$1;
  69859. endIndex += MP2T_PACKET_LENGTH$1;
  69860. continue;
  69861. }
  69862. startIndex++;
  69863. endIndex++;
  69864. }
  69865. if (startIndex < everything.byteLength) {
  69866. buffer.set(everything.subarray(startIndex), 0);
  69867. bytesInBuffer = everything.byteLength - startIndex;
  69868. }
  69869. };
  69870. this.flush = function() {
  69871. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  69872. this.trigger("data", buffer);
  69873. bytesInBuffer = 0;
  69874. }
  69875. this.trigger("done");
  69876. };
  69877. this.endTimeline = function() {
  69878. this.flush();
  69879. this.trigger("endedtimeline");
  69880. };
  69881. this.reset = function() {
  69882. bytesInBuffer = 0;
  69883. this.trigger("reset");
  69884. };
  69885. };
  69886. TransportPacketStream.prototype = new Stream$4();
  69887. TransportParseStream = function() {
  69888. var parsePsi, parsePat2, parsePmt2, self2;
  69889. TransportParseStream.prototype.init.call(this);
  69890. self2 = this;
  69891. this.packetsWaitingForPmt = [];
  69892. this.programMapTable = void 0;
  69893. parsePsi = function(payload, psi) {
  69894. var offset = 0;
  69895. if (psi.payloadUnitStartIndicator) {
  69896. offset += payload[offset] + 1;
  69897. }
  69898. if (psi.type === "pat") {
  69899. parsePat2(payload.subarray(offset), psi);
  69900. } else {
  69901. parsePmt2(payload.subarray(offset), psi);
  69902. }
  69903. };
  69904. parsePat2 = function(payload, pat) {
  69905. pat.section_number = payload[7];
  69906. pat.last_section_number = payload[8];
  69907. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  69908. pat.pmtPid = self2.pmtPid;
  69909. };
  69910. parsePmt2 = function(payload, pmt) {
  69911. var sectionLength, tableEnd, programInfoLength, offset;
  69912. if (!(payload[5] & 1)) {
  69913. return;
  69914. }
  69915. self2.programMapTable = {
  69916. video: null,
  69917. audio: null,
  69918. "timed-metadata": {}
  69919. };
  69920. sectionLength = (payload[1] & 15) << 8 | payload[2];
  69921. tableEnd = 3 + sectionLength - 4;
  69922. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  69923. offset = 12 + programInfoLength;
  69924. while (offset < tableEnd) {
  69925. var streamType = payload[offset];
  69926. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  69927. if (streamType === StreamTypes$2.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  69928. self2.programMapTable.video = pid;
  69929. } else if (streamType === StreamTypes$2.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  69930. self2.programMapTable.audio = pid;
  69931. } else if (streamType === StreamTypes$2.METADATA_STREAM_TYPE) {
  69932. self2.programMapTable["timed-metadata"][pid] = streamType;
  69933. }
  69934. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  69935. }
  69936. pmt.programMapTable = self2.programMapTable;
  69937. };
  69938. this.push = function(packet) {
  69939. var result = {}, offset = 4;
  69940. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  69941. result.pid = packet[1] & 31;
  69942. result.pid <<= 8;
  69943. result.pid |= packet[2];
  69944. if ((packet[3] & 48) >>> 4 > 1) {
  69945. offset += packet[offset] + 1;
  69946. }
  69947. if (result.pid === 0) {
  69948. result.type = "pat";
  69949. parsePsi(packet.subarray(offset), result);
  69950. this.trigger("data", result);
  69951. } else if (result.pid === this.pmtPid) {
  69952. result.type = "pmt";
  69953. parsePsi(packet.subarray(offset), result);
  69954. this.trigger("data", result);
  69955. while (this.packetsWaitingForPmt.length) {
  69956. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  69957. }
  69958. } else if (this.programMapTable === void 0) {
  69959. this.packetsWaitingForPmt.push([packet, offset, result]);
  69960. } else {
  69961. this.processPes_(packet, offset, result);
  69962. }
  69963. };
  69964. this.processPes_ = function(packet, offset, result) {
  69965. if (result.pid === this.programMapTable.video) {
  69966. result.streamType = StreamTypes$2.H264_STREAM_TYPE;
  69967. } else if (result.pid === this.programMapTable.audio) {
  69968. result.streamType = StreamTypes$2.ADTS_STREAM_TYPE;
  69969. } else {
  69970. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  69971. }
  69972. result.type = "pes";
  69973. result.data = packet.subarray(offset);
  69974. this.trigger("data", result);
  69975. };
  69976. };
  69977. TransportParseStream.prototype = new Stream$4();
  69978. TransportParseStream.STREAM_TYPES = {
  69979. h264: 27,
  69980. adts: 15
  69981. };
  69982. ElementaryStream = function() {
  69983. var self2 = this, segmentHadPmt = false, video = {
  69984. data: [],
  69985. size: 0
  69986. }, audio = {
  69987. data: [],
  69988. size: 0
  69989. }, timedMetadata = {
  69990. data: [],
  69991. size: 0
  69992. }, programMapTable, parsePes = function(payload, pes) {
  69993. var ptsDtsFlags;
  69994. const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  69995. pes.data = new Uint8Array();
  69996. if (startPrefix !== 1) {
  69997. return;
  69998. }
  69999. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  70000. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  70001. ptsDtsFlags = payload[7];
  70002. if (ptsDtsFlags & 192) {
  70003. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  70004. pes.pts *= 4;
  70005. pes.pts += (payload[13] & 6) >>> 1;
  70006. pes.dts = pes.pts;
  70007. if (ptsDtsFlags & 64) {
  70008. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  70009. pes.dts *= 4;
  70010. pes.dts += (payload[18] & 6) >>> 1;
  70011. }
  70012. }
  70013. pes.data = payload.subarray(9 + payload[8]);
  70014. }, flushStream = function(stream2, type3, forceFlush) {
  70015. var packetData = new Uint8Array(stream2.size), event2 = {
  70016. type: type3
  70017. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  70018. if (!stream2.data.length || stream2.size < 9) {
  70019. return;
  70020. }
  70021. event2.trackId = stream2.data[0].pid;
  70022. for (i2 = 0; i2 < stream2.data.length; i2++) {
  70023. fragment = stream2.data[i2];
  70024. packetData.set(fragment.data, offset);
  70025. offset += fragment.data.byteLength;
  70026. }
  70027. parsePes(packetData, event2);
  70028. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  70029. if (forceFlush || packetFlushable) {
  70030. stream2.size = 0;
  70031. stream2.data.length = 0;
  70032. }
  70033. if (packetFlushable) {
  70034. self2.trigger("data", event2);
  70035. }
  70036. };
  70037. ElementaryStream.prototype.init.call(this);
  70038. this.push = function(data) {
  70039. ({
  70040. pat: function() {
  70041. },
  70042. pes: function() {
  70043. var stream2, streamType;
  70044. switch (data.streamType) {
  70045. case StreamTypes$2.H264_STREAM_TYPE:
  70046. stream2 = video;
  70047. streamType = "video";
  70048. break;
  70049. case StreamTypes$2.ADTS_STREAM_TYPE:
  70050. stream2 = audio;
  70051. streamType = "audio";
  70052. break;
  70053. case StreamTypes$2.METADATA_STREAM_TYPE:
  70054. stream2 = timedMetadata;
  70055. streamType = "timed-metadata";
  70056. break;
  70057. default:
  70058. return;
  70059. }
  70060. if (data.payloadUnitStartIndicator) {
  70061. flushStream(stream2, streamType, true);
  70062. }
  70063. stream2.data.push(data);
  70064. stream2.size += data.data.byteLength;
  70065. },
  70066. pmt: function() {
  70067. var event2 = {
  70068. type: "metadata",
  70069. tracks: []
  70070. };
  70071. programMapTable = data.programMapTable;
  70072. if (programMapTable.video !== null) {
  70073. event2.tracks.push({
  70074. timelineStartInfo: {
  70075. baseMediaDecodeTime: 0
  70076. },
  70077. id: +programMapTable.video,
  70078. codec: "avc",
  70079. type: "video"
  70080. });
  70081. }
  70082. if (programMapTable.audio !== null) {
  70083. event2.tracks.push({
  70084. timelineStartInfo: {
  70085. baseMediaDecodeTime: 0
  70086. },
  70087. id: +programMapTable.audio,
  70088. codec: "adts",
  70089. type: "audio"
  70090. });
  70091. }
  70092. segmentHadPmt = true;
  70093. self2.trigger("data", event2);
  70094. }
  70095. })[data.type]();
  70096. };
  70097. this.reset = function() {
  70098. video.size = 0;
  70099. video.data.length = 0;
  70100. audio.size = 0;
  70101. audio.data.length = 0;
  70102. this.trigger("reset");
  70103. };
  70104. this.flushStreams_ = function() {
  70105. flushStream(video, "video");
  70106. flushStream(audio, "audio");
  70107. flushStream(timedMetadata, "timed-metadata");
  70108. };
  70109. this.flush = function() {
  70110. if (!segmentHadPmt && programMapTable) {
  70111. var pmt = {
  70112. type: "metadata",
  70113. tracks: []
  70114. };
  70115. if (programMapTable.video !== null) {
  70116. pmt.tracks.push({
  70117. timelineStartInfo: {
  70118. baseMediaDecodeTime: 0
  70119. },
  70120. id: +programMapTable.video,
  70121. codec: "avc",
  70122. type: "video"
  70123. });
  70124. }
  70125. if (programMapTable.audio !== null) {
  70126. pmt.tracks.push({
  70127. timelineStartInfo: {
  70128. baseMediaDecodeTime: 0
  70129. },
  70130. id: +programMapTable.audio,
  70131. codec: "adts",
  70132. type: "audio"
  70133. });
  70134. }
  70135. self2.trigger("data", pmt);
  70136. }
  70137. segmentHadPmt = false;
  70138. this.flushStreams_();
  70139. this.trigger("done");
  70140. };
  70141. };
  70142. ElementaryStream.prototype = new Stream$4();
  70143. var m2ts$1 = {
  70144. PAT_PID: 0,
  70145. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  70146. TransportPacketStream,
  70147. TransportParseStream,
  70148. ElementaryStream,
  70149. TimestampRolloverStream,
  70150. CaptionStream: CaptionStream$1.CaptionStream,
  70151. Cea608Stream: CaptionStream$1.Cea608Stream,
  70152. Cea708Stream: CaptionStream$1.Cea708Stream,
  70153. MetadataStream: metadataStream
  70154. };
  70155. for (var type2 in StreamTypes$2) {
  70156. if (StreamTypes$2.hasOwnProperty(type2)) {
  70157. m2ts$1[type2] = StreamTypes$2[type2];
  70158. }
  70159. }
  70160. var m2ts_1 = m2ts$1;
  70161. var Stream$3 = stream;
  70162. var ONE_SECOND_IN_TS$2 = clock$2.ONE_SECOND_IN_TS;
  70163. var AdtsStream$1;
  70164. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70165. AdtsStream$1 = function(handlePartialSegments) {
  70166. var buffer, frameNum = 0;
  70167. AdtsStream$1.prototype.init.call(this);
  70168. this.skipWarn_ = function(start2, end) {
  70169. this.trigger("log", {
  70170. level: "warn",
  70171. message: `adts skiping bytes ${start2} to ${end} in frame ${frameNum} outside syncword`
  70172. });
  70173. };
  70174. this.push = function(packet) {
  70175. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  70176. if (!handlePartialSegments) {
  70177. frameNum = 0;
  70178. }
  70179. if (packet.type !== "audio") {
  70180. return;
  70181. }
  70182. if (buffer && buffer.length) {
  70183. oldBuffer = buffer;
  70184. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  70185. buffer.set(oldBuffer);
  70186. buffer.set(packet.data, oldBuffer.byteLength);
  70187. } else {
  70188. buffer = packet.data;
  70189. }
  70190. var skip;
  70191. while (i2 + 7 < buffer.length) {
  70192. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  70193. if (typeof skip !== "number") {
  70194. skip = i2;
  70195. }
  70196. i2++;
  70197. continue;
  70198. }
  70199. if (typeof skip === "number") {
  70200. this.skipWarn_(skip, i2);
  70201. skip = null;
  70202. }
  70203. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  70204. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  70205. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  70206. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  70207. if (buffer.byteLength - i2 < frameLength) {
  70208. break;
  70209. }
  70210. this.trigger("data", {
  70211. pts: packet.pts + frameNum * adtsFrameDuration,
  70212. dts: packet.dts + frameNum * adtsFrameDuration,
  70213. sampleCount,
  70214. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  70215. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  70216. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  70217. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  70218. samplesize: 16,
  70219. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  70220. });
  70221. frameNum++;
  70222. i2 += frameLength;
  70223. }
  70224. if (typeof skip === "number") {
  70225. this.skipWarn_(skip, i2);
  70226. skip = null;
  70227. }
  70228. buffer = buffer.subarray(i2);
  70229. };
  70230. this.flush = function() {
  70231. frameNum = 0;
  70232. this.trigger("done");
  70233. };
  70234. this.reset = function() {
  70235. buffer = void 0;
  70236. this.trigger("reset");
  70237. };
  70238. this.endTimeline = function() {
  70239. buffer = void 0;
  70240. this.trigger("endedtimeline");
  70241. };
  70242. };
  70243. AdtsStream$1.prototype = new Stream$3();
  70244. var adts = AdtsStream$1;
  70245. var ExpGolomb$1;
  70246. ExpGolomb$1 = function(workingData) {
  70247. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  70248. this.length = function() {
  70249. return 8 * workingBytesAvailable;
  70250. };
  70251. this.bitsAvailable = function() {
  70252. return 8 * workingBytesAvailable + workingBitsAvailable;
  70253. };
  70254. this.loadWord = function() {
  70255. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  70256. if (availableBytes === 0) {
  70257. throw new Error("no bytes available");
  70258. }
  70259. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  70260. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  70261. workingBitsAvailable = availableBytes * 8;
  70262. workingBytesAvailable -= availableBytes;
  70263. };
  70264. this.skipBits = function(count) {
  70265. var skipBytes;
  70266. if (workingBitsAvailable > count) {
  70267. workingWord <<= count;
  70268. workingBitsAvailable -= count;
  70269. } else {
  70270. count -= workingBitsAvailable;
  70271. skipBytes = Math.floor(count / 8);
  70272. count -= skipBytes * 8;
  70273. workingBytesAvailable -= skipBytes;
  70274. this.loadWord();
  70275. workingWord <<= count;
  70276. workingBitsAvailable -= count;
  70277. }
  70278. };
  70279. this.readBits = function(size) {
  70280. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  70281. workingBitsAvailable -= bits;
  70282. if (workingBitsAvailable > 0) {
  70283. workingWord <<= bits;
  70284. } else if (workingBytesAvailable > 0) {
  70285. this.loadWord();
  70286. }
  70287. bits = size - bits;
  70288. if (bits > 0) {
  70289. return valu << bits | this.readBits(bits);
  70290. }
  70291. return valu;
  70292. };
  70293. this.skipLeadingZeros = function() {
  70294. var leadingZeroCount;
  70295. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  70296. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  70297. workingWord <<= leadingZeroCount;
  70298. workingBitsAvailable -= leadingZeroCount;
  70299. return leadingZeroCount;
  70300. }
  70301. }
  70302. this.loadWord();
  70303. return leadingZeroCount + this.skipLeadingZeros();
  70304. };
  70305. this.skipUnsignedExpGolomb = function() {
  70306. this.skipBits(1 + this.skipLeadingZeros());
  70307. };
  70308. this.skipExpGolomb = function() {
  70309. this.skipBits(1 + this.skipLeadingZeros());
  70310. };
  70311. this.readUnsignedExpGolomb = function() {
  70312. var clz = this.skipLeadingZeros();
  70313. return this.readBits(clz + 1) - 1;
  70314. };
  70315. this.readExpGolomb = function() {
  70316. var valu = this.readUnsignedExpGolomb();
  70317. if (1 & valu) {
  70318. return 1 + valu >>> 1;
  70319. }
  70320. return -1 * (valu >>> 1);
  70321. };
  70322. this.readBoolean = function() {
  70323. return this.readBits(1) === 1;
  70324. };
  70325. this.readUnsignedByte = function() {
  70326. return this.readBits(8);
  70327. };
  70328. this.loadWord();
  70329. };
  70330. var expGolomb = ExpGolomb$1;
  70331. var Stream$2 = stream;
  70332. var ExpGolomb = expGolomb;
  70333. var H264Stream$1, NalByteStream;
  70334. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  70335. NalByteStream = function() {
  70336. var syncPoint = 0, i2, buffer;
  70337. NalByteStream.prototype.init.call(this);
  70338. this.push = function(data) {
  70339. var swapBuffer;
  70340. if (!buffer) {
  70341. buffer = data.data;
  70342. } else {
  70343. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  70344. swapBuffer.set(buffer);
  70345. swapBuffer.set(data.data, buffer.byteLength);
  70346. buffer = swapBuffer;
  70347. }
  70348. var len = buffer.byteLength;
  70349. for (; syncPoint < len - 3; syncPoint++) {
  70350. if (buffer[syncPoint + 2] === 1) {
  70351. i2 = syncPoint + 5;
  70352. break;
  70353. }
  70354. }
  70355. while (i2 < len) {
  70356. switch (buffer[i2]) {
  70357. case 0:
  70358. if (buffer[i2 - 1] !== 0) {
  70359. i2 += 2;
  70360. break;
  70361. } else if (buffer[i2 - 2] !== 0) {
  70362. i2++;
  70363. break;
  70364. }
  70365. if (syncPoint + 3 !== i2 - 2) {
  70366. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70367. }
  70368. do {
  70369. i2++;
  70370. } while (buffer[i2] !== 1 && i2 < len);
  70371. syncPoint = i2 - 2;
  70372. i2 += 3;
  70373. break;
  70374. case 1:
  70375. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  70376. i2 += 3;
  70377. break;
  70378. }
  70379. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70380. syncPoint = i2 - 2;
  70381. i2 += 3;
  70382. break;
  70383. default:
  70384. i2 += 3;
  70385. break;
  70386. }
  70387. }
  70388. buffer = buffer.subarray(syncPoint);
  70389. i2 -= syncPoint;
  70390. syncPoint = 0;
  70391. };
  70392. this.reset = function() {
  70393. buffer = null;
  70394. syncPoint = 0;
  70395. this.trigger("reset");
  70396. };
  70397. this.flush = function() {
  70398. if (buffer && buffer.byteLength > 3) {
  70399. this.trigger("data", buffer.subarray(syncPoint + 3));
  70400. }
  70401. buffer = null;
  70402. syncPoint = 0;
  70403. this.trigger("done");
  70404. };
  70405. this.endTimeline = function() {
  70406. this.flush();
  70407. this.trigger("endedtimeline");
  70408. };
  70409. };
  70410. NalByteStream.prototype = new Stream$2();
  70411. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  70412. 100: true,
  70413. 110: true,
  70414. 122: true,
  70415. 244: true,
  70416. 44: true,
  70417. 83: true,
  70418. 86: true,
  70419. 118: true,
  70420. 128: true,
  70421. 138: true,
  70422. 139: true,
  70423. 134: true
  70424. };
  70425. H264Stream$1 = function() {
  70426. var nalByteStream = new NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  70427. H264Stream$1.prototype.init.call(this);
  70428. self2 = this;
  70429. this.push = function(packet) {
  70430. if (packet.type !== "video") {
  70431. return;
  70432. }
  70433. trackId = packet.trackId;
  70434. currentPts = packet.pts;
  70435. currentDts = packet.dts;
  70436. nalByteStream.push(packet);
  70437. };
  70438. nalByteStream.on("data", function(data) {
  70439. var event2 = {
  70440. trackId,
  70441. pts: currentPts,
  70442. dts: currentDts,
  70443. data,
  70444. nalUnitTypeCode: data[0] & 31
  70445. };
  70446. switch (event2.nalUnitTypeCode) {
  70447. case 5:
  70448. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  70449. break;
  70450. case 6:
  70451. event2.nalUnitType = "sei_rbsp";
  70452. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70453. break;
  70454. case 7:
  70455. event2.nalUnitType = "seq_parameter_set_rbsp";
  70456. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70457. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  70458. break;
  70459. case 8:
  70460. event2.nalUnitType = "pic_parameter_set_rbsp";
  70461. break;
  70462. case 9:
  70463. event2.nalUnitType = "access_unit_delimiter_rbsp";
  70464. break;
  70465. }
  70466. self2.trigger("data", event2);
  70467. });
  70468. nalByteStream.on("done", function() {
  70469. self2.trigger("done");
  70470. });
  70471. nalByteStream.on("partialdone", function() {
  70472. self2.trigger("partialdone");
  70473. });
  70474. nalByteStream.on("reset", function() {
  70475. self2.trigger("reset");
  70476. });
  70477. nalByteStream.on("endedtimeline", function() {
  70478. self2.trigger("endedtimeline");
  70479. });
  70480. this.flush = function() {
  70481. nalByteStream.flush();
  70482. };
  70483. this.partialFlush = function() {
  70484. nalByteStream.partialFlush();
  70485. };
  70486. this.reset = function() {
  70487. nalByteStream.reset();
  70488. };
  70489. this.endTimeline = function() {
  70490. nalByteStream.endTimeline();
  70491. };
  70492. skipScalingList = function(count, expGolombDecoder) {
  70493. var lastScale = 8, nextScale = 8, j, deltaScale;
  70494. for (j = 0; j < count; j++) {
  70495. if (nextScale !== 0) {
  70496. deltaScale = expGolombDecoder.readExpGolomb();
  70497. nextScale = (lastScale + deltaScale + 256) % 256;
  70498. }
  70499. lastScale = nextScale === 0 ? lastScale : nextScale;
  70500. }
  70501. };
  70502. discardEmulationPreventionBytes5 = function(data) {
  70503. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  70504. while (i2 < length - 2) {
  70505. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  70506. emulationPreventionBytesPositions.push(i2 + 2);
  70507. i2 += 2;
  70508. } else {
  70509. i2++;
  70510. }
  70511. }
  70512. if (emulationPreventionBytesPositions.length === 0) {
  70513. return data;
  70514. }
  70515. newLength = length - emulationPreventionBytesPositions.length;
  70516. newData = new Uint8Array(newLength);
  70517. var sourceIndex = 0;
  70518. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  70519. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  70520. sourceIndex++;
  70521. emulationPreventionBytesPositions.shift();
  70522. }
  70523. newData[i2] = data[sourceIndex];
  70524. }
  70525. return newData;
  70526. };
  70527. readSequenceParameterSet = function(data) {
  70528. 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;
  70529. expGolombDecoder = new ExpGolomb(data);
  70530. profileIdc = expGolombDecoder.readUnsignedByte();
  70531. profileCompatibility = expGolombDecoder.readUnsignedByte();
  70532. levelIdc = expGolombDecoder.readUnsignedByte();
  70533. expGolombDecoder.skipUnsignedExpGolomb();
  70534. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  70535. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  70536. if (chromaFormatIdc === 3) {
  70537. expGolombDecoder.skipBits(1);
  70538. }
  70539. expGolombDecoder.skipUnsignedExpGolomb();
  70540. expGolombDecoder.skipUnsignedExpGolomb();
  70541. expGolombDecoder.skipBits(1);
  70542. if (expGolombDecoder.readBoolean()) {
  70543. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  70544. for (i2 = 0; i2 < scalingListCount; i2++) {
  70545. if (expGolombDecoder.readBoolean()) {
  70546. if (i2 < 6) {
  70547. skipScalingList(16, expGolombDecoder);
  70548. } else {
  70549. skipScalingList(64, expGolombDecoder);
  70550. }
  70551. }
  70552. }
  70553. }
  70554. }
  70555. expGolombDecoder.skipUnsignedExpGolomb();
  70556. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  70557. if (picOrderCntType === 0) {
  70558. expGolombDecoder.readUnsignedExpGolomb();
  70559. } else if (picOrderCntType === 1) {
  70560. expGolombDecoder.skipBits(1);
  70561. expGolombDecoder.skipExpGolomb();
  70562. expGolombDecoder.skipExpGolomb();
  70563. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  70564. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  70565. expGolombDecoder.skipExpGolomb();
  70566. }
  70567. }
  70568. expGolombDecoder.skipUnsignedExpGolomb();
  70569. expGolombDecoder.skipBits(1);
  70570. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70571. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70572. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  70573. if (frameMbsOnlyFlag === 0) {
  70574. expGolombDecoder.skipBits(1);
  70575. }
  70576. expGolombDecoder.skipBits(1);
  70577. if (expGolombDecoder.readBoolean()) {
  70578. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  70579. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  70580. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  70581. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  70582. }
  70583. if (expGolombDecoder.readBoolean()) {
  70584. if (expGolombDecoder.readBoolean()) {
  70585. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  70586. switch (aspectRatioIdc) {
  70587. case 1:
  70588. sarRatio = [1, 1];
  70589. break;
  70590. case 2:
  70591. sarRatio = [12, 11];
  70592. break;
  70593. case 3:
  70594. sarRatio = [10, 11];
  70595. break;
  70596. case 4:
  70597. sarRatio = [16, 11];
  70598. break;
  70599. case 5:
  70600. sarRatio = [40, 33];
  70601. break;
  70602. case 6:
  70603. sarRatio = [24, 11];
  70604. break;
  70605. case 7:
  70606. sarRatio = [20, 11];
  70607. break;
  70608. case 8:
  70609. sarRatio = [32, 11];
  70610. break;
  70611. case 9:
  70612. sarRatio = [80, 33];
  70613. break;
  70614. case 10:
  70615. sarRatio = [18, 11];
  70616. break;
  70617. case 11:
  70618. sarRatio = [15, 11];
  70619. break;
  70620. case 12:
  70621. sarRatio = [64, 33];
  70622. break;
  70623. case 13:
  70624. sarRatio = [160, 99];
  70625. break;
  70626. case 14:
  70627. sarRatio = [4, 3];
  70628. break;
  70629. case 15:
  70630. sarRatio = [3, 2];
  70631. break;
  70632. case 16:
  70633. sarRatio = [2, 1];
  70634. break;
  70635. case 255: {
  70636. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  70637. break;
  70638. }
  70639. }
  70640. if (sarRatio) {
  70641. sarRatio[0] / sarRatio[1];
  70642. }
  70643. }
  70644. }
  70645. return {
  70646. profileIdc,
  70647. levelIdc,
  70648. profileCompatibility,
  70649. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  70650. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  70651. sarRatio
  70652. };
  70653. };
  70654. };
  70655. H264Stream$1.prototype = new Stream$2();
  70656. var h2643 = {
  70657. H264Stream: H264Stream$1,
  70658. NalByteStream
  70659. };
  70660. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70661. var parseId3TagSize = function(header, byteIndex) {
  70662. 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;
  70663. returnSize = returnSize >= 0 ? returnSize : 0;
  70664. if (footerPresent) {
  70665. return returnSize + 20;
  70666. }
  70667. return returnSize + 10;
  70668. };
  70669. var getId3Offset4 = function(data, offset) {
  70670. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  70671. return offset;
  70672. }
  70673. offset += parseId3TagSize(data, offset);
  70674. return getId3Offset4(data, offset);
  70675. };
  70676. var isLikelyAacData$1 = function(data) {
  70677. var offset = getId3Offset4(data, 0);
  70678. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  70679. };
  70680. var parseSyncSafeInteger = function(data) {
  70681. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  70682. };
  70683. var percentEncode = function(bytes, start2, end) {
  70684. var i2, result = "";
  70685. for (i2 = start2; i2 < end; i2++) {
  70686. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  70687. }
  70688. return result;
  70689. };
  70690. var parseIso88591 = function(bytes, start2, end) {
  70691. return unescape(percentEncode(bytes, start2, end));
  70692. };
  70693. var parseAdtsSize = function(header, byteIndex) {
  70694. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  70695. return highTwo | middle | lowThree;
  70696. };
  70697. var parseType$4 = function(header, byteIndex) {
  70698. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  70699. return "timed-metadata";
  70700. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  70701. return "audio";
  70702. }
  70703. return null;
  70704. };
  70705. var parseSampleRate = function(packet) {
  70706. var i2 = 0;
  70707. while (i2 + 5 < packet.length) {
  70708. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  70709. i2++;
  70710. continue;
  70711. }
  70712. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  70713. }
  70714. return null;
  70715. };
  70716. var parseAacTimestamp = function(packet) {
  70717. var frameStart, frameSize, frame, frameHeader;
  70718. frameStart = 10;
  70719. if (packet[5] & 64) {
  70720. frameStart += 4;
  70721. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  70722. }
  70723. do {
  70724. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  70725. if (frameSize < 1) {
  70726. return null;
  70727. }
  70728. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  70729. if (frameHeader === "PRIV") {
  70730. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  70731. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  70732. if (frame[i2] === 0) {
  70733. var owner = parseIso88591(frame, 0, i2);
  70734. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  70735. var d2 = frame.subarray(i2 + 1);
  70736. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  70737. size *= 4;
  70738. size += d2[7] & 3;
  70739. return size;
  70740. }
  70741. break;
  70742. }
  70743. }
  70744. }
  70745. frameStart += 10;
  70746. frameStart += frameSize;
  70747. } while (frameStart < packet.byteLength);
  70748. return null;
  70749. };
  70750. var utils2 = {
  70751. isLikelyAacData: isLikelyAacData$1,
  70752. parseId3TagSize,
  70753. parseAdtsSize,
  70754. parseType: parseType$4,
  70755. parseSampleRate,
  70756. parseAacTimestamp
  70757. };
  70758. var Stream$12 = stream;
  70759. var aacUtils = utils2;
  70760. var AacStream$1;
  70761. AacStream$1 = function() {
  70762. var everything = new Uint8Array(), timeStamp = 0;
  70763. AacStream$1.prototype.init.call(this);
  70764. this.setTimestamp = function(timestamp) {
  70765. timeStamp = timestamp;
  70766. };
  70767. this.push = function(bytes) {
  70768. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  70769. if (everything.length) {
  70770. tempLength = everything.length;
  70771. everything = new Uint8Array(bytes.byteLength + tempLength);
  70772. everything.set(everything.subarray(0, tempLength));
  70773. everything.set(bytes, tempLength);
  70774. } else {
  70775. everything = bytes;
  70776. }
  70777. while (everything.length - byteIndex >= 3) {
  70778. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  70779. if (everything.length - byteIndex < 10) {
  70780. break;
  70781. }
  70782. frameSize = aacUtils.parseId3TagSize(everything, byteIndex);
  70783. if (byteIndex + frameSize > everything.length) {
  70784. break;
  70785. }
  70786. chunk = {
  70787. type: "timed-metadata",
  70788. data: everything.subarray(byteIndex, byteIndex + frameSize)
  70789. };
  70790. this.trigger("data", chunk);
  70791. byteIndex += frameSize;
  70792. continue;
  70793. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  70794. if (everything.length - byteIndex < 7) {
  70795. break;
  70796. }
  70797. frameSize = aacUtils.parseAdtsSize(everything, byteIndex);
  70798. if (byteIndex + frameSize > everything.length) {
  70799. break;
  70800. }
  70801. packet = {
  70802. type: "audio",
  70803. data: everything.subarray(byteIndex, byteIndex + frameSize),
  70804. pts: timeStamp,
  70805. dts: timeStamp
  70806. };
  70807. this.trigger("data", packet);
  70808. byteIndex += frameSize;
  70809. continue;
  70810. }
  70811. byteIndex++;
  70812. }
  70813. bytesLeft = everything.length - byteIndex;
  70814. if (bytesLeft > 0) {
  70815. everything = everything.subarray(byteIndex);
  70816. } else {
  70817. everything = new Uint8Array();
  70818. }
  70819. };
  70820. this.reset = function() {
  70821. everything = new Uint8Array();
  70822. this.trigger("reset");
  70823. };
  70824. this.endTimeline = function() {
  70825. everything = new Uint8Array();
  70826. this.trigger("endedtimeline");
  70827. };
  70828. };
  70829. AacStream$1.prototype = new Stream$12();
  70830. var aac3 = AacStream$1;
  70831. var AUDIO_PROPERTIES$1 = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  70832. var audioProperties = AUDIO_PROPERTIES$1;
  70833. var VIDEO_PROPERTIES$1 = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  70834. var videoProperties = VIDEO_PROPERTIES$1;
  70835. var Stream2 = stream;
  70836. var mp43 = mp4Generator;
  70837. var frameUtils = frameUtils$1;
  70838. var audioFrameUtils = audioFrameUtils$1;
  70839. var trackDecodeInfo = trackDecodeInfo$1;
  70840. var m2ts = m2ts_1;
  70841. var clock2 = clock$2;
  70842. var AdtsStream = adts;
  70843. var H264Stream = h2643.H264Stream;
  70844. var AacStream = aac3;
  70845. var isLikelyAacData = utils2.isLikelyAacData;
  70846. var ONE_SECOND_IN_TS$12 = clock$2.ONE_SECOND_IN_TS;
  70847. var AUDIO_PROPERTIES = audioProperties;
  70848. var VIDEO_PROPERTIES = videoProperties;
  70849. var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream;
  70850. var retriggerForStream = function(key, event2) {
  70851. event2.stream = key;
  70852. this.trigger("log", event2);
  70853. };
  70854. var addPipelineLogRetriggers = function(transmuxer2, pipeline) {
  70855. var keys3 = Object.keys(pipeline);
  70856. for (var i2 = 0; i2 < keys3.length; i2++) {
  70857. var key = keys3[i2];
  70858. if (key === "headOfPipeline" || !pipeline[key].on) {
  70859. continue;
  70860. }
  70861. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  70862. }
  70863. };
  70864. var arrayEquals = function(a, b) {
  70865. var i2;
  70866. if (a.length !== b.length) {
  70867. return false;
  70868. }
  70869. for (i2 = 0; i2 < a.length; i2++) {
  70870. if (a[i2] !== b[i2]) {
  70871. return false;
  70872. }
  70873. }
  70874. return true;
  70875. };
  70876. var generateSegmentTimingInfo = function(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  70877. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  70878. return {
  70879. start: {
  70880. dts: baseMediaDecodeTime,
  70881. pts: baseMediaDecodeTime + ptsOffsetFromDts
  70882. },
  70883. end: {
  70884. dts: baseMediaDecodeTime + decodeDuration,
  70885. pts: baseMediaDecodeTime + presentationDuration
  70886. },
  70887. prependedContentDuration,
  70888. baseMediaDecodeTime
  70889. };
  70890. };
  70891. AudioSegmentStream = function(track, options2) {
  70892. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  70893. options2 = options2 || {};
  70894. sequenceNumber = options2.firstSequenceNumber || 0;
  70895. AudioSegmentStream.prototype.init.call(this);
  70896. this.push = function(data) {
  70897. trackDecodeInfo.collectDtsInfo(track, data);
  70898. if (track) {
  70899. AUDIO_PROPERTIES.forEach(function(prop) {
  70900. track[prop] = data[prop];
  70901. });
  70902. }
  70903. adtsFrames.push(data);
  70904. };
  70905. this.setEarliestDts = function(earliestDts) {
  70906. earliestAllowedDts = earliestDts;
  70907. };
  70908. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  70909. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  70910. };
  70911. this.setAudioAppendStart = function(timestamp) {
  70912. audioAppendStartTs = timestamp;
  70913. };
  70914. this.flush = function() {
  70915. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  70916. if (adtsFrames.length === 0) {
  70917. this.trigger("done", "AudioSegmentStream");
  70918. return;
  70919. }
  70920. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  70921. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  70922. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  70923. track.samples = audioFrameUtils.generateSampleTable(frames);
  70924. mdat2 = mp43.mdat(audioFrameUtils.concatenateFrameData(frames));
  70925. adtsFrames = [];
  70926. moof2 = mp43.moof(sequenceNumber, [track]);
  70927. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  70928. sequenceNumber++;
  70929. boxes.set(moof2);
  70930. boxes.set(mdat2, moof2.byteLength);
  70931. trackDecodeInfo.clearDtsInfo(track);
  70932. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  70933. if (frames.length) {
  70934. segmentDuration = frames.length * frameDuration;
  70935. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  70936. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  70937. frames[0].dts,
  70938. frames[0].pts,
  70939. frames[0].dts + segmentDuration,
  70940. frames[0].pts + segmentDuration,
  70941. videoClockCyclesOfSilencePrefixed || 0
  70942. ));
  70943. this.trigger("timingInfo", {
  70944. start: frames[0].pts,
  70945. end: frames[0].pts + segmentDuration
  70946. });
  70947. }
  70948. this.trigger("data", {
  70949. track,
  70950. boxes
  70951. });
  70952. this.trigger("done", "AudioSegmentStream");
  70953. };
  70954. this.reset = function() {
  70955. trackDecodeInfo.clearDtsInfo(track);
  70956. adtsFrames = [];
  70957. this.trigger("reset");
  70958. };
  70959. };
  70960. AudioSegmentStream.prototype = new Stream2();
  70961. VideoSegmentStream = function(track, options2) {
  70962. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  70963. options2 = options2 || {};
  70964. sequenceNumber = options2.firstSequenceNumber || 0;
  70965. VideoSegmentStream.prototype.init.call(this);
  70966. delete track.minPTS;
  70967. this.gopCache_ = [];
  70968. this.push = function(nalUnit) {
  70969. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  70970. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  70971. config = nalUnit.config;
  70972. track.sps = [nalUnit.data];
  70973. VIDEO_PROPERTIES.forEach(function(prop) {
  70974. track[prop] = config[prop];
  70975. }, this);
  70976. }
  70977. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  70978. pps = nalUnit.data;
  70979. track.pps = [nalUnit.data];
  70980. }
  70981. nalUnits.push(nalUnit);
  70982. };
  70983. this.flush = function() {
  70984. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  70985. while (nalUnits.length) {
  70986. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  70987. break;
  70988. }
  70989. nalUnits.shift();
  70990. }
  70991. if (nalUnits.length === 0) {
  70992. this.resetStream_();
  70993. this.trigger("done", "VideoSegmentStream");
  70994. return;
  70995. }
  70996. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  70997. gops = frameUtils.groupFramesIntoGops(frames);
  70998. if (!gops[0][0].keyFrame) {
  70999. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  71000. if (gopForFusion) {
  71001. prependedContentDuration = gopForFusion.duration;
  71002. gops.unshift(gopForFusion);
  71003. gops.byteLength += gopForFusion.byteLength;
  71004. gops.nalCount += gopForFusion.nalCount;
  71005. gops.pts = gopForFusion.pts;
  71006. gops.dts = gopForFusion.dts;
  71007. gops.duration += gopForFusion.duration;
  71008. } else {
  71009. gops = frameUtils.extendFirstKeyFrame(gops);
  71010. }
  71011. }
  71012. if (gopsToAlignWith.length) {
  71013. var alignedGops;
  71014. if (options2.alignGopsAtEnd) {
  71015. alignedGops = this.alignGopsAtEnd_(gops);
  71016. } else {
  71017. alignedGops = this.alignGopsAtStart_(gops);
  71018. }
  71019. if (!alignedGops) {
  71020. this.gopCache_.unshift({
  71021. gop: gops.pop(),
  71022. pps: track.pps,
  71023. sps: track.sps
  71024. });
  71025. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  71026. nalUnits = [];
  71027. this.resetStream_();
  71028. this.trigger("done", "VideoSegmentStream");
  71029. return;
  71030. }
  71031. trackDecodeInfo.clearDtsInfo(track);
  71032. gops = alignedGops;
  71033. }
  71034. trackDecodeInfo.collectDtsInfo(track, gops);
  71035. track.samples = frameUtils.generateSampleTable(gops);
  71036. mdat2 = mp43.mdat(frameUtils.concatenateNalData(gops));
  71037. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  71038. this.trigger("processedGopsInfo", gops.map(function(gop) {
  71039. return {
  71040. pts: gop.pts,
  71041. dts: gop.dts,
  71042. byteLength: gop.byteLength
  71043. };
  71044. }));
  71045. firstGop = gops[0];
  71046. lastGop = gops[gops.length - 1];
  71047. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  71048. this.trigger("timingInfo", {
  71049. start: gops[0].pts,
  71050. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  71051. });
  71052. this.gopCache_.unshift({
  71053. gop: gops.pop(),
  71054. pps: track.pps,
  71055. sps: track.sps
  71056. });
  71057. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  71058. nalUnits = [];
  71059. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  71060. this.trigger("timelineStartInfo", track.timelineStartInfo);
  71061. moof2 = mp43.moof(sequenceNumber, [track]);
  71062. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  71063. sequenceNumber++;
  71064. boxes.set(moof2);
  71065. boxes.set(mdat2, moof2.byteLength);
  71066. this.trigger("data", {
  71067. track,
  71068. boxes
  71069. });
  71070. this.resetStream_();
  71071. this.trigger("done", "VideoSegmentStream");
  71072. };
  71073. this.reset = function() {
  71074. this.resetStream_();
  71075. nalUnits = [];
  71076. this.gopCache_.length = 0;
  71077. gopsToAlignWith.length = 0;
  71078. this.trigger("reset");
  71079. };
  71080. this.resetStream_ = function() {
  71081. trackDecodeInfo.clearDtsInfo(track);
  71082. config = void 0;
  71083. pps = void 0;
  71084. };
  71085. this.getGopForFusion_ = function(nalUnit) {
  71086. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  71087. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  71088. currentGopObj = this.gopCache_[i2];
  71089. currentGop = currentGopObj.gop;
  71090. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  71091. continue;
  71092. }
  71093. if (currentGop.dts < track.timelineStartInfo.dts) {
  71094. continue;
  71095. }
  71096. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  71097. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  71098. if (!nearestGopObj || nearestDistance > dtsDistance) {
  71099. nearestGopObj = currentGopObj;
  71100. nearestDistance = dtsDistance;
  71101. }
  71102. }
  71103. }
  71104. if (nearestGopObj) {
  71105. return nearestGopObj.gop;
  71106. }
  71107. return null;
  71108. };
  71109. this.alignGopsAtStart_ = function(gops) {
  71110. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  71111. byteLength = gops.byteLength;
  71112. nalCount = gops.nalCount;
  71113. duration5 = gops.duration;
  71114. alignIndex = gopIndex = 0;
  71115. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  71116. align = gopsToAlignWith[alignIndex];
  71117. gop = gops[gopIndex];
  71118. if (align.pts === gop.pts) {
  71119. break;
  71120. }
  71121. if (gop.pts > align.pts) {
  71122. alignIndex++;
  71123. continue;
  71124. }
  71125. gopIndex++;
  71126. byteLength -= gop.byteLength;
  71127. nalCount -= gop.nalCount;
  71128. duration5 -= gop.duration;
  71129. }
  71130. if (gopIndex === 0) {
  71131. return gops;
  71132. }
  71133. if (gopIndex === gops.length) {
  71134. return null;
  71135. }
  71136. alignedGops = gops.slice(gopIndex);
  71137. alignedGops.byteLength = byteLength;
  71138. alignedGops.duration = duration5;
  71139. alignedGops.nalCount = nalCount;
  71140. alignedGops.pts = alignedGops[0].pts;
  71141. alignedGops.dts = alignedGops[0].dts;
  71142. return alignedGops;
  71143. };
  71144. this.alignGopsAtEnd_ = function(gops) {
  71145. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  71146. alignIndex = gopsToAlignWith.length - 1;
  71147. gopIndex = gops.length - 1;
  71148. alignEndIndex = null;
  71149. matchFound = false;
  71150. while (alignIndex >= 0 && gopIndex >= 0) {
  71151. align = gopsToAlignWith[alignIndex];
  71152. gop = gops[gopIndex];
  71153. if (align.pts === gop.pts) {
  71154. matchFound = true;
  71155. break;
  71156. }
  71157. if (align.pts > gop.pts) {
  71158. alignIndex--;
  71159. continue;
  71160. }
  71161. if (alignIndex === gopsToAlignWith.length - 1) {
  71162. alignEndIndex = gopIndex;
  71163. }
  71164. gopIndex--;
  71165. }
  71166. if (!matchFound && alignEndIndex === null) {
  71167. return null;
  71168. }
  71169. var trimIndex;
  71170. if (matchFound) {
  71171. trimIndex = gopIndex;
  71172. } else {
  71173. trimIndex = alignEndIndex;
  71174. }
  71175. if (trimIndex === 0) {
  71176. return gops;
  71177. }
  71178. var alignedGops = gops.slice(trimIndex);
  71179. var metadata = alignedGops.reduce(function(total, gop2) {
  71180. total.byteLength += gop2.byteLength;
  71181. total.duration += gop2.duration;
  71182. total.nalCount += gop2.nalCount;
  71183. return total;
  71184. }, {
  71185. byteLength: 0,
  71186. duration: 0,
  71187. nalCount: 0
  71188. });
  71189. alignedGops.byteLength = metadata.byteLength;
  71190. alignedGops.duration = metadata.duration;
  71191. alignedGops.nalCount = metadata.nalCount;
  71192. alignedGops.pts = alignedGops[0].pts;
  71193. alignedGops.dts = alignedGops[0].dts;
  71194. return alignedGops;
  71195. };
  71196. this.alignGopsWith = function(newGopsToAlignWith) {
  71197. gopsToAlignWith = newGopsToAlignWith;
  71198. };
  71199. };
  71200. VideoSegmentStream.prototype = new Stream2();
  71201. CoalesceStream = function(options2, metadataStream2) {
  71202. this.numberOfTracks = 0;
  71203. this.metadataStream = metadataStream2;
  71204. options2 = options2 || {};
  71205. if (typeof options2.remux !== "undefined") {
  71206. this.remuxTracks = !!options2.remux;
  71207. } else {
  71208. this.remuxTracks = true;
  71209. }
  71210. if (typeof options2.keepOriginalTimestamps === "boolean") {
  71211. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  71212. } else {
  71213. this.keepOriginalTimestamps = false;
  71214. }
  71215. this.pendingTracks = [];
  71216. this.videoTrack = null;
  71217. this.pendingBoxes = [];
  71218. this.pendingCaptions = [];
  71219. this.pendingMetadata = [];
  71220. this.pendingBytes = 0;
  71221. this.emittedTracks = 0;
  71222. CoalesceStream.prototype.init.call(this);
  71223. this.push = function(output) {
  71224. if (output.text) {
  71225. return this.pendingCaptions.push(output);
  71226. }
  71227. if (output.frames) {
  71228. return this.pendingMetadata.push(output);
  71229. }
  71230. this.pendingTracks.push(output.track);
  71231. this.pendingBytes += output.boxes.byteLength;
  71232. if (output.track.type === "video") {
  71233. this.videoTrack = output.track;
  71234. this.pendingBoxes.push(output.boxes);
  71235. }
  71236. if (output.track.type === "audio") {
  71237. this.audioTrack = output.track;
  71238. this.pendingBoxes.unshift(output.boxes);
  71239. }
  71240. };
  71241. };
  71242. CoalesceStream.prototype = new Stream2();
  71243. CoalesceStream.prototype.flush = function(flushSource) {
  71244. var offset = 0, event2 = {
  71245. captions: [],
  71246. captionStreams: {},
  71247. metadata: [],
  71248. info: {}
  71249. }, caption, id32, initSegment, timelineStartPts = 0, i2;
  71250. if (this.pendingTracks.length < this.numberOfTracks) {
  71251. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  71252. return;
  71253. } else if (this.remuxTracks) {
  71254. return;
  71255. } else if (this.pendingTracks.length === 0) {
  71256. this.emittedTracks++;
  71257. if (this.emittedTracks >= this.numberOfTracks) {
  71258. this.trigger("done");
  71259. this.emittedTracks = 0;
  71260. }
  71261. return;
  71262. }
  71263. }
  71264. if (this.videoTrack) {
  71265. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  71266. VIDEO_PROPERTIES.forEach(function(prop) {
  71267. event2.info[prop] = this.videoTrack[prop];
  71268. }, this);
  71269. } else if (this.audioTrack) {
  71270. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  71271. AUDIO_PROPERTIES.forEach(function(prop) {
  71272. event2.info[prop] = this.audioTrack[prop];
  71273. }, this);
  71274. }
  71275. if (this.videoTrack || this.audioTrack) {
  71276. if (this.pendingTracks.length === 1) {
  71277. event2.type = this.pendingTracks[0].type;
  71278. } else {
  71279. event2.type = "combined";
  71280. }
  71281. this.emittedTracks += this.pendingTracks.length;
  71282. initSegment = mp43.initSegment(this.pendingTracks);
  71283. event2.initSegment = new Uint8Array(initSegment.byteLength);
  71284. event2.initSegment.set(initSegment);
  71285. event2.data = new Uint8Array(this.pendingBytes);
  71286. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  71287. event2.data.set(this.pendingBoxes[i2], offset);
  71288. offset += this.pendingBoxes[i2].byteLength;
  71289. }
  71290. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  71291. caption = this.pendingCaptions[i2];
  71292. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  71293. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  71294. event2.captionStreams[caption.stream] = true;
  71295. event2.captions.push(caption);
  71296. }
  71297. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  71298. id32 = this.pendingMetadata[i2];
  71299. id32.cueTime = clock2.metadataTsToSeconds(id32.pts, timelineStartPts, this.keepOriginalTimestamps);
  71300. event2.metadata.push(id32);
  71301. }
  71302. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  71303. this.pendingTracks.length = 0;
  71304. this.videoTrack = null;
  71305. this.pendingBoxes.length = 0;
  71306. this.pendingCaptions.length = 0;
  71307. this.pendingBytes = 0;
  71308. this.pendingMetadata.length = 0;
  71309. this.trigger("data", event2);
  71310. for (i2 = 0; i2 < event2.captions.length; i2++) {
  71311. caption = event2.captions[i2];
  71312. this.trigger("caption", caption);
  71313. }
  71314. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  71315. id32 = event2.metadata[i2];
  71316. this.trigger("id3Frame", id32);
  71317. }
  71318. }
  71319. if (this.emittedTracks >= this.numberOfTracks) {
  71320. this.trigger("done");
  71321. this.emittedTracks = 0;
  71322. }
  71323. };
  71324. CoalesceStream.prototype.setRemux = function(val) {
  71325. this.remuxTracks = val;
  71326. };
  71327. Transmuxer = function(options2) {
  71328. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  71329. Transmuxer.prototype.init.call(this);
  71330. options2 = options2 || {};
  71331. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  71332. this.transmuxPipeline_ = {};
  71333. this.setupAacPipeline = function() {
  71334. var pipeline = {};
  71335. this.transmuxPipeline_ = pipeline;
  71336. pipeline.type = "aac";
  71337. pipeline.metadataStream = new m2ts.MetadataStream();
  71338. pipeline.aacStream = new AacStream();
  71339. pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream("audio");
  71340. pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream("timed-metadata");
  71341. pipeline.adtsStream = new AdtsStream();
  71342. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71343. pipeline.headOfPipeline = pipeline.aacStream;
  71344. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  71345. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71346. pipeline.metadataStream.on("timestamp", function(frame) {
  71347. pipeline.aacStream.setTimestamp(frame.timeStamp);
  71348. });
  71349. pipeline.aacStream.on("data", function(data) {
  71350. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  71351. return;
  71352. }
  71353. audioTrack = audioTrack || {
  71354. timelineStartInfo: {
  71355. baseMediaDecodeTime: self2.baseMediaDecodeTime
  71356. },
  71357. codec: "adts",
  71358. type: "audio"
  71359. };
  71360. pipeline.coalesceStream.numberOfTracks++;
  71361. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71362. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71363. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71364. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71365. self2.trigger("trackinfo", {
  71366. hasAudio: !!audioTrack,
  71367. hasVideo: !!videoTrack
  71368. });
  71369. });
  71370. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71371. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71372. addPipelineLogRetriggers(this, pipeline);
  71373. };
  71374. this.setupTsPipeline = function() {
  71375. var pipeline = {};
  71376. this.transmuxPipeline_ = pipeline;
  71377. pipeline.type = "ts";
  71378. pipeline.metadataStream = new m2ts.MetadataStream();
  71379. pipeline.packetStream = new m2ts.TransportPacketStream();
  71380. pipeline.parseStream = new m2ts.TransportParseStream();
  71381. pipeline.elementaryStream = new m2ts.ElementaryStream();
  71382. pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream();
  71383. pipeline.adtsStream = new AdtsStream();
  71384. pipeline.h264Stream = new H264Stream();
  71385. pipeline.captionStream = new m2ts.CaptionStream(options2);
  71386. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71387. pipeline.headOfPipeline = pipeline.packetStream;
  71388. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  71389. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  71390. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  71391. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71392. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  71393. pipeline.elementaryStream.on("data", function(data) {
  71394. var i2;
  71395. if (data.type === "metadata") {
  71396. i2 = data.tracks.length;
  71397. while (i2--) {
  71398. if (!videoTrack && data.tracks[i2].type === "video") {
  71399. videoTrack = data.tracks[i2];
  71400. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71401. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  71402. audioTrack = data.tracks[i2];
  71403. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71404. }
  71405. }
  71406. if (videoTrack && !pipeline.videoSegmentStream) {
  71407. pipeline.coalesceStream.numberOfTracks++;
  71408. pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options2);
  71409. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  71410. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  71411. if (audioTrack && !options2.keepOriginalTimestamps) {
  71412. audioTrack.timelineStartInfo = timelineStartInfo;
  71413. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  71414. }
  71415. });
  71416. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  71417. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  71418. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  71419. if (audioTrack) {
  71420. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  71421. }
  71422. });
  71423. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  71424. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  71425. }
  71426. if (audioTrack && !pipeline.audioSegmentStream) {
  71427. pipeline.coalesceStream.numberOfTracks++;
  71428. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71429. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71430. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71431. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  71432. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71433. }
  71434. self2.trigger("trackinfo", {
  71435. hasAudio: !!audioTrack,
  71436. hasVideo: !!videoTrack
  71437. });
  71438. }
  71439. });
  71440. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71441. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  71442. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  71443. self2.trigger("id3Frame", id3Frame);
  71444. });
  71445. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  71446. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71447. addPipelineLogRetriggers(this, pipeline);
  71448. };
  71449. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  71450. var pipeline = this.transmuxPipeline_;
  71451. if (!options2.keepOriginalTimestamps) {
  71452. this.baseMediaDecodeTime = baseMediaDecodeTime;
  71453. }
  71454. if (audioTrack) {
  71455. audioTrack.timelineStartInfo.dts = void 0;
  71456. audioTrack.timelineStartInfo.pts = void 0;
  71457. trackDecodeInfo.clearDtsInfo(audioTrack);
  71458. if (pipeline.audioTimestampRolloverStream) {
  71459. pipeline.audioTimestampRolloverStream.discontinuity();
  71460. }
  71461. }
  71462. if (videoTrack) {
  71463. if (pipeline.videoSegmentStream) {
  71464. pipeline.videoSegmentStream.gopCache_ = [];
  71465. }
  71466. videoTrack.timelineStartInfo.dts = void 0;
  71467. videoTrack.timelineStartInfo.pts = void 0;
  71468. trackDecodeInfo.clearDtsInfo(videoTrack);
  71469. pipeline.captionStream.reset();
  71470. }
  71471. if (pipeline.timestampRolloverStream) {
  71472. pipeline.timestampRolloverStream.discontinuity();
  71473. }
  71474. };
  71475. this.setAudioAppendStart = function(timestamp) {
  71476. if (audioTrack) {
  71477. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  71478. }
  71479. };
  71480. this.setRemux = function(val) {
  71481. var pipeline = this.transmuxPipeline_;
  71482. options2.remux = val;
  71483. if (pipeline && pipeline.coalesceStream) {
  71484. pipeline.coalesceStream.setRemux(val);
  71485. }
  71486. };
  71487. this.alignGopsWith = function(gopsToAlignWith) {
  71488. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  71489. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  71490. }
  71491. };
  71492. this.getLogTrigger_ = function(key) {
  71493. var self3 = this;
  71494. return function(event2) {
  71495. event2.stream = key;
  71496. self3.trigger("log", event2);
  71497. };
  71498. };
  71499. this.push = function(data) {
  71500. if (hasFlushed) {
  71501. var isAac = isLikelyAacData(data);
  71502. if (isAac && this.transmuxPipeline_.type !== "aac") {
  71503. this.setupAacPipeline();
  71504. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  71505. this.setupTsPipeline();
  71506. }
  71507. hasFlushed = false;
  71508. }
  71509. this.transmuxPipeline_.headOfPipeline.push(data);
  71510. };
  71511. this.flush = function() {
  71512. hasFlushed = true;
  71513. this.transmuxPipeline_.headOfPipeline.flush();
  71514. };
  71515. this.endTimeline = function() {
  71516. this.transmuxPipeline_.headOfPipeline.endTimeline();
  71517. };
  71518. this.reset = function() {
  71519. if (this.transmuxPipeline_.headOfPipeline) {
  71520. this.transmuxPipeline_.headOfPipeline.reset();
  71521. }
  71522. };
  71523. this.resetCaptions = function() {
  71524. if (this.transmuxPipeline_.captionStream) {
  71525. this.transmuxPipeline_.captionStream.reset();
  71526. }
  71527. };
  71528. };
  71529. Transmuxer.prototype = new Stream2();
  71530. var transmuxer = {
  71531. Transmuxer,
  71532. VideoSegmentStream,
  71533. AudioSegmentStream,
  71534. AUDIO_PROPERTIES,
  71535. VIDEO_PROPERTIES,
  71536. generateSegmentTimingInfo
  71537. };
  71538. var toUnsigned$3 = function(value) {
  71539. return value >>> 0;
  71540. };
  71541. var toHexString$1 = function(value) {
  71542. return ("00" + value.toString(16)).slice(-2);
  71543. };
  71544. var bin = {
  71545. toUnsigned: toUnsigned$3,
  71546. toHexString: toHexString$1
  71547. };
  71548. var parseType$3 = function(buffer) {
  71549. var result = "";
  71550. result += String.fromCharCode(buffer[0]);
  71551. result += String.fromCharCode(buffer[1]);
  71552. result += String.fromCharCode(buffer[2]);
  71553. result += String.fromCharCode(buffer[3]);
  71554. return result;
  71555. };
  71556. var parseType_1 = parseType$3;
  71557. var toUnsigned$2 = bin.toUnsigned;
  71558. var parseType$2 = parseType_1;
  71559. var findBox$2 = function(data, path) {
  71560. var results = [], i2, size, type3, end, subresults;
  71561. if (!path.length) {
  71562. return null;
  71563. }
  71564. for (i2 = 0; i2 < data.byteLength; ) {
  71565. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  71566. type3 = parseType$2(data.subarray(i2 + 4, i2 + 8));
  71567. end = size > 1 ? i2 + size : data.byteLength;
  71568. if (type3 === path[0]) {
  71569. if (path.length === 1) {
  71570. results.push(data.subarray(i2 + 8, end));
  71571. } else {
  71572. subresults = findBox$2(data.subarray(i2 + 8, end), path.slice(1));
  71573. if (subresults.length) {
  71574. results = results.concat(subresults);
  71575. }
  71576. }
  71577. }
  71578. i2 = end;
  71579. }
  71580. return results;
  71581. };
  71582. var findBox_1 = findBox$2;
  71583. var toUnsigned$1 = bin.toUnsigned;
  71584. var getUint64$22 = numbers2.getUint64;
  71585. var tfdt = function(data) {
  71586. var result = {
  71587. version: data[0],
  71588. flags: new Uint8Array(data.subarray(1, 4))
  71589. };
  71590. if (result.version === 1) {
  71591. result.baseMediaDecodeTime = getUint64$22(data.subarray(4));
  71592. } else {
  71593. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  71594. }
  71595. return result;
  71596. };
  71597. var parseTfdt$2 = tfdt;
  71598. var parseSampleFlags$1 = function(flags) {
  71599. return {
  71600. isLeading: (flags[0] & 12) >>> 2,
  71601. dependsOn: flags[0] & 3,
  71602. isDependedOn: (flags[1] & 192) >>> 6,
  71603. hasRedundancy: (flags[1] & 48) >>> 4,
  71604. paddingValue: (flags[1] & 14) >>> 1,
  71605. isNonSyncSample: flags[1] & 1,
  71606. degradationPriority: flags[2] << 8 | flags[3]
  71607. };
  71608. };
  71609. var parseSampleFlags_1 = parseSampleFlags$1;
  71610. var parseSampleFlags = parseSampleFlags_1;
  71611. var trun = function(data) {
  71612. var result = {
  71613. version: data[0],
  71614. flags: new Uint8Array(data.subarray(1, 4)),
  71615. samples: []
  71616. }, 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;
  71617. if (dataOffsetPresent) {
  71618. result.dataOffset = view.getInt32(offset);
  71619. offset += 4;
  71620. }
  71621. if (firstSampleFlagsPresent && sampleCount) {
  71622. sample = {
  71623. flags: parseSampleFlags(data.subarray(offset, offset + 4))
  71624. };
  71625. offset += 4;
  71626. if (sampleDurationPresent) {
  71627. sample.duration = view.getUint32(offset);
  71628. offset += 4;
  71629. }
  71630. if (sampleSizePresent) {
  71631. sample.size = view.getUint32(offset);
  71632. offset += 4;
  71633. }
  71634. if (sampleCompositionTimeOffsetPresent) {
  71635. if (result.version === 1) {
  71636. sample.compositionTimeOffset = view.getInt32(offset);
  71637. } else {
  71638. sample.compositionTimeOffset = view.getUint32(offset);
  71639. }
  71640. offset += 4;
  71641. }
  71642. result.samples.push(sample);
  71643. sampleCount--;
  71644. }
  71645. while (sampleCount--) {
  71646. sample = {};
  71647. if (sampleDurationPresent) {
  71648. sample.duration = view.getUint32(offset);
  71649. offset += 4;
  71650. }
  71651. if (sampleSizePresent) {
  71652. sample.size = view.getUint32(offset);
  71653. offset += 4;
  71654. }
  71655. if (sampleFlagsPresent) {
  71656. sample.flags = parseSampleFlags(data.subarray(offset, offset + 4));
  71657. offset += 4;
  71658. }
  71659. if (sampleCompositionTimeOffsetPresent) {
  71660. if (result.version === 1) {
  71661. sample.compositionTimeOffset = view.getInt32(offset);
  71662. } else {
  71663. sample.compositionTimeOffset = view.getUint32(offset);
  71664. }
  71665. offset += 4;
  71666. }
  71667. result.samples.push(sample);
  71668. }
  71669. return result;
  71670. };
  71671. var parseTrun$2 = trun;
  71672. var tfhd = function(data) {
  71673. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  71674. version: data[0],
  71675. flags: new Uint8Array(data.subarray(1, 4)),
  71676. trackId: view.getUint32(4)
  71677. }, 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;
  71678. i2 = 8;
  71679. if (baseDataOffsetPresent) {
  71680. i2 += 4;
  71681. result.baseDataOffset = view.getUint32(12);
  71682. i2 += 4;
  71683. }
  71684. if (sampleDescriptionIndexPresent) {
  71685. result.sampleDescriptionIndex = view.getUint32(i2);
  71686. i2 += 4;
  71687. }
  71688. if (defaultSampleDurationPresent) {
  71689. result.defaultSampleDuration = view.getUint32(i2);
  71690. i2 += 4;
  71691. }
  71692. if (defaultSampleSizePresent) {
  71693. result.defaultSampleSize = view.getUint32(i2);
  71694. i2 += 4;
  71695. }
  71696. if (defaultSampleFlagsPresent) {
  71697. result.defaultSampleFlags = view.getUint32(i2);
  71698. }
  71699. if (durationIsEmpty) {
  71700. result.durationIsEmpty = true;
  71701. }
  71702. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  71703. result.baseDataOffsetIsMoof = true;
  71704. }
  71705. return result;
  71706. };
  71707. var parseTfhd$2 = tfhd;
  71708. var win2;
  71709. if (typeof window !== "undefined") {
  71710. win2 = window;
  71711. } else if (typeof commonjsGlobal2 !== "undefined") {
  71712. win2 = commonjsGlobal2;
  71713. } else if (typeof self !== "undefined") {
  71714. win2 = self;
  71715. } else {
  71716. win2 = {};
  71717. }
  71718. var window_12 = win2;
  71719. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  71720. var CaptionStream = captionStream.CaptionStream;
  71721. var findBox$12 = findBox_1;
  71722. var parseTfdt$1 = parseTfdt$2;
  71723. var parseTrun$1 = parseTrun$2;
  71724. var parseTfhd$1 = parseTfhd$2;
  71725. var window$22 = window_12;
  71726. var mapToSample = function(offset, samples) {
  71727. var approximateOffset = offset;
  71728. for (var i2 = 0; i2 < samples.length; i2++) {
  71729. var sample = samples[i2];
  71730. if (approximateOffset < sample.size) {
  71731. return sample;
  71732. }
  71733. approximateOffset -= sample.size;
  71734. }
  71735. return null;
  71736. };
  71737. var findSeiNals = function(avcStream, samples, trackId) {
  71738. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  71739. logs: [],
  71740. seiNals: []
  71741. }, seiNal, i2, length, lastMatchedSample;
  71742. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  71743. length = avcView.getUint32(i2);
  71744. i2 += 4;
  71745. if (length <= 0) {
  71746. continue;
  71747. }
  71748. switch (avcStream[i2] & 31) {
  71749. case 6:
  71750. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  71751. var matchingSample = mapToSample(i2, samples);
  71752. seiNal = {
  71753. nalUnitType: "sei_rbsp",
  71754. size: length,
  71755. data,
  71756. escapedRBSP: discardEmulationPreventionBytes4(data),
  71757. trackId
  71758. };
  71759. if (matchingSample) {
  71760. seiNal.pts = matchingSample.pts;
  71761. seiNal.dts = matchingSample.dts;
  71762. lastMatchedSample = matchingSample;
  71763. } else if (lastMatchedSample) {
  71764. seiNal.pts = lastMatchedSample.pts;
  71765. seiNal.dts = lastMatchedSample.dts;
  71766. } else {
  71767. result.logs.push({
  71768. level: "warn",
  71769. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  71770. });
  71771. break;
  71772. }
  71773. result.seiNals.push(seiNal);
  71774. break;
  71775. }
  71776. }
  71777. return result;
  71778. };
  71779. var parseSamples = function(truns, baseMediaDecodeTime, tfhd2) {
  71780. var currentDts = baseMediaDecodeTime;
  71781. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  71782. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  71783. var trackId = tfhd2.trackId;
  71784. var allSamples = [];
  71785. truns.forEach(function(trun2) {
  71786. var trackRun = parseTrun$1(trun2);
  71787. var samples = trackRun.samples;
  71788. samples.forEach(function(sample) {
  71789. if (sample.duration === void 0) {
  71790. sample.duration = defaultSampleDuration;
  71791. }
  71792. if (sample.size === void 0) {
  71793. sample.size = defaultSampleSize;
  71794. }
  71795. sample.trackId = trackId;
  71796. sample.dts = currentDts;
  71797. if (sample.compositionTimeOffset === void 0) {
  71798. sample.compositionTimeOffset = 0;
  71799. }
  71800. if (typeof currentDts === "bigint") {
  71801. sample.pts = currentDts + window$22.BigInt(sample.compositionTimeOffset);
  71802. currentDts += window$22.BigInt(sample.duration);
  71803. } else {
  71804. sample.pts = currentDts + sample.compositionTimeOffset;
  71805. currentDts += sample.duration;
  71806. }
  71807. });
  71808. allSamples = allSamples.concat(samples);
  71809. });
  71810. return allSamples;
  71811. };
  71812. var parseCaptionNals = function(segment, videoTrackId) {
  71813. var trafs = findBox$12(segment, ["moof", "traf"]);
  71814. var mdats = findBox$12(segment, ["mdat"]);
  71815. var captionNals = {};
  71816. var mdatTrafPairs = [];
  71817. mdats.forEach(function(mdat2, index2) {
  71818. var matchingTraf = trafs[index2];
  71819. mdatTrafPairs.push({
  71820. mdat: mdat2,
  71821. traf: matchingTraf
  71822. });
  71823. });
  71824. mdatTrafPairs.forEach(function(pair) {
  71825. var mdat2 = pair.mdat;
  71826. var traf2 = pair.traf;
  71827. var tfhd2 = findBox$12(traf2, ["tfhd"]);
  71828. var headerInfo = parseTfhd$1(tfhd2[0]);
  71829. var trackId = headerInfo.trackId;
  71830. var tfdt2 = findBox$12(traf2, ["tfdt"]);
  71831. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt$1(tfdt2[0]).baseMediaDecodeTime : 0;
  71832. var truns = findBox$12(traf2, ["trun"]);
  71833. var samples;
  71834. var result;
  71835. if (videoTrackId === trackId && truns.length > 0) {
  71836. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  71837. result = findSeiNals(mdat2, samples, trackId);
  71838. if (!captionNals[trackId]) {
  71839. captionNals[trackId] = {
  71840. seiNals: [],
  71841. logs: []
  71842. };
  71843. }
  71844. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  71845. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  71846. }
  71847. });
  71848. return captionNals;
  71849. };
  71850. var parseEmbeddedCaptions = function(segment, trackId, timescale3) {
  71851. var captionNals;
  71852. if (trackId === null) {
  71853. return null;
  71854. }
  71855. captionNals = parseCaptionNals(segment, trackId);
  71856. var trackNals = captionNals[trackId] || {};
  71857. return {
  71858. seiNals: trackNals.seiNals,
  71859. logs: trackNals.logs,
  71860. timescale: timescale3
  71861. };
  71862. };
  71863. var CaptionParser = function() {
  71864. var isInitialized = false;
  71865. var captionStream2;
  71866. var segmentCache;
  71867. var trackId;
  71868. var timescale3;
  71869. var parsedCaptions;
  71870. var parsingPartial;
  71871. this.isInitialized = function() {
  71872. return isInitialized;
  71873. };
  71874. this.init = function(options2) {
  71875. captionStream2 = new CaptionStream();
  71876. isInitialized = true;
  71877. parsingPartial = options2 ? options2.isPartial : false;
  71878. captionStream2.on("data", function(event2) {
  71879. event2.startTime = event2.startPts / timescale3;
  71880. event2.endTime = event2.endPts / timescale3;
  71881. parsedCaptions.captions.push(event2);
  71882. parsedCaptions.captionStreams[event2.stream] = true;
  71883. });
  71884. captionStream2.on("log", function(log2) {
  71885. parsedCaptions.logs.push(log2);
  71886. });
  71887. };
  71888. this.isNewInit = function(videoTrackIds, timescales) {
  71889. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  71890. return false;
  71891. }
  71892. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  71893. };
  71894. this.parse = function(segment, videoTrackIds, timescales) {
  71895. var parsedData;
  71896. if (!this.isInitialized()) {
  71897. return null;
  71898. } else if (!videoTrackIds || !timescales) {
  71899. return null;
  71900. } else if (this.isNewInit(videoTrackIds, timescales)) {
  71901. trackId = videoTrackIds[0];
  71902. timescale3 = timescales[trackId];
  71903. } else if (trackId === null || !timescale3) {
  71904. segmentCache.push(segment);
  71905. return null;
  71906. }
  71907. while (segmentCache.length > 0) {
  71908. var cachedSegment = segmentCache.shift();
  71909. this.parse(cachedSegment, videoTrackIds, timescales);
  71910. }
  71911. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  71912. if (parsedData && parsedData.logs) {
  71913. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  71914. }
  71915. if (parsedData === null || !parsedData.seiNals) {
  71916. if (parsedCaptions.logs.length) {
  71917. return {
  71918. logs: parsedCaptions.logs,
  71919. captions: [],
  71920. captionStreams: []
  71921. };
  71922. }
  71923. return null;
  71924. }
  71925. this.pushNals(parsedData.seiNals);
  71926. this.flushStream();
  71927. return parsedCaptions;
  71928. };
  71929. this.pushNals = function(nals) {
  71930. if (!this.isInitialized() || !nals || nals.length === 0) {
  71931. return null;
  71932. }
  71933. nals.forEach(function(nal) {
  71934. captionStream2.push(nal);
  71935. });
  71936. };
  71937. this.flushStream = function() {
  71938. if (!this.isInitialized()) {
  71939. return null;
  71940. }
  71941. if (!parsingPartial) {
  71942. captionStream2.flush();
  71943. } else {
  71944. captionStream2.partialFlush();
  71945. }
  71946. };
  71947. this.clearParsedCaptions = function() {
  71948. parsedCaptions.captions = [];
  71949. parsedCaptions.captionStreams = {};
  71950. parsedCaptions.logs = [];
  71951. };
  71952. this.resetCaptionStream = function() {
  71953. if (!this.isInitialized()) {
  71954. return null;
  71955. }
  71956. captionStream2.reset();
  71957. };
  71958. this.clearAllCaptions = function() {
  71959. this.clearParsedCaptions();
  71960. this.resetCaptionStream();
  71961. };
  71962. this.reset = function() {
  71963. segmentCache = [];
  71964. trackId = null;
  71965. timescale3 = null;
  71966. if (!parsedCaptions) {
  71967. parsedCaptions = {
  71968. captions: [],
  71969. captionStreams: {},
  71970. logs: []
  71971. };
  71972. } else {
  71973. this.clearParsedCaptions();
  71974. }
  71975. this.resetCaptionStream();
  71976. };
  71977. this.reset();
  71978. };
  71979. var captionParser = CaptionParser;
  71980. var uint8ToCString$1 = function(data) {
  71981. var index2 = 0;
  71982. var curChar = String.fromCharCode(data[index2]);
  71983. var retString = "";
  71984. while (curChar !== "\0") {
  71985. retString += curChar;
  71986. index2++;
  71987. curChar = String.fromCharCode(data[index2]);
  71988. }
  71989. retString += curChar;
  71990. return retString;
  71991. };
  71992. var string = {
  71993. uint8ToCString: uint8ToCString$1
  71994. };
  71995. var uint8ToCString = string.uint8ToCString;
  71996. var getUint64$12 = numbers2.getUint64;
  71997. var parseEmsgBox = function(boxData) {
  71998. var offset = 4;
  71999. var version2 = boxData[0];
  72000. var scheme_id_uri, value, timescale3, presentation_time, presentation_time_delta, event_duration, id, message_data;
  72001. if (version2 === 0) {
  72002. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  72003. offset += scheme_id_uri.length;
  72004. value = uint8ToCString(boxData.subarray(offset));
  72005. offset += value.length;
  72006. var dv = new DataView(boxData.buffer);
  72007. timescale3 = dv.getUint32(offset);
  72008. offset += 4;
  72009. presentation_time_delta = dv.getUint32(offset);
  72010. offset += 4;
  72011. event_duration = dv.getUint32(offset);
  72012. offset += 4;
  72013. id = dv.getUint32(offset);
  72014. offset += 4;
  72015. } else if (version2 === 1) {
  72016. var dv = new DataView(boxData.buffer);
  72017. timescale3 = dv.getUint32(offset);
  72018. offset += 4;
  72019. presentation_time = getUint64$12(boxData.subarray(offset));
  72020. offset += 8;
  72021. event_duration = dv.getUint32(offset);
  72022. offset += 4;
  72023. id = dv.getUint32(offset);
  72024. offset += 4;
  72025. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  72026. offset += scheme_id_uri.length;
  72027. value = uint8ToCString(boxData.subarray(offset));
  72028. offset += value.length;
  72029. }
  72030. message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength));
  72031. var emsgBox = {
  72032. scheme_id_uri,
  72033. value,
  72034. timescale: timescale3 ? timescale3 : 1,
  72035. presentation_time,
  72036. presentation_time_delta,
  72037. event_duration,
  72038. id,
  72039. message_data
  72040. };
  72041. return isValidEmsgBox(version2, emsgBox) ? emsgBox : void 0;
  72042. };
  72043. var scaleTime = function(presentationTime, timescale3, timeDelta, offset) {
  72044. return presentationTime || presentationTime === 0 ? presentationTime / timescale3 : offset + timeDelta / timescale3;
  72045. };
  72046. var isValidEmsgBox = function(version2, emsg2) {
  72047. var hasScheme = emsg2.scheme_id_uri !== "\0";
  72048. var isValidV0Box = version2 === 0 && isDefined(emsg2.presentation_time_delta) && hasScheme;
  72049. var isValidV1Box = version2 === 1 && isDefined(emsg2.presentation_time) && hasScheme;
  72050. return !(version2 > 1) && isValidV0Box || isValidV1Box;
  72051. };
  72052. var isDefined = function(data) {
  72053. return data !== void 0 || data !== null;
  72054. };
  72055. var emsg$1 = {
  72056. parseEmsgBox,
  72057. scaleTime
  72058. };
  72059. var toUnsigned = bin.toUnsigned;
  72060. var toHexString = bin.toHexString;
  72061. var findBox4 = findBox_1;
  72062. var parseType$1 = parseType_1;
  72063. var emsg = emsg$1;
  72064. var parseTfhd = parseTfhd$2;
  72065. var parseTrun = parseTrun$2;
  72066. var parseTfdt = parseTfdt$2;
  72067. var getUint642 = numbers2.getUint64;
  72068. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3;
  72069. var window$12 = window_12;
  72070. var parseId3Frames = parseId3.parseId3Frames;
  72071. timescale2 = function(init) {
  72072. var result = {}, traks = findBox4(init, ["moov", "trak"]);
  72073. return traks.reduce(function(result2, trak2) {
  72074. var tkhd2, version2, index2, id, mdhd2;
  72075. tkhd2 = findBox4(trak2, ["tkhd"])[0];
  72076. if (!tkhd2) {
  72077. return null;
  72078. }
  72079. version2 = tkhd2[0];
  72080. index2 = version2 === 0 ? 12 : 20;
  72081. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  72082. mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  72083. if (!mdhd2) {
  72084. return null;
  72085. }
  72086. version2 = mdhd2[0];
  72087. index2 = version2 === 0 ? 12 : 20;
  72088. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  72089. return result2;
  72090. }, result);
  72091. };
  72092. startTime = function(timescale3, fragment) {
  72093. var trafs;
  72094. trafs = findBox4(fragment, ["moof", "traf"]);
  72095. var lowestTime = trafs.reduce(function(acc, traf2) {
  72096. var tfhd2 = findBox4(traf2, ["tfhd"])[0];
  72097. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  72098. var scale = timescale3[id] || 9e4;
  72099. var tfdt2 = findBox4(traf2, ["tfdt"])[0];
  72100. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  72101. var baseTime;
  72102. if (tfdt2[0] === 1) {
  72103. baseTime = getUint642(tfdt2.subarray(4, 12));
  72104. } else {
  72105. baseTime = dv.getUint32(4);
  72106. }
  72107. let seconds;
  72108. if (typeof baseTime === "bigint") {
  72109. seconds = baseTime / window$12.BigInt(scale);
  72110. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  72111. seconds = baseTime / scale;
  72112. }
  72113. if (seconds < Number.MAX_SAFE_INTEGER) {
  72114. seconds = Number(seconds);
  72115. }
  72116. if (seconds < acc) {
  72117. acc = seconds;
  72118. }
  72119. return acc;
  72120. }, Infinity);
  72121. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  72122. };
  72123. compositionStartTime = function(timescales, fragment) {
  72124. var trafBoxes = findBox4(fragment, ["moof", "traf"]);
  72125. var baseMediaDecodeTime = 0;
  72126. var compositionTimeOffset = 0;
  72127. var trackId;
  72128. if (trafBoxes && trafBoxes.length) {
  72129. var tfhd2 = findBox4(trafBoxes[0], ["tfhd"])[0];
  72130. var trun2 = findBox4(trafBoxes[0], ["trun"])[0];
  72131. var tfdt2 = findBox4(trafBoxes[0], ["tfdt"])[0];
  72132. if (tfhd2) {
  72133. var parsedTfhd = parseTfhd(tfhd2);
  72134. trackId = parsedTfhd.trackId;
  72135. }
  72136. if (tfdt2) {
  72137. var parsedTfdt = parseTfdt(tfdt2);
  72138. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  72139. }
  72140. if (trun2) {
  72141. var parsedTrun = parseTrun(trun2);
  72142. if (parsedTrun.samples && parsedTrun.samples.length) {
  72143. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  72144. }
  72145. }
  72146. }
  72147. var timescale3 = timescales[trackId] || 9e4;
  72148. if (typeof baseMediaDecodeTime === "bigint") {
  72149. compositionTimeOffset = window$12.BigInt(compositionTimeOffset);
  72150. timescale3 = window$12.BigInt(timescale3);
  72151. }
  72152. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  72153. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  72154. result = Number(result);
  72155. }
  72156. return result;
  72157. };
  72158. getVideoTrackIds = function(init) {
  72159. var traks = findBox4(init, ["moov", "trak"]);
  72160. var videoTrackIds = [];
  72161. traks.forEach(function(trak2) {
  72162. var hdlrs = findBox4(trak2, ["mdia", "hdlr"]);
  72163. var tkhds = findBox4(trak2, ["tkhd"]);
  72164. hdlrs.forEach(function(hdlr2, index2) {
  72165. var handlerType = parseType$1(hdlr2.subarray(8, 12));
  72166. var tkhd2 = tkhds[index2];
  72167. var view;
  72168. var version2;
  72169. var trackId;
  72170. if (handlerType === "vide") {
  72171. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72172. version2 = view.getUint8(0);
  72173. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  72174. videoTrackIds.push(trackId);
  72175. }
  72176. });
  72177. });
  72178. return videoTrackIds;
  72179. };
  72180. getTimescaleFromMediaHeader = function(mdhd2) {
  72181. var version2 = mdhd2[0];
  72182. var index2 = version2 === 0 ? 12 : 20;
  72183. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  72184. };
  72185. getTracks = function(init) {
  72186. var traks = findBox4(init, ["moov", "trak"]);
  72187. var tracks = [];
  72188. traks.forEach(function(trak2) {
  72189. var track = {};
  72190. var tkhd2 = findBox4(trak2, ["tkhd"])[0];
  72191. var view, tkhdVersion;
  72192. if (tkhd2) {
  72193. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72194. tkhdVersion = view.getUint8(0);
  72195. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  72196. }
  72197. var hdlr2 = findBox4(trak2, ["mdia", "hdlr"])[0];
  72198. if (hdlr2) {
  72199. var type3 = parseType$1(hdlr2.subarray(8, 12));
  72200. if (type3 === "vide") {
  72201. track.type = "video";
  72202. } else if (type3 === "soun") {
  72203. track.type = "audio";
  72204. } else {
  72205. track.type = type3;
  72206. }
  72207. }
  72208. var stsd2 = findBox4(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  72209. if (stsd2) {
  72210. var sampleDescriptions = stsd2.subarray(8);
  72211. track.codec = parseType$1(sampleDescriptions.subarray(4, 8));
  72212. var codecBox = findBox4(sampleDescriptions, [track.codec])[0];
  72213. var codecConfig, codecConfigType;
  72214. if (codecBox) {
  72215. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  72216. codecConfig = codecBox.subarray(78);
  72217. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72218. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  72219. track.codec += ".";
  72220. track.codec += toHexString(codecConfig[9]);
  72221. track.codec += toHexString(codecConfig[10]);
  72222. track.codec += toHexString(codecConfig[11]);
  72223. } else {
  72224. track.codec = "avc1.4d400d";
  72225. }
  72226. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  72227. codecConfig = codecBox.subarray(28);
  72228. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72229. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  72230. track.codec += "." + toHexString(codecConfig[19]);
  72231. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  72232. } else {
  72233. track.codec = "mp4a.40.2";
  72234. }
  72235. } else {
  72236. track.codec = track.codec.toLowerCase();
  72237. }
  72238. }
  72239. }
  72240. var mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  72241. if (mdhd2) {
  72242. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  72243. }
  72244. tracks.push(track);
  72245. });
  72246. return tracks;
  72247. };
  72248. getEmsgID3 = function(segmentData, offset = 0) {
  72249. var emsgBoxes = findBox4(segmentData, ["emsg"]);
  72250. return emsgBoxes.map((data) => {
  72251. var parsedBox = emsg.parseEmsgBox(new Uint8Array(data));
  72252. var parsedId3Frames = parseId3Frames(parsedBox.message_data);
  72253. return {
  72254. cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset),
  72255. duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale),
  72256. frames: parsedId3Frames
  72257. };
  72258. });
  72259. };
  72260. var probe$2 = {
  72261. findBox: findBox4,
  72262. parseType: parseType$1,
  72263. timescale: timescale2,
  72264. startTime,
  72265. compositionStartTime,
  72266. videoTrackIds: getVideoTrackIds,
  72267. tracks: getTracks,
  72268. getTimescaleFromMediaHeader,
  72269. getEmsgID3
  72270. };
  72271. var StreamTypes$1 = streamTypes;
  72272. var parsePid = function(packet) {
  72273. var pid = packet[1] & 31;
  72274. pid <<= 8;
  72275. pid |= packet[2];
  72276. return pid;
  72277. };
  72278. var parsePayloadUnitStartIndicator = function(packet) {
  72279. return !!(packet[1] & 64);
  72280. };
  72281. var parseAdaptionField = function(packet) {
  72282. var offset = 0;
  72283. if ((packet[3] & 48) >>> 4 > 1) {
  72284. offset += packet[4] + 1;
  72285. }
  72286. return offset;
  72287. };
  72288. var parseType = function(packet, pmtPid) {
  72289. var pid = parsePid(packet);
  72290. if (pid === 0) {
  72291. return "pat";
  72292. } else if (pid === pmtPid) {
  72293. return "pmt";
  72294. } else if (pmtPid) {
  72295. return "pes";
  72296. }
  72297. return null;
  72298. };
  72299. var parsePat = function(packet) {
  72300. var pusi = parsePayloadUnitStartIndicator(packet);
  72301. var offset = 4 + parseAdaptionField(packet);
  72302. if (pusi) {
  72303. offset += packet[offset] + 1;
  72304. }
  72305. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  72306. };
  72307. var parsePmt = function(packet) {
  72308. var programMapTable = {};
  72309. var pusi = parsePayloadUnitStartIndicator(packet);
  72310. var payloadOffset = 4 + parseAdaptionField(packet);
  72311. if (pusi) {
  72312. payloadOffset += packet[payloadOffset] + 1;
  72313. }
  72314. if (!(packet[payloadOffset + 5] & 1)) {
  72315. return;
  72316. }
  72317. var sectionLength, tableEnd, programInfoLength;
  72318. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  72319. tableEnd = 3 + sectionLength - 4;
  72320. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  72321. var offset = 12 + programInfoLength;
  72322. while (offset < tableEnd) {
  72323. var i2 = payloadOffset + offset;
  72324. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  72325. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  72326. }
  72327. return programMapTable;
  72328. };
  72329. var parsePesType = function(packet, programMapTable) {
  72330. var pid = parsePid(packet);
  72331. var type3 = programMapTable[pid];
  72332. switch (type3) {
  72333. case StreamTypes$1.H264_STREAM_TYPE:
  72334. return "video";
  72335. case StreamTypes$1.ADTS_STREAM_TYPE:
  72336. return "audio";
  72337. case StreamTypes$1.METADATA_STREAM_TYPE:
  72338. return "timed-metadata";
  72339. default:
  72340. return null;
  72341. }
  72342. };
  72343. var parsePesTime = function(packet) {
  72344. var pusi = parsePayloadUnitStartIndicator(packet);
  72345. if (!pusi) {
  72346. return null;
  72347. }
  72348. var offset = 4 + parseAdaptionField(packet);
  72349. if (offset >= packet.byteLength) {
  72350. return null;
  72351. }
  72352. var pes = null;
  72353. var ptsDtsFlags;
  72354. ptsDtsFlags = packet[offset + 7];
  72355. if (ptsDtsFlags & 192) {
  72356. pes = {};
  72357. 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;
  72358. pes.pts *= 4;
  72359. pes.pts += (packet[offset + 13] & 6) >>> 1;
  72360. pes.dts = pes.pts;
  72361. if (ptsDtsFlags & 64) {
  72362. 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;
  72363. pes.dts *= 4;
  72364. pes.dts += (packet[offset + 18] & 6) >>> 1;
  72365. }
  72366. }
  72367. return pes;
  72368. };
  72369. var parseNalUnitType = function(type3) {
  72370. switch (type3) {
  72371. case 5:
  72372. return "slice_layer_without_partitioning_rbsp_idr";
  72373. case 6:
  72374. return "sei_rbsp";
  72375. case 7:
  72376. return "seq_parameter_set_rbsp";
  72377. case 8:
  72378. return "pic_parameter_set_rbsp";
  72379. case 9:
  72380. return "access_unit_delimiter_rbsp";
  72381. default:
  72382. return null;
  72383. }
  72384. };
  72385. var videoPacketContainsKeyFrame = function(packet) {
  72386. var offset = 4 + parseAdaptionField(packet);
  72387. var frameBuffer = packet.subarray(offset);
  72388. var frameI = 0;
  72389. var frameSyncPoint = 0;
  72390. var foundKeyFrame = false;
  72391. var nalType;
  72392. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  72393. if (frameBuffer[frameSyncPoint + 2] === 1) {
  72394. frameI = frameSyncPoint + 5;
  72395. break;
  72396. }
  72397. }
  72398. while (frameI < frameBuffer.byteLength) {
  72399. switch (frameBuffer[frameI]) {
  72400. case 0:
  72401. if (frameBuffer[frameI - 1] !== 0) {
  72402. frameI += 2;
  72403. break;
  72404. } else if (frameBuffer[frameI - 2] !== 0) {
  72405. frameI++;
  72406. break;
  72407. }
  72408. if (frameSyncPoint + 3 !== frameI - 2) {
  72409. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72410. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72411. foundKeyFrame = true;
  72412. }
  72413. }
  72414. do {
  72415. frameI++;
  72416. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  72417. frameSyncPoint = frameI - 2;
  72418. frameI += 3;
  72419. break;
  72420. case 1:
  72421. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  72422. frameI += 3;
  72423. break;
  72424. }
  72425. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72426. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72427. foundKeyFrame = true;
  72428. }
  72429. frameSyncPoint = frameI - 2;
  72430. frameI += 3;
  72431. break;
  72432. default:
  72433. frameI += 3;
  72434. break;
  72435. }
  72436. }
  72437. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  72438. frameI -= frameSyncPoint;
  72439. frameSyncPoint = 0;
  72440. if (frameBuffer && frameBuffer.byteLength > 3) {
  72441. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72442. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72443. foundKeyFrame = true;
  72444. }
  72445. }
  72446. return foundKeyFrame;
  72447. };
  72448. var probe$1 = {
  72449. parseType,
  72450. parsePat,
  72451. parsePmt,
  72452. parsePayloadUnitStartIndicator,
  72453. parsePesType,
  72454. parsePesTime,
  72455. videoPacketContainsKeyFrame
  72456. };
  72457. var StreamTypes = streamTypes;
  72458. var handleRollover = timestampRolloverStream.handleRollover;
  72459. var probe = {};
  72460. probe.ts = probe$1;
  72461. probe.aac = utils2;
  72462. var ONE_SECOND_IN_TS2 = clock$2.ONE_SECOND_IN_TS;
  72463. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  72464. var parsePsi_ = function(bytes, pmt) {
  72465. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  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 "pat":
  72472. pmt.pid = probe.ts.parsePat(packet);
  72473. break;
  72474. case "pmt":
  72475. var table = probe.ts.parsePmt(packet);
  72476. pmt.table = pmt.table || {};
  72477. Object.keys(table).forEach(function(key) {
  72478. pmt.table[key] = table[key];
  72479. });
  72480. break;
  72481. }
  72482. startIndex += MP2T_PACKET_LENGTH;
  72483. endIndex += MP2T_PACKET_LENGTH;
  72484. continue;
  72485. }
  72486. startIndex++;
  72487. endIndex++;
  72488. }
  72489. };
  72490. var parseAudioPes_ = function(bytes, pmt, result) {
  72491. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  72492. var endLoop = false;
  72493. while (endIndex <= bytes.byteLength) {
  72494. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  72495. packet = bytes.subarray(startIndex, endIndex);
  72496. type3 = probe.ts.parseType(packet, pmt.pid);
  72497. switch (type3) {
  72498. case "pes":
  72499. pesType = probe.ts.parsePesType(packet, pmt.table);
  72500. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72501. if (pesType === "audio" && pusi) {
  72502. parsed = probe.ts.parsePesTime(packet);
  72503. if (parsed) {
  72504. parsed.type = "audio";
  72505. result.audio.push(parsed);
  72506. endLoop = true;
  72507. }
  72508. }
  72509. break;
  72510. }
  72511. if (endLoop) {
  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 || endIndex === bytes.byteLength)) {
  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 === "audio" && pusi) {
  72533. parsed = probe.ts.parsePesTime(packet);
  72534. if (parsed) {
  72535. parsed.type = "audio";
  72536. result.audio.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 parseVideoPes_ = function(bytes, pmt, result) {
  72554. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  72555. var endLoop = false;
  72556. var currentFrame = {
  72557. data: [],
  72558. size: 0
  72559. };
  72560. while (endIndex < bytes.byteLength) {
  72561. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72562. packet = bytes.subarray(startIndex, endIndex);
  72563. type3 = probe.ts.parseType(packet, pmt.pid);
  72564. switch (type3) {
  72565. case "pes":
  72566. pesType = probe.ts.parsePesType(packet, pmt.table);
  72567. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72568. if (pesType === "video") {
  72569. if (pusi && !endLoop) {
  72570. parsed = probe.ts.parsePesTime(packet);
  72571. if (parsed) {
  72572. parsed.type = "video";
  72573. result.video.push(parsed);
  72574. endLoop = true;
  72575. }
  72576. }
  72577. if (!result.firstKeyFrame) {
  72578. if (pusi) {
  72579. if (currentFrame.size !== 0) {
  72580. frame = new Uint8Array(currentFrame.size);
  72581. i2 = 0;
  72582. while (currentFrame.data.length) {
  72583. pes = currentFrame.data.shift();
  72584. frame.set(pes, i2);
  72585. i2 += pes.byteLength;
  72586. }
  72587. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  72588. var firstKeyFrame = probe.ts.parsePesTime(frame);
  72589. if (firstKeyFrame) {
  72590. result.firstKeyFrame = firstKeyFrame;
  72591. result.firstKeyFrame.type = "video";
  72592. } else {
  72593. 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.");
  72594. }
  72595. }
  72596. currentFrame.size = 0;
  72597. }
  72598. }
  72599. currentFrame.data.push(packet);
  72600. currentFrame.size += packet.byteLength;
  72601. }
  72602. }
  72603. break;
  72604. }
  72605. if (endLoop && result.firstKeyFrame) {
  72606. break;
  72607. }
  72608. startIndex += MP2T_PACKET_LENGTH;
  72609. endIndex += MP2T_PACKET_LENGTH;
  72610. continue;
  72611. }
  72612. startIndex++;
  72613. endIndex++;
  72614. }
  72615. endIndex = bytes.byteLength;
  72616. startIndex = endIndex - MP2T_PACKET_LENGTH;
  72617. endLoop = false;
  72618. while (startIndex >= 0) {
  72619. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72620. packet = bytes.subarray(startIndex, endIndex);
  72621. type3 = probe.ts.parseType(packet, pmt.pid);
  72622. switch (type3) {
  72623. case "pes":
  72624. pesType = probe.ts.parsePesType(packet, pmt.table);
  72625. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72626. if (pesType === "video" && pusi) {
  72627. parsed = probe.ts.parsePesTime(packet);
  72628. if (parsed) {
  72629. parsed.type = "video";
  72630. result.video.push(parsed);
  72631. endLoop = true;
  72632. }
  72633. }
  72634. break;
  72635. }
  72636. if (endLoop) {
  72637. break;
  72638. }
  72639. startIndex -= MP2T_PACKET_LENGTH;
  72640. endIndex -= MP2T_PACKET_LENGTH;
  72641. continue;
  72642. }
  72643. startIndex--;
  72644. endIndex--;
  72645. }
  72646. };
  72647. var adjustTimestamp_ = function(segmentInfo, baseTimestamp) {
  72648. if (segmentInfo.audio && segmentInfo.audio.length) {
  72649. var audioBaseTimestamp = baseTimestamp;
  72650. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  72651. audioBaseTimestamp = segmentInfo.audio[0].dts;
  72652. }
  72653. segmentInfo.audio.forEach(function(info) {
  72654. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  72655. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  72656. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72657. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72658. });
  72659. }
  72660. if (segmentInfo.video && segmentInfo.video.length) {
  72661. var videoBaseTimestamp = baseTimestamp;
  72662. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  72663. videoBaseTimestamp = segmentInfo.video[0].dts;
  72664. }
  72665. segmentInfo.video.forEach(function(info) {
  72666. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  72667. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  72668. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72669. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72670. });
  72671. if (segmentInfo.firstKeyFrame) {
  72672. var frame = segmentInfo.firstKeyFrame;
  72673. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  72674. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  72675. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  72676. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  72677. }
  72678. }
  72679. };
  72680. var inspectAac_ = function(bytes) {
  72681. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  72682. while (bytes.length - byteIndex >= 3) {
  72683. var type3 = probe.aac.parseType(bytes, byteIndex);
  72684. switch (type3) {
  72685. case "timed-metadata":
  72686. if (bytes.length - byteIndex < 10) {
  72687. endLoop = true;
  72688. break;
  72689. }
  72690. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  72691. if (frameSize > bytes.length) {
  72692. endLoop = true;
  72693. break;
  72694. }
  72695. if (timestamp === null) {
  72696. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72697. timestamp = probe.aac.parseAacTimestamp(packet);
  72698. }
  72699. byteIndex += frameSize;
  72700. break;
  72701. case "audio":
  72702. if (bytes.length - byteIndex < 7) {
  72703. endLoop = true;
  72704. break;
  72705. }
  72706. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  72707. if (frameSize > bytes.length) {
  72708. endLoop = true;
  72709. break;
  72710. }
  72711. if (sampleRate === null) {
  72712. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72713. sampleRate = probe.aac.parseSampleRate(packet);
  72714. }
  72715. audioCount++;
  72716. byteIndex += frameSize;
  72717. break;
  72718. default:
  72719. byteIndex++;
  72720. break;
  72721. }
  72722. if (endLoop) {
  72723. return null;
  72724. }
  72725. }
  72726. if (sampleRate === null || timestamp === null) {
  72727. return null;
  72728. }
  72729. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  72730. var result = {
  72731. audio: [{
  72732. type: "audio",
  72733. dts: timestamp,
  72734. pts: timestamp
  72735. }, {
  72736. type: "audio",
  72737. dts: timestamp + audioCount * 1024 * audioTimescale,
  72738. pts: timestamp + audioCount * 1024 * audioTimescale
  72739. }]
  72740. };
  72741. return result;
  72742. };
  72743. var inspectTs_ = function(bytes) {
  72744. var pmt = {
  72745. pid: null,
  72746. table: null
  72747. };
  72748. var result = {};
  72749. parsePsi_(bytes, pmt);
  72750. for (var pid in pmt.table) {
  72751. if (pmt.table.hasOwnProperty(pid)) {
  72752. var type3 = pmt.table[pid];
  72753. switch (type3) {
  72754. case StreamTypes.H264_STREAM_TYPE:
  72755. result.video = [];
  72756. parseVideoPes_(bytes, pmt, result);
  72757. if (result.video.length === 0) {
  72758. delete result.video;
  72759. }
  72760. break;
  72761. case StreamTypes.ADTS_STREAM_TYPE:
  72762. result.audio = [];
  72763. parseAudioPes_(bytes, pmt, result);
  72764. if (result.audio.length === 0) {
  72765. delete result.audio;
  72766. }
  72767. break;
  72768. }
  72769. }
  72770. }
  72771. return result;
  72772. };
  72773. var inspect = function(bytes, baseTimestamp) {
  72774. var isAacData = probe.aac.isLikelyAacData(bytes);
  72775. var result;
  72776. if (isAacData) {
  72777. result = inspectAac_(bytes);
  72778. } else {
  72779. result = inspectTs_(bytes);
  72780. }
  72781. if (!result || !result.audio && !result.video) {
  72782. return null;
  72783. }
  72784. adjustTimestamp_(result, baseTimestamp);
  72785. return result;
  72786. };
  72787. var tsInspector = {
  72788. inspect,
  72789. parseAudioPes_
  72790. };
  72791. const wireTransmuxerEvents = function(self2, transmuxer2) {
  72792. transmuxer2.on("data", function(segment) {
  72793. const initArray = segment.initSegment;
  72794. segment.initSegment = {
  72795. data: initArray.buffer,
  72796. byteOffset: initArray.byteOffset,
  72797. byteLength: initArray.byteLength
  72798. };
  72799. const typedArray2 = segment.data;
  72800. segment.data = typedArray2.buffer;
  72801. self2.postMessage({
  72802. action: "data",
  72803. segment,
  72804. byteOffset: typedArray2.byteOffset,
  72805. byteLength: typedArray2.byteLength
  72806. }, [segment.data]);
  72807. });
  72808. transmuxer2.on("done", function(data) {
  72809. self2.postMessage({
  72810. action: "done"
  72811. });
  72812. });
  72813. transmuxer2.on("gopInfo", function(gopInfo) {
  72814. self2.postMessage({
  72815. action: "gopInfo",
  72816. gopInfo
  72817. });
  72818. });
  72819. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  72820. const videoSegmentTimingInfo = {
  72821. start: {
  72822. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72823. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72824. },
  72825. end: {
  72826. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72827. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72828. },
  72829. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72830. };
  72831. if (timingInfo.prependedContentDuration) {
  72832. videoSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72833. }
  72834. self2.postMessage({
  72835. action: "videoSegmentTimingInfo",
  72836. videoSegmentTimingInfo
  72837. });
  72838. });
  72839. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  72840. const audioSegmentTimingInfo = {
  72841. start: {
  72842. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72843. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72844. },
  72845. end: {
  72846. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72847. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72848. },
  72849. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72850. };
  72851. if (timingInfo.prependedContentDuration) {
  72852. audioSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72853. }
  72854. self2.postMessage({
  72855. action: "audioSegmentTimingInfo",
  72856. audioSegmentTimingInfo
  72857. });
  72858. });
  72859. transmuxer2.on("id3Frame", function(id3Frame) {
  72860. self2.postMessage({
  72861. action: "id3Frame",
  72862. id3Frame
  72863. });
  72864. });
  72865. transmuxer2.on("caption", function(caption) {
  72866. self2.postMessage({
  72867. action: "caption",
  72868. caption
  72869. });
  72870. });
  72871. transmuxer2.on("trackinfo", function(trackInfo) {
  72872. self2.postMessage({
  72873. action: "trackinfo",
  72874. trackInfo
  72875. });
  72876. });
  72877. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  72878. self2.postMessage({
  72879. action: "audioTimingInfo",
  72880. audioTimingInfo: {
  72881. start: clock$2.videoTsToSeconds(audioTimingInfo.start),
  72882. end: clock$2.videoTsToSeconds(audioTimingInfo.end)
  72883. }
  72884. });
  72885. });
  72886. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  72887. self2.postMessage({
  72888. action: "videoTimingInfo",
  72889. videoTimingInfo: {
  72890. start: clock$2.videoTsToSeconds(videoTimingInfo.start),
  72891. end: clock$2.videoTsToSeconds(videoTimingInfo.end)
  72892. }
  72893. });
  72894. });
  72895. transmuxer2.on("log", function(log2) {
  72896. self2.postMessage({
  72897. action: "log",
  72898. log: log2
  72899. });
  72900. });
  72901. };
  72902. class MessageHandlers {
  72903. constructor(self2, options2) {
  72904. this.options = options2 || {};
  72905. this.self = self2;
  72906. this.init();
  72907. }
  72908. init() {
  72909. if (this.transmuxer) {
  72910. this.transmuxer.dispose();
  72911. }
  72912. this.transmuxer = new transmuxer.Transmuxer(this.options);
  72913. wireTransmuxerEvents(this.self, this.transmuxer);
  72914. }
  72915. pushMp4Captions(data) {
  72916. if (!this.captionParser) {
  72917. this.captionParser = new captionParser();
  72918. this.captionParser.init();
  72919. }
  72920. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  72921. const parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  72922. this.self.postMessage({
  72923. action: "mp4Captions",
  72924. captions: parsed && parsed.captions || [],
  72925. logs: parsed && parsed.logs || [],
  72926. data: segment.buffer
  72927. }, [segment.buffer]);
  72928. }
  72929. probeMp4StartTime({
  72930. timescales,
  72931. data
  72932. }) {
  72933. const startTime2 = probe$2.startTime(timescales, data);
  72934. this.self.postMessage({
  72935. action: "probeMp4StartTime",
  72936. startTime: startTime2,
  72937. data
  72938. }, [data.buffer]);
  72939. }
  72940. probeMp4Tracks({
  72941. data
  72942. }) {
  72943. const tracks = probe$2.tracks(data);
  72944. this.self.postMessage({
  72945. action: "probeMp4Tracks",
  72946. tracks,
  72947. data
  72948. }, [data.buffer]);
  72949. }
  72950. probeTs({
  72951. data,
  72952. baseStartTime
  72953. }) {
  72954. const tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock$2.ONE_SECOND_IN_TS : void 0;
  72955. const timeInfo = tsInspector.inspect(data, tsStartTime);
  72956. let result = null;
  72957. if (timeInfo) {
  72958. result = {
  72959. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  72960. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  72961. };
  72962. if (result.hasVideo) {
  72963. result.videoStart = timeInfo.video[0].ptsTime;
  72964. }
  72965. if (result.hasAudio) {
  72966. result.audioStart = timeInfo.audio[0].ptsTime;
  72967. }
  72968. }
  72969. this.self.postMessage({
  72970. action: "probeTs",
  72971. result,
  72972. data
  72973. }, [data.buffer]);
  72974. }
  72975. clearAllMp4Captions() {
  72976. if (this.captionParser) {
  72977. this.captionParser.clearAllCaptions();
  72978. }
  72979. }
  72980. clearParsedMp4Captions() {
  72981. if (this.captionParser) {
  72982. this.captionParser.clearParsedCaptions();
  72983. }
  72984. }
  72985. push(data) {
  72986. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  72987. this.transmuxer.push(segment);
  72988. }
  72989. reset() {
  72990. this.transmuxer.reset();
  72991. }
  72992. setTimestampOffset(data) {
  72993. const timestampOffset2 = data.timestampOffset || 0;
  72994. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock$2.secondsToVideoTs(timestampOffset2)));
  72995. }
  72996. setAudioAppendStart(data) {
  72997. this.transmuxer.setAudioAppendStart(Math.ceil(clock$2.secondsToVideoTs(data.appendStart)));
  72998. }
  72999. setRemux(data) {
  73000. this.transmuxer.setRemux(data.remux);
  73001. }
  73002. flush(data) {
  73003. this.transmuxer.flush();
  73004. self.postMessage({
  73005. action: "done",
  73006. type: "transmuxed"
  73007. });
  73008. }
  73009. endTimeline() {
  73010. this.transmuxer.endTimeline();
  73011. self.postMessage({
  73012. action: "endedtimeline",
  73013. type: "transmuxed"
  73014. });
  73015. }
  73016. alignGopsWith(data) {
  73017. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  73018. }
  73019. }
  73020. self.onmessage = function(event2) {
  73021. if (event2.data.action === "init" && event2.data.options) {
  73022. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  73023. return;
  73024. }
  73025. if (!this.messageHandlers) {
  73026. this.messageHandlers = new MessageHandlers(self);
  73027. }
  73028. if (event2.data && event2.data.action && event2.data.action !== "init") {
  73029. if (this.messageHandlers[event2.data.action]) {
  73030. this.messageHandlers[event2.data.action](event2.data);
  73031. }
  73032. }
  73033. };
  73034. }));
  73035. var TransmuxWorker$1 = factory$1(workerCode$1$1);
  73036. const handleData_$1 = (event2, transmuxedData, callback2) => {
  73037. const {
  73038. type: type2,
  73039. initSegment,
  73040. captions,
  73041. captionStreams,
  73042. metadata,
  73043. videoFrameDtsTime,
  73044. videoFramePtsTime
  73045. } = event2.data.segment;
  73046. transmuxedData.buffer.push({
  73047. captions,
  73048. captionStreams,
  73049. metadata
  73050. });
  73051. const boxes = event2.data.segment.boxes || {
  73052. data: event2.data.segment.data
  73053. };
  73054. const result = {
  73055. type: type2,
  73056. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  73057. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  73058. };
  73059. if (typeof videoFrameDtsTime !== "undefined") {
  73060. result.videoFrameDtsTime = videoFrameDtsTime;
  73061. }
  73062. if (typeof videoFramePtsTime !== "undefined") {
  73063. result.videoFramePtsTime = videoFramePtsTime;
  73064. }
  73065. callback2(result);
  73066. };
  73067. const handleDone_$1 = ({
  73068. transmuxedData,
  73069. callback: callback2
  73070. }) => {
  73071. transmuxedData.buffer = [];
  73072. callback2(transmuxedData);
  73073. };
  73074. const handleGopInfo_$1 = (event2, transmuxedData) => {
  73075. transmuxedData.gopInfo = event2.data.gopInfo;
  73076. };
  73077. const processTransmux$1 = (options2) => {
  73078. const {
  73079. transmuxer,
  73080. bytes,
  73081. audioAppendStart,
  73082. gopsToAlignWith,
  73083. remux,
  73084. onData,
  73085. onTrackInfo,
  73086. onAudioTimingInfo,
  73087. onVideoTimingInfo,
  73088. onVideoSegmentTimingInfo,
  73089. onAudioSegmentTimingInfo,
  73090. onId3,
  73091. onCaptions,
  73092. onDone,
  73093. onEndedTimeline,
  73094. onTransmuxerLog,
  73095. isEndOfTimeline
  73096. } = options2;
  73097. const transmuxedData = {
  73098. buffer: []
  73099. };
  73100. let waitForEndedTimelineEvent = isEndOfTimeline;
  73101. const handleMessage = (event2) => {
  73102. if (transmuxer.currentTransmux !== options2) {
  73103. return;
  73104. }
  73105. if (event2.data.action === "data") {
  73106. handleData_$1(event2, transmuxedData, onData);
  73107. }
  73108. if (event2.data.action === "trackinfo") {
  73109. onTrackInfo(event2.data.trackInfo);
  73110. }
  73111. if (event2.data.action === "gopInfo") {
  73112. handleGopInfo_$1(event2, transmuxedData);
  73113. }
  73114. if (event2.data.action === "audioTimingInfo") {
  73115. onAudioTimingInfo(event2.data.audioTimingInfo);
  73116. }
  73117. if (event2.data.action === "videoTimingInfo") {
  73118. onVideoTimingInfo(event2.data.videoTimingInfo);
  73119. }
  73120. if (event2.data.action === "videoSegmentTimingInfo") {
  73121. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  73122. }
  73123. if (event2.data.action === "audioSegmentTimingInfo") {
  73124. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  73125. }
  73126. if (event2.data.action === "id3Frame") {
  73127. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  73128. }
  73129. if (event2.data.action === "caption") {
  73130. onCaptions(event2.data.caption);
  73131. }
  73132. if (event2.data.action === "endedtimeline") {
  73133. waitForEndedTimelineEvent = false;
  73134. onEndedTimeline();
  73135. }
  73136. if (event2.data.action === "log") {
  73137. onTransmuxerLog(event2.data.log);
  73138. }
  73139. if (event2.data.type !== "transmuxed") {
  73140. return;
  73141. }
  73142. if (waitForEndedTimelineEvent) {
  73143. return;
  73144. }
  73145. transmuxer.onmessage = null;
  73146. handleDone_$1({
  73147. transmuxedData,
  73148. callback: onDone
  73149. });
  73150. dequeue$1(transmuxer);
  73151. };
  73152. transmuxer.onmessage = handleMessage;
  73153. if (audioAppendStart) {
  73154. transmuxer.postMessage({
  73155. action: "setAudioAppendStart",
  73156. appendStart: audioAppendStart
  73157. });
  73158. }
  73159. if (Array.isArray(gopsToAlignWith)) {
  73160. transmuxer.postMessage({
  73161. action: "alignGopsWith",
  73162. gopsToAlignWith
  73163. });
  73164. }
  73165. if (typeof remux !== "undefined") {
  73166. transmuxer.postMessage({
  73167. action: "setRemux",
  73168. remux
  73169. });
  73170. }
  73171. if (bytes.byteLength) {
  73172. const buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  73173. const byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  73174. transmuxer.postMessage({
  73175. action: "push",
  73176. data: buffer,
  73177. byteOffset,
  73178. byteLength: bytes.byteLength
  73179. }, [buffer]);
  73180. }
  73181. if (isEndOfTimeline) {
  73182. transmuxer.postMessage({
  73183. action: "endTimeline"
  73184. });
  73185. }
  73186. transmuxer.postMessage({
  73187. action: "flush"
  73188. });
  73189. };
  73190. const dequeue$1 = (transmuxer) => {
  73191. transmuxer.currentTransmux = null;
  73192. if (transmuxer.transmuxQueue.length) {
  73193. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  73194. if (typeof transmuxer.currentTransmux === "function") {
  73195. transmuxer.currentTransmux();
  73196. } else {
  73197. processTransmux$1(transmuxer.currentTransmux);
  73198. }
  73199. }
  73200. };
  73201. const processAction$1 = (transmuxer, action) => {
  73202. transmuxer.postMessage({
  73203. action
  73204. });
  73205. dequeue$1(transmuxer);
  73206. };
  73207. const enqueueAction$1 = (action, transmuxer) => {
  73208. if (!transmuxer.currentTransmux) {
  73209. transmuxer.currentTransmux = action;
  73210. processAction$1(transmuxer, action);
  73211. return;
  73212. }
  73213. transmuxer.transmuxQueue.push(processAction$1.bind(null, transmuxer, action));
  73214. };
  73215. const reset$1 = (transmuxer) => {
  73216. enqueueAction$1("reset", transmuxer);
  73217. };
  73218. const endTimeline$1 = (transmuxer) => {
  73219. enqueueAction$1("endTimeline", transmuxer);
  73220. };
  73221. const transmux$1 = (options2) => {
  73222. if (!options2.transmuxer.currentTransmux) {
  73223. options2.transmuxer.currentTransmux = options2;
  73224. processTransmux$1(options2);
  73225. return;
  73226. }
  73227. options2.transmuxer.transmuxQueue.push(options2);
  73228. };
  73229. const createTransmuxer$1 = (options2) => {
  73230. const transmuxer = new TransmuxWorker$1();
  73231. transmuxer.currentTransmux = null;
  73232. transmuxer.transmuxQueue = [];
  73233. const term = transmuxer.terminate;
  73234. transmuxer.terminate = () => {
  73235. transmuxer.currentTransmux = null;
  73236. transmuxer.transmuxQueue.length = 0;
  73237. return term.call(transmuxer);
  73238. };
  73239. transmuxer.postMessage({
  73240. action: "init",
  73241. options: options2
  73242. });
  73243. return transmuxer;
  73244. };
  73245. var segmentTransmuxer$1 = {
  73246. reset: reset$1,
  73247. endTimeline: endTimeline$1,
  73248. transmux: transmux$1,
  73249. createTransmuxer: createTransmuxer$1
  73250. };
  73251. const workerCallback$1 = function(options2) {
  73252. const transmuxer = options2.transmuxer;
  73253. const endAction = options2.endAction || options2.action;
  73254. const callback2 = options2.callback;
  73255. const message = _extends$2({}, options2, {
  73256. endAction: null,
  73257. transmuxer: null,
  73258. callback: null
  73259. });
  73260. const listenForEndEvent = (event2) => {
  73261. if (event2.data.action !== endAction) {
  73262. return;
  73263. }
  73264. transmuxer.removeEventListener("message", listenForEndEvent);
  73265. if (event2.data.data) {
  73266. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  73267. if (options2.data) {
  73268. options2.data = event2.data.data;
  73269. }
  73270. }
  73271. callback2(event2.data);
  73272. };
  73273. transmuxer.addEventListener("message", listenForEndEvent);
  73274. if (options2.data) {
  73275. const isArrayBuffer = options2.data instanceof ArrayBuffer;
  73276. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  73277. message.byteLength = options2.data.byteLength;
  73278. const transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  73279. transmuxer.postMessage(message, transfers);
  73280. } else {
  73281. transmuxer.postMessage(message);
  73282. }
  73283. };
  73284. const REQUEST_ERRORS$1 = {
  73285. FAILURE: 2,
  73286. TIMEOUT: -101,
  73287. ABORTED: -102
  73288. };
  73289. const abortAll$1 = (activeXhrs) => {
  73290. activeXhrs.forEach((xhr) => {
  73291. xhr.abort();
  73292. });
  73293. };
  73294. const getRequestStats$1 = (request) => {
  73295. return {
  73296. bandwidth: request.bandwidth,
  73297. bytesReceived: request.bytesReceived || 0,
  73298. roundTripTime: request.roundTripTime || 0
  73299. };
  73300. };
  73301. const getProgressStats$1 = (progressEvent) => {
  73302. const request = progressEvent.target;
  73303. const roundTripTime = Date.now() - request.requestTime;
  73304. const stats = {
  73305. bandwidth: Infinity,
  73306. bytesReceived: 0,
  73307. roundTripTime: roundTripTime || 0
  73308. };
  73309. stats.bytesReceived = progressEvent.loaded;
  73310. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  73311. return stats;
  73312. };
  73313. const handleErrors$1 = (error, request) => {
  73314. if (request.timedout) {
  73315. return {
  73316. status: request.status,
  73317. message: "HLS request timed-out at URL: " + request.uri,
  73318. code: REQUEST_ERRORS$1.TIMEOUT,
  73319. xhr: request
  73320. };
  73321. }
  73322. if (request.aborted) {
  73323. return {
  73324. status: request.status,
  73325. message: "HLS request aborted at URL: " + request.uri,
  73326. code: REQUEST_ERRORS$1.ABORTED,
  73327. xhr: request
  73328. };
  73329. }
  73330. if (error) {
  73331. return {
  73332. status: request.status,
  73333. message: "HLS request errored at URL: " + request.uri,
  73334. code: REQUEST_ERRORS$1.FAILURE,
  73335. xhr: request
  73336. };
  73337. }
  73338. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  73339. return {
  73340. status: request.status,
  73341. message: "Empty HLS response at URL: " + request.uri,
  73342. code: REQUEST_ERRORS$1.FAILURE,
  73343. xhr: request
  73344. };
  73345. }
  73346. return null;
  73347. };
  73348. const handleKeyResponse$1 = (segment, objects, finishProcessingFn) => (error, request) => {
  73349. const response = request.response;
  73350. const errorObj = handleErrors$1(error, request);
  73351. if (errorObj) {
  73352. return finishProcessingFn(errorObj, segment);
  73353. }
  73354. if (response.byteLength !== 16) {
  73355. return finishProcessingFn({
  73356. status: request.status,
  73357. message: "Invalid HLS key at URL: " + request.uri,
  73358. code: REQUEST_ERRORS$1.FAILURE,
  73359. xhr: request
  73360. }, segment);
  73361. }
  73362. const view = new DataView(response);
  73363. const bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  73364. for (let i2 = 0; i2 < objects.length; i2++) {
  73365. objects[i2].bytes = bytes;
  73366. }
  73367. return finishProcessingFn(null, segment);
  73368. };
  73369. const parseInitSegment$1 = (segment, callback2) => {
  73370. const type2 = detectContainerForBytes$1(segment.map.bytes);
  73371. if (type2 !== "mp4") {
  73372. const uri = segment.map.resolvedUri || segment.map.uri;
  73373. return callback2({
  73374. internal: true,
  73375. message: `Found unsupported ${type2 || "unknown"} container for initialization segment at URL: ${uri}`,
  73376. code: REQUEST_ERRORS$1.FAILURE
  73377. });
  73378. }
  73379. workerCallback$1({
  73380. action: "probeMp4Tracks",
  73381. data: segment.map.bytes,
  73382. transmuxer: segment.transmuxer,
  73383. callback: ({
  73384. tracks,
  73385. data
  73386. }) => {
  73387. segment.map.bytes = data;
  73388. tracks.forEach(function(track) {
  73389. segment.map.tracks = segment.map.tracks || {};
  73390. if (segment.map.tracks[track.type]) {
  73391. return;
  73392. }
  73393. segment.map.tracks[track.type] = track;
  73394. if (typeof track.id === "number" && track.timescale) {
  73395. segment.map.timescales = segment.map.timescales || {};
  73396. segment.map.timescales[track.id] = track.timescale;
  73397. }
  73398. });
  73399. return callback2(null);
  73400. }
  73401. });
  73402. };
  73403. const handleInitSegmentResponse$1 = ({
  73404. segment,
  73405. finishProcessingFn
  73406. }) => (error, request) => {
  73407. const errorObj = handleErrors$1(error, request);
  73408. if (errorObj) {
  73409. return finishProcessingFn(errorObj, segment);
  73410. }
  73411. const bytes = new Uint8Array(request.response);
  73412. if (segment.map.key) {
  73413. segment.map.encryptedBytes = bytes;
  73414. return finishProcessingFn(null, segment);
  73415. }
  73416. segment.map.bytes = bytes;
  73417. parseInitSegment$1(segment, function(parseError) {
  73418. if (parseError) {
  73419. parseError.xhr = request;
  73420. parseError.status = request.status;
  73421. return finishProcessingFn(parseError, segment);
  73422. }
  73423. finishProcessingFn(null, segment);
  73424. });
  73425. };
  73426. const handleSegmentResponse$1 = ({
  73427. segment,
  73428. finishProcessingFn,
  73429. responseType
  73430. }) => (error, request) => {
  73431. const errorObj = handleErrors$1(error, request);
  73432. if (errorObj) {
  73433. return finishProcessingFn(errorObj, segment);
  73434. }
  73435. const newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer$1(request.responseText.substring(segment.lastReachedChar || 0));
  73436. segment.stats = getRequestStats$1(request);
  73437. if (segment.key) {
  73438. segment.encryptedBytes = new Uint8Array(newBytes);
  73439. } else {
  73440. segment.bytes = new Uint8Array(newBytes);
  73441. }
  73442. return finishProcessingFn(null, segment);
  73443. };
  73444. const transmuxAndNotify$1 = ({
  73445. segment,
  73446. bytes,
  73447. trackInfoFn,
  73448. timingInfoFn,
  73449. videoSegmentTimingInfoFn,
  73450. audioSegmentTimingInfoFn,
  73451. id3Fn,
  73452. captionsFn,
  73453. isEndOfTimeline,
  73454. endedTimelineFn,
  73455. dataFn,
  73456. doneFn,
  73457. onTransmuxerLog
  73458. }) => {
  73459. const fmp4Tracks = segment.map && segment.map.tracks || {};
  73460. const isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  73461. let audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  73462. const audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  73463. let videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  73464. const videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  73465. const finish = () => transmux$1({
  73466. bytes,
  73467. transmuxer: segment.transmuxer,
  73468. audioAppendStart: segment.audioAppendStart,
  73469. gopsToAlignWith: segment.gopsToAlignWith,
  73470. remux: isMuxed3,
  73471. onData: (result) => {
  73472. result.type = result.type === "combined" ? "video" : result.type;
  73473. dataFn(segment, result);
  73474. },
  73475. onTrackInfo: (trackInfo) => {
  73476. if (trackInfoFn) {
  73477. if (isMuxed3) {
  73478. trackInfo.isMuxed = true;
  73479. }
  73480. trackInfoFn(segment, trackInfo);
  73481. }
  73482. },
  73483. onAudioTimingInfo: (audioTimingInfo) => {
  73484. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  73485. audioStartFn(audioTimingInfo.start);
  73486. audioStartFn = null;
  73487. }
  73488. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  73489. audioEndFn(audioTimingInfo.end);
  73490. }
  73491. },
  73492. onVideoTimingInfo: (videoTimingInfo) => {
  73493. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  73494. videoStartFn(videoTimingInfo.start);
  73495. videoStartFn = null;
  73496. }
  73497. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  73498. videoEndFn(videoTimingInfo.end);
  73499. }
  73500. },
  73501. onVideoSegmentTimingInfo: (videoSegmentTimingInfo) => {
  73502. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  73503. },
  73504. onAudioSegmentTimingInfo: (audioSegmentTimingInfo) => {
  73505. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  73506. },
  73507. onId3: (id3Frames, dispatchType) => {
  73508. id3Fn(segment, id3Frames, dispatchType);
  73509. },
  73510. onCaptions: (captions) => {
  73511. captionsFn(segment, [captions]);
  73512. },
  73513. isEndOfTimeline,
  73514. onEndedTimeline: () => {
  73515. endedTimelineFn();
  73516. },
  73517. onTransmuxerLog,
  73518. onDone: (result) => {
  73519. if (!doneFn) {
  73520. return;
  73521. }
  73522. result.type = result.type === "combined" ? "video" : result.type;
  73523. doneFn(null, segment, result);
  73524. }
  73525. });
  73526. workerCallback$1({
  73527. action: "probeTs",
  73528. transmuxer: segment.transmuxer,
  73529. data: bytes,
  73530. baseStartTime: segment.baseStartTime,
  73531. callback: (data) => {
  73532. segment.bytes = bytes = data.data;
  73533. const probeResult = data.result;
  73534. if (probeResult) {
  73535. trackInfoFn(segment, {
  73536. hasAudio: probeResult.hasAudio,
  73537. hasVideo: probeResult.hasVideo,
  73538. isMuxed: isMuxed3
  73539. });
  73540. trackInfoFn = null;
  73541. if (probeResult.hasAudio && !isMuxed3) {
  73542. audioStartFn(probeResult.audioStart);
  73543. }
  73544. if (probeResult.hasVideo) {
  73545. videoStartFn(probeResult.videoStart);
  73546. }
  73547. audioStartFn = null;
  73548. videoStartFn = null;
  73549. }
  73550. finish();
  73551. }
  73552. });
  73553. };
  73554. const handleSegmentBytes$1 = ({
  73555. segment,
  73556. bytes,
  73557. trackInfoFn,
  73558. timingInfoFn,
  73559. videoSegmentTimingInfoFn,
  73560. audioSegmentTimingInfoFn,
  73561. id3Fn,
  73562. captionsFn,
  73563. isEndOfTimeline,
  73564. endedTimelineFn,
  73565. dataFn,
  73566. doneFn,
  73567. onTransmuxerLog
  73568. }) => {
  73569. let bytesAsUint8Array = new Uint8Array(bytes);
  73570. if (isLikelyFmp4MediaSegment$1(bytesAsUint8Array)) {
  73571. segment.isFmp4 = true;
  73572. const {
  73573. tracks
  73574. } = segment.map;
  73575. const trackInfo = {
  73576. isFmp4: true,
  73577. hasVideo: !!tracks.video,
  73578. hasAudio: !!tracks.audio
  73579. };
  73580. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  73581. trackInfo.audioCodec = tracks.audio.codec;
  73582. }
  73583. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  73584. trackInfo.videoCodec = tracks.video.codec;
  73585. }
  73586. if (tracks.video && tracks.audio) {
  73587. trackInfo.isMuxed = true;
  73588. }
  73589. trackInfoFn(segment, trackInfo);
  73590. const finishLoading = (captions) => {
  73591. dataFn(segment, {
  73592. data: bytesAsUint8Array,
  73593. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  73594. });
  73595. if (captions && captions.length) {
  73596. captionsFn(segment, captions);
  73597. }
  73598. doneFn(null, segment, {});
  73599. };
  73600. workerCallback$1({
  73601. action: "probeMp4StartTime",
  73602. timescales: segment.map.timescales,
  73603. data: bytesAsUint8Array,
  73604. transmuxer: segment.transmuxer,
  73605. callback: ({
  73606. data,
  73607. startTime
  73608. }) => {
  73609. bytes = data.buffer;
  73610. segment.bytes = bytesAsUint8Array = data;
  73611. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  73612. timingInfoFn(segment, "audio", "start", startTime);
  73613. }
  73614. if (trackInfo.hasVideo) {
  73615. timingInfoFn(segment, "video", "start", startTime);
  73616. }
  73617. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  73618. finishLoading();
  73619. return;
  73620. }
  73621. workerCallback$1({
  73622. action: "pushMp4Captions",
  73623. endAction: "mp4Captions",
  73624. transmuxer: segment.transmuxer,
  73625. data: bytesAsUint8Array,
  73626. timescales: segment.map.timescales,
  73627. trackIds: [tracks.video.id],
  73628. callback: (message) => {
  73629. bytes = message.data.buffer;
  73630. segment.bytes = bytesAsUint8Array = message.data;
  73631. message.logs.forEach(function(log2) {
  73632. onTransmuxerLog(merge$2(log2, {
  73633. stream: "mp4CaptionParser"
  73634. }));
  73635. });
  73636. finishLoading(message.captions);
  73637. }
  73638. });
  73639. }
  73640. });
  73641. return;
  73642. }
  73643. if (!segment.transmuxer) {
  73644. doneFn(null, segment, {});
  73645. return;
  73646. }
  73647. if (typeof segment.container === "undefined") {
  73648. segment.container = detectContainerForBytes$1(bytesAsUint8Array);
  73649. }
  73650. if (segment.container !== "ts" && segment.container !== "aac") {
  73651. trackInfoFn(segment, {
  73652. hasAudio: false,
  73653. hasVideo: false
  73654. });
  73655. doneFn(null, segment, {});
  73656. return;
  73657. }
  73658. transmuxAndNotify$1({
  73659. segment,
  73660. bytes,
  73661. trackInfoFn,
  73662. timingInfoFn,
  73663. videoSegmentTimingInfoFn,
  73664. audioSegmentTimingInfoFn,
  73665. id3Fn,
  73666. captionsFn,
  73667. isEndOfTimeline,
  73668. endedTimelineFn,
  73669. dataFn,
  73670. doneFn,
  73671. onTransmuxerLog
  73672. });
  73673. };
  73674. const decrypt$1 = function({
  73675. id,
  73676. key,
  73677. encryptedBytes,
  73678. decryptionWorker
  73679. }, callback2) {
  73680. const decryptionHandler = (event2) => {
  73681. if (event2.data.source === id) {
  73682. decryptionWorker.removeEventListener("message", decryptionHandler);
  73683. const decrypted = event2.data.decrypted;
  73684. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  73685. }
  73686. };
  73687. decryptionWorker.addEventListener("message", decryptionHandler);
  73688. let keyBytes;
  73689. if (key.bytes.slice) {
  73690. keyBytes = key.bytes.slice();
  73691. } else {
  73692. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  73693. }
  73694. decryptionWorker.postMessage(createTransferableMessage$1({
  73695. source: id,
  73696. encrypted: encryptedBytes,
  73697. key: keyBytes,
  73698. iv: key.iv
  73699. }), [encryptedBytes.buffer, keyBytes.buffer]);
  73700. };
  73701. const decryptSegment$1 = ({
  73702. decryptionWorker,
  73703. segment,
  73704. trackInfoFn,
  73705. timingInfoFn,
  73706. videoSegmentTimingInfoFn,
  73707. audioSegmentTimingInfoFn,
  73708. id3Fn,
  73709. captionsFn,
  73710. isEndOfTimeline,
  73711. endedTimelineFn,
  73712. dataFn,
  73713. doneFn,
  73714. onTransmuxerLog
  73715. }) => {
  73716. decrypt$1({
  73717. id: segment.requestId,
  73718. key: segment.key,
  73719. encryptedBytes: segment.encryptedBytes,
  73720. decryptionWorker
  73721. }, (decryptedBytes) => {
  73722. segment.bytes = decryptedBytes;
  73723. handleSegmentBytes$1({
  73724. segment,
  73725. bytes: segment.bytes,
  73726. trackInfoFn,
  73727. timingInfoFn,
  73728. videoSegmentTimingInfoFn,
  73729. audioSegmentTimingInfoFn,
  73730. id3Fn,
  73731. captionsFn,
  73732. isEndOfTimeline,
  73733. endedTimelineFn,
  73734. dataFn,
  73735. doneFn,
  73736. onTransmuxerLog
  73737. });
  73738. });
  73739. };
  73740. const waitForCompletion$1 = ({
  73741. activeXhrs,
  73742. decryptionWorker,
  73743. trackInfoFn,
  73744. timingInfoFn,
  73745. videoSegmentTimingInfoFn,
  73746. audioSegmentTimingInfoFn,
  73747. id3Fn,
  73748. captionsFn,
  73749. isEndOfTimeline,
  73750. endedTimelineFn,
  73751. dataFn,
  73752. doneFn,
  73753. onTransmuxerLog
  73754. }) => {
  73755. let count = 0;
  73756. let didError = false;
  73757. return (error, segment) => {
  73758. if (didError) {
  73759. return;
  73760. }
  73761. if (error) {
  73762. didError = true;
  73763. abortAll$1(activeXhrs);
  73764. return doneFn(error, segment);
  73765. }
  73766. count += 1;
  73767. if (count === activeXhrs.length) {
  73768. const segmentFinish = function() {
  73769. if (segment.encryptedBytes) {
  73770. return decryptSegment$1({
  73771. decryptionWorker,
  73772. segment,
  73773. trackInfoFn,
  73774. timingInfoFn,
  73775. videoSegmentTimingInfoFn,
  73776. audioSegmentTimingInfoFn,
  73777. id3Fn,
  73778. captionsFn,
  73779. isEndOfTimeline,
  73780. endedTimelineFn,
  73781. dataFn,
  73782. doneFn,
  73783. onTransmuxerLog
  73784. });
  73785. }
  73786. handleSegmentBytes$1({
  73787. segment,
  73788. bytes: segment.bytes,
  73789. trackInfoFn,
  73790. timingInfoFn,
  73791. videoSegmentTimingInfoFn,
  73792. audioSegmentTimingInfoFn,
  73793. id3Fn,
  73794. captionsFn,
  73795. isEndOfTimeline,
  73796. endedTimelineFn,
  73797. dataFn,
  73798. doneFn,
  73799. onTransmuxerLog
  73800. });
  73801. };
  73802. segment.endOfAllRequests = Date.now();
  73803. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  73804. return decrypt$1({
  73805. decryptionWorker,
  73806. id: segment.requestId + "-init",
  73807. encryptedBytes: segment.map.encryptedBytes,
  73808. key: segment.map.key
  73809. }, (decryptedBytes) => {
  73810. segment.map.bytes = decryptedBytes;
  73811. parseInitSegment$1(segment, (parseError) => {
  73812. if (parseError) {
  73813. abortAll$1(activeXhrs);
  73814. return doneFn(parseError, segment);
  73815. }
  73816. segmentFinish();
  73817. });
  73818. });
  73819. }
  73820. segmentFinish();
  73821. }
  73822. };
  73823. };
  73824. const handleLoadEnd$1 = ({
  73825. loadendState,
  73826. abortFn
  73827. }) => (event2) => {
  73828. const request = event2.target;
  73829. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  73830. abortFn();
  73831. loadendState.calledAbortFn = true;
  73832. }
  73833. };
  73834. const handleProgress$1 = ({
  73835. segment,
  73836. progressFn,
  73837. trackInfoFn,
  73838. timingInfoFn,
  73839. videoSegmentTimingInfoFn,
  73840. audioSegmentTimingInfoFn,
  73841. id3Fn,
  73842. captionsFn,
  73843. isEndOfTimeline,
  73844. endedTimelineFn,
  73845. dataFn
  73846. }) => (event2) => {
  73847. const request = event2.target;
  73848. if (request.aborted) {
  73849. return;
  73850. }
  73851. segment.stats = merge$2(segment.stats, getProgressStats$1(event2));
  73852. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  73853. segment.stats.firstBytesReceivedAt = Date.now();
  73854. }
  73855. return progressFn(event2, segment);
  73856. };
  73857. const mediaSegmentRequest$1 = ({
  73858. xhr,
  73859. xhrOptions,
  73860. decryptionWorker,
  73861. segment,
  73862. abortFn,
  73863. progressFn,
  73864. trackInfoFn,
  73865. timingInfoFn,
  73866. videoSegmentTimingInfoFn,
  73867. audioSegmentTimingInfoFn,
  73868. id3Fn,
  73869. captionsFn,
  73870. isEndOfTimeline,
  73871. endedTimelineFn,
  73872. dataFn,
  73873. doneFn,
  73874. onTransmuxerLog
  73875. }) => {
  73876. const activeXhrs = [];
  73877. const finishProcessingFn = waitForCompletion$1({
  73878. activeXhrs,
  73879. decryptionWorker,
  73880. trackInfoFn,
  73881. timingInfoFn,
  73882. videoSegmentTimingInfoFn,
  73883. audioSegmentTimingInfoFn,
  73884. id3Fn,
  73885. captionsFn,
  73886. isEndOfTimeline,
  73887. endedTimelineFn,
  73888. dataFn,
  73889. doneFn,
  73890. onTransmuxerLog
  73891. });
  73892. if (segment.key && !segment.key.bytes) {
  73893. const objects = [segment.key];
  73894. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  73895. objects.push(segment.map.key);
  73896. }
  73897. const keyRequestOptions = merge$2(xhrOptions, {
  73898. uri: segment.key.resolvedUri,
  73899. responseType: "arraybuffer"
  73900. });
  73901. const keyRequestCallback = handleKeyResponse$1(segment, objects, finishProcessingFn);
  73902. const keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  73903. activeXhrs.push(keyXhr);
  73904. }
  73905. if (segment.map && !segment.map.bytes) {
  73906. const differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  73907. if (differentMapKey) {
  73908. const mapKeyRequestOptions = merge$2(xhrOptions, {
  73909. uri: segment.map.key.resolvedUri,
  73910. responseType: "arraybuffer"
  73911. });
  73912. const mapKeyRequestCallback = handleKeyResponse$1(segment, [segment.map.key], finishProcessingFn);
  73913. const mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  73914. activeXhrs.push(mapKeyXhr);
  73915. }
  73916. const initSegmentOptions = merge$2(xhrOptions, {
  73917. uri: segment.map.resolvedUri,
  73918. responseType: "arraybuffer",
  73919. headers: segmentXhrHeaders$1(segment.map)
  73920. });
  73921. const initSegmentRequestCallback = handleInitSegmentResponse$1({
  73922. segment,
  73923. finishProcessingFn
  73924. });
  73925. const initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  73926. activeXhrs.push(initSegmentXhr);
  73927. }
  73928. const segmentRequestOptions = merge$2(xhrOptions, {
  73929. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  73930. responseType: "arraybuffer",
  73931. headers: segmentXhrHeaders$1(segment)
  73932. });
  73933. const segmentRequestCallback = handleSegmentResponse$1({
  73934. segment,
  73935. finishProcessingFn,
  73936. responseType: segmentRequestOptions.responseType
  73937. });
  73938. const segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  73939. segmentXhr.addEventListener("progress", handleProgress$1({
  73940. segment,
  73941. progressFn,
  73942. trackInfoFn,
  73943. timingInfoFn,
  73944. videoSegmentTimingInfoFn,
  73945. audioSegmentTimingInfoFn,
  73946. id3Fn,
  73947. captionsFn,
  73948. isEndOfTimeline,
  73949. endedTimelineFn,
  73950. dataFn
  73951. }));
  73952. activeXhrs.push(segmentXhr);
  73953. const loadendState = {};
  73954. activeXhrs.forEach((activeXhr) => {
  73955. activeXhr.addEventListener("loadend", handleLoadEnd$1({
  73956. loadendState,
  73957. abortFn
  73958. }));
  73959. });
  73960. return () => abortAll$1(activeXhrs);
  73961. };
  73962. const logFn$1$1 = logger$1("CodecUtils");
  73963. const getCodecs$1 = function(media) {
  73964. const mediaAttributes = media.attributes || {};
  73965. if (mediaAttributes.CODECS) {
  73966. return parseCodecs$1(mediaAttributes.CODECS);
  73967. }
  73968. };
  73969. const isMaat$1 = (main, media) => {
  73970. const mediaAttributes = media.attributes || {};
  73971. return main && main.mediaGroups && main.mediaGroups.AUDIO && mediaAttributes.AUDIO && main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  73972. };
  73973. const isMuxed$1 = (main, media) => {
  73974. if (!isMaat$1(main, media)) {
  73975. return true;
  73976. }
  73977. const mediaAttributes = media.attributes || {};
  73978. const audioGroup = main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  73979. for (const groupId in audioGroup) {
  73980. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  73981. return true;
  73982. }
  73983. }
  73984. return false;
  73985. };
  73986. const unwrapCodecList$1 = function(codecList) {
  73987. const codecs = {};
  73988. codecList.forEach(({
  73989. mediaType,
  73990. type: type2,
  73991. details
  73992. }) => {
  73993. codecs[mediaType] = codecs[mediaType] || [];
  73994. codecs[mediaType].push(translateLegacyCodec$1(`${type2}${details}`));
  73995. });
  73996. Object.keys(codecs).forEach(function(mediaType) {
  73997. if (codecs[mediaType].length > 1) {
  73998. 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.`);
  73999. codecs[mediaType] = null;
  74000. return;
  74001. }
  74002. codecs[mediaType] = codecs[mediaType][0];
  74003. });
  74004. return codecs;
  74005. };
  74006. const codecCount$1 = function(codecObj) {
  74007. let count = 0;
  74008. if (codecObj.audio) {
  74009. count++;
  74010. }
  74011. if (codecObj.video) {
  74012. count++;
  74013. }
  74014. return count;
  74015. };
  74016. const codecsForPlaylist$1 = function(main, media) {
  74017. const mediaAttributes = media.attributes || {};
  74018. const codecInfo = unwrapCodecList$1(getCodecs$1(media) || []);
  74019. if (isMaat$1(main, media) && !codecInfo.audio) {
  74020. if (!isMuxed$1(main, media)) {
  74021. const defaultCodecs = unwrapCodecList$1(codecsFromDefault$1(main, mediaAttributes.AUDIO) || []);
  74022. if (defaultCodecs.audio) {
  74023. codecInfo.audio = defaultCodecs.audio;
  74024. }
  74025. }
  74026. }
  74027. return codecInfo;
  74028. };
  74029. const logFn$2 = logger$1("PlaylistSelector");
  74030. const representationToString$1 = function(representation) {
  74031. if (!representation || !representation.playlist) {
  74032. return;
  74033. }
  74034. const playlist = representation.playlist;
  74035. return JSON.stringify({
  74036. id: playlist.id,
  74037. bandwidth: representation.bandwidth,
  74038. width: representation.width,
  74039. height: representation.height,
  74040. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  74041. });
  74042. };
  74043. const safeGetComputedStyle$1 = function(el, property) {
  74044. if (!el) {
  74045. return "";
  74046. }
  74047. const result = window_1.getComputedStyle(el);
  74048. if (!result) {
  74049. return "";
  74050. }
  74051. return result[property];
  74052. };
  74053. const stableSort$1 = function(array, sortFn) {
  74054. const newArray = array.slice();
  74055. array.sort(function(left, right) {
  74056. const cmp = sortFn(left, right);
  74057. if (cmp === 0) {
  74058. return newArray.indexOf(left) - newArray.indexOf(right);
  74059. }
  74060. return cmp;
  74061. });
  74062. };
  74063. const comparePlaylistBandwidth$1 = function(left, right) {
  74064. let leftBandwidth;
  74065. let rightBandwidth;
  74066. if (left.attributes.BANDWIDTH) {
  74067. leftBandwidth = left.attributes.BANDWIDTH;
  74068. }
  74069. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  74070. if (right.attributes.BANDWIDTH) {
  74071. rightBandwidth = right.attributes.BANDWIDTH;
  74072. }
  74073. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  74074. return leftBandwidth - rightBandwidth;
  74075. };
  74076. const comparePlaylistResolution$1 = function(left, right) {
  74077. let leftWidth;
  74078. let rightWidth;
  74079. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  74080. leftWidth = left.attributes.RESOLUTION.width;
  74081. }
  74082. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  74083. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  74084. rightWidth = right.attributes.RESOLUTION.width;
  74085. }
  74086. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  74087. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  74088. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  74089. }
  74090. return leftWidth - rightWidth;
  74091. };
  74092. let simpleSelector$1 = function(main, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, playlistController) {
  74093. if (!main) {
  74094. return;
  74095. }
  74096. const options2 = {
  74097. bandwidth: playerBandwidth,
  74098. width: playerWidth,
  74099. height: playerHeight,
  74100. limitRenditionByPlayerDimensions
  74101. };
  74102. let playlists = main.playlists;
  74103. if (Playlist$1.isAudioOnly(main)) {
  74104. playlists = playlistController.getAudioTrackPlaylists_();
  74105. options2.audioOnly = true;
  74106. }
  74107. let sortedPlaylistReps = playlists.map((playlist) => {
  74108. let bandwidth2;
  74109. const width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  74110. const height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  74111. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  74112. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  74113. return {
  74114. bandwidth: bandwidth2,
  74115. width: width2,
  74116. height: height2,
  74117. playlist
  74118. };
  74119. });
  74120. stableSort$1(sortedPlaylistReps, (left, right) => left.bandwidth - right.bandwidth);
  74121. sortedPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isIncompatible(rep2.playlist));
  74122. let enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => Playlist$1.isEnabled(rep2.playlist));
  74123. if (!enabledPlaylistReps.length) {
  74124. enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isDisabled(rep2.playlist));
  74125. }
  74126. const bandwidthPlaylistReps = enabledPlaylistReps.filter((rep2) => rep2.bandwidth * Config$1.BANDWIDTH_VARIANCE < playerBandwidth);
  74127. let highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  74128. const bandwidthBestRep = bandwidthPlaylistReps.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74129. if (limitRenditionByPlayerDimensions === false) {
  74130. const chosenRep2 = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74131. if (chosenRep2 && chosenRep2.playlist) {
  74132. let type2 = "sortedPlaylistReps";
  74133. if (bandwidthBestRep) {
  74134. type2 = "bandwidthBestRep";
  74135. }
  74136. if (enabledPlaylistReps[0]) {
  74137. type2 = "enabledPlaylistReps";
  74138. }
  74139. logFn$2(`choosing ${representationToString$1(chosenRep2)} using ${type2} with options`, options2);
  74140. return chosenRep2.playlist;
  74141. }
  74142. logFn$2("could not choose a playlist with options", options2);
  74143. return null;
  74144. }
  74145. const haveResolution = bandwidthPlaylistReps.filter((rep2) => rep2.width && rep2.height);
  74146. stableSort$1(haveResolution, (left, right) => left.width - right.width);
  74147. const resolutionBestRepList = haveResolution.filter((rep2) => rep2.width === playerWidth && rep2.height === playerHeight);
  74148. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  74149. const resolutionBestRep = resolutionBestRepList.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74150. let resolutionPlusOneList;
  74151. let resolutionPlusOneSmallest;
  74152. let resolutionPlusOneRep;
  74153. if (!resolutionBestRep) {
  74154. resolutionPlusOneList = haveResolution.filter((rep2) => rep2.width > playerWidth || rep2.height > playerHeight);
  74155. resolutionPlusOneSmallest = resolutionPlusOneList.filter((rep2) => rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height);
  74156. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  74157. resolutionPlusOneRep = resolutionPlusOneSmallest.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74158. }
  74159. let leastPixelDiffRep;
  74160. if (playlistController.leastPixelDiffSelector) {
  74161. const leastPixelDiffList = haveResolution.map((rep2) => {
  74162. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  74163. return rep2;
  74164. });
  74165. stableSort$1(leastPixelDiffList, (left, right) => {
  74166. if (left.pixelDiff === right.pixelDiff) {
  74167. return right.bandwidth - left.bandwidth;
  74168. }
  74169. return left.pixelDiff - right.pixelDiff;
  74170. });
  74171. leastPixelDiffRep = leastPixelDiffList[0];
  74172. }
  74173. const chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74174. if (chosenRep && chosenRep.playlist) {
  74175. let type2 = "sortedPlaylistReps";
  74176. if (leastPixelDiffRep) {
  74177. type2 = "leastPixelDiffRep";
  74178. } else if (resolutionPlusOneRep) {
  74179. type2 = "resolutionPlusOneRep";
  74180. } else if (resolutionBestRep) {
  74181. type2 = "resolutionBestRep";
  74182. } else if (bandwidthBestRep) {
  74183. type2 = "bandwidthBestRep";
  74184. } else if (enabledPlaylistReps[0]) {
  74185. type2 = "enabledPlaylistReps";
  74186. }
  74187. logFn$2(`choosing ${representationToString$1(chosenRep)} using ${type2} with options`, options2);
  74188. return chosenRep.playlist;
  74189. }
  74190. logFn$2("could not choose a playlist with options", options2);
  74191. return null;
  74192. };
  74193. const lastBandwidthSelector$1 = function() {
  74194. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74195. 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_);
  74196. };
  74197. const movingAverageBandwidthSelector$1 = function(decay) {
  74198. let average = -1;
  74199. let lastSystemBandwidth = -1;
  74200. if (decay < 0 || decay > 1) {
  74201. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  74202. }
  74203. return function() {
  74204. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74205. if (average < 0) {
  74206. average = this.systemBandwidth;
  74207. lastSystemBandwidth = this.systemBandwidth;
  74208. }
  74209. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  74210. average = decay * this.systemBandwidth + (1 - decay) * average;
  74211. lastSystemBandwidth = this.systemBandwidth;
  74212. }
  74213. 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_);
  74214. };
  74215. };
  74216. const minRebufferMaxBandwidthSelector$1 = function(settings) {
  74217. const {
  74218. main,
  74219. currentTime,
  74220. bandwidth: bandwidth2,
  74221. duration: duration5,
  74222. segmentDuration,
  74223. timeUntilRebuffer: timeUntilRebuffer3,
  74224. currentTimeline,
  74225. syncController
  74226. } = settings;
  74227. const compatiblePlaylists = main.playlists.filter((playlist) => !Playlist$1.isIncompatible(playlist));
  74228. let enabledPlaylists = compatiblePlaylists.filter(Playlist$1.isEnabled);
  74229. if (!enabledPlaylists.length) {
  74230. enabledPlaylists = compatiblePlaylists.filter((playlist) => !Playlist$1.isDisabled(playlist));
  74231. }
  74232. const bandwidthPlaylists = enabledPlaylists.filter(Playlist$1.hasAttribute.bind(null, "BANDWIDTH"));
  74233. const rebufferingEstimates = bandwidthPlaylists.map((playlist) => {
  74234. const syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  74235. const numRequests = syncPoint ? 1 : 2;
  74236. const requestTimeEstimate = Playlist$1.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  74237. const rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  74238. return {
  74239. playlist,
  74240. rebufferingImpact
  74241. };
  74242. });
  74243. const noRebufferingPlaylists = rebufferingEstimates.filter((estimate) => estimate.rebufferingImpact <= 0);
  74244. stableSort$1(noRebufferingPlaylists, (a, b) => comparePlaylistBandwidth$1(b.playlist, a.playlist));
  74245. if (noRebufferingPlaylists.length) {
  74246. return noRebufferingPlaylists[0];
  74247. }
  74248. stableSort$1(rebufferingEstimates, (a, b) => a.rebufferingImpact - b.rebufferingImpact);
  74249. return rebufferingEstimates[0] || null;
  74250. };
  74251. const lowestBitrateCompatibleVariantSelector$1 = function() {
  74252. const playlists = this.playlists.main.playlists.filter(Playlist$1.isEnabled);
  74253. stableSort$1(playlists, (a, b) => comparePlaylistBandwidth$1(a, b));
  74254. const playlistsWithVideo = playlists.filter((playlist) => !!codecsForPlaylist$1(this.playlists.main, playlist).video);
  74255. return playlistsWithVideo[0] || null;
  74256. };
  74257. const concatSegments$1 = (segmentObj) => {
  74258. let offset = 0;
  74259. let tempBuffer;
  74260. if (segmentObj.bytes) {
  74261. tempBuffer = new Uint8Array(segmentObj.bytes);
  74262. segmentObj.segments.forEach((segment) => {
  74263. tempBuffer.set(segment, offset);
  74264. offset += segment.byteLength;
  74265. });
  74266. }
  74267. return tempBuffer;
  74268. };
  74269. const createCaptionsTrackIfNotExists$1 = function(inbandTextTracks, tech, captionStream) {
  74270. if (!inbandTextTracks[captionStream]) {
  74271. tech.trigger({
  74272. type: "usage",
  74273. name: "vhs-608"
  74274. });
  74275. let instreamId = captionStream;
  74276. if (/^cc708_/.test(captionStream)) {
  74277. instreamId = "SERVICE" + captionStream.split("_")[1];
  74278. }
  74279. const track = tech.textTracks().getTrackById(instreamId);
  74280. if (track) {
  74281. inbandTextTracks[captionStream] = track;
  74282. } else {
  74283. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  74284. let label2 = captionStream;
  74285. let language = captionStream;
  74286. let def = false;
  74287. const captionService = captionServices[instreamId];
  74288. if (captionService) {
  74289. label2 = captionService.label;
  74290. language = captionService.language;
  74291. def = captionService.default;
  74292. }
  74293. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  74294. kind: "captions",
  74295. id: instreamId,
  74296. default: def,
  74297. label: label2,
  74298. language
  74299. }, false).track;
  74300. }
  74301. }
  74302. };
  74303. const addCaptionData$1 = function({
  74304. inbandTextTracks,
  74305. captionArray,
  74306. timestampOffset: timestampOffset2
  74307. }) {
  74308. if (!captionArray) {
  74309. return;
  74310. }
  74311. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74312. captionArray.forEach((caption) => {
  74313. const track = caption.stream;
  74314. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  74315. });
  74316. };
  74317. const deprecateOldCue$1 = function(cue) {
  74318. Object.defineProperties(cue.frame, {
  74319. id: {
  74320. get() {
  74321. videojs$2.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  74322. return cue.value.key;
  74323. }
  74324. },
  74325. value: {
  74326. get() {
  74327. videojs$2.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  74328. return cue.value.data;
  74329. }
  74330. },
  74331. privateData: {
  74332. get() {
  74333. videojs$2.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  74334. return cue.value.data;
  74335. }
  74336. }
  74337. });
  74338. };
  74339. const addMetadata$1 = ({
  74340. inbandTextTracks,
  74341. metadataArray,
  74342. timestampOffset: timestampOffset2,
  74343. videoDuration
  74344. }) => {
  74345. if (!metadataArray) {
  74346. return;
  74347. }
  74348. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74349. const metadataTrack = inbandTextTracks.metadataTrack_;
  74350. if (!metadataTrack) {
  74351. return;
  74352. }
  74353. metadataArray.forEach((metadata) => {
  74354. const time = metadata.cueTime + timestampOffset2;
  74355. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  74356. return;
  74357. }
  74358. metadata.frames.forEach((frame) => {
  74359. const cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  74360. cue.frame = frame;
  74361. cue.value = frame;
  74362. deprecateOldCue$1(cue);
  74363. metadataTrack.addCue(cue);
  74364. });
  74365. });
  74366. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  74367. return;
  74368. }
  74369. const cues = metadataTrack.cues;
  74370. const cuesArray = [];
  74371. for (let i2 = 0; i2 < cues.length; i2++) {
  74372. if (cues[i2]) {
  74373. cuesArray.push(cues[i2]);
  74374. }
  74375. }
  74376. const cuesGroupedByStartTime = cuesArray.reduce((obj, cue) => {
  74377. const timeSlot = obj[cue.startTime] || [];
  74378. timeSlot.push(cue);
  74379. obj[cue.startTime] = timeSlot;
  74380. return obj;
  74381. }, {});
  74382. const sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort((a, b) => Number(a) - Number(b));
  74383. sortedStartTimes.forEach((startTime, idx) => {
  74384. const cueGroup = cuesGroupedByStartTime[startTime];
  74385. const nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  74386. cueGroup.forEach((cue) => {
  74387. cue.endTime = nextTime;
  74388. });
  74389. });
  74390. };
  74391. const createMetadataTrackIfNotExists$1 = (inbandTextTracks, dispatchType, tech) => {
  74392. if (inbandTextTracks.metadataTrack_) {
  74393. return;
  74394. }
  74395. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  74396. kind: "metadata",
  74397. label: "Timed Metadata"
  74398. }, false).track;
  74399. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  74400. };
  74401. const removeCuesFromTrack$1 = function(start2, end, track) {
  74402. let i2;
  74403. let cue;
  74404. if (!track) {
  74405. return;
  74406. }
  74407. if (!track.cues) {
  74408. return;
  74409. }
  74410. i2 = track.cues.length;
  74411. while (i2--) {
  74412. cue = track.cues[i2];
  74413. if (cue.startTime >= start2 && cue.endTime <= end) {
  74414. track.removeCue(cue);
  74415. }
  74416. }
  74417. };
  74418. const removeDuplicateCuesFromTrack$1 = function(track) {
  74419. const cues = track.cues;
  74420. if (!cues) {
  74421. return;
  74422. }
  74423. for (let i2 = 0; i2 < cues.length; i2++) {
  74424. const duplicates = [];
  74425. let occurrences = 0;
  74426. for (let j = 0; j < cues.length; j++) {
  74427. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  74428. occurrences++;
  74429. if (occurrences > 1) {
  74430. duplicates.push(cues[j]);
  74431. }
  74432. }
  74433. }
  74434. if (duplicates.length) {
  74435. duplicates.forEach((dupe) => track.removeCue(dupe));
  74436. }
  74437. }
  74438. };
  74439. const gopsSafeToAlignWith$1 = (buffer, currentTime, mapping) => {
  74440. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  74441. return [];
  74442. }
  74443. const currentTimePts = Math.ceil((currentTime - mapping + 3) * clock$1.ONE_SECOND_IN_TS);
  74444. let i2;
  74445. for (i2 = 0; i2 < buffer.length; i2++) {
  74446. if (buffer[i2].pts > currentTimePts) {
  74447. break;
  74448. }
  74449. }
  74450. return buffer.slice(i2);
  74451. };
  74452. const updateGopBuffer$1 = (buffer, gops, replace) => {
  74453. if (!gops.length) {
  74454. return buffer;
  74455. }
  74456. if (replace) {
  74457. return gops.slice();
  74458. }
  74459. const start2 = gops[0].pts;
  74460. let i2 = 0;
  74461. for (i2; i2 < buffer.length; i2++) {
  74462. if (buffer[i2].pts >= start2) {
  74463. break;
  74464. }
  74465. }
  74466. return buffer.slice(0, i2).concat(gops);
  74467. };
  74468. const removeGopBuffer$1 = (buffer, start2, end, mapping) => {
  74469. const startPts = Math.ceil((start2 - mapping) * clock$1.ONE_SECOND_IN_TS);
  74470. const endPts = Math.ceil((end - mapping) * clock$1.ONE_SECOND_IN_TS);
  74471. const updatedBuffer = buffer.slice();
  74472. let i2 = buffer.length;
  74473. while (i2--) {
  74474. if (buffer[i2].pts <= endPts) {
  74475. break;
  74476. }
  74477. }
  74478. if (i2 === -1) {
  74479. return updatedBuffer;
  74480. }
  74481. let j = i2 + 1;
  74482. while (j--) {
  74483. if (buffer[j].pts <= startPts) {
  74484. break;
  74485. }
  74486. }
  74487. j = Math.max(j, 0);
  74488. updatedBuffer.splice(j, i2 - j + 1);
  74489. return updatedBuffer;
  74490. };
  74491. const shallowEqual$1 = function(a, b) {
  74492. if (!a && !b || !a && b || a && !b) {
  74493. return false;
  74494. }
  74495. if (a === b) {
  74496. return true;
  74497. }
  74498. const akeys = Object.keys(a).sort();
  74499. const bkeys = Object.keys(b).sort();
  74500. if (akeys.length !== bkeys.length) {
  74501. return false;
  74502. }
  74503. for (let i2 = 0; i2 < akeys.length; i2++) {
  74504. const key = akeys[i2];
  74505. if (key !== bkeys[i2]) {
  74506. return false;
  74507. }
  74508. if (a[key] !== b[key]) {
  74509. return false;
  74510. }
  74511. }
  74512. return true;
  74513. };
  74514. const QUOTA_EXCEEDED_ERR$1 = 22;
  74515. const getSyncSegmentCandidate$1 = function(currentTimeline, segments, targetTime) {
  74516. segments = segments || [];
  74517. const timelineSegments = [];
  74518. let time = 0;
  74519. for (let i2 = 0; i2 < segments.length; i2++) {
  74520. const segment = segments[i2];
  74521. if (currentTimeline === segment.timeline) {
  74522. timelineSegments.push(i2);
  74523. time += segment.duration;
  74524. if (time > targetTime) {
  74525. return i2;
  74526. }
  74527. }
  74528. }
  74529. if (timelineSegments.length === 0) {
  74530. return 0;
  74531. }
  74532. return timelineSegments[timelineSegments.length - 1];
  74533. };
  74534. const MIN_BACK_BUFFER$1 = 1;
  74535. const CHECK_BUFFER_DELAY$1 = 500;
  74536. const finite$1 = (num) => typeof num === "number" && isFinite(num);
  74537. const MIN_SEGMENT_DURATION_TO_SAVE_STATS$1 = 1 / 60;
  74538. const illegalMediaSwitch$1 = (loaderType, startingMedia, trackInfo) => {
  74539. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  74540. return null;
  74541. }
  74542. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  74543. return "Neither audio nor video found in segment.";
  74544. }
  74545. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  74546. 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.";
  74547. }
  74548. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  74549. 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.";
  74550. }
  74551. return null;
  74552. };
  74553. const safeBackBufferTrimTime$1 = (seekable3, currentTime, targetDuration) => {
  74554. let trimTime = currentTime - Config$1.BACK_BUFFER_LENGTH;
  74555. if (seekable3.length) {
  74556. trimTime = Math.max(trimTime, seekable3.start(0));
  74557. }
  74558. const maxTrimTime = currentTime - targetDuration;
  74559. return Math.min(maxTrimTime, trimTime);
  74560. };
  74561. const segmentInfoString$1 = (segmentInfo) => {
  74562. const {
  74563. startOfSegment,
  74564. duration: duration5,
  74565. segment,
  74566. part,
  74567. playlist: {
  74568. mediaSequence: seq,
  74569. id,
  74570. segments = []
  74571. },
  74572. mediaIndex: index2,
  74573. partIndex,
  74574. timeline
  74575. } = segmentInfo;
  74576. const segmentLen = segments.length - 1;
  74577. let selection = "mediaIndex/partIndex increment";
  74578. if (segmentInfo.getMediaInfoForTime) {
  74579. selection = `getMediaInfoForTime (${segmentInfo.getMediaInfoForTime})`;
  74580. } else if (segmentInfo.isSyncRequest) {
  74581. selection = "getSyncSegmentCandidate (isSyncRequest)";
  74582. }
  74583. if (segmentInfo.independent) {
  74584. selection += ` with independent ${segmentInfo.independent}`;
  74585. }
  74586. const hasPartIndex = typeof partIndex === "number";
  74587. const name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  74588. const zeroBasedPartCount = hasPartIndex ? getKnownPartCount$1({
  74589. preloadSegment: segment
  74590. }) - 1 : 0;
  74591. 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}]`;
  74592. };
  74593. const timingInfoPropertyForMedia$1 = (mediaType) => `${mediaType}TimingInfo`;
  74594. const timestampOffsetForSegment$1 = ({
  74595. segmentTimeline,
  74596. currentTimeline,
  74597. startOfSegment,
  74598. buffered,
  74599. overrideCheck
  74600. }) => {
  74601. if (!overrideCheck && segmentTimeline === currentTimeline) {
  74602. return null;
  74603. }
  74604. if (segmentTimeline < currentTimeline) {
  74605. return startOfSegment;
  74606. }
  74607. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  74608. };
  74609. const shouldWaitForTimelineChange$1 = ({
  74610. timelineChangeController,
  74611. currentTimeline,
  74612. segmentTimeline,
  74613. loaderType,
  74614. audioDisabled
  74615. }) => {
  74616. if (currentTimeline === segmentTimeline) {
  74617. return false;
  74618. }
  74619. if (loaderType === "audio") {
  74620. const lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  74621. type: "main"
  74622. });
  74623. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  74624. }
  74625. if (loaderType === "main" && audioDisabled) {
  74626. const pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  74627. type: "audio"
  74628. });
  74629. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  74630. return false;
  74631. }
  74632. return true;
  74633. }
  74634. return false;
  74635. };
  74636. const mediaDuration$1 = (timingInfos) => {
  74637. let maxDuration = 0;
  74638. ["video", "audio"].forEach(function(type2) {
  74639. const typeTimingInfo = timingInfos[`${type2}TimingInfo`];
  74640. if (!typeTimingInfo) {
  74641. return;
  74642. }
  74643. const {
  74644. start: start2,
  74645. end
  74646. } = typeTimingInfo;
  74647. let duration5;
  74648. if (typeof start2 === "bigint" || typeof end === "bigint") {
  74649. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  74650. } else if (typeof start2 === "number" && typeof end === "number") {
  74651. duration5 = end - start2;
  74652. }
  74653. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  74654. maxDuration = duration5;
  74655. }
  74656. });
  74657. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  74658. maxDuration = Number(maxDuration);
  74659. }
  74660. return maxDuration;
  74661. };
  74662. const segmentTooLong$1 = ({
  74663. segmentDuration,
  74664. maxDuration
  74665. }) => {
  74666. if (!segmentDuration) {
  74667. return false;
  74668. }
  74669. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR$1;
  74670. };
  74671. const getTroublesomeSegmentDurationMessage$1 = (segmentInfo, sourceType) => {
  74672. if (sourceType !== "hls") {
  74673. return null;
  74674. }
  74675. const segmentDuration = mediaDuration$1({
  74676. audioTimingInfo: segmentInfo.audioTimingInfo,
  74677. videoTimingInfo: segmentInfo.videoTimingInfo
  74678. });
  74679. if (!segmentDuration) {
  74680. return null;
  74681. }
  74682. const targetDuration = segmentInfo.playlist.targetDuration;
  74683. const isSegmentWayTooLong = segmentTooLong$1({
  74684. segmentDuration,
  74685. maxDuration: targetDuration * 2
  74686. });
  74687. const isSegmentSlightlyTooLong = segmentTooLong$1({
  74688. segmentDuration,
  74689. maxDuration: targetDuration
  74690. });
  74691. 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`;
  74692. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  74693. return {
  74694. severity: isSegmentWayTooLong ? "warn" : "info",
  74695. message: segmentTooLongMessage
  74696. };
  74697. }
  74698. return null;
  74699. };
  74700. class SegmentLoader$1 extends videojs$2.EventTarget {
  74701. constructor(settings, options2 = {}) {
  74702. super();
  74703. if (!settings) {
  74704. throw new TypeError("Initialization settings are required");
  74705. }
  74706. if (typeof settings.currentTime !== "function") {
  74707. throw new TypeError("No currentTime getter specified");
  74708. }
  74709. if (!settings.mediaSource) {
  74710. throw new TypeError("No MediaSource specified");
  74711. }
  74712. this.bandwidth = settings.bandwidth;
  74713. this.throughput = {
  74714. rate: 0,
  74715. count: 0
  74716. };
  74717. this.roundTrip = NaN;
  74718. this.resetStats_();
  74719. this.mediaIndex = null;
  74720. this.partIndex = null;
  74721. this.hasPlayed_ = settings.hasPlayed;
  74722. this.currentTime_ = settings.currentTime;
  74723. this.seekable_ = settings.seekable;
  74724. this.seeking_ = settings.seeking;
  74725. this.duration_ = settings.duration;
  74726. this.mediaSource_ = settings.mediaSource;
  74727. this.vhs_ = settings.vhs;
  74728. this.loaderType_ = settings.loaderType;
  74729. this.currentMediaInfo_ = void 0;
  74730. this.startingMediaInfo_ = void 0;
  74731. this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  74732. this.goalBufferLength_ = settings.goalBufferLength;
  74733. this.sourceType_ = settings.sourceType;
  74734. this.sourceUpdater_ = settings.sourceUpdater;
  74735. this.inbandTextTracks_ = settings.inbandTextTracks;
  74736. this.state_ = "INIT";
  74737. this.timelineChangeController_ = settings.timelineChangeController;
  74738. this.shouldSaveSegmentTimingInfo_ = true;
  74739. this.parse708captions_ = settings.parse708captions;
  74740. this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  74741. this.captionServices_ = settings.captionServices;
  74742. this.exactManifestTimings = settings.exactManifestTimings;
  74743. this.checkBufferTimeout_ = null;
  74744. this.error_ = void 0;
  74745. this.currentTimeline_ = -1;
  74746. this.pendingSegment_ = null;
  74747. this.xhrOptions_ = null;
  74748. this.pendingSegments_ = [];
  74749. this.audioDisabled_ = false;
  74750. this.isPendingTimestampOffset_ = false;
  74751. this.gopBuffer_ = [];
  74752. this.timeMapping_ = 0;
  74753. this.safeAppend_ = videojs$2.browser.IE_VERSION >= 11;
  74754. this.appendInitSegment_ = {
  74755. audio: true,
  74756. video: true
  74757. };
  74758. this.playlistOfLastInitSegment_ = {
  74759. audio: null,
  74760. video: null
  74761. };
  74762. this.callQueue_ = [];
  74763. this.loadQueue_ = [];
  74764. this.metadataQueue_ = {
  74765. id3: [],
  74766. caption: []
  74767. };
  74768. this.waitingOnRemove_ = false;
  74769. this.quotaExceededErrorRetryTimeout_ = null;
  74770. this.activeInitSegmentId_ = null;
  74771. this.initSegments_ = {};
  74772. this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  74773. this.keyCache_ = {};
  74774. this.decrypter_ = settings.decrypter;
  74775. this.syncController_ = settings.syncController;
  74776. this.syncPoint_ = {
  74777. segmentIndex: 0,
  74778. time: 0
  74779. };
  74780. this.transmuxer_ = this.createTransmuxer_();
  74781. this.triggerSyncInfoUpdate_ = () => this.trigger("syncinfoupdate");
  74782. this.syncController_.on("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74783. this.mediaSource_.addEventListener("sourceopen", () => {
  74784. if (!this.isEndOfStream_()) {
  74785. this.ended_ = false;
  74786. }
  74787. });
  74788. this.fetchAtBuffer_ = false;
  74789. this.logger_ = logger$1(`SegmentLoader[${this.loaderType_}]`);
  74790. Object.defineProperty(this, "state", {
  74791. get() {
  74792. return this.state_;
  74793. },
  74794. set(newState) {
  74795. if (newState !== this.state_) {
  74796. this.logger_(`${this.state_} -> ${newState}`);
  74797. this.state_ = newState;
  74798. this.trigger("statechange");
  74799. }
  74800. }
  74801. });
  74802. this.sourceUpdater_.on("ready", () => {
  74803. if (this.hasEnoughInfoToAppend_()) {
  74804. this.processCallQueue_();
  74805. }
  74806. });
  74807. if (this.loaderType_ === "main") {
  74808. this.timelineChangeController_.on("pendingtimelinechange", () => {
  74809. if (this.hasEnoughInfoToAppend_()) {
  74810. this.processCallQueue_();
  74811. }
  74812. });
  74813. }
  74814. if (this.loaderType_ === "audio") {
  74815. this.timelineChangeController_.on("timelinechange", () => {
  74816. if (this.hasEnoughInfoToLoad_()) {
  74817. this.processLoadQueue_();
  74818. }
  74819. if (this.hasEnoughInfoToAppend_()) {
  74820. this.processCallQueue_();
  74821. }
  74822. });
  74823. }
  74824. }
  74825. createTransmuxer_() {
  74826. return segmentTransmuxer$1.createTransmuxer({
  74827. remux: false,
  74828. alignGopsAtEnd: this.safeAppend_,
  74829. keepOriginalTimestamps: true,
  74830. parse708captions: this.parse708captions_,
  74831. captionServices: this.captionServices_
  74832. });
  74833. }
  74834. resetStats_() {
  74835. this.mediaBytesTransferred = 0;
  74836. this.mediaRequests = 0;
  74837. this.mediaRequestsAborted = 0;
  74838. this.mediaRequestsTimedout = 0;
  74839. this.mediaRequestsErrored = 0;
  74840. this.mediaTransferDuration = 0;
  74841. this.mediaSecondsLoaded = 0;
  74842. this.mediaAppends = 0;
  74843. }
  74844. dispose() {
  74845. this.trigger("dispose");
  74846. this.state = "DISPOSED";
  74847. this.pause();
  74848. this.abort_();
  74849. if (this.transmuxer_) {
  74850. this.transmuxer_.terminate();
  74851. }
  74852. this.resetStats_();
  74853. if (this.checkBufferTimeout_) {
  74854. window_1.clearTimeout(this.checkBufferTimeout_);
  74855. }
  74856. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  74857. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74858. }
  74859. this.off();
  74860. }
  74861. setAudio(enable) {
  74862. this.audioDisabled_ = !enable;
  74863. if (enable) {
  74864. this.appendInitSegment_.audio = true;
  74865. } else {
  74866. this.sourceUpdater_.removeAudio(0, this.duration_());
  74867. }
  74868. }
  74869. abort() {
  74870. if (this.state !== "WAITING") {
  74871. if (this.pendingSegment_) {
  74872. this.pendingSegment_ = null;
  74873. }
  74874. return;
  74875. }
  74876. this.abort_();
  74877. this.state = "READY";
  74878. if (!this.paused()) {
  74879. this.monitorBuffer_();
  74880. }
  74881. }
  74882. abort_() {
  74883. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  74884. this.pendingSegment_.abortRequests();
  74885. }
  74886. this.pendingSegment_ = null;
  74887. this.callQueue_ = [];
  74888. this.loadQueue_ = [];
  74889. this.metadataQueue_.id3 = [];
  74890. this.metadataQueue_.caption = [];
  74891. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  74892. this.waitingOnRemove_ = false;
  74893. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  74894. this.quotaExceededErrorRetryTimeout_ = null;
  74895. }
  74896. checkForAbort_(requestId) {
  74897. if (this.state === "APPENDING" && !this.pendingSegment_) {
  74898. this.state = "READY";
  74899. return true;
  74900. }
  74901. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  74902. return true;
  74903. }
  74904. return false;
  74905. }
  74906. error(error) {
  74907. if (typeof error !== "undefined") {
  74908. this.logger_("error occurred:", error);
  74909. this.error_ = error;
  74910. }
  74911. this.pendingSegment_ = null;
  74912. return this.error_;
  74913. }
  74914. endOfStream() {
  74915. this.ended_ = true;
  74916. if (this.transmuxer_) {
  74917. segmentTransmuxer$1.reset(this.transmuxer_);
  74918. }
  74919. this.gopBuffer_.length = 0;
  74920. this.pause();
  74921. this.trigger("ended");
  74922. }
  74923. buffered_() {
  74924. const trackInfo = this.getMediaInfo_();
  74925. if (!this.sourceUpdater_ || !trackInfo) {
  74926. return createTimeRanges$2();
  74927. }
  74928. if (this.loaderType_ === "main") {
  74929. const {
  74930. hasAudio,
  74931. hasVideo,
  74932. isMuxed: isMuxed3
  74933. } = trackInfo;
  74934. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  74935. return this.sourceUpdater_.buffered();
  74936. }
  74937. if (hasVideo) {
  74938. return this.sourceUpdater_.videoBuffered();
  74939. }
  74940. }
  74941. return this.sourceUpdater_.audioBuffered();
  74942. }
  74943. initSegmentForMap(map, set4 = false) {
  74944. if (!map) {
  74945. return null;
  74946. }
  74947. const id = initSegmentId$1(map);
  74948. let storedMap = this.initSegments_[id];
  74949. if (set4 && !storedMap && map.bytes) {
  74950. this.initSegments_[id] = storedMap = {
  74951. resolvedUri: map.resolvedUri,
  74952. byterange: map.byterange,
  74953. bytes: map.bytes,
  74954. tracks: map.tracks,
  74955. timescales: map.timescales
  74956. };
  74957. }
  74958. return storedMap || map;
  74959. }
  74960. segmentKey(key, set4 = false) {
  74961. if (!key) {
  74962. return null;
  74963. }
  74964. const id = segmentKeyId$1(key);
  74965. let storedKey = this.keyCache_[id];
  74966. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  74967. this.keyCache_[id] = storedKey = {
  74968. resolvedUri: key.resolvedUri,
  74969. bytes: key.bytes
  74970. };
  74971. }
  74972. const result = {
  74973. resolvedUri: (storedKey || key).resolvedUri
  74974. };
  74975. if (storedKey) {
  74976. result.bytes = storedKey.bytes;
  74977. }
  74978. return result;
  74979. }
  74980. couldBeginLoading_() {
  74981. return this.playlist_ && !this.paused();
  74982. }
  74983. load() {
  74984. this.monitorBuffer_();
  74985. if (!this.playlist_) {
  74986. return;
  74987. }
  74988. if (this.state === "INIT" && this.couldBeginLoading_()) {
  74989. return this.init_();
  74990. }
  74991. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  74992. return;
  74993. }
  74994. this.state = "READY";
  74995. }
  74996. init_() {
  74997. this.state = "READY";
  74998. this.resetEverything();
  74999. return this.monitorBuffer_();
  75000. }
  75001. playlist(newPlaylist, options2 = {}) {
  75002. if (!newPlaylist) {
  75003. return;
  75004. }
  75005. const oldPlaylist = this.playlist_;
  75006. const segmentInfo = this.pendingSegment_;
  75007. this.playlist_ = newPlaylist;
  75008. this.xhrOptions_ = options2;
  75009. if (this.state === "INIT") {
  75010. newPlaylist.syncInfo = {
  75011. mediaSequence: newPlaylist.mediaSequence,
  75012. time: 0
  75013. };
  75014. if (this.loaderType_ === "main") {
  75015. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  75016. }
  75017. }
  75018. let oldId = null;
  75019. if (oldPlaylist) {
  75020. if (oldPlaylist.id) {
  75021. oldId = oldPlaylist.id;
  75022. } else if (oldPlaylist.uri) {
  75023. oldId = oldPlaylist.uri;
  75024. }
  75025. }
  75026. this.logger_(`playlist update [${oldId} => ${newPlaylist.id || newPlaylist.uri}]`);
  75027. this.trigger("syncinfoupdate");
  75028. if (this.state === "INIT" && this.couldBeginLoading_()) {
  75029. return this.init_();
  75030. }
  75031. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  75032. if (this.mediaIndex !== null) {
  75033. if (!newPlaylist.endList) {
  75034. this.resetLoader();
  75035. } else {
  75036. this.resyncLoader();
  75037. }
  75038. }
  75039. this.currentMediaInfo_ = void 0;
  75040. this.trigger("playlistupdate");
  75041. return;
  75042. }
  75043. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  75044. this.logger_(`live window shift [${mediaSequenceDiff}]`);
  75045. if (this.mediaIndex !== null) {
  75046. this.mediaIndex -= mediaSequenceDiff;
  75047. if (this.mediaIndex < 0) {
  75048. this.mediaIndex = null;
  75049. this.partIndex = null;
  75050. } else {
  75051. const segment = this.playlist_.segments[this.mediaIndex];
  75052. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  75053. const mediaIndex = this.mediaIndex;
  75054. this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`);
  75055. this.resetLoader();
  75056. this.mediaIndex = mediaIndex;
  75057. }
  75058. }
  75059. }
  75060. if (segmentInfo) {
  75061. segmentInfo.mediaIndex -= mediaSequenceDiff;
  75062. if (segmentInfo.mediaIndex < 0) {
  75063. segmentInfo.mediaIndex = null;
  75064. segmentInfo.partIndex = null;
  75065. } else {
  75066. if (segmentInfo.mediaIndex >= 0) {
  75067. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  75068. }
  75069. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  75070. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  75071. }
  75072. }
  75073. }
  75074. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  75075. }
  75076. pause() {
  75077. if (this.checkBufferTimeout_) {
  75078. window_1.clearTimeout(this.checkBufferTimeout_);
  75079. this.checkBufferTimeout_ = null;
  75080. }
  75081. }
  75082. paused() {
  75083. return this.checkBufferTimeout_ === null;
  75084. }
  75085. resetEverything(done) {
  75086. this.ended_ = false;
  75087. this.activeInitSegmentId_ = null;
  75088. this.appendInitSegment_ = {
  75089. audio: true,
  75090. video: true
  75091. };
  75092. this.resetLoader();
  75093. this.remove(0, Infinity, done);
  75094. if (this.transmuxer_) {
  75095. this.transmuxer_.postMessage({
  75096. action: "clearAllMp4Captions"
  75097. });
  75098. this.transmuxer_.postMessage({
  75099. action: "reset"
  75100. });
  75101. }
  75102. }
  75103. resetLoader() {
  75104. this.fetchAtBuffer_ = false;
  75105. this.resyncLoader();
  75106. }
  75107. resyncLoader() {
  75108. if (this.transmuxer_) {
  75109. segmentTransmuxer$1.reset(this.transmuxer_);
  75110. }
  75111. this.mediaIndex = null;
  75112. this.partIndex = null;
  75113. this.syncPoint_ = null;
  75114. this.isPendingTimestampOffset_ = false;
  75115. this.callQueue_ = [];
  75116. this.loadQueue_ = [];
  75117. this.metadataQueue_.id3 = [];
  75118. this.metadataQueue_.caption = [];
  75119. this.abort();
  75120. if (this.transmuxer_) {
  75121. this.transmuxer_.postMessage({
  75122. action: "clearParsedMp4Captions"
  75123. });
  75124. }
  75125. }
  75126. remove(start2, end, done = () => {
  75127. }, force = false) {
  75128. if (end === Infinity) {
  75129. end = this.duration_();
  75130. }
  75131. if (end <= start2) {
  75132. this.logger_("skipping remove because end ${end} is <= start ${start}");
  75133. return;
  75134. }
  75135. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  75136. this.logger_("skipping remove because no source updater or starting media info");
  75137. return;
  75138. }
  75139. let removesRemaining = 1;
  75140. const removeFinished = () => {
  75141. removesRemaining--;
  75142. if (removesRemaining === 0) {
  75143. done();
  75144. }
  75145. };
  75146. if (force || !this.audioDisabled_) {
  75147. removesRemaining++;
  75148. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  75149. }
  75150. if (force || this.loaderType_ === "main") {
  75151. this.gopBuffer_ = removeGopBuffer$1(this.gopBuffer_, start2, end, this.timeMapping_);
  75152. removesRemaining++;
  75153. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  75154. }
  75155. for (const track in this.inbandTextTracks_) {
  75156. removeCuesFromTrack$1(start2, end, this.inbandTextTracks_[track]);
  75157. }
  75158. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  75159. removeFinished();
  75160. }
  75161. monitorBuffer_() {
  75162. if (this.checkBufferTimeout_) {
  75163. window_1.clearTimeout(this.checkBufferTimeout_);
  75164. }
  75165. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  75166. }
  75167. monitorBufferTick_() {
  75168. if (this.state === "READY") {
  75169. this.fillBuffer_();
  75170. }
  75171. if (this.checkBufferTimeout_) {
  75172. window_1.clearTimeout(this.checkBufferTimeout_);
  75173. }
  75174. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY$1);
  75175. }
  75176. fillBuffer_() {
  75177. if (this.sourceUpdater_.updating()) {
  75178. return;
  75179. }
  75180. const segmentInfo = this.chooseNextRequest_();
  75181. if (!segmentInfo) {
  75182. return;
  75183. }
  75184. if (typeof segmentInfo.timestampOffset === "number") {
  75185. this.isPendingTimestampOffset_ = false;
  75186. this.timelineChangeController_.pendingTimelineChange({
  75187. type: this.loaderType_,
  75188. from: this.currentTimeline_,
  75189. to: segmentInfo.timeline
  75190. });
  75191. }
  75192. this.loadSegment_(segmentInfo);
  75193. }
  75194. isEndOfStream_(mediaIndex = this.mediaIndex, playlist = this.playlist_, partIndex = this.partIndex) {
  75195. if (!playlist || !this.mediaSource_) {
  75196. return false;
  75197. }
  75198. const segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  75199. const appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  75200. const appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  75201. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  75202. }
  75203. chooseNextRequest_() {
  75204. const buffered = this.buffered_();
  75205. const bufferedEnd = lastBufferedEnd$1(buffered) || 0;
  75206. const bufferedTime = timeAheadOf$1(buffered, this.currentTime_());
  75207. const preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  75208. const haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  75209. const segments = this.playlist_.segments;
  75210. if (!segments.length || preloaded || haveEnoughBuffer) {
  75211. return null;
  75212. }
  75213. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  75214. const next = {
  75215. partIndex: null,
  75216. mediaIndex: null,
  75217. startOfSegment: null,
  75218. playlist: this.playlist_,
  75219. isSyncRequest: Boolean(!this.syncPoint_)
  75220. };
  75221. if (next.isSyncRequest) {
  75222. next.mediaIndex = getSyncSegmentCandidate$1(this.currentTimeline_, segments, bufferedEnd);
  75223. } else if (this.mediaIndex !== null) {
  75224. const segment = segments[this.mediaIndex];
  75225. const partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  75226. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  75227. if (segment.parts && segment.parts[partIndex + 1]) {
  75228. next.mediaIndex = this.mediaIndex;
  75229. next.partIndex = partIndex + 1;
  75230. } else {
  75231. next.mediaIndex = this.mediaIndex + 1;
  75232. }
  75233. } else {
  75234. const {
  75235. segmentIndex,
  75236. startTime,
  75237. partIndex
  75238. } = Playlist$1.getMediaInfoForTime({
  75239. exactManifestTimings: this.exactManifestTimings,
  75240. playlist: this.playlist_,
  75241. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  75242. startingPartIndex: this.syncPoint_.partIndex,
  75243. startingSegmentIndex: this.syncPoint_.segmentIndex,
  75244. startTime: this.syncPoint_.time
  75245. });
  75246. next.getMediaInfoForTime = this.fetchAtBuffer_ ? `bufferedEnd ${bufferedEnd}` : `currentTime ${this.currentTime_()}`;
  75247. next.mediaIndex = segmentIndex;
  75248. next.startOfSegment = startTime;
  75249. next.partIndex = partIndex;
  75250. }
  75251. const nextSegment = segments[next.mediaIndex];
  75252. let nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  75253. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  75254. return null;
  75255. }
  75256. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  75257. next.partIndex = 0;
  75258. nextPart = nextSegment.parts[0];
  75259. }
  75260. if (!bufferedTime && nextPart && !nextPart.independent) {
  75261. if (next.partIndex === 0) {
  75262. const lastSegment = segments[next.mediaIndex - 1];
  75263. const lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  75264. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  75265. next.mediaIndex -= 1;
  75266. next.partIndex = lastSegment.parts.length - 1;
  75267. next.independent = "previous segment";
  75268. }
  75269. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  75270. next.partIndex -= 1;
  75271. next.independent = "previous part";
  75272. }
  75273. }
  75274. const ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  75275. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  75276. return null;
  75277. }
  75278. return this.generateSegmentInfo_(next);
  75279. }
  75280. generateSegmentInfo_(options2) {
  75281. const {
  75282. independent,
  75283. playlist,
  75284. mediaIndex,
  75285. startOfSegment,
  75286. isSyncRequest,
  75287. partIndex,
  75288. forceTimestampOffset,
  75289. getMediaInfoForTime: getMediaInfoForTime3
  75290. } = options2;
  75291. const segment = playlist.segments[mediaIndex];
  75292. const part = typeof partIndex === "number" && segment.parts[partIndex];
  75293. const segmentInfo = {
  75294. requestId: "segment-loader-" + Math.random(),
  75295. uri: part && part.resolvedUri || segment.resolvedUri,
  75296. mediaIndex,
  75297. partIndex: part ? partIndex : null,
  75298. isSyncRequest,
  75299. startOfSegment,
  75300. playlist,
  75301. bytes: null,
  75302. encryptedBytes: null,
  75303. timestampOffset: null,
  75304. timeline: segment.timeline,
  75305. duration: part && part.duration || segment.duration,
  75306. segment,
  75307. part,
  75308. byteLength: 0,
  75309. transmuxer: this.transmuxer_,
  75310. getMediaInfoForTime: getMediaInfoForTime3,
  75311. independent
  75312. };
  75313. const overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  75314. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  75315. segmentTimeline: segment.timeline,
  75316. currentTimeline: this.currentTimeline_,
  75317. startOfSegment,
  75318. buffered: this.buffered_(),
  75319. overrideCheck
  75320. });
  75321. const audioBufferedEnd = lastBufferedEnd$1(this.sourceUpdater_.audioBuffered());
  75322. if (typeof audioBufferedEnd === "number") {
  75323. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  75324. }
  75325. if (this.sourceUpdater_.videoBuffered().length) {
  75326. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith$1(
  75327. this.gopBuffer_,
  75328. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  75329. this.timeMapping_
  75330. );
  75331. }
  75332. return segmentInfo;
  75333. }
  75334. timestampOffsetForSegment_(options2) {
  75335. return timestampOffsetForSegment$1(options2);
  75336. }
  75337. earlyAbortWhenNeeded_(stats) {
  75338. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  75339. return;
  75340. }
  75341. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  75342. return;
  75343. }
  75344. const currentTime = this.currentTime_();
  75345. const measuredBandwidth = stats.bandwidth;
  75346. const segmentDuration = this.pendingSegment_.duration;
  75347. const requestTimeRemaining = Playlist$1.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  75348. const timeUntilRebuffer$1$1 = timeUntilRebuffer$1(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  75349. if (requestTimeRemaining <= timeUntilRebuffer$1$1) {
  75350. return;
  75351. }
  75352. const switchCandidate = minRebufferMaxBandwidthSelector$1({
  75353. main: this.vhs_.playlists.main,
  75354. currentTime,
  75355. bandwidth: measuredBandwidth,
  75356. duration: this.duration_(),
  75357. segmentDuration,
  75358. timeUntilRebuffer: timeUntilRebuffer$1$1,
  75359. currentTimeline: this.currentTimeline_,
  75360. syncController: this.syncController_
  75361. });
  75362. if (!switchCandidate) {
  75363. return;
  75364. }
  75365. const rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1$1;
  75366. const timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  75367. let minimumTimeSaving = 0.5;
  75368. if (timeUntilRebuffer$1$1 <= TIME_FUDGE_FACTOR$1) {
  75369. minimumTimeSaving = 1;
  75370. }
  75371. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  75372. return;
  75373. }
  75374. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config$1.BANDWIDTH_VARIANCE + 1;
  75375. this.trigger("earlyabort");
  75376. }
  75377. handleAbort_(segmentInfo) {
  75378. this.logger_(`Aborting ${segmentInfoString$1(segmentInfo)}`);
  75379. this.mediaRequestsAborted += 1;
  75380. }
  75381. handleProgress_(event2, simpleSegment) {
  75382. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75383. if (this.checkForAbort_(simpleSegment.requestId)) {
  75384. return;
  75385. }
  75386. this.trigger("progress");
  75387. }
  75388. handleTrackInfo_(simpleSegment, trackInfo) {
  75389. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75390. if (this.checkForAbort_(simpleSegment.requestId)) {
  75391. return;
  75392. }
  75393. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  75394. return;
  75395. }
  75396. trackInfo = trackInfo || {};
  75397. if (!shallowEqual$1(this.currentMediaInfo_, trackInfo)) {
  75398. this.appendInitSegment_ = {
  75399. audio: true,
  75400. video: true
  75401. };
  75402. this.startingMediaInfo_ = trackInfo;
  75403. this.currentMediaInfo_ = trackInfo;
  75404. this.logger_("trackinfo update", trackInfo);
  75405. this.trigger("trackinfo");
  75406. }
  75407. if (this.checkForAbort_(simpleSegment.requestId)) {
  75408. return;
  75409. }
  75410. this.pendingSegment_.trackInfo = trackInfo;
  75411. if (this.hasEnoughInfoToAppend_()) {
  75412. this.processCallQueue_();
  75413. }
  75414. }
  75415. handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  75416. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75417. if (this.checkForAbort_(simpleSegment.requestId)) {
  75418. return;
  75419. }
  75420. const segmentInfo = this.pendingSegment_;
  75421. const timingInfoProperty = timingInfoPropertyForMedia$1(mediaType);
  75422. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  75423. segmentInfo[timingInfoProperty][timeType] = time;
  75424. this.logger_(`timinginfo: ${mediaType} - ${timeType} - ${time}`);
  75425. if (this.hasEnoughInfoToAppend_()) {
  75426. this.processCallQueue_();
  75427. }
  75428. }
  75429. handleCaptions_(simpleSegment, captionData) {
  75430. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75431. if (this.checkForAbort_(simpleSegment.requestId)) {
  75432. return;
  75433. }
  75434. if (captionData.length === 0) {
  75435. this.logger_("SegmentLoader received no captions from a caption event");
  75436. return;
  75437. }
  75438. const segmentInfo = this.pendingSegment_;
  75439. if (!segmentInfo.hasAppendedData_) {
  75440. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  75441. return;
  75442. }
  75443. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75444. const captionTracks = {};
  75445. captionData.forEach((caption) => {
  75446. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  75447. startTime: Infinity,
  75448. captions: [],
  75449. endTime: 0
  75450. };
  75451. const captionTrack = captionTracks[caption.stream];
  75452. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  75453. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  75454. captionTrack.captions.push(caption);
  75455. });
  75456. Object.keys(captionTracks).forEach((trackName) => {
  75457. const {
  75458. startTime,
  75459. endTime,
  75460. captions
  75461. } = captionTracks[trackName];
  75462. const inbandTextTracks = this.inbandTextTracks_;
  75463. this.logger_(`adding cues from ${startTime} -> ${endTime} for ${trackName}`);
  75464. createCaptionsTrackIfNotExists$1(inbandTextTracks, this.vhs_.tech_, trackName);
  75465. removeCuesFromTrack$1(startTime, endTime, inbandTextTracks[trackName]);
  75466. addCaptionData$1({
  75467. captionArray: captions,
  75468. inbandTextTracks,
  75469. timestampOffset: timestampOffset2
  75470. });
  75471. });
  75472. if (this.transmuxer_) {
  75473. this.transmuxer_.postMessage({
  75474. action: "clearParsedMp4Captions"
  75475. });
  75476. }
  75477. }
  75478. handleId3_(simpleSegment, id3Frames, dispatchType) {
  75479. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75480. if (this.checkForAbort_(simpleSegment.requestId)) {
  75481. return;
  75482. }
  75483. const segmentInfo = this.pendingSegment_;
  75484. if (!segmentInfo.hasAppendedData_) {
  75485. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  75486. return;
  75487. }
  75488. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75489. createMetadataTrackIfNotExists$1(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  75490. addMetadata$1({
  75491. inbandTextTracks: this.inbandTextTracks_,
  75492. metadataArray: id3Frames,
  75493. timestampOffset: timestampOffset2,
  75494. videoDuration: this.duration_()
  75495. });
  75496. }
  75497. processMetadataQueue_() {
  75498. this.metadataQueue_.id3.forEach((fn2) => fn2());
  75499. this.metadataQueue_.caption.forEach((fn2) => fn2());
  75500. this.metadataQueue_.id3 = [];
  75501. this.metadataQueue_.caption = [];
  75502. }
  75503. processCallQueue_() {
  75504. const callQueue = this.callQueue_;
  75505. this.callQueue_ = [];
  75506. callQueue.forEach((fun) => fun());
  75507. }
  75508. processLoadQueue_() {
  75509. const loadQueue = this.loadQueue_;
  75510. this.loadQueue_ = [];
  75511. loadQueue.forEach((fun) => fun());
  75512. }
  75513. hasEnoughInfoToLoad_() {
  75514. if (this.loaderType_ !== "audio") {
  75515. return true;
  75516. }
  75517. const segmentInfo = this.pendingSegment_;
  75518. if (!segmentInfo) {
  75519. return false;
  75520. }
  75521. if (!this.getCurrentMediaInfo_()) {
  75522. return true;
  75523. }
  75524. if (shouldWaitForTimelineChange$1({
  75525. timelineChangeController: this.timelineChangeController_,
  75526. currentTimeline: this.currentTimeline_,
  75527. segmentTimeline: segmentInfo.timeline,
  75528. loaderType: this.loaderType_,
  75529. audioDisabled: this.audioDisabled_
  75530. })) {
  75531. return false;
  75532. }
  75533. return true;
  75534. }
  75535. getCurrentMediaInfo_(segmentInfo = this.pendingSegment_) {
  75536. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  75537. }
  75538. getMediaInfo_(segmentInfo = this.pendingSegment_) {
  75539. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  75540. }
  75541. getPendingSegmentPlaylist() {
  75542. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  75543. }
  75544. hasEnoughInfoToAppend_() {
  75545. if (!this.sourceUpdater_.ready()) {
  75546. return false;
  75547. }
  75548. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  75549. return false;
  75550. }
  75551. const segmentInfo = this.pendingSegment_;
  75552. const trackInfo = this.getCurrentMediaInfo_();
  75553. if (!segmentInfo || !trackInfo) {
  75554. return false;
  75555. }
  75556. const {
  75557. hasAudio,
  75558. hasVideo,
  75559. isMuxed: isMuxed3
  75560. } = trackInfo;
  75561. if (hasVideo && !segmentInfo.videoTimingInfo) {
  75562. return false;
  75563. }
  75564. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  75565. return false;
  75566. }
  75567. if (shouldWaitForTimelineChange$1({
  75568. timelineChangeController: this.timelineChangeController_,
  75569. currentTimeline: this.currentTimeline_,
  75570. segmentTimeline: segmentInfo.timeline,
  75571. loaderType: this.loaderType_,
  75572. audioDisabled: this.audioDisabled_
  75573. })) {
  75574. return false;
  75575. }
  75576. return true;
  75577. }
  75578. handleData_(simpleSegment, result) {
  75579. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75580. if (this.checkForAbort_(simpleSegment.requestId)) {
  75581. return;
  75582. }
  75583. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  75584. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  75585. return;
  75586. }
  75587. const segmentInfo = this.pendingSegment_;
  75588. this.setTimeMapping_(segmentInfo.timeline);
  75589. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  75590. if (this.mediaSource_.readyState === "closed") {
  75591. return;
  75592. }
  75593. if (simpleSegment.map) {
  75594. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  75595. segmentInfo.segment.map = simpleSegment.map;
  75596. }
  75597. if (simpleSegment.key) {
  75598. this.segmentKey(simpleSegment.key, true);
  75599. }
  75600. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  75601. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  75602. if (segmentInfo.isFmp4) {
  75603. this.trigger("fmp4");
  75604. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia$1(result.type)].start;
  75605. } else {
  75606. const trackInfo = this.getCurrentMediaInfo_();
  75607. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  75608. let firstVideoFrameTimeForData;
  75609. if (useVideoTimingInfo) {
  75610. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  75611. }
  75612. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  75613. currentStart: segmentInfo.timingInfo.start,
  75614. playlist: segmentInfo.playlist,
  75615. mediaIndex: segmentInfo.mediaIndex,
  75616. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  75617. useVideoTimingInfo,
  75618. firstVideoFrameTimeForData,
  75619. videoTimingInfo: segmentInfo.videoTimingInfo,
  75620. audioTimingInfo: segmentInfo.audioTimingInfo
  75621. });
  75622. }
  75623. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  75624. this.updateSourceBufferTimestampOffset_(segmentInfo);
  75625. if (segmentInfo.isSyncRequest) {
  75626. this.updateTimingInfoEnd_(segmentInfo);
  75627. this.syncController_.saveSegmentTimingInfo({
  75628. segmentInfo,
  75629. shouldSaveTimelineMapping: this.loaderType_ === "main"
  75630. });
  75631. const next = this.chooseNextRequest_();
  75632. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  75633. this.logger_("sync segment was incorrect, not appending");
  75634. return;
  75635. }
  75636. this.logger_("sync segment was correct, appending");
  75637. }
  75638. segmentInfo.hasAppendedData_ = true;
  75639. this.processMetadataQueue_();
  75640. this.appendData_(segmentInfo, result);
  75641. }
  75642. updateAppendInitSegmentStatus(segmentInfo, type2) {
  75643. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  75644. this.appendInitSegment_ = {
  75645. audio: true,
  75646. video: true
  75647. };
  75648. }
  75649. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  75650. this.appendInitSegment_[type2] = true;
  75651. }
  75652. }
  75653. getInitSegmentAndUpdateState_({
  75654. type: type2,
  75655. initSegment,
  75656. map,
  75657. playlist
  75658. }) {
  75659. if (map) {
  75660. const id = initSegmentId$1(map);
  75661. if (this.activeInitSegmentId_ === id) {
  75662. return null;
  75663. }
  75664. initSegment = this.initSegmentForMap(map, true).bytes;
  75665. this.activeInitSegmentId_ = id;
  75666. }
  75667. if (initSegment && this.appendInitSegment_[type2]) {
  75668. this.playlistOfLastInitSegment_[type2] = playlist;
  75669. this.appendInitSegment_[type2] = false;
  75670. this.activeInitSegmentId_ = null;
  75671. return initSegment;
  75672. }
  75673. return null;
  75674. }
  75675. handleQuotaExceededError_({
  75676. segmentInfo,
  75677. type: type2,
  75678. bytes
  75679. }, error) {
  75680. const audioBuffered = this.sourceUpdater_.audioBuffered();
  75681. const videoBuffered = this.sourceUpdater_.videoBuffered();
  75682. if (audioBuffered.length > 1) {
  75683. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray$1(audioBuffered).join(", "));
  75684. }
  75685. if (videoBuffered.length > 1) {
  75686. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray$1(videoBuffered).join(", "));
  75687. }
  75688. const audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  75689. const audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  75690. const videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  75691. const videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  75692. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER$1 && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER$1) {
  75693. 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(", ")}, `);
  75694. this.error({
  75695. message: "Quota exceeded error with append of a single segment of content",
  75696. excludeUntil: Infinity
  75697. });
  75698. this.trigger("error");
  75699. return;
  75700. }
  75701. this.waitingOnRemove_ = true;
  75702. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  75703. segmentInfo,
  75704. type: type2,
  75705. bytes
  75706. }));
  75707. const currentTime = this.currentTime_();
  75708. const timeToRemoveUntil = currentTime - MIN_BACK_BUFFER$1;
  75709. this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${timeToRemoveUntil}`);
  75710. this.remove(0, timeToRemoveUntil, () => {
  75711. this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${MIN_BACK_BUFFER$1}s`);
  75712. this.waitingOnRemove_ = false;
  75713. this.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(() => {
  75714. this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  75715. this.quotaExceededErrorRetryTimeout_ = null;
  75716. this.processCallQueue_();
  75717. }, MIN_BACK_BUFFER$1 * 1e3);
  75718. }, true);
  75719. }
  75720. handleAppendError_({
  75721. segmentInfo,
  75722. type: type2,
  75723. bytes
  75724. }, error) {
  75725. if (!error) {
  75726. return;
  75727. }
  75728. if (error.code === QUOTA_EXCEEDED_ERR$1) {
  75729. this.handleQuotaExceededError_({
  75730. segmentInfo,
  75731. type: type2,
  75732. bytes
  75733. });
  75734. return;
  75735. }
  75736. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  75737. this.error(`${type2} append of ${bytes.length}b failed for segment #${segmentInfo.mediaIndex} in playlist ${segmentInfo.playlist.id}`);
  75738. this.trigger("appenderror");
  75739. }
  75740. appendToSourceBuffer_({
  75741. segmentInfo,
  75742. type: type2,
  75743. initSegment,
  75744. data,
  75745. bytes
  75746. }) {
  75747. if (!bytes) {
  75748. const segments = [data];
  75749. let byteLength = data.byteLength;
  75750. if (initSegment) {
  75751. segments.unshift(initSegment);
  75752. byteLength += initSegment.byteLength;
  75753. }
  75754. bytes = concatSegments$1({
  75755. bytes: byteLength,
  75756. segments
  75757. });
  75758. }
  75759. this.sourceUpdater_.appendBuffer({
  75760. segmentInfo,
  75761. type: type2,
  75762. bytes
  75763. }, this.handleAppendError_.bind(this, {
  75764. segmentInfo,
  75765. type: type2,
  75766. bytes
  75767. }));
  75768. }
  75769. handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  75770. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  75771. return;
  75772. }
  75773. const segment = this.pendingSegment_.segment;
  75774. const timingInfoProperty = `${type2}TimingInfo`;
  75775. if (!segment[timingInfoProperty]) {
  75776. segment[timingInfoProperty] = {};
  75777. }
  75778. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  75779. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  75780. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  75781. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  75782. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  75783. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  75784. }
  75785. appendData_(segmentInfo, result) {
  75786. const {
  75787. type: type2,
  75788. data
  75789. } = result;
  75790. if (!data || !data.byteLength) {
  75791. return;
  75792. }
  75793. if (type2 === "audio" && this.audioDisabled_) {
  75794. return;
  75795. }
  75796. const initSegment = this.getInitSegmentAndUpdateState_({
  75797. type: type2,
  75798. initSegment: result.initSegment,
  75799. playlist: segmentInfo.playlist,
  75800. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  75801. });
  75802. this.appendToSourceBuffer_({
  75803. segmentInfo,
  75804. type: type2,
  75805. initSegment,
  75806. data
  75807. });
  75808. }
  75809. loadSegment_(segmentInfo) {
  75810. this.state = "WAITING";
  75811. this.pendingSegment_ = segmentInfo;
  75812. this.trimBackBuffer_(segmentInfo);
  75813. if (typeof segmentInfo.timestampOffset === "number") {
  75814. if (this.transmuxer_) {
  75815. this.transmuxer_.postMessage({
  75816. action: "clearAllMp4Captions"
  75817. });
  75818. }
  75819. }
  75820. if (!this.hasEnoughInfoToLoad_()) {
  75821. this.loadQueue_.push(() => {
  75822. const options2 = _extends$2({}, segmentInfo, {
  75823. forceTimestampOffset: true
  75824. });
  75825. _extends$2(segmentInfo, this.generateSegmentInfo_(options2));
  75826. this.isPendingTimestampOffset_ = false;
  75827. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75828. });
  75829. return;
  75830. }
  75831. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75832. }
  75833. updateTransmuxerAndRequestSegment_(segmentInfo) {
  75834. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  75835. this.gopBuffer_.length = 0;
  75836. segmentInfo.gopsToAlignWith = [];
  75837. this.timeMapping_ = 0;
  75838. this.transmuxer_.postMessage({
  75839. action: "reset"
  75840. });
  75841. this.transmuxer_.postMessage({
  75842. action: "setTimestampOffset",
  75843. timestampOffset: segmentInfo.timestampOffset
  75844. });
  75845. }
  75846. const simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  75847. const isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  75848. const isWalkingForward = this.mediaIndex !== null;
  75849. const isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  75850. const isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  75851. this.logger_(`Requesting ${segmentInfoString$1(segmentInfo)}`);
  75852. if (simpleSegment.map && !simpleSegment.map.bytes) {
  75853. this.logger_("going to request init segment.");
  75854. this.appendInitSegment_ = {
  75855. video: true,
  75856. audio: true
  75857. };
  75858. }
  75859. segmentInfo.abortRequests = mediaSegmentRequest$1({
  75860. xhr: this.vhs_.xhr,
  75861. xhrOptions: this.xhrOptions_,
  75862. decryptionWorker: this.decrypter_,
  75863. segment: simpleSegment,
  75864. abortFn: this.handleAbort_.bind(this, segmentInfo),
  75865. progressFn: this.handleProgress_.bind(this),
  75866. trackInfoFn: this.handleTrackInfo_.bind(this),
  75867. timingInfoFn: this.handleTimingInfo_.bind(this),
  75868. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  75869. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  75870. captionsFn: this.handleCaptions_.bind(this),
  75871. isEndOfTimeline,
  75872. endedTimelineFn: () => {
  75873. this.logger_("received endedtimeline callback");
  75874. },
  75875. id3Fn: this.handleId3_.bind(this),
  75876. dataFn: this.handleData_.bind(this),
  75877. doneFn: this.segmentRequestFinished_.bind(this),
  75878. onTransmuxerLog: ({
  75879. message,
  75880. level,
  75881. stream
  75882. }) => {
  75883. this.logger_(`${segmentInfoString$1(segmentInfo)} logged from transmuxer stream ${stream} as a ${level}: ${message}`);
  75884. }
  75885. });
  75886. }
  75887. trimBackBuffer_(segmentInfo) {
  75888. const removeToTime = safeBackBufferTrimTime$1(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  75889. if (removeToTime > 0) {
  75890. this.remove(0, removeToTime);
  75891. }
  75892. }
  75893. createSimplifiedSegmentObj_(segmentInfo) {
  75894. const segment = segmentInfo.segment;
  75895. const part = segmentInfo.part;
  75896. const simpleSegment = {
  75897. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  75898. byterange: part ? part.byterange : segment.byterange,
  75899. requestId: segmentInfo.requestId,
  75900. transmuxer: segmentInfo.transmuxer,
  75901. audioAppendStart: segmentInfo.audioAppendStart,
  75902. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  75903. part: segmentInfo.part
  75904. };
  75905. const previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  75906. if (previousSegment && previousSegment.timeline === segment.timeline) {
  75907. if (previousSegment.videoTimingInfo) {
  75908. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  75909. } else if (previousSegment.audioTimingInfo) {
  75910. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  75911. }
  75912. }
  75913. if (segment.key) {
  75914. const iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  75915. simpleSegment.key = this.segmentKey(segment.key);
  75916. simpleSegment.key.iv = iv;
  75917. }
  75918. if (segment.map) {
  75919. simpleSegment.map = this.initSegmentForMap(segment.map);
  75920. }
  75921. return simpleSegment;
  75922. }
  75923. saveTransferStats_(stats) {
  75924. this.mediaRequests += 1;
  75925. if (stats) {
  75926. this.mediaBytesTransferred += stats.bytesReceived;
  75927. this.mediaTransferDuration += stats.roundTripTime;
  75928. }
  75929. }
  75930. saveBandwidthRelatedStats_(duration5, stats) {
  75931. this.pendingSegment_.byteLength = stats.bytesReceived;
  75932. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  75933. 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}`);
  75934. return;
  75935. }
  75936. this.bandwidth = stats.bandwidth;
  75937. this.roundTrip = stats.roundTripTime;
  75938. }
  75939. handleTimeout_() {
  75940. this.mediaRequestsTimedout += 1;
  75941. this.bandwidth = 1;
  75942. this.roundTrip = NaN;
  75943. this.trigger("bandwidthupdate");
  75944. this.trigger("timeout");
  75945. }
  75946. segmentRequestFinished_(error, simpleSegment, result) {
  75947. if (this.callQueue_.length) {
  75948. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  75949. return;
  75950. }
  75951. this.saveTransferStats_(simpleSegment.stats);
  75952. if (!this.pendingSegment_) {
  75953. return;
  75954. }
  75955. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  75956. return;
  75957. }
  75958. if (error) {
  75959. this.pendingSegment_ = null;
  75960. this.state = "READY";
  75961. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  75962. return;
  75963. }
  75964. this.pause();
  75965. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  75966. this.handleTimeout_();
  75967. return;
  75968. }
  75969. this.mediaRequestsErrored += 1;
  75970. this.error(error);
  75971. this.trigger("error");
  75972. return;
  75973. }
  75974. const segmentInfo = this.pendingSegment_;
  75975. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  75976. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  75977. if (result.gopInfo) {
  75978. this.gopBuffer_ = updateGopBuffer$1(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  75979. }
  75980. this.state = "APPENDING";
  75981. this.trigger("appending");
  75982. this.waitForAppendsToComplete_(segmentInfo);
  75983. }
  75984. setTimeMapping_(timeline) {
  75985. const timelineMapping = this.syncController_.mappingForTimeline(timeline);
  75986. if (timelineMapping !== null) {
  75987. this.timeMapping_ = timelineMapping;
  75988. }
  75989. }
  75990. updateMediaSecondsLoaded_(segment) {
  75991. if (typeof segment.start === "number" && typeof segment.end === "number") {
  75992. this.mediaSecondsLoaded += segment.end - segment.start;
  75993. } else {
  75994. this.mediaSecondsLoaded += segment.duration;
  75995. }
  75996. }
  75997. shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  75998. if (timestampOffset2 === null) {
  75999. return false;
  76000. }
  76001. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  76002. return true;
  76003. }
  76004. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  76005. return true;
  76006. }
  76007. return false;
  76008. }
  76009. trueSegmentStart_({
  76010. currentStart,
  76011. playlist,
  76012. mediaIndex,
  76013. firstVideoFrameTimeForData,
  76014. currentVideoTimestampOffset,
  76015. useVideoTimingInfo,
  76016. videoTimingInfo,
  76017. audioTimingInfo
  76018. }) {
  76019. if (typeof currentStart !== "undefined") {
  76020. return currentStart;
  76021. }
  76022. if (!useVideoTimingInfo) {
  76023. return audioTimingInfo.start;
  76024. }
  76025. const previousSegment = playlist.segments[mediaIndex - 1];
  76026. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  76027. return firstVideoFrameTimeForData;
  76028. }
  76029. return videoTimingInfo.start;
  76030. }
  76031. waitForAppendsToComplete_(segmentInfo) {
  76032. const trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  76033. if (!trackInfo) {
  76034. this.error({
  76035. message: "No starting media returned, likely due to an unsupported media format.",
  76036. playlistExclusionDuration: Infinity
  76037. });
  76038. this.trigger("error");
  76039. return;
  76040. }
  76041. const {
  76042. hasAudio,
  76043. hasVideo,
  76044. isMuxed: isMuxed3
  76045. } = trackInfo;
  76046. const waitForVideo = this.loaderType_ === "main" && hasVideo;
  76047. const waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  76048. segmentInfo.waitingOnAppends = 0;
  76049. if (!segmentInfo.hasAppendedData_) {
  76050. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  76051. this.isPendingTimestampOffset_ = true;
  76052. }
  76053. segmentInfo.timingInfo = {
  76054. start: 0
  76055. };
  76056. segmentInfo.waitingOnAppends++;
  76057. if (!this.isPendingTimestampOffset_) {
  76058. this.updateSourceBufferTimestampOffset_(segmentInfo);
  76059. this.processMetadataQueue_();
  76060. }
  76061. this.checkAppendsDone_(segmentInfo);
  76062. return;
  76063. }
  76064. if (waitForVideo) {
  76065. segmentInfo.waitingOnAppends++;
  76066. }
  76067. if (waitForAudio) {
  76068. segmentInfo.waitingOnAppends++;
  76069. }
  76070. if (waitForVideo) {
  76071. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  76072. }
  76073. if (waitForAudio) {
  76074. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  76075. }
  76076. }
  76077. checkAppendsDone_(segmentInfo) {
  76078. if (this.checkForAbort_(segmentInfo.requestId)) {
  76079. return;
  76080. }
  76081. segmentInfo.waitingOnAppends--;
  76082. if (segmentInfo.waitingOnAppends === 0) {
  76083. this.handleAppendsDone_();
  76084. }
  76085. }
  76086. checkForIllegalMediaSwitch(trackInfo) {
  76087. const illegalMediaSwitchError = illegalMediaSwitch$1(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  76088. if (illegalMediaSwitchError) {
  76089. this.error({
  76090. message: illegalMediaSwitchError,
  76091. playlistExclusionDuration: Infinity
  76092. });
  76093. this.trigger("error");
  76094. return true;
  76095. }
  76096. return false;
  76097. }
  76098. updateSourceBufferTimestampOffset_(segmentInfo) {
  76099. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  76100. return;
  76101. }
  76102. let didChange = false;
  76103. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  76104. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  76105. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  76106. timingInfo: segmentInfo.timingInfo
  76107. });
  76108. segmentInfo.changedTimestampOffset = true;
  76109. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  76110. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  76111. didChange = true;
  76112. }
  76113. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  76114. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  76115. didChange = true;
  76116. }
  76117. if (didChange) {
  76118. this.trigger("timestampoffset");
  76119. }
  76120. }
  76121. getSegmentStartTimeForTimestampOffsetCalculation_({
  76122. videoTimingInfo,
  76123. audioTimingInfo,
  76124. timingInfo
  76125. }) {
  76126. if (!this.useDtsForTimestampOffset_) {
  76127. return timingInfo.start;
  76128. }
  76129. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  76130. return videoTimingInfo.transmuxedDecodeStart;
  76131. }
  76132. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  76133. return audioTimingInfo.transmuxedDecodeStart;
  76134. }
  76135. return timingInfo.start;
  76136. }
  76137. updateTimingInfoEnd_(segmentInfo) {
  76138. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  76139. const trackInfo = this.getMediaInfo_();
  76140. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  76141. const prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  76142. if (!prioritizedTimingInfo) {
  76143. return;
  76144. }
  76145. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  76146. }
  76147. handleAppendsDone_() {
  76148. if (this.pendingSegment_) {
  76149. this.trigger("appendsdone");
  76150. }
  76151. if (!this.pendingSegment_) {
  76152. this.state = "READY";
  76153. if (!this.paused()) {
  76154. this.monitorBuffer_();
  76155. }
  76156. return;
  76157. }
  76158. const segmentInfo = this.pendingSegment_;
  76159. this.updateTimingInfoEnd_(segmentInfo);
  76160. if (this.shouldSaveSegmentTimingInfo_) {
  76161. this.syncController_.saveSegmentTimingInfo({
  76162. segmentInfo,
  76163. shouldSaveTimelineMapping: this.loaderType_ === "main"
  76164. });
  76165. }
  76166. const segmentDurationMessage = getTroublesomeSegmentDurationMessage$1(segmentInfo, this.sourceType_);
  76167. if (segmentDurationMessage) {
  76168. if (segmentDurationMessage.severity === "warn") {
  76169. videojs$2.log.warn(segmentDurationMessage.message);
  76170. } else {
  76171. this.logger_(segmentDurationMessage.message);
  76172. }
  76173. }
  76174. this.recordThroughput_(segmentInfo);
  76175. this.pendingSegment_ = null;
  76176. this.state = "READY";
  76177. if (segmentInfo.isSyncRequest) {
  76178. this.trigger("syncinfoupdate");
  76179. if (!segmentInfo.hasAppendedData_) {
  76180. this.logger_(`Throwing away un-appended sync request ${segmentInfoString$1(segmentInfo)}`);
  76181. return;
  76182. }
  76183. }
  76184. this.logger_(`Appended ${segmentInfoString$1(segmentInfo)}`);
  76185. this.addSegmentMetadataCue_(segmentInfo);
  76186. this.fetchAtBuffer_ = true;
  76187. if (this.currentTimeline_ !== segmentInfo.timeline) {
  76188. this.timelineChangeController_.lastTimelineChange({
  76189. type: this.loaderType_,
  76190. from: this.currentTimeline_,
  76191. to: segmentInfo.timeline
  76192. });
  76193. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  76194. this.timelineChangeController_.lastTimelineChange({
  76195. type: "audio",
  76196. from: this.currentTimeline_,
  76197. to: segmentInfo.timeline
  76198. });
  76199. }
  76200. }
  76201. this.currentTimeline_ = segmentInfo.timeline;
  76202. this.trigger("syncinfoupdate");
  76203. const segment = segmentInfo.segment;
  76204. const part = segmentInfo.part;
  76205. const badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  76206. const badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  76207. if (badSegmentGuess || badPartGuess) {
  76208. this.logger_(`bad ${badSegmentGuess ? "segment" : "part"} ${segmentInfoString$1(segmentInfo)}`);
  76209. this.resetEverything();
  76210. return;
  76211. }
  76212. const isWalkingForward = this.mediaIndex !== null;
  76213. if (isWalkingForward) {
  76214. this.trigger("bandwidthupdate");
  76215. }
  76216. this.trigger("progress");
  76217. this.mediaIndex = segmentInfo.mediaIndex;
  76218. this.partIndex = segmentInfo.partIndex;
  76219. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  76220. this.endOfStream();
  76221. }
  76222. this.trigger("appended");
  76223. if (segmentInfo.hasAppendedData_) {
  76224. this.mediaAppends++;
  76225. }
  76226. if (!this.paused()) {
  76227. this.monitorBuffer_();
  76228. }
  76229. }
  76230. recordThroughput_(segmentInfo) {
  76231. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  76232. 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}`);
  76233. return;
  76234. }
  76235. const rate = this.throughput.rate;
  76236. const segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  76237. const segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  76238. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  76239. }
  76240. addSegmentMetadataCue_(segmentInfo) {
  76241. if (!this.segmentMetadataTrack_) {
  76242. return;
  76243. }
  76244. const segment = segmentInfo.segment;
  76245. const start2 = segment.start;
  76246. const end = segment.end;
  76247. if (!finite$1(start2) || !finite$1(end)) {
  76248. return;
  76249. }
  76250. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  76251. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  76252. const value = {
  76253. custom: segment.custom,
  76254. dateTimeObject: segment.dateTimeObject,
  76255. dateTimeString: segment.dateTimeString,
  76256. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  76257. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  76258. codecs: segmentInfo.playlist.attributes.CODECS,
  76259. byteLength: segmentInfo.byteLength,
  76260. uri: segmentInfo.uri,
  76261. timeline: segmentInfo.timeline,
  76262. playlist: segmentInfo.playlist.id,
  76263. start: start2,
  76264. end
  76265. };
  76266. const data = JSON.stringify(value);
  76267. const cue = new Cue(start2, end, data);
  76268. cue.value = value;
  76269. this.segmentMetadataTrack_.addCue(cue);
  76270. }
  76271. }
  76272. function noop$1() {
  76273. }
  76274. const toTitleCase$2 = function(string) {
  76275. if (typeof string !== "string") {
  76276. return string;
  76277. }
  76278. return string.replace(/./, (w) => w.toUpperCase());
  76279. };
  76280. const bufferTypes$1 = ["video", "audio"];
  76281. const updating = (type2, sourceUpdater) => {
  76282. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76283. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  76284. };
  76285. const nextQueueIndexOfType$1 = (type2, queue) => {
  76286. for (let i2 = 0; i2 < queue.length; i2++) {
  76287. const queueEntry = queue[i2];
  76288. if (queueEntry.type === "mediaSource") {
  76289. return null;
  76290. }
  76291. if (queueEntry.type === type2) {
  76292. return i2;
  76293. }
  76294. }
  76295. return null;
  76296. };
  76297. const shiftQueue$1 = (type2, sourceUpdater) => {
  76298. if (sourceUpdater.queue.length === 0) {
  76299. return;
  76300. }
  76301. let queueIndex = 0;
  76302. let queueEntry = sourceUpdater.queue[queueIndex];
  76303. if (queueEntry.type === "mediaSource") {
  76304. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  76305. sourceUpdater.queue.shift();
  76306. queueEntry.action(sourceUpdater);
  76307. if (queueEntry.doneFn) {
  76308. queueEntry.doneFn();
  76309. }
  76310. shiftQueue$1("audio", sourceUpdater);
  76311. shiftQueue$1("video", sourceUpdater);
  76312. }
  76313. return;
  76314. }
  76315. if (type2 === "mediaSource") {
  76316. return;
  76317. }
  76318. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || updating(type2, sourceUpdater)) {
  76319. return;
  76320. }
  76321. if (queueEntry.type !== type2) {
  76322. queueIndex = nextQueueIndexOfType$1(type2, sourceUpdater.queue);
  76323. if (queueIndex === null) {
  76324. return;
  76325. }
  76326. queueEntry = sourceUpdater.queue[queueIndex];
  76327. }
  76328. sourceUpdater.queue.splice(queueIndex, 1);
  76329. sourceUpdater.queuePending[type2] = queueEntry;
  76330. queueEntry.action(type2, sourceUpdater);
  76331. if (!queueEntry.doneFn) {
  76332. sourceUpdater.queuePending[type2] = null;
  76333. shiftQueue$1(type2, sourceUpdater);
  76334. return;
  76335. }
  76336. };
  76337. const cleanupBuffer$1 = (type2, sourceUpdater) => {
  76338. const buffer = sourceUpdater[`${type2}Buffer`];
  76339. const titleType = toTitleCase$2(type2);
  76340. if (!buffer) {
  76341. return;
  76342. }
  76343. buffer.removeEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76344. buffer.removeEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76345. sourceUpdater.codecs[type2] = null;
  76346. sourceUpdater[`${type2}Buffer`] = null;
  76347. };
  76348. const inSourceBuffers$1 = (mediaSource, sourceBuffer) => mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  76349. const actions$1 = {
  76350. appendBuffer: (bytes, segmentInfo, onError2) => (type2, sourceUpdater) => {
  76351. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76352. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76353. return;
  76354. }
  76355. sourceUpdater.logger_(`Appending segment ${segmentInfo.mediaIndex}'s ${bytes.length} bytes to ${type2}Buffer`);
  76356. try {
  76357. sourceBuffer.appendBuffer(bytes);
  76358. } catch (e) {
  76359. sourceUpdater.logger_(`Error with code ${e.code} ` + (e.code === QUOTA_EXCEEDED_ERR$1 ? "(QUOTA_EXCEEDED_ERR) " : "") + `when appending segment ${segmentInfo.mediaIndex} to ${type2}Buffer`);
  76360. sourceUpdater.queuePending[type2] = null;
  76361. onError2(e);
  76362. }
  76363. },
  76364. remove: (start2, end) => (type2, sourceUpdater) => {
  76365. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76366. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76367. return;
  76368. }
  76369. sourceUpdater.logger_(`Removing ${start2} to ${end} from ${type2}Buffer`);
  76370. try {
  76371. sourceBuffer.remove(start2, end);
  76372. } catch (e) {
  76373. sourceUpdater.logger_(`Remove ${start2} to ${end} from ${type2}Buffer failed`);
  76374. }
  76375. },
  76376. timestampOffset: (offset) => (type2, sourceUpdater) => {
  76377. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76378. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76379. return;
  76380. }
  76381. sourceUpdater.logger_(`Setting ${type2}timestampOffset to ${offset}`);
  76382. sourceBuffer.timestampOffset = offset;
  76383. },
  76384. callback: (callback2) => (type2, sourceUpdater) => {
  76385. callback2();
  76386. },
  76387. endOfStream: (error) => (sourceUpdater) => {
  76388. if (sourceUpdater.mediaSource.readyState !== "open") {
  76389. return;
  76390. }
  76391. sourceUpdater.logger_(`Calling mediaSource endOfStream(${error || ""})`);
  76392. try {
  76393. sourceUpdater.mediaSource.endOfStream(error);
  76394. } catch (e) {
  76395. videojs$2.log.warn("Failed to call media source endOfStream", e);
  76396. }
  76397. },
  76398. duration: (duration5) => (sourceUpdater) => {
  76399. sourceUpdater.logger_(`Setting mediaSource duration to ${duration5}`);
  76400. try {
  76401. sourceUpdater.mediaSource.duration = duration5;
  76402. } catch (e) {
  76403. videojs$2.log.warn("Failed to set media source duration", e);
  76404. }
  76405. },
  76406. abort: () => (type2, sourceUpdater) => {
  76407. if (sourceUpdater.mediaSource.readyState !== "open") {
  76408. return;
  76409. }
  76410. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76411. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76412. return;
  76413. }
  76414. sourceUpdater.logger_(`calling abort on ${type2}Buffer`);
  76415. try {
  76416. sourceBuffer.abort();
  76417. } catch (e) {
  76418. videojs$2.log.warn(`Failed to abort on ${type2}Buffer`, e);
  76419. }
  76420. },
  76421. addSourceBuffer: (type2, codec) => (sourceUpdater) => {
  76422. const titleType = toTitleCase$2(type2);
  76423. const mime = getMimeForCodec$1(codec);
  76424. sourceUpdater.logger_(`Adding ${type2}Buffer with codec ${codec} to mediaSource`);
  76425. const sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  76426. sourceBuffer.addEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76427. sourceBuffer.addEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76428. sourceUpdater.codecs[type2] = codec;
  76429. sourceUpdater[`${type2}Buffer`] = sourceBuffer;
  76430. },
  76431. removeSourceBuffer: (type2) => (sourceUpdater) => {
  76432. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76433. cleanupBuffer$1(type2, sourceUpdater);
  76434. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76435. return;
  76436. }
  76437. sourceUpdater.logger_(`Removing ${type2}Buffer with codec ${sourceUpdater.codecs[type2]} from mediaSource`);
  76438. try {
  76439. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  76440. } catch (e) {
  76441. videojs$2.log.warn(`Failed to removeSourceBuffer ${type2}Buffer`, e);
  76442. }
  76443. },
  76444. changeType: (codec) => (type2, sourceUpdater) => {
  76445. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76446. const mime = getMimeForCodec$1(codec);
  76447. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76448. return;
  76449. }
  76450. if (sourceUpdater.codecs[type2] === codec) {
  76451. return;
  76452. }
  76453. sourceUpdater.logger_(`changing ${type2}Buffer codec from ${sourceUpdater.codecs[type2]} to ${codec}`);
  76454. sourceBuffer.changeType(mime);
  76455. sourceUpdater.codecs[type2] = codec;
  76456. }
  76457. };
  76458. const pushQueue$1 = ({
  76459. type: type2,
  76460. sourceUpdater,
  76461. action,
  76462. doneFn,
  76463. name
  76464. }) => {
  76465. sourceUpdater.queue.push({
  76466. type: type2,
  76467. action,
  76468. doneFn,
  76469. name
  76470. });
  76471. shiftQueue$1(type2, sourceUpdater);
  76472. };
  76473. const onUpdateend$1 = (type2, sourceUpdater) => (e) => {
  76474. if (sourceUpdater.queuePending[type2]) {
  76475. const doneFn = sourceUpdater.queuePending[type2].doneFn;
  76476. sourceUpdater.queuePending[type2] = null;
  76477. if (doneFn) {
  76478. doneFn(sourceUpdater[`${type2}Error_`]);
  76479. }
  76480. }
  76481. shiftQueue$1(type2, sourceUpdater);
  76482. };
  76483. class SourceUpdater$1 extends videojs$2.EventTarget {
  76484. constructor(mediaSource) {
  76485. super();
  76486. this.mediaSource = mediaSource;
  76487. this.sourceopenListener_ = () => shiftQueue$1("mediaSource", this);
  76488. this.mediaSource.addEventListener("sourceopen", this.sourceopenListener_);
  76489. this.logger_ = logger$1("SourceUpdater");
  76490. this.audioTimestampOffset_ = 0;
  76491. this.videoTimestampOffset_ = 0;
  76492. this.queue = [];
  76493. this.queuePending = {
  76494. audio: null,
  76495. video: null
  76496. };
  76497. this.delayedAudioAppendQueue_ = [];
  76498. this.videoAppendQueued_ = false;
  76499. this.codecs = {};
  76500. this.onVideoUpdateEnd_ = onUpdateend$1("video", this);
  76501. this.onAudioUpdateEnd_ = onUpdateend$1("audio", this);
  76502. this.onVideoError_ = (e) => {
  76503. this.videoError_ = e;
  76504. };
  76505. this.onAudioError_ = (e) => {
  76506. this.audioError_ = e;
  76507. };
  76508. this.createdSourceBuffers_ = false;
  76509. this.initializedEme_ = false;
  76510. this.triggeredReady_ = false;
  76511. }
  76512. initializedEme() {
  76513. this.initializedEme_ = true;
  76514. this.triggerReady();
  76515. }
  76516. hasCreatedSourceBuffers() {
  76517. return this.createdSourceBuffers_;
  76518. }
  76519. hasInitializedAnyEme() {
  76520. return this.initializedEme_;
  76521. }
  76522. ready() {
  76523. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  76524. }
  76525. createSourceBuffers(codecs) {
  76526. if (this.hasCreatedSourceBuffers()) {
  76527. return;
  76528. }
  76529. this.addOrChangeSourceBuffers(codecs);
  76530. this.createdSourceBuffers_ = true;
  76531. this.trigger("createdsourcebuffers");
  76532. this.triggerReady();
  76533. }
  76534. triggerReady() {
  76535. if (this.ready() && !this.triggeredReady_) {
  76536. this.triggeredReady_ = true;
  76537. this.trigger("ready");
  76538. }
  76539. }
  76540. addSourceBuffer(type2, codec) {
  76541. pushQueue$1({
  76542. type: "mediaSource",
  76543. sourceUpdater: this,
  76544. action: actions$1.addSourceBuffer(type2, codec),
  76545. name: "addSourceBuffer"
  76546. });
  76547. }
  76548. abort(type2) {
  76549. pushQueue$1({
  76550. type: type2,
  76551. sourceUpdater: this,
  76552. action: actions$1.abort(type2),
  76553. name: "abort"
  76554. });
  76555. }
  76556. removeSourceBuffer(type2) {
  76557. if (!this.canRemoveSourceBuffer()) {
  76558. videojs$2.log.error("removeSourceBuffer is not supported!");
  76559. return;
  76560. }
  76561. pushQueue$1({
  76562. type: "mediaSource",
  76563. sourceUpdater: this,
  76564. action: actions$1.removeSourceBuffer(type2),
  76565. name: "removeSourceBuffer"
  76566. });
  76567. }
  76568. canRemoveSourceBuffer() {
  76569. 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";
  76570. }
  76571. static canChangeType() {
  76572. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  76573. }
  76574. canChangeType() {
  76575. return this.constructor.canChangeType();
  76576. }
  76577. changeType(type2, codec) {
  76578. if (!this.canChangeType()) {
  76579. videojs$2.log.error("changeType is not supported!");
  76580. return;
  76581. }
  76582. pushQueue$1({
  76583. type: type2,
  76584. sourceUpdater: this,
  76585. action: actions$1.changeType(codec),
  76586. name: "changeType"
  76587. });
  76588. }
  76589. addOrChangeSourceBuffers(codecs) {
  76590. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  76591. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  76592. }
  76593. Object.keys(codecs).forEach((type2) => {
  76594. const codec = codecs[type2];
  76595. if (!this.hasCreatedSourceBuffers()) {
  76596. return this.addSourceBuffer(type2, codec);
  76597. }
  76598. if (this.canChangeType()) {
  76599. this.changeType(type2, codec);
  76600. }
  76601. });
  76602. }
  76603. appendBuffer(options2, doneFn) {
  76604. const {
  76605. segmentInfo,
  76606. type: type2,
  76607. bytes
  76608. } = options2;
  76609. this.processedAppend_ = true;
  76610. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  76611. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  76612. this.logger_(`delayed audio append of ${bytes.length} until video append`);
  76613. return;
  76614. }
  76615. const onError2 = doneFn;
  76616. pushQueue$1({
  76617. type: type2,
  76618. sourceUpdater: this,
  76619. action: actions$1.appendBuffer(bytes, segmentInfo || {
  76620. mediaIndex: -1
  76621. }, onError2),
  76622. doneFn,
  76623. name: "appendBuffer"
  76624. });
  76625. if (type2 === "video") {
  76626. this.videoAppendQueued_ = true;
  76627. if (!this.delayedAudioAppendQueue_.length) {
  76628. return;
  76629. }
  76630. const queue = this.delayedAudioAppendQueue_.slice();
  76631. this.logger_(`queuing delayed audio ${queue.length} appendBuffers`);
  76632. this.delayedAudioAppendQueue_.length = 0;
  76633. queue.forEach((que) => {
  76634. this.appendBuffer.apply(this, que);
  76635. });
  76636. }
  76637. }
  76638. audioBuffered() {
  76639. if (!inSourceBuffers$1(this.mediaSource, this.audioBuffer)) {
  76640. return createTimeRanges$2();
  76641. }
  76642. return this.audioBuffer.buffered ? this.audioBuffer.buffered : createTimeRanges$2();
  76643. }
  76644. videoBuffered() {
  76645. if (!inSourceBuffers$1(this.mediaSource, this.videoBuffer)) {
  76646. return createTimeRanges$2();
  76647. }
  76648. return this.videoBuffer.buffered ? this.videoBuffer.buffered : createTimeRanges$2();
  76649. }
  76650. buffered() {
  76651. const video = inSourceBuffers$1(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  76652. const audio = inSourceBuffers$1(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  76653. if (audio && !video) {
  76654. return this.audioBuffered();
  76655. }
  76656. if (video && !audio) {
  76657. return this.videoBuffered();
  76658. }
  76659. return bufferIntersection$1(this.audioBuffered(), this.videoBuffered());
  76660. }
  76661. setDuration(duration5, doneFn = noop$1) {
  76662. pushQueue$1({
  76663. type: "mediaSource",
  76664. sourceUpdater: this,
  76665. action: actions$1.duration(duration5),
  76666. name: "duration",
  76667. doneFn
  76668. });
  76669. }
  76670. endOfStream(error = null, doneFn = noop$1) {
  76671. if (typeof error !== "string") {
  76672. error = void 0;
  76673. }
  76674. pushQueue$1({
  76675. type: "mediaSource",
  76676. sourceUpdater: this,
  76677. action: actions$1.endOfStream(error),
  76678. name: "endOfStream",
  76679. doneFn
  76680. });
  76681. }
  76682. removeAudio(start2, end, done = noop$1) {
  76683. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  76684. done();
  76685. return;
  76686. }
  76687. pushQueue$1({
  76688. type: "audio",
  76689. sourceUpdater: this,
  76690. action: actions$1.remove(start2, end),
  76691. doneFn: done,
  76692. name: "remove"
  76693. });
  76694. }
  76695. removeVideo(start2, end, done = noop$1) {
  76696. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  76697. done();
  76698. return;
  76699. }
  76700. pushQueue$1({
  76701. type: "video",
  76702. sourceUpdater: this,
  76703. action: actions$1.remove(start2, end),
  76704. doneFn: done,
  76705. name: "remove"
  76706. });
  76707. }
  76708. updating() {
  76709. if (updating("audio", this) || updating("video", this)) {
  76710. return true;
  76711. }
  76712. return false;
  76713. }
  76714. audioTimestampOffset(offset) {
  76715. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  76716. pushQueue$1({
  76717. type: "audio",
  76718. sourceUpdater: this,
  76719. action: actions$1.timestampOffset(offset),
  76720. name: "timestampOffset"
  76721. });
  76722. this.audioTimestampOffset_ = offset;
  76723. }
  76724. return this.audioTimestampOffset_;
  76725. }
  76726. videoTimestampOffset(offset) {
  76727. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  76728. pushQueue$1({
  76729. type: "video",
  76730. sourceUpdater: this,
  76731. action: actions$1.timestampOffset(offset),
  76732. name: "timestampOffset"
  76733. });
  76734. this.videoTimestampOffset_ = offset;
  76735. }
  76736. return this.videoTimestampOffset_;
  76737. }
  76738. audioQueueCallback(callback2) {
  76739. if (!this.audioBuffer) {
  76740. return;
  76741. }
  76742. pushQueue$1({
  76743. type: "audio",
  76744. sourceUpdater: this,
  76745. action: actions$1.callback(callback2),
  76746. name: "callback"
  76747. });
  76748. }
  76749. videoQueueCallback(callback2) {
  76750. if (!this.videoBuffer) {
  76751. return;
  76752. }
  76753. pushQueue$1({
  76754. type: "video",
  76755. sourceUpdater: this,
  76756. action: actions$1.callback(callback2),
  76757. name: "callback"
  76758. });
  76759. }
  76760. dispose() {
  76761. this.trigger("dispose");
  76762. bufferTypes$1.forEach((type2) => {
  76763. this.abort(type2);
  76764. if (this.canRemoveSourceBuffer()) {
  76765. this.removeSourceBuffer(type2);
  76766. } else {
  76767. this[`${type2}QueueCallback`](() => cleanupBuffer$1(type2, this));
  76768. }
  76769. });
  76770. this.videoAppendQueued_ = false;
  76771. this.delayedAudioAppendQueue_.length = 0;
  76772. if (this.sourceopenListener_) {
  76773. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  76774. }
  76775. this.off();
  76776. }
  76777. }
  76778. const uint8ToUtf8$1 = (uintArray) => decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  76779. const VTT_LINE_TERMINATORS$1 = new Uint8Array("\n\n".split("").map((char) => char.charCodeAt(0)));
  76780. class NoVttJsError$1 extends Error {
  76781. constructor() {
  76782. super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.");
  76783. }
  76784. }
  76785. class VTTSegmentLoader$1 extends SegmentLoader$1 {
  76786. constructor(settings, options2 = {}) {
  76787. super(settings, options2);
  76788. this.mediaSource_ = null;
  76789. this.subtitlesTrack_ = null;
  76790. this.loaderType_ = "subtitle";
  76791. this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  76792. this.loadVttJs = settings.loadVttJs;
  76793. this.shouldSaveSegmentTimingInfo_ = false;
  76794. }
  76795. createTransmuxer_() {
  76796. return null;
  76797. }
  76798. buffered_() {
  76799. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  76800. return createTimeRanges$2();
  76801. }
  76802. const cues = this.subtitlesTrack_.cues;
  76803. const start2 = cues[0].startTime;
  76804. const end = cues[cues.length - 1].startTime;
  76805. return createTimeRanges$2([[start2, end]]);
  76806. }
  76807. initSegmentForMap(map, set4 = false) {
  76808. if (!map) {
  76809. return null;
  76810. }
  76811. const id = initSegmentId$1(map);
  76812. let storedMap = this.initSegments_[id];
  76813. if (set4 && !storedMap && map.bytes) {
  76814. const combinedByteLength = VTT_LINE_TERMINATORS$1.byteLength + map.bytes.byteLength;
  76815. const combinedSegment = new Uint8Array(combinedByteLength);
  76816. combinedSegment.set(map.bytes);
  76817. combinedSegment.set(VTT_LINE_TERMINATORS$1, map.bytes.byteLength);
  76818. this.initSegments_[id] = storedMap = {
  76819. resolvedUri: map.resolvedUri,
  76820. byterange: map.byterange,
  76821. bytes: combinedSegment
  76822. };
  76823. }
  76824. return storedMap || map;
  76825. }
  76826. couldBeginLoading_() {
  76827. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  76828. }
  76829. init_() {
  76830. this.state = "READY";
  76831. this.resetEverything();
  76832. return this.monitorBuffer_();
  76833. }
  76834. track(track) {
  76835. if (typeof track === "undefined") {
  76836. return this.subtitlesTrack_;
  76837. }
  76838. this.subtitlesTrack_ = track;
  76839. if (this.state === "INIT" && this.couldBeginLoading_()) {
  76840. this.init_();
  76841. }
  76842. return this.subtitlesTrack_;
  76843. }
  76844. remove(start2, end) {
  76845. removeCuesFromTrack$1(start2, end, this.subtitlesTrack_);
  76846. }
  76847. fillBuffer_() {
  76848. const segmentInfo = this.chooseNextRequest_();
  76849. if (!segmentInfo) {
  76850. return;
  76851. }
  76852. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  76853. const checkTimestampOffset = () => {
  76854. this.state = "READY";
  76855. if (!this.paused()) {
  76856. this.monitorBuffer_();
  76857. }
  76858. };
  76859. this.syncController_.one("timestampoffset", checkTimestampOffset);
  76860. this.state = "WAITING_ON_TIMELINE";
  76861. return;
  76862. }
  76863. this.loadSegment_(segmentInfo);
  76864. }
  76865. timestampOffsetForSegment_() {
  76866. return null;
  76867. }
  76868. chooseNextRequest_() {
  76869. return this.skipEmptySegments_(super.chooseNextRequest_());
  76870. }
  76871. skipEmptySegments_(segmentInfo) {
  76872. while (segmentInfo && segmentInfo.segment.empty) {
  76873. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  76874. segmentInfo = null;
  76875. break;
  76876. }
  76877. segmentInfo = this.generateSegmentInfo_({
  76878. playlist: segmentInfo.playlist,
  76879. mediaIndex: segmentInfo.mediaIndex + 1,
  76880. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  76881. isSyncRequest: segmentInfo.isSyncRequest
  76882. });
  76883. }
  76884. return segmentInfo;
  76885. }
  76886. stopForError(error) {
  76887. this.error(error);
  76888. this.state = "READY";
  76889. this.pause();
  76890. this.trigger("error");
  76891. }
  76892. segmentRequestFinished_(error, simpleSegment, result) {
  76893. if (!this.subtitlesTrack_) {
  76894. this.state = "READY";
  76895. return;
  76896. }
  76897. this.saveTransferStats_(simpleSegment.stats);
  76898. if (!this.pendingSegment_) {
  76899. this.state = "READY";
  76900. this.mediaRequestsAborted += 1;
  76901. return;
  76902. }
  76903. if (error) {
  76904. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  76905. this.handleTimeout_();
  76906. }
  76907. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  76908. this.mediaRequestsAborted += 1;
  76909. } else {
  76910. this.mediaRequestsErrored += 1;
  76911. }
  76912. this.stopForError(error);
  76913. return;
  76914. }
  76915. const segmentInfo = this.pendingSegment_;
  76916. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  76917. if (simpleSegment.key) {
  76918. this.segmentKey(simpleSegment.key, true);
  76919. }
  76920. this.state = "APPENDING";
  76921. this.trigger("appending");
  76922. const segment = segmentInfo.segment;
  76923. if (segment.map) {
  76924. segment.map.bytes = simpleSegment.map.bytes;
  76925. }
  76926. segmentInfo.bytes = simpleSegment.bytes;
  76927. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  76928. this.state = "WAITING_ON_VTTJS";
  76929. this.loadVttJs().then(() => this.segmentRequestFinished_(error, simpleSegment, result), () => this.stopForError({
  76930. message: "Error loading vtt.js"
  76931. }));
  76932. return;
  76933. }
  76934. segment.requested = true;
  76935. try {
  76936. this.parseVTTCues_(segmentInfo);
  76937. } catch (e) {
  76938. this.stopForError({
  76939. message: e.message
  76940. });
  76941. return;
  76942. }
  76943. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  76944. if (segmentInfo.cues.length) {
  76945. segmentInfo.timingInfo = {
  76946. start: segmentInfo.cues[0].startTime,
  76947. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  76948. };
  76949. } else {
  76950. segmentInfo.timingInfo = {
  76951. start: segmentInfo.startOfSegment,
  76952. end: segmentInfo.startOfSegment + segmentInfo.duration
  76953. };
  76954. }
  76955. if (segmentInfo.isSyncRequest) {
  76956. this.trigger("syncinfoupdate");
  76957. this.pendingSegment_ = null;
  76958. this.state = "READY";
  76959. return;
  76960. }
  76961. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  76962. this.mediaSecondsLoaded += segment.duration;
  76963. segmentInfo.cues.forEach((cue) => {
  76964. this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  76965. });
  76966. removeDuplicateCuesFromTrack$1(this.subtitlesTrack_);
  76967. this.handleAppendsDone_();
  76968. }
  76969. handleData_() {
  76970. }
  76971. updateTimingInfoEnd_() {
  76972. }
  76973. parseVTTCues_(segmentInfo) {
  76974. let decoder;
  76975. let decodeBytesToString = false;
  76976. if (typeof window_1.WebVTT !== "function") {
  76977. throw new NoVttJsError$1();
  76978. }
  76979. if (typeof window_1.TextDecoder === "function") {
  76980. decoder = new window_1.TextDecoder("utf8");
  76981. } else {
  76982. decoder = window_1.WebVTT.StringDecoder();
  76983. decodeBytesToString = true;
  76984. }
  76985. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  76986. segmentInfo.cues = [];
  76987. segmentInfo.timestampmap = {
  76988. MPEGTS: 0,
  76989. LOCAL: 0
  76990. };
  76991. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  76992. parser2.ontimestampmap = (map) => {
  76993. segmentInfo.timestampmap = map;
  76994. };
  76995. parser2.onparsingerror = (error) => {
  76996. videojs$2.log.warn("Error encountered when parsing cues: " + error.message);
  76997. };
  76998. if (segmentInfo.segment.map) {
  76999. let mapData = segmentInfo.segment.map.bytes;
  77000. if (decodeBytesToString) {
  77001. mapData = uint8ToUtf8$1(mapData);
  77002. }
  77003. parser2.parse(mapData);
  77004. }
  77005. let segmentData = segmentInfo.bytes;
  77006. if (decodeBytesToString) {
  77007. segmentData = uint8ToUtf8$1(segmentData);
  77008. }
  77009. parser2.parse(segmentData);
  77010. parser2.flush();
  77011. }
  77012. updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  77013. const segment = segmentInfo.segment;
  77014. if (!mappingObj) {
  77015. return;
  77016. }
  77017. if (!segmentInfo.cues.length) {
  77018. segment.empty = true;
  77019. return;
  77020. }
  77021. const timestampmap = segmentInfo.timestampmap;
  77022. const diff = timestampmap.MPEGTS / clock$1.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  77023. segmentInfo.cues.forEach((cue) => {
  77024. cue.startTime += diff;
  77025. cue.endTime += diff;
  77026. });
  77027. if (!playlist.syncInfo) {
  77028. const firstStart = segmentInfo.cues[0].startTime;
  77029. const lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  77030. playlist.syncInfo = {
  77031. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  77032. time: Math.min(firstStart, lastStart - segment.duration)
  77033. };
  77034. }
  77035. }
  77036. }
  77037. const findAdCue$1 = function(track, mediaTime) {
  77038. const cues = track.cues;
  77039. for (let i2 = 0; i2 < cues.length; i2++) {
  77040. const cue = cues[i2];
  77041. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  77042. return cue;
  77043. }
  77044. }
  77045. return null;
  77046. };
  77047. const updateAdCues$1 = function(media, track, offset = 0) {
  77048. if (!media.segments) {
  77049. return;
  77050. }
  77051. let mediaTime = offset;
  77052. let cue;
  77053. for (let i2 = 0; i2 < media.segments.length; i2++) {
  77054. const segment = media.segments[i2];
  77055. if (!cue) {
  77056. cue = findAdCue$1(track, mediaTime + segment.duration / 2);
  77057. }
  77058. if (cue) {
  77059. if ("cueIn" in segment) {
  77060. cue.endTime = mediaTime;
  77061. cue.adEndTime = mediaTime;
  77062. mediaTime += segment.duration;
  77063. cue = null;
  77064. continue;
  77065. }
  77066. if (mediaTime < cue.endTime) {
  77067. mediaTime += segment.duration;
  77068. continue;
  77069. }
  77070. cue.endTime += segment.duration;
  77071. } else {
  77072. if ("cueOut" in segment) {
  77073. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  77074. cue.adStartTime = mediaTime;
  77075. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  77076. track.addCue(cue);
  77077. }
  77078. if ("cueOutCont" in segment) {
  77079. const [adOffset, adTotal] = segment.cueOutCont.split("/").map(parseFloat);
  77080. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  77081. cue.adStartTime = mediaTime - adOffset;
  77082. cue.adEndTime = cue.adStartTime + adTotal;
  77083. track.addCue(cue);
  77084. }
  77085. }
  77086. mediaTime += segment.duration;
  77087. }
  77088. };
  77089. const MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1 = 86400;
  77090. const syncPointStrategies$1 = [
  77091. {
  77092. name: "VOD",
  77093. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77094. if (duration5 !== Infinity) {
  77095. const syncPoint = {
  77096. time: 0,
  77097. segmentIndex: 0,
  77098. partIndex: null
  77099. };
  77100. return syncPoint;
  77101. }
  77102. return null;
  77103. }
  77104. },
  77105. {
  77106. name: "ProgramDateTime",
  77107. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77108. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  77109. return null;
  77110. }
  77111. let syncPoint = null;
  77112. let lastDistance = null;
  77113. const partsAndSegments = getPartsAndSegments$1(playlist);
  77114. currentTime = currentTime || 0;
  77115. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77116. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77117. const partAndSegment = partsAndSegments[index2];
  77118. const segment = partAndSegment.segment;
  77119. const datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  77120. if (!datetimeMapping || !segment.dateTimeObject) {
  77121. continue;
  77122. }
  77123. const segmentTime = segment.dateTimeObject.getTime() / 1e3;
  77124. let start2 = segmentTime + datetimeMapping;
  77125. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  77126. for (let z = 0; z < partAndSegment.partIndex; z++) {
  77127. start2 += segment.parts[z].duration;
  77128. }
  77129. }
  77130. const distance2 = Math.abs(currentTime - start2);
  77131. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  77132. break;
  77133. }
  77134. lastDistance = distance2;
  77135. syncPoint = {
  77136. time: start2,
  77137. segmentIndex: partAndSegment.segmentIndex,
  77138. partIndex: partAndSegment.partIndex
  77139. };
  77140. }
  77141. return syncPoint;
  77142. }
  77143. },
  77144. {
  77145. name: "Segment",
  77146. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77147. let syncPoint = null;
  77148. let lastDistance = null;
  77149. currentTime = currentTime || 0;
  77150. const partsAndSegments = getPartsAndSegments$1(playlist);
  77151. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77152. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77153. const partAndSegment = partsAndSegments[index2];
  77154. const segment = partAndSegment.segment;
  77155. const start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  77156. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  77157. const distance2 = Math.abs(currentTime - start2);
  77158. if (lastDistance !== null && lastDistance < distance2) {
  77159. break;
  77160. }
  77161. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77162. lastDistance = distance2;
  77163. syncPoint = {
  77164. time: start2,
  77165. segmentIndex: partAndSegment.segmentIndex,
  77166. partIndex: partAndSegment.partIndex
  77167. };
  77168. }
  77169. }
  77170. }
  77171. return syncPoint;
  77172. }
  77173. },
  77174. {
  77175. name: "Discontinuity",
  77176. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77177. let syncPoint = null;
  77178. currentTime = currentTime || 0;
  77179. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77180. let lastDistance = null;
  77181. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77182. const segmentIndex = playlist.discontinuityStarts[i2];
  77183. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77184. const discontinuitySync = syncController.discontinuities[discontinuity];
  77185. if (discontinuitySync) {
  77186. const distance2 = Math.abs(currentTime - discontinuitySync.time);
  77187. if (lastDistance !== null && lastDistance < distance2) {
  77188. break;
  77189. }
  77190. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77191. lastDistance = distance2;
  77192. syncPoint = {
  77193. time: discontinuitySync.time,
  77194. segmentIndex,
  77195. partIndex: null
  77196. };
  77197. }
  77198. }
  77199. }
  77200. }
  77201. return syncPoint;
  77202. }
  77203. },
  77204. {
  77205. name: "Playlist",
  77206. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77207. if (playlist.syncInfo) {
  77208. const syncPoint = {
  77209. time: playlist.syncInfo.time,
  77210. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  77211. partIndex: null
  77212. };
  77213. return syncPoint;
  77214. }
  77215. return null;
  77216. }
  77217. }
  77218. ];
  77219. class SyncController$1 extends videojs$2.EventTarget {
  77220. constructor(options2 = {}) {
  77221. super();
  77222. this.timelines = [];
  77223. this.discontinuities = [];
  77224. this.timelineToDatetimeMappings = {};
  77225. this.logger_ = logger$1("SyncController");
  77226. }
  77227. getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  77228. const syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  77229. if (!syncPoints.length) {
  77230. return null;
  77231. }
  77232. return this.selectSyncPoint_(syncPoints, {
  77233. key: "time",
  77234. value: currentTime
  77235. });
  77236. }
  77237. getExpiredTime(playlist, duration5) {
  77238. if (!playlist || !playlist.segments) {
  77239. return null;
  77240. }
  77241. const syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  77242. if (!syncPoints.length) {
  77243. return null;
  77244. }
  77245. const syncPoint = this.selectSyncPoint_(syncPoints, {
  77246. key: "segmentIndex",
  77247. value: 0
  77248. });
  77249. if (syncPoint.segmentIndex > 0) {
  77250. syncPoint.time *= -1;
  77251. }
  77252. return Math.abs(syncPoint.time + sumDurations$1({
  77253. defaultDuration: playlist.targetDuration,
  77254. durationList: playlist.segments,
  77255. startIndex: syncPoint.segmentIndex,
  77256. endIndex: 0
  77257. }));
  77258. }
  77259. runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  77260. const syncPoints = [];
  77261. for (let i2 = 0; i2 < syncPointStrategies$1.length; i2++) {
  77262. const strategy = syncPointStrategies$1[i2];
  77263. const syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  77264. if (syncPoint) {
  77265. syncPoint.strategy = strategy.name;
  77266. syncPoints.push({
  77267. strategy: strategy.name,
  77268. syncPoint
  77269. });
  77270. }
  77271. }
  77272. return syncPoints;
  77273. }
  77274. selectSyncPoint_(syncPoints, target) {
  77275. let bestSyncPoint = syncPoints[0].syncPoint;
  77276. let bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  77277. let bestStrategy = syncPoints[0].strategy;
  77278. for (let i2 = 1; i2 < syncPoints.length; i2++) {
  77279. const newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  77280. if (newDistance < bestDistance) {
  77281. bestDistance = newDistance;
  77282. bestSyncPoint = syncPoints[i2].syncPoint;
  77283. bestStrategy = syncPoints[i2].strategy;
  77284. }
  77285. }
  77286. 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}` : "") + "]");
  77287. return bestSyncPoint;
  77288. }
  77289. saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  77290. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  77291. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1) {
  77292. videojs$2.log.warn(`Not saving expired segment info. Media sequence gap ${mediaSequenceDiff} is too large.`);
  77293. return;
  77294. }
  77295. for (let i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  77296. const lastRemovedSegment = oldPlaylist.segments[i2];
  77297. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  77298. newPlaylist.syncInfo = {
  77299. mediaSequence: oldPlaylist.mediaSequence + i2,
  77300. time: lastRemovedSegment.start
  77301. };
  77302. this.logger_(`playlist refresh sync: [time:${newPlaylist.syncInfo.time}, mediaSequence: ${newPlaylist.syncInfo.mediaSequence}]`);
  77303. this.trigger("syncinfoupdate");
  77304. break;
  77305. }
  77306. }
  77307. }
  77308. setDateTimeMappingForStart(playlist) {
  77309. this.timelineToDatetimeMappings = {};
  77310. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  77311. const firstSegment = playlist.segments[0];
  77312. const playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  77313. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  77314. }
  77315. }
  77316. saveSegmentTimingInfo({
  77317. segmentInfo,
  77318. shouldSaveTimelineMapping
  77319. }) {
  77320. const didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  77321. const segment = segmentInfo.segment;
  77322. if (didCalculateSegmentTimeMapping) {
  77323. this.saveDiscontinuitySyncInfo_(segmentInfo);
  77324. if (!segmentInfo.playlist.syncInfo) {
  77325. segmentInfo.playlist.syncInfo = {
  77326. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  77327. time: segment.start
  77328. };
  77329. }
  77330. }
  77331. const dateTime = segment.dateTimeObject;
  77332. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  77333. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  77334. }
  77335. }
  77336. timestampOffsetForTimeline(timeline) {
  77337. if (typeof this.timelines[timeline] === "undefined") {
  77338. return null;
  77339. }
  77340. return this.timelines[timeline].time;
  77341. }
  77342. mappingForTimeline(timeline) {
  77343. if (typeof this.timelines[timeline] === "undefined") {
  77344. return null;
  77345. }
  77346. return this.timelines[timeline].mapping;
  77347. }
  77348. calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  77349. const segment = segmentInfo.segment;
  77350. const part = segmentInfo.part;
  77351. let mappingObj = this.timelines[segmentInfo.timeline];
  77352. let start2;
  77353. let end;
  77354. if (typeof segmentInfo.timestampOffset === "number") {
  77355. mappingObj = {
  77356. time: segmentInfo.startOfSegment,
  77357. mapping: segmentInfo.startOfSegment - timingInfo.start
  77358. };
  77359. if (shouldSaveTimelineMapping) {
  77360. this.timelines[segmentInfo.timeline] = mappingObj;
  77361. this.trigger("timestampoffset");
  77362. this.logger_(`time mapping for timeline ${segmentInfo.timeline}: [time: ${mappingObj.time}] [mapping: ${mappingObj.mapping}]`);
  77363. }
  77364. start2 = segmentInfo.startOfSegment;
  77365. end = timingInfo.end + mappingObj.mapping;
  77366. } else if (mappingObj) {
  77367. start2 = timingInfo.start + mappingObj.mapping;
  77368. end = timingInfo.end + mappingObj.mapping;
  77369. } else {
  77370. return false;
  77371. }
  77372. if (part) {
  77373. part.start = start2;
  77374. part.end = end;
  77375. }
  77376. if (!segment.start || start2 < segment.start) {
  77377. segment.start = start2;
  77378. }
  77379. segment.end = end;
  77380. return true;
  77381. }
  77382. saveDiscontinuitySyncInfo_(segmentInfo) {
  77383. const playlist = segmentInfo.playlist;
  77384. const segment = segmentInfo.segment;
  77385. if (segment.discontinuity) {
  77386. this.discontinuities[segment.timeline] = {
  77387. time: segment.start,
  77388. accuracy: 0
  77389. };
  77390. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77391. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77392. const segmentIndex = playlist.discontinuityStarts[i2];
  77393. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77394. const mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  77395. const accuracy = Math.abs(mediaIndexDiff);
  77396. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  77397. let time;
  77398. if (mediaIndexDiff < 0) {
  77399. time = segment.start - sumDurations$1({
  77400. defaultDuration: playlist.targetDuration,
  77401. durationList: playlist.segments,
  77402. startIndex: segmentInfo.mediaIndex,
  77403. endIndex: segmentIndex
  77404. });
  77405. } else {
  77406. time = segment.end + sumDurations$1({
  77407. defaultDuration: playlist.targetDuration,
  77408. durationList: playlist.segments,
  77409. startIndex: segmentInfo.mediaIndex + 1,
  77410. endIndex: segmentIndex
  77411. });
  77412. }
  77413. this.discontinuities[discontinuity] = {
  77414. time,
  77415. accuracy
  77416. };
  77417. }
  77418. }
  77419. }
  77420. }
  77421. dispose() {
  77422. this.trigger("dispose");
  77423. this.off();
  77424. }
  77425. }
  77426. class TimelineChangeController$1 extends videojs$2.EventTarget {
  77427. constructor() {
  77428. super();
  77429. this.pendingTimelineChanges_ = {};
  77430. this.lastTimelineChanges_ = {};
  77431. }
  77432. clearPendingTimelineChange(type2) {
  77433. this.pendingTimelineChanges_[type2] = null;
  77434. this.trigger("pendingtimelinechange");
  77435. }
  77436. pendingTimelineChange({
  77437. type: type2,
  77438. from: from3,
  77439. to
  77440. }) {
  77441. if (typeof from3 === "number" && typeof to === "number") {
  77442. this.pendingTimelineChanges_[type2] = {
  77443. type: type2,
  77444. from: from3,
  77445. to
  77446. };
  77447. this.trigger("pendingtimelinechange");
  77448. }
  77449. return this.pendingTimelineChanges_[type2];
  77450. }
  77451. lastTimelineChange({
  77452. type: type2,
  77453. from: from3,
  77454. to
  77455. }) {
  77456. if (typeof from3 === "number" && typeof to === "number") {
  77457. this.lastTimelineChanges_[type2] = {
  77458. type: type2,
  77459. from: from3,
  77460. to
  77461. };
  77462. delete this.pendingTimelineChanges_[type2];
  77463. this.trigger("timelinechange");
  77464. }
  77465. return this.lastTimelineChanges_[type2];
  77466. }
  77467. dispose() {
  77468. this.trigger("dispose");
  77469. this.pendingTimelineChanges_ = {};
  77470. this.lastTimelineChanges_ = {};
  77471. this.off();
  77472. }
  77473. }
  77474. const workerCode$2 = transform$1(getWorkerString$1(function() {
  77475. var Stream2 = /* @__PURE__ */ function() {
  77476. function Stream3() {
  77477. this.listeners = {};
  77478. }
  77479. var _proto = Stream3.prototype;
  77480. _proto.on = function on3(type2, listener) {
  77481. if (!this.listeners[type2]) {
  77482. this.listeners[type2] = [];
  77483. }
  77484. this.listeners[type2].push(listener);
  77485. };
  77486. _proto.off = function off2(type2, listener) {
  77487. if (!this.listeners[type2]) {
  77488. return false;
  77489. }
  77490. var index2 = this.listeners[type2].indexOf(listener);
  77491. this.listeners[type2] = this.listeners[type2].slice(0);
  77492. this.listeners[type2].splice(index2, 1);
  77493. return index2 > -1;
  77494. };
  77495. _proto.trigger = function trigger2(type2) {
  77496. var callbacks = this.listeners[type2];
  77497. if (!callbacks) {
  77498. return;
  77499. }
  77500. if (arguments.length === 2) {
  77501. var length = callbacks.length;
  77502. for (var i2 = 0; i2 < length; ++i2) {
  77503. callbacks[i2].call(this, arguments[1]);
  77504. }
  77505. } else {
  77506. var args = Array.prototype.slice.call(arguments, 1);
  77507. var _length = callbacks.length;
  77508. for (var _i = 0; _i < _length; ++_i) {
  77509. callbacks[_i].apply(this, args);
  77510. }
  77511. }
  77512. };
  77513. _proto.dispose = function dispose() {
  77514. this.listeners = {};
  77515. };
  77516. _proto.pipe = function pipe(destination2) {
  77517. this.on("data", function(data) {
  77518. destination2.push(data);
  77519. });
  77520. };
  77521. return Stream3;
  77522. }();
  77523. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  77524. function unpad(padded) {
  77525. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  77526. }
  77527. /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
  77528. const precompute = function() {
  77529. const tables = [[[], [], [], [], []], [[], [], [], [], []]];
  77530. const encTable = tables[0];
  77531. const decTable = tables[1];
  77532. const sbox = encTable[4];
  77533. const sboxInv = decTable[4];
  77534. let i2;
  77535. let x;
  77536. let xInv;
  77537. const d2 = [];
  77538. const th = [];
  77539. let x2;
  77540. let x4;
  77541. let x8;
  77542. let s;
  77543. let tEnc;
  77544. let tDec;
  77545. for (i2 = 0; i2 < 256; i2++) {
  77546. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  77547. }
  77548. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  77549. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  77550. s = s >> 8 ^ s & 255 ^ 99;
  77551. sbox[x] = s;
  77552. sboxInv[s] = x;
  77553. x8 = d2[x4 = d2[x2 = d2[x]]];
  77554. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  77555. tEnc = d2[s] * 257 ^ s * 16843008;
  77556. for (i2 = 0; i2 < 4; i2++) {
  77557. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  77558. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  77559. }
  77560. }
  77561. for (i2 = 0; i2 < 5; i2++) {
  77562. encTable[i2] = encTable[i2].slice(0);
  77563. decTable[i2] = decTable[i2].slice(0);
  77564. }
  77565. return tables;
  77566. };
  77567. let aesTables = null;
  77568. class AES {
  77569. constructor(key) {
  77570. if (!aesTables) {
  77571. aesTables = precompute();
  77572. }
  77573. 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()]];
  77574. let i2;
  77575. let j;
  77576. let tmp;
  77577. const sbox = this._tables[0][4];
  77578. const decTable = this._tables[1];
  77579. const keyLen = key.length;
  77580. let rcon = 1;
  77581. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  77582. throw new Error("Invalid aes key size");
  77583. }
  77584. const encKey = key.slice(0);
  77585. const decKey = [];
  77586. this._key = [encKey, decKey];
  77587. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  77588. tmp = encKey[i2 - 1];
  77589. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  77590. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  77591. if (i2 % keyLen === 0) {
  77592. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  77593. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  77594. }
  77595. }
  77596. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  77597. }
  77598. for (j = 0; i2; j++, i2--) {
  77599. tmp = encKey[j & 3 ? i2 : i2 - 4];
  77600. if (i2 <= 4 || j < 4) {
  77601. decKey[j] = tmp;
  77602. } else {
  77603. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  77604. }
  77605. }
  77606. }
  77607. decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  77608. const key = this._key[1];
  77609. let a = encrypted0 ^ key[0];
  77610. let b = encrypted3 ^ key[1];
  77611. let c = encrypted2 ^ key[2];
  77612. let d2 = encrypted1 ^ key[3];
  77613. let a2;
  77614. let b2;
  77615. let c2;
  77616. const nInnerRounds = key.length / 4 - 2;
  77617. let i2;
  77618. let kIndex = 4;
  77619. const table = this._tables[1];
  77620. const table0 = table[0];
  77621. const table1 = table[1];
  77622. const table2 = table[2];
  77623. const table3 = table[3];
  77624. const sbox = table[4];
  77625. for (i2 = 0; i2 < nInnerRounds; i2++) {
  77626. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  77627. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  77628. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  77629. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  77630. kIndex += 4;
  77631. a = a2;
  77632. b = b2;
  77633. c = c2;
  77634. }
  77635. for (i2 = 0; i2 < 4; i2++) {
  77636. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  77637. a2 = a;
  77638. a = b;
  77639. b = c;
  77640. c = d2;
  77641. d2 = a2;
  77642. }
  77643. }
  77644. }
  77645. class AsyncStream extends Stream2 {
  77646. constructor() {
  77647. super(Stream2);
  77648. this.jobs = [];
  77649. this.delay = 1;
  77650. this.timeout_ = null;
  77651. }
  77652. processJob_() {
  77653. this.jobs.shift()();
  77654. if (this.jobs.length) {
  77655. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77656. } else {
  77657. this.timeout_ = null;
  77658. }
  77659. }
  77660. push(job) {
  77661. this.jobs.push(job);
  77662. if (!this.timeout_) {
  77663. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77664. }
  77665. }
  77666. }
  77667. const ntoh = function(word) {
  77668. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  77669. };
  77670. const decrypt3 = function(encrypted, key, initVector) {
  77671. const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  77672. const decipher = new AES(Array.prototype.slice.call(key));
  77673. const decrypted = new Uint8Array(encrypted.byteLength);
  77674. const decrypted32 = new Int32Array(decrypted.buffer);
  77675. let init0;
  77676. let init1;
  77677. let init2;
  77678. let init3;
  77679. let encrypted0;
  77680. let encrypted1;
  77681. let encrypted2;
  77682. let encrypted3;
  77683. let wordIx;
  77684. init0 = initVector[0];
  77685. init1 = initVector[1];
  77686. init2 = initVector[2];
  77687. init3 = initVector[3];
  77688. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  77689. encrypted0 = ntoh(encrypted32[wordIx]);
  77690. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  77691. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  77692. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  77693. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  77694. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  77695. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  77696. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  77697. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  77698. init0 = encrypted0;
  77699. init1 = encrypted1;
  77700. init2 = encrypted2;
  77701. init3 = encrypted3;
  77702. }
  77703. return decrypted;
  77704. };
  77705. class Decrypter2 {
  77706. constructor(encrypted, key, initVector, done) {
  77707. const step = Decrypter2.STEP;
  77708. const encrypted32 = new Int32Array(encrypted.buffer);
  77709. const decrypted = new Uint8Array(encrypted.byteLength);
  77710. let i2 = 0;
  77711. this.asyncStream_ = new AsyncStream();
  77712. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77713. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  77714. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  77715. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77716. }
  77717. this.asyncStream_.push(function() {
  77718. done(null, unpad(decrypted));
  77719. });
  77720. }
  77721. static get STEP() {
  77722. return 32e3;
  77723. }
  77724. decryptChunk_(encrypted, key, initVector, decrypted) {
  77725. return function() {
  77726. const bytes = decrypt3(encrypted, key, initVector);
  77727. decrypted.set(bytes, encrypted.byteOffset);
  77728. };
  77729. }
  77730. }
  77731. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  77732. var win2;
  77733. if (typeof window !== "undefined") {
  77734. win2 = window;
  77735. } else if (typeof commonjsGlobal2 !== "undefined") {
  77736. win2 = commonjsGlobal2;
  77737. } else if (typeof self !== "undefined") {
  77738. win2 = self;
  77739. } else {
  77740. win2 = {};
  77741. }
  77742. var window_12 = win2;
  77743. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  77744. if (ArrayBuffer.isView === "function") {
  77745. return ArrayBuffer.isView(obj);
  77746. }
  77747. return obj && obj.buffer instanceof ArrayBuffer;
  77748. };
  77749. var BigInt2 = window_12.BigInt || Number;
  77750. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  77751. (function() {
  77752. var a = new Uint16Array([65484]);
  77753. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  77754. if (b[0] === 255) {
  77755. return "big";
  77756. }
  77757. if (b[0] === 204) {
  77758. return "little";
  77759. }
  77760. return "unknown";
  77761. })();
  77762. const createTransferableMessage3 = function(message) {
  77763. const transferable = {};
  77764. Object.keys(message).forEach((key) => {
  77765. const value = message[key];
  77766. if (isArrayBufferView4(value)) {
  77767. transferable[key] = {
  77768. bytes: value.buffer,
  77769. byteOffset: value.byteOffset,
  77770. byteLength: value.byteLength
  77771. };
  77772. } else {
  77773. transferable[key] = value;
  77774. }
  77775. });
  77776. return transferable;
  77777. };
  77778. self.onmessage = function(event2) {
  77779. const data = event2.data;
  77780. const encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  77781. const key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  77782. const iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  77783. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  77784. self.postMessage(createTransferableMessage3({
  77785. source: data.source,
  77786. decrypted: bytes
  77787. }), [bytes.buffer]);
  77788. });
  77789. };
  77790. }));
  77791. var Decrypter$1 = factory$1(workerCode$2);
  77792. const audioTrackKind_$1 = (properties) => {
  77793. let kind = properties.default ? "main" : "alternative";
  77794. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  77795. kind = "main-desc";
  77796. }
  77797. return kind;
  77798. };
  77799. const stopLoaders$1 = (segmentLoader, mediaType) => {
  77800. segmentLoader.abort();
  77801. segmentLoader.pause();
  77802. if (mediaType && mediaType.activePlaylistLoader) {
  77803. mediaType.activePlaylistLoader.pause();
  77804. mediaType.activePlaylistLoader = null;
  77805. }
  77806. };
  77807. const startLoaders$1 = (playlistLoader, mediaType) => {
  77808. mediaType.activePlaylistLoader = playlistLoader;
  77809. playlistLoader.load();
  77810. };
  77811. const onGroupChanged$1 = (type2, settings) => () => {
  77812. const {
  77813. segmentLoaders: {
  77814. [type2]: segmentLoader,
  77815. main: mainSegmentLoader
  77816. },
  77817. mediaTypes: {
  77818. [type2]: mediaType
  77819. }
  77820. } = settings;
  77821. const activeTrack2 = mediaType.activeTrack();
  77822. const activeGroup3 = mediaType.getActiveGroup();
  77823. const previousActiveLoader = mediaType.activePlaylistLoader;
  77824. const lastGroup = mediaType.lastGroup_;
  77825. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  77826. return;
  77827. }
  77828. mediaType.lastGroup_ = activeGroup3;
  77829. mediaType.lastTrack_ = activeTrack2;
  77830. stopLoaders$1(segmentLoader, mediaType);
  77831. if (!activeGroup3 || activeGroup3.isMainPlaylist) {
  77832. return;
  77833. }
  77834. if (!activeGroup3.playlistLoader) {
  77835. if (previousActiveLoader) {
  77836. mainSegmentLoader.resetEverything();
  77837. }
  77838. return;
  77839. }
  77840. segmentLoader.resyncLoader();
  77841. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77842. };
  77843. const onGroupChanging$1 = (type2, settings) => () => {
  77844. const {
  77845. segmentLoaders: {
  77846. [type2]: segmentLoader
  77847. },
  77848. mediaTypes: {
  77849. [type2]: mediaType
  77850. }
  77851. } = settings;
  77852. mediaType.lastGroup_ = null;
  77853. segmentLoader.abort();
  77854. segmentLoader.pause();
  77855. };
  77856. const onTrackChanged$1 = (type2, settings) => () => {
  77857. const {
  77858. mainPlaylistLoader,
  77859. segmentLoaders: {
  77860. [type2]: segmentLoader,
  77861. main: mainSegmentLoader
  77862. },
  77863. mediaTypes: {
  77864. [type2]: mediaType
  77865. }
  77866. } = settings;
  77867. const activeTrack2 = mediaType.activeTrack();
  77868. const activeGroup3 = mediaType.getActiveGroup();
  77869. const previousActiveLoader = mediaType.activePlaylistLoader;
  77870. const lastTrack = mediaType.lastTrack_;
  77871. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  77872. return;
  77873. }
  77874. mediaType.lastGroup_ = activeGroup3;
  77875. mediaType.lastTrack_ = activeTrack2;
  77876. stopLoaders$1(segmentLoader, mediaType);
  77877. if (!activeGroup3) {
  77878. return;
  77879. }
  77880. if (activeGroup3.isMainPlaylist) {
  77881. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  77882. return;
  77883. }
  77884. const pc = settings.vhs.playlistController_;
  77885. const newPlaylist = pc.selectPlaylist();
  77886. if (pc.media() === newPlaylist) {
  77887. return;
  77888. }
  77889. mediaType.logger_(`track change. Switching main audio from ${lastTrack.id} to ${activeTrack2.id}`);
  77890. mainPlaylistLoader.pause();
  77891. mainSegmentLoader.resetEverything();
  77892. pc.fastQualityChange_(newPlaylist);
  77893. return;
  77894. }
  77895. if (type2 === "AUDIO") {
  77896. if (!activeGroup3.playlistLoader) {
  77897. mainSegmentLoader.setAudio(true);
  77898. mainSegmentLoader.resetEverything();
  77899. return;
  77900. }
  77901. segmentLoader.setAudio(true);
  77902. mainSegmentLoader.setAudio(false);
  77903. }
  77904. if (previousActiveLoader === activeGroup3.playlistLoader) {
  77905. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77906. return;
  77907. }
  77908. if (segmentLoader.track) {
  77909. segmentLoader.track(activeTrack2);
  77910. }
  77911. segmentLoader.resetEverything();
  77912. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77913. };
  77914. const onError$1 = {
  77915. AUDIO: (type2, settings) => () => {
  77916. const {
  77917. segmentLoaders: {
  77918. [type2]: segmentLoader
  77919. },
  77920. mediaTypes: {
  77921. [type2]: mediaType
  77922. },
  77923. excludePlaylist
  77924. } = settings;
  77925. stopLoaders$1(segmentLoader, mediaType);
  77926. const activeTrack2 = mediaType.activeTrack();
  77927. const activeGroup3 = mediaType.activeGroup();
  77928. const id = (activeGroup3.filter((group) => group.default)[0] || activeGroup3[0]).id;
  77929. const defaultTrack = mediaType.tracks[id];
  77930. if (activeTrack2 === defaultTrack) {
  77931. excludePlaylist({
  77932. error: {
  77933. message: "Problem encountered loading the default audio track."
  77934. }
  77935. });
  77936. return;
  77937. }
  77938. videojs$2.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  77939. for (const trackId in mediaType.tracks) {
  77940. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  77941. }
  77942. mediaType.onTrackChanged();
  77943. },
  77944. SUBTITLES: (type2, settings) => () => {
  77945. const {
  77946. segmentLoaders: {
  77947. [type2]: segmentLoader
  77948. },
  77949. mediaTypes: {
  77950. [type2]: mediaType
  77951. }
  77952. } = settings;
  77953. videojs$2.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  77954. stopLoaders$1(segmentLoader, mediaType);
  77955. const track = mediaType.activeTrack();
  77956. if (track) {
  77957. track.mode = "disabled";
  77958. }
  77959. mediaType.onTrackChanged();
  77960. }
  77961. };
  77962. const setupListeners$1 = {
  77963. AUDIO: (type2, playlistLoader, settings) => {
  77964. if (!playlistLoader) {
  77965. return;
  77966. }
  77967. const {
  77968. tech,
  77969. requestOptions,
  77970. segmentLoaders: {
  77971. [type2]: segmentLoader
  77972. }
  77973. } = settings;
  77974. playlistLoader.on("loadedmetadata", () => {
  77975. const media = playlistLoader.media();
  77976. segmentLoader.playlist(media, requestOptions);
  77977. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  77978. segmentLoader.load();
  77979. }
  77980. });
  77981. playlistLoader.on("loadedplaylist", () => {
  77982. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  77983. if (!tech.paused()) {
  77984. segmentLoader.load();
  77985. }
  77986. });
  77987. playlistLoader.on("error", onError$1[type2](type2, settings));
  77988. },
  77989. SUBTITLES: (type2, playlistLoader, settings) => {
  77990. const {
  77991. tech,
  77992. requestOptions,
  77993. segmentLoaders: {
  77994. [type2]: segmentLoader
  77995. },
  77996. mediaTypes: {
  77997. [type2]: mediaType
  77998. }
  77999. } = settings;
  78000. playlistLoader.on("loadedmetadata", () => {
  78001. const media = playlistLoader.media();
  78002. segmentLoader.playlist(media, requestOptions);
  78003. segmentLoader.track(mediaType.activeTrack());
  78004. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  78005. segmentLoader.load();
  78006. }
  78007. });
  78008. playlistLoader.on("loadedplaylist", () => {
  78009. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  78010. if (!tech.paused()) {
  78011. segmentLoader.load();
  78012. }
  78013. });
  78014. playlistLoader.on("error", onError$1[type2](type2, settings));
  78015. }
  78016. };
  78017. const initialize$1 = {
  78018. "AUDIO": (type2, settings) => {
  78019. const {
  78020. vhs,
  78021. sourceType,
  78022. segmentLoaders: {
  78023. [type2]: segmentLoader
  78024. },
  78025. requestOptions,
  78026. main: {
  78027. mediaGroups
  78028. },
  78029. mediaTypes: {
  78030. [type2]: {
  78031. groups,
  78032. tracks,
  78033. logger_
  78034. }
  78035. },
  78036. mainPlaylistLoader
  78037. } = settings;
  78038. const audioOnlyMain = isAudioOnly$1(mainPlaylistLoader.main);
  78039. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  78040. mediaGroups[type2] = {
  78041. main: {
  78042. default: {
  78043. default: true
  78044. }
  78045. }
  78046. };
  78047. if (audioOnlyMain) {
  78048. mediaGroups[type2].main.default.playlists = mainPlaylistLoader.main.playlists;
  78049. }
  78050. }
  78051. for (const groupId in mediaGroups[type2]) {
  78052. if (!groups[groupId]) {
  78053. groups[groupId] = [];
  78054. }
  78055. for (const variantLabel in mediaGroups[type2][groupId]) {
  78056. let properties = mediaGroups[type2][groupId][variantLabel];
  78057. let playlistLoader;
  78058. if (audioOnlyMain) {
  78059. logger_(`AUDIO group '${groupId}' label '${variantLabel}' is a main playlist`);
  78060. properties.isMainPlaylist = true;
  78061. playlistLoader = null;
  78062. } else if (sourceType === "vhs-json" && properties.playlists) {
  78063. playlistLoader = new PlaylistLoader$1(properties.playlists[0], vhs, requestOptions);
  78064. } else if (properties.resolvedUri) {
  78065. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  78066. } else if (properties.playlists && sourceType === "dash") {
  78067. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  78068. } else {
  78069. playlistLoader = null;
  78070. }
  78071. properties = merge$2({
  78072. id: variantLabel,
  78073. playlistLoader
  78074. }, properties);
  78075. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  78076. groups[groupId].push(properties);
  78077. if (typeof tracks[variantLabel] === "undefined") {
  78078. const track = new videojs$2.AudioTrack({
  78079. id: variantLabel,
  78080. kind: audioTrackKind_$1(properties),
  78081. enabled: false,
  78082. language: properties.language,
  78083. default: properties.default,
  78084. label: variantLabel
  78085. });
  78086. tracks[variantLabel] = track;
  78087. }
  78088. }
  78089. }
  78090. segmentLoader.on("error", onError$1[type2](type2, settings));
  78091. },
  78092. "SUBTITLES": (type2, settings) => {
  78093. const {
  78094. tech,
  78095. vhs,
  78096. sourceType,
  78097. segmentLoaders: {
  78098. [type2]: segmentLoader
  78099. },
  78100. requestOptions,
  78101. main: {
  78102. mediaGroups
  78103. },
  78104. mediaTypes: {
  78105. [type2]: {
  78106. groups,
  78107. tracks
  78108. }
  78109. },
  78110. mainPlaylistLoader
  78111. } = settings;
  78112. for (const groupId in mediaGroups[type2]) {
  78113. if (!groups[groupId]) {
  78114. groups[groupId] = [];
  78115. }
  78116. for (const variantLabel in mediaGroups[type2][groupId]) {
  78117. if (mediaGroups[type2][groupId][variantLabel].forced) {
  78118. continue;
  78119. }
  78120. let properties = mediaGroups[type2][groupId][variantLabel];
  78121. let playlistLoader;
  78122. if (sourceType === "hls") {
  78123. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  78124. } else if (sourceType === "dash") {
  78125. const playlists = properties.playlists.filter((p) => p.excludeUntil !== Infinity);
  78126. if (!playlists.length) {
  78127. return;
  78128. }
  78129. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  78130. } else if (sourceType === "vhs-json") {
  78131. playlistLoader = new PlaylistLoader$1(
  78132. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  78133. vhs,
  78134. requestOptions
  78135. );
  78136. }
  78137. properties = merge$2({
  78138. id: variantLabel,
  78139. playlistLoader
  78140. }, properties);
  78141. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  78142. groups[groupId].push(properties);
  78143. if (typeof tracks[variantLabel] === "undefined") {
  78144. const track = tech.addRemoteTextTrack({
  78145. id: variantLabel,
  78146. kind: "subtitles",
  78147. default: properties.default && properties.autoselect,
  78148. language: properties.language,
  78149. label: variantLabel
  78150. }, false).track;
  78151. tracks[variantLabel] = track;
  78152. }
  78153. }
  78154. }
  78155. segmentLoader.on("error", onError$1[type2](type2, settings));
  78156. },
  78157. "CLOSED-CAPTIONS": (type2, settings) => {
  78158. const {
  78159. tech,
  78160. main: {
  78161. mediaGroups
  78162. },
  78163. mediaTypes: {
  78164. [type2]: {
  78165. groups,
  78166. tracks
  78167. }
  78168. }
  78169. } = settings;
  78170. for (const groupId in mediaGroups[type2]) {
  78171. if (!groups[groupId]) {
  78172. groups[groupId] = [];
  78173. }
  78174. for (const variantLabel in mediaGroups[type2][groupId]) {
  78175. const properties = mediaGroups[type2][groupId][variantLabel];
  78176. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  78177. continue;
  78178. }
  78179. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  78180. let newProps = {
  78181. label: variantLabel,
  78182. language: properties.language,
  78183. instreamId: properties.instreamId,
  78184. default: properties.default && properties.autoselect
  78185. };
  78186. if (captionServices[newProps.instreamId]) {
  78187. newProps = merge$2(newProps, captionServices[newProps.instreamId]);
  78188. }
  78189. if (newProps.default === void 0) {
  78190. delete newProps.default;
  78191. }
  78192. groups[groupId].push(merge$2({
  78193. id: variantLabel
  78194. }, properties));
  78195. if (typeof tracks[variantLabel] === "undefined") {
  78196. const track = tech.addRemoteTextTrack({
  78197. id: newProps.instreamId,
  78198. kind: "captions",
  78199. default: newProps.default,
  78200. language: newProps.language,
  78201. label: newProps.label
  78202. }, false).track;
  78203. tracks[variantLabel] = track;
  78204. }
  78205. }
  78206. }
  78207. }
  78208. };
  78209. const groupMatch$1 = (list, media) => {
  78210. for (let i2 = 0; i2 < list.length; i2++) {
  78211. if (playlistMatch$1(media, list[i2])) {
  78212. return true;
  78213. }
  78214. if (list[i2].playlists && groupMatch$1(list[i2].playlists, media)) {
  78215. return true;
  78216. }
  78217. }
  78218. return false;
  78219. };
  78220. const activeGroup$1 = (type2, settings) => (track) => {
  78221. const {
  78222. mainPlaylistLoader,
  78223. mediaTypes: {
  78224. [type2]: {
  78225. groups
  78226. }
  78227. }
  78228. } = settings;
  78229. const media = mainPlaylistLoader.media();
  78230. if (!media) {
  78231. return null;
  78232. }
  78233. let variants = null;
  78234. if (media.attributes[type2]) {
  78235. variants = groups[media.attributes[type2]];
  78236. }
  78237. const groupKeys = Object.keys(groups);
  78238. if (!variants) {
  78239. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly$1(settings.main)) {
  78240. for (let i2 = 0; i2 < groupKeys.length; i2++) {
  78241. const groupPropertyList = groups[groupKeys[i2]];
  78242. if (groupMatch$1(groupPropertyList, media)) {
  78243. variants = groupPropertyList;
  78244. break;
  78245. }
  78246. }
  78247. } else if (groups.main) {
  78248. variants = groups.main;
  78249. } else if (groupKeys.length === 1) {
  78250. variants = groups[groupKeys[0]];
  78251. }
  78252. }
  78253. if (typeof track === "undefined") {
  78254. return variants;
  78255. }
  78256. if (track === null || !variants) {
  78257. return null;
  78258. }
  78259. return variants.filter((props) => props.id === track.id)[0] || null;
  78260. };
  78261. const activeTrack$1 = {
  78262. AUDIO: (type2, settings) => () => {
  78263. const {
  78264. mediaTypes: {
  78265. [type2]: {
  78266. tracks
  78267. }
  78268. }
  78269. } = settings;
  78270. for (const id in tracks) {
  78271. if (tracks[id].enabled) {
  78272. return tracks[id];
  78273. }
  78274. }
  78275. return null;
  78276. },
  78277. SUBTITLES: (type2, settings) => () => {
  78278. const {
  78279. mediaTypes: {
  78280. [type2]: {
  78281. tracks
  78282. }
  78283. }
  78284. } = settings;
  78285. for (const id in tracks) {
  78286. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  78287. return tracks[id];
  78288. }
  78289. }
  78290. return null;
  78291. }
  78292. };
  78293. const getActiveGroup$1 = (type2, {
  78294. mediaTypes: mediaTypes2
  78295. }) => () => {
  78296. const activeTrack_ = mediaTypes2[type2].activeTrack();
  78297. if (!activeTrack_) {
  78298. return null;
  78299. }
  78300. return mediaTypes2[type2].activeGroup(activeTrack_);
  78301. };
  78302. const setupMediaGroups$1 = (settings) => {
  78303. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78304. initialize$1[type2](type2, settings);
  78305. });
  78306. const {
  78307. mediaTypes: mediaTypes2,
  78308. mainPlaylistLoader,
  78309. tech,
  78310. vhs,
  78311. segmentLoaders: {
  78312. ["AUDIO"]: audioSegmentLoader,
  78313. main: mainSegmentLoader
  78314. }
  78315. } = settings;
  78316. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  78317. mediaTypes2[type2].activeGroup = activeGroup$1(type2, settings);
  78318. mediaTypes2[type2].activeTrack = activeTrack$1[type2](type2, settings);
  78319. mediaTypes2[type2].onGroupChanged = onGroupChanged$1(type2, settings);
  78320. mediaTypes2[type2].onGroupChanging = onGroupChanging$1(type2, settings);
  78321. mediaTypes2[type2].onTrackChanged = onTrackChanged$1(type2, settings);
  78322. mediaTypes2[type2].getActiveGroup = getActiveGroup$1(type2, settings);
  78323. });
  78324. const audioGroup = mediaTypes2.AUDIO.activeGroup();
  78325. if (audioGroup) {
  78326. const groupId = (audioGroup.filter((group) => group.default)[0] || audioGroup[0]).id;
  78327. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  78328. mediaTypes2.AUDIO.onGroupChanged();
  78329. mediaTypes2.AUDIO.onTrackChanged();
  78330. const activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  78331. if (!activeAudioGroup.playlistLoader) {
  78332. mainSegmentLoader.setAudio(true);
  78333. } else {
  78334. mainSegmentLoader.setAudio(false);
  78335. audioSegmentLoader.setAudio(true);
  78336. }
  78337. }
  78338. mainPlaylistLoader.on("mediachange", () => {
  78339. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanged());
  78340. });
  78341. mainPlaylistLoader.on("mediachanging", () => {
  78342. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanging());
  78343. });
  78344. const onAudioTrackChanged = () => {
  78345. mediaTypes2.AUDIO.onTrackChanged();
  78346. tech.trigger({
  78347. type: "usage",
  78348. name: "vhs-audio-change"
  78349. });
  78350. };
  78351. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  78352. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78353. vhs.on("dispose", () => {
  78354. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  78355. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78356. });
  78357. tech.clearTracks("audio");
  78358. for (const id in mediaTypes2.AUDIO.tracks) {
  78359. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  78360. }
  78361. };
  78362. const createMediaTypes$1 = () => {
  78363. const mediaTypes2 = {};
  78364. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78365. mediaTypes2[type2] = {
  78366. groups: {},
  78367. tracks: {},
  78368. activePlaylistLoader: null,
  78369. activeGroup: noop$1,
  78370. activeTrack: noop$1,
  78371. getActiveGroup: noop$1,
  78372. onGroupChanged: noop$1,
  78373. onTrackChanged: noop$1,
  78374. lastTrack_: null,
  78375. logger_: logger$1(`MediaGroups[${type2}]`)
  78376. };
  78377. });
  78378. return mediaTypes2;
  78379. };
  78380. const ABORT_EARLY_EXCLUSION_SECONDS = 60 * 2;
  78381. let Vhs$1$1;
  78382. const loaderStats$1 = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  78383. const sumLoaderStat$1 = function(stat) {
  78384. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  78385. };
  78386. const shouldSwitchToMedia$1 = function({
  78387. currentPlaylist,
  78388. buffered,
  78389. currentTime,
  78390. nextPlaylist,
  78391. bufferLowWaterLine,
  78392. bufferHighWaterLine,
  78393. duration: duration5,
  78394. bufferBasedABR,
  78395. log: log2
  78396. }) {
  78397. if (!nextPlaylist) {
  78398. videojs$2.log.warn("We received no playlist to switch to. Please check your stream.");
  78399. return false;
  78400. }
  78401. const sharedLogLine = `allowing switch ${currentPlaylist && currentPlaylist.id || "null"} -> ${nextPlaylist.id}`;
  78402. if (!currentPlaylist) {
  78403. log2(`${sharedLogLine} as current playlist is not set`);
  78404. return true;
  78405. }
  78406. if (nextPlaylist.id === currentPlaylist.id) {
  78407. return false;
  78408. }
  78409. const isBuffered = Boolean(findRange$1(buffered, currentTime).length);
  78410. if (!currentPlaylist.endList) {
  78411. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  78412. log2(`not ${sharedLogLine} as current playlist is live llhls, but currentTime isn't in buffered.`);
  78413. return false;
  78414. }
  78415. log2(`${sharedLogLine} as current playlist is live`);
  78416. return true;
  78417. }
  78418. const forwardBuffer = timeAheadOf$1(buffered, currentTime);
  78419. const maxBufferLowWaterLine = bufferBasedABR ? Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config$1.MAX_BUFFER_LOW_WATER_LINE;
  78420. if (duration5 < maxBufferLowWaterLine) {
  78421. log2(`${sharedLogLine} as duration < max low water line (${duration5} < ${maxBufferLowWaterLine})`);
  78422. return true;
  78423. }
  78424. const nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  78425. const currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  78426. if (nextBandwidth < currBandwidth && (!bufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  78427. let logLine = `${sharedLogLine} as next bandwidth < current bandwidth (${nextBandwidth} < ${currBandwidth})`;
  78428. if (bufferBasedABR) {
  78429. logLine += ` and forwardBuffer < bufferHighWaterLine (${forwardBuffer} < ${bufferHighWaterLine})`;
  78430. }
  78431. log2(logLine);
  78432. return true;
  78433. }
  78434. if ((!bufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  78435. let logLine = `${sharedLogLine} as forwardBuffer >= bufferLowWaterLine (${forwardBuffer} >= ${bufferLowWaterLine})`;
  78436. if (bufferBasedABR) {
  78437. logLine += ` and next bandwidth > current bandwidth (${nextBandwidth} > ${currBandwidth})`;
  78438. }
  78439. log2(logLine);
  78440. return true;
  78441. }
  78442. log2(`not ${sharedLogLine} as no switching criteria met`);
  78443. return false;
  78444. };
  78445. class PlaylistController extends videojs$2.EventTarget {
  78446. constructor(options2) {
  78447. super();
  78448. const {
  78449. src,
  78450. withCredentials,
  78451. tech,
  78452. bandwidth: bandwidth2,
  78453. externVhs,
  78454. useCueTags,
  78455. playlistExclusionDuration,
  78456. enableLowInitialPlaylist,
  78457. sourceType,
  78458. cacheEncryptionKeys,
  78459. bufferBasedABR,
  78460. leastPixelDiffSelector,
  78461. captionServices
  78462. } = options2;
  78463. if (!src) {
  78464. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  78465. }
  78466. let {
  78467. maxPlaylistRetries
  78468. } = options2;
  78469. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  78470. maxPlaylistRetries = Infinity;
  78471. }
  78472. Vhs$1$1 = externVhs;
  78473. this.bufferBasedABR = Boolean(bufferBasedABR);
  78474. this.leastPixelDiffSelector = Boolean(leastPixelDiffSelector);
  78475. this.withCredentials = withCredentials;
  78476. this.tech_ = tech;
  78477. this.vhs_ = tech.vhs;
  78478. this.sourceType_ = sourceType;
  78479. this.useCueTags_ = useCueTags;
  78480. this.playlistExclusionDuration = playlistExclusionDuration;
  78481. this.maxPlaylistRetries = maxPlaylistRetries;
  78482. this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  78483. if (this.useCueTags_) {
  78484. this.cueTagsTrack_ = this.tech_.addTextTrack("metadata", "ad-cues");
  78485. this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  78486. }
  78487. this.requestOptions_ = {
  78488. withCredentials,
  78489. maxPlaylistRetries,
  78490. timeout: null
  78491. };
  78492. this.on("error", this.pauseLoading);
  78493. this.mediaTypes_ = createMediaTypes$1();
  78494. this.mediaSource = new window_1.MediaSource();
  78495. this.handleDurationChange_ = this.handleDurationChange_.bind(this);
  78496. this.handleSourceOpen_ = this.handleSourceOpen_.bind(this);
  78497. this.handleSourceEnded_ = this.handleSourceEnded_.bind(this);
  78498. this.mediaSource.addEventListener("durationchange", this.handleDurationChange_);
  78499. this.mediaSource.addEventListener("sourceopen", this.handleSourceOpen_);
  78500. this.mediaSource.addEventListener("sourceended", this.handleSourceEnded_);
  78501. this.seekable_ = createTimeRanges$2();
  78502. this.hasPlayed_ = false;
  78503. this.syncController_ = new SyncController$1(options2);
  78504. this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  78505. kind: "metadata",
  78506. label: "segment-metadata"
  78507. }, false).track;
  78508. this.decrypter_ = new Decrypter$1();
  78509. this.sourceUpdater_ = new SourceUpdater$1(this.mediaSource);
  78510. this.inbandTextTracks_ = {};
  78511. this.timelineChangeController_ = new TimelineChangeController$1();
  78512. const segmentLoaderSettings = {
  78513. vhs: this.vhs_,
  78514. parse708captions: options2.parse708captions,
  78515. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  78516. captionServices,
  78517. mediaSource: this.mediaSource,
  78518. currentTime: this.tech_.currentTime.bind(this.tech_),
  78519. seekable: () => this.seekable(),
  78520. seeking: () => this.tech_.seeking(),
  78521. duration: () => this.duration(),
  78522. hasPlayed: () => this.hasPlayed_,
  78523. goalBufferLength: () => this.goalBufferLength(),
  78524. bandwidth: bandwidth2,
  78525. syncController: this.syncController_,
  78526. decrypter: this.decrypter_,
  78527. sourceType: this.sourceType_,
  78528. inbandTextTracks: this.inbandTextTracks_,
  78529. cacheEncryptionKeys,
  78530. sourceUpdater: this.sourceUpdater_,
  78531. timelineChangeController: this.timelineChangeController_,
  78532. exactManifestTimings: options2.exactManifestTimings
  78533. };
  78534. this.mainPlaylistLoader_ = this.sourceType_ === "dash" ? new DashPlaylistLoader$1(src, this.vhs_, this.requestOptions_) : new PlaylistLoader$1(src, this.vhs_, this.requestOptions_);
  78535. this.setupMainPlaylistLoaderListeners_();
  78536. this.mainSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78537. segmentMetadataTrack: this.segmentMetadataTrack_,
  78538. loaderType: "main"
  78539. }), options2);
  78540. this.audioSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78541. loaderType: "audio"
  78542. }), options2);
  78543. this.subtitleSegmentLoader_ = new VTTSegmentLoader$1(merge$2(segmentLoaderSettings, {
  78544. loaderType: "vtt",
  78545. featuresNativeTextTracks: this.tech_.featuresNativeTextTracks,
  78546. loadVttJs: () => new Promise((resolve2, reject2) => {
  78547. function onLoad() {
  78548. tech.off("vttjserror", onError2);
  78549. resolve2();
  78550. }
  78551. function onError2() {
  78552. tech.off("vttjsloaded", onLoad);
  78553. reject2();
  78554. }
  78555. tech.one("vttjsloaded", onLoad);
  78556. tech.one("vttjserror", onError2);
  78557. tech.addWebVttScript_();
  78558. })
  78559. }), options2);
  78560. this.setupSegmentLoaderListeners_();
  78561. if (this.bufferBasedABR) {
  78562. this.mainPlaylistLoader_.one("loadedplaylist", () => this.startABRTimer_());
  78563. this.tech_.on("pause", () => this.stopABRTimer_());
  78564. this.tech_.on("play", () => this.startABRTimer_());
  78565. }
  78566. loaderStats$1.forEach((stat) => {
  78567. this[stat + "_"] = sumLoaderStat$1.bind(this, stat);
  78568. });
  78569. this.logger_ = logger$1("pc");
  78570. this.triggeredFmp4Usage = false;
  78571. if (this.tech_.preload() === "none") {
  78572. this.loadOnPlay_ = () => {
  78573. this.loadOnPlay_ = null;
  78574. this.mainPlaylistLoader_.load();
  78575. };
  78576. this.tech_.one("play", this.loadOnPlay_);
  78577. } else {
  78578. this.mainPlaylistLoader_.load();
  78579. }
  78580. this.timeToLoadedData__ = -1;
  78581. this.mainAppendsToLoadedData__ = -1;
  78582. this.audioAppendsToLoadedData__ = -1;
  78583. const event2 = this.tech_.preload() === "none" ? "play" : "loadstart";
  78584. this.tech_.one(event2, () => {
  78585. const timeToLoadedDataStart = Date.now();
  78586. this.tech_.one("loadeddata", () => {
  78587. this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  78588. this.mainAppendsToLoadedData__ = this.mainSegmentLoader_.mediaAppends;
  78589. this.audioAppendsToLoadedData__ = this.audioSegmentLoader_.mediaAppends;
  78590. });
  78591. });
  78592. }
  78593. mainAppendsToLoadedData_() {
  78594. return this.mainAppendsToLoadedData__;
  78595. }
  78596. audioAppendsToLoadedData_() {
  78597. return this.audioAppendsToLoadedData__;
  78598. }
  78599. appendsToLoadedData_() {
  78600. const main = this.mainAppendsToLoadedData_();
  78601. const audio = this.audioAppendsToLoadedData_();
  78602. if (main === -1 || audio === -1) {
  78603. return -1;
  78604. }
  78605. return main + audio;
  78606. }
  78607. timeToLoadedData_() {
  78608. return this.timeToLoadedData__;
  78609. }
  78610. checkABR_(reason = "abr") {
  78611. const nextPlaylist = this.selectPlaylist();
  78612. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  78613. this.switchMedia_(nextPlaylist, reason);
  78614. }
  78615. }
  78616. switchMedia_(playlist, cause, delay) {
  78617. const oldMedia = this.media();
  78618. const oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  78619. const newId = playlist.id || playlist.uri;
  78620. if (oldId && oldId !== newId) {
  78621. this.logger_(`switch media ${oldId} -> ${newId} from ${cause}`);
  78622. this.tech_.trigger({
  78623. type: "usage",
  78624. name: `vhs-rendition-change-${cause}`
  78625. });
  78626. }
  78627. this.mainPlaylistLoader_.media(playlist, delay);
  78628. }
  78629. startABRTimer_() {
  78630. this.stopABRTimer_();
  78631. this.abrTimer_ = window_1.setInterval(() => this.checkABR_(), 250);
  78632. }
  78633. stopABRTimer_() {
  78634. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  78635. return;
  78636. }
  78637. window_1.clearInterval(this.abrTimer_);
  78638. this.abrTimer_ = null;
  78639. }
  78640. getAudioTrackPlaylists_() {
  78641. const main = this.main();
  78642. const defaultPlaylists = main && main.playlists || [];
  78643. if (!main || !main.mediaGroups || !main.mediaGroups.AUDIO) {
  78644. return defaultPlaylists;
  78645. }
  78646. const AUDIO5 = main.mediaGroups.AUDIO;
  78647. const groupKeys = Object.keys(AUDIO5);
  78648. let track;
  78649. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  78650. track = this.mediaTypes_.AUDIO.activeTrack();
  78651. } else {
  78652. const defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  78653. for (const label2 in defaultGroup) {
  78654. if (defaultGroup[label2].default) {
  78655. track = {
  78656. label: label2
  78657. };
  78658. break;
  78659. }
  78660. }
  78661. }
  78662. if (!track) {
  78663. return defaultPlaylists;
  78664. }
  78665. const playlists = [];
  78666. for (const group in AUDIO5) {
  78667. if (AUDIO5[group][track.label]) {
  78668. const properties = AUDIO5[group][track.label];
  78669. if (properties.playlists && properties.playlists.length) {
  78670. playlists.push.apply(playlists, properties.playlists);
  78671. } else if (properties.uri) {
  78672. playlists.push(properties);
  78673. } else if (main.playlists.length) {
  78674. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  78675. const playlist = main.playlists[i2];
  78676. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  78677. playlists.push(playlist);
  78678. }
  78679. }
  78680. }
  78681. }
  78682. }
  78683. if (!playlists.length) {
  78684. return defaultPlaylists;
  78685. }
  78686. return playlists;
  78687. }
  78688. setupMainPlaylistLoaderListeners_() {
  78689. this.mainPlaylistLoader_.on("loadedmetadata", () => {
  78690. const media = this.mainPlaylistLoader_.media();
  78691. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78692. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78693. this.requestOptions_.timeout = 0;
  78694. } else {
  78695. this.requestOptions_.timeout = requestTimeout;
  78696. }
  78697. if (media.endList && this.tech_.preload() !== "none") {
  78698. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78699. this.mainSegmentLoader_.load();
  78700. }
  78701. setupMediaGroups$1({
  78702. sourceType: this.sourceType_,
  78703. segmentLoaders: {
  78704. AUDIO: this.audioSegmentLoader_,
  78705. SUBTITLES: this.subtitleSegmentLoader_,
  78706. main: this.mainSegmentLoader_
  78707. },
  78708. tech: this.tech_,
  78709. requestOptions: this.requestOptions_,
  78710. mainPlaylistLoader: this.mainPlaylistLoader_,
  78711. vhs: this.vhs_,
  78712. main: this.main(),
  78713. mediaTypes: this.mediaTypes_,
  78714. excludePlaylist: this.excludePlaylist.bind(this)
  78715. });
  78716. this.triggerPresenceUsage_(this.main(), media);
  78717. this.setupFirstPlay();
  78718. if (!this.mediaTypes_.AUDIO.activePlaylistLoader || this.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  78719. this.trigger("selectedinitialmedia");
  78720. } else {
  78721. this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", () => {
  78722. this.trigger("selectedinitialmedia");
  78723. });
  78724. }
  78725. });
  78726. this.mainPlaylistLoader_.on("loadedplaylist", () => {
  78727. if (this.loadOnPlay_) {
  78728. this.tech_.off("play", this.loadOnPlay_);
  78729. }
  78730. let updatedPlaylist = this.mainPlaylistLoader_.media();
  78731. if (!updatedPlaylist) {
  78732. this.excludeUnsupportedVariants_();
  78733. let selectedMedia;
  78734. if (this.enableLowInitialPlaylist) {
  78735. selectedMedia = this.selectInitialPlaylist();
  78736. }
  78737. if (!selectedMedia) {
  78738. selectedMedia = this.selectPlaylist();
  78739. }
  78740. if (!selectedMedia || !this.shouldSwitchToMedia_(selectedMedia)) {
  78741. return;
  78742. }
  78743. this.initialMedia_ = selectedMedia;
  78744. this.switchMedia_(this.initialMedia_, "initial");
  78745. const haveJsonSource = this.sourceType_ === "vhs-json" && this.initialMedia_.segments;
  78746. if (!haveJsonSource) {
  78747. return;
  78748. }
  78749. updatedPlaylist = this.initialMedia_;
  78750. }
  78751. this.handleUpdatedMediaPlaylist(updatedPlaylist);
  78752. });
  78753. this.mainPlaylistLoader_.on("error", () => {
  78754. const error = this.mainPlaylistLoader_.error;
  78755. this.excludePlaylist({
  78756. playlistToExclude: error.playlist,
  78757. error
  78758. });
  78759. });
  78760. this.mainPlaylistLoader_.on("mediachanging", () => {
  78761. this.mainSegmentLoader_.abort();
  78762. this.mainSegmentLoader_.pause();
  78763. });
  78764. this.mainPlaylistLoader_.on("mediachange", () => {
  78765. const media = this.mainPlaylistLoader_.media();
  78766. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78767. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78768. this.requestOptions_.timeout = 0;
  78769. } else {
  78770. this.requestOptions_.timeout = requestTimeout;
  78771. }
  78772. this.mainPlaylistLoader_.load();
  78773. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78774. this.mainSegmentLoader_.load();
  78775. this.tech_.trigger({
  78776. type: "mediachange",
  78777. bubbles: true
  78778. });
  78779. });
  78780. this.mainPlaylistLoader_.on("playlistunchanged", () => {
  78781. const updatedPlaylist = this.mainPlaylistLoader_.media();
  78782. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  78783. return;
  78784. }
  78785. const playlistOutdated = this.stuckAtPlaylistEnd_(updatedPlaylist);
  78786. if (playlistOutdated) {
  78787. this.excludePlaylist({
  78788. error: {
  78789. message: "Playlist no longer updating.",
  78790. reason: "playlist-unchanged"
  78791. }
  78792. });
  78793. this.tech_.trigger("playliststuck");
  78794. }
  78795. });
  78796. this.mainPlaylistLoader_.on("renditiondisabled", () => {
  78797. this.tech_.trigger({
  78798. type: "usage",
  78799. name: "vhs-rendition-disabled"
  78800. });
  78801. });
  78802. this.mainPlaylistLoader_.on("renditionenabled", () => {
  78803. this.tech_.trigger({
  78804. type: "usage",
  78805. name: "vhs-rendition-enabled"
  78806. });
  78807. });
  78808. }
  78809. handleUpdatedMediaPlaylist(updatedPlaylist) {
  78810. if (this.useCueTags_) {
  78811. this.updateAdCues_(updatedPlaylist);
  78812. }
  78813. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  78814. this.updateDuration(!updatedPlaylist.endList);
  78815. if (!this.tech_.paused()) {
  78816. this.mainSegmentLoader_.load();
  78817. if (this.audioSegmentLoader_) {
  78818. this.audioSegmentLoader_.load();
  78819. }
  78820. }
  78821. }
  78822. triggerPresenceUsage_(main, media) {
  78823. const mediaGroups = main.mediaGroups || {};
  78824. let defaultDemuxed = true;
  78825. const audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  78826. for (const mediaGroup in mediaGroups.AUDIO) {
  78827. for (const label2 in mediaGroups.AUDIO[mediaGroup]) {
  78828. const properties = mediaGroups.AUDIO[mediaGroup][label2];
  78829. if (!properties.uri) {
  78830. defaultDemuxed = false;
  78831. }
  78832. }
  78833. }
  78834. if (defaultDemuxed) {
  78835. this.tech_.trigger({
  78836. type: "usage",
  78837. name: "vhs-demuxed"
  78838. });
  78839. }
  78840. if (Object.keys(mediaGroups.SUBTITLES).length) {
  78841. this.tech_.trigger({
  78842. type: "usage",
  78843. name: "vhs-webvtt"
  78844. });
  78845. }
  78846. if (Vhs$1$1.Playlist.isAes(media)) {
  78847. this.tech_.trigger({
  78848. type: "usage",
  78849. name: "vhs-aes"
  78850. });
  78851. }
  78852. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  78853. this.tech_.trigger({
  78854. type: "usage",
  78855. name: "vhs-alternate-audio"
  78856. });
  78857. }
  78858. if (this.useCueTags_) {
  78859. this.tech_.trigger({
  78860. type: "usage",
  78861. name: "vhs-playlist-cue-tags"
  78862. });
  78863. }
  78864. }
  78865. shouldSwitchToMedia_(nextPlaylist) {
  78866. const currentPlaylist = this.mainPlaylistLoader_.media() || this.mainPlaylistLoader_.pendingMedia_;
  78867. const currentTime = this.tech_.currentTime();
  78868. const bufferLowWaterLine = this.bufferLowWaterLine();
  78869. const bufferHighWaterLine = this.bufferHighWaterLine();
  78870. const buffered = this.tech_.buffered();
  78871. return shouldSwitchToMedia$1({
  78872. buffered,
  78873. currentTime,
  78874. currentPlaylist,
  78875. nextPlaylist,
  78876. bufferLowWaterLine,
  78877. bufferHighWaterLine,
  78878. duration: this.duration(),
  78879. bufferBasedABR: this.bufferBasedABR,
  78880. log: this.logger_
  78881. });
  78882. }
  78883. setupSegmentLoaderListeners_() {
  78884. this.mainSegmentLoader_.on("bandwidthupdate", () => {
  78885. this.checkABR_("bandwidthupdate");
  78886. this.tech_.trigger("bandwidthupdate");
  78887. });
  78888. this.mainSegmentLoader_.on("timeout", () => {
  78889. if (this.bufferBasedABR) {
  78890. this.mainSegmentLoader_.load();
  78891. }
  78892. });
  78893. if (!this.bufferBasedABR) {
  78894. this.mainSegmentLoader_.on("progress", () => {
  78895. this.trigger("progress");
  78896. });
  78897. }
  78898. this.mainSegmentLoader_.on("error", () => {
  78899. const error = this.mainSegmentLoader_.error();
  78900. this.excludePlaylist({
  78901. playlistToExclude: error.playlist,
  78902. error
  78903. });
  78904. });
  78905. this.mainSegmentLoader_.on("appenderror", () => {
  78906. this.error = this.mainSegmentLoader_.error_;
  78907. this.trigger("error");
  78908. });
  78909. this.mainSegmentLoader_.on("syncinfoupdate", () => {
  78910. this.onSyncInfoUpdate_();
  78911. });
  78912. this.mainSegmentLoader_.on("timestampoffset", () => {
  78913. this.tech_.trigger({
  78914. type: "usage",
  78915. name: "vhs-timestamp-offset"
  78916. });
  78917. });
  78918. this.audioSegmentLoader_.on("syncinfoupdate", () => {
  78919. this.onSyncInfoUpdate_();
  78920. });
  78921. this.audioSegmentLoader_.on("appenderror", () => {
  78922. this.error = this.audioSegmentLoader_.error_;
  78923. this.trigger("error");
  78924. });
  78925. this.mainSegmentLoader_.on("ended", () => {
  78926. this.logger_("main segment loader ended");
  78927. this.onEndOfStream();
  78928. });
  78929. this.mainSegmentLoader_.on("earlyabort", (event2) => {
  78930. if (this.bufferBasedABR) {
  78931. return;
  78932. }
  78933. this.delegateLoaders_("all", ["abort"]);
  78934. this.excludePlaylist({
  78935. error: {
  78936. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  78937. },
  78938. playlistExclusionDuration: ABORT_EARLY_EXCLUSION_SECONDS
  78939. });
  78940. });
  78941. const updateCodecs = () => {
  78942. if (!this.sourceUpdater_.hasCreatedSourceBuffers()) {
  78943. return this.tryToCreateSourceBuffers_();
  78944. }
  78945. const codecs = this.getCodecsOrExclude_();
  78946. if (!codecs) {
  78947. return;
  78948. }
  78949. this.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  78950. };
  78951. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  78952. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  78953. this.mainSegmentLoader_.on("fmp4", () => {
  78954. if (!this.triggeredFmp4Usage) {
  78955. this.tech_.trigger({
  78956. type: "usage",
  78957. name: "vhs-fmp4"
  78958. });
  78959. this.triggeredFmp4Usage = true;
  78960. }
  78961. });
  78962. this.audioSegmentLoader_.on("fmp4", () => {
  78963. if (!this.triggeredFmp4Usage) {
  78964. this.tech_.trigger({
  78965. type: "usage",
  78966. name: "vhs-fmp4"
  78967. });
  78968. this.triggeredFmp4Usage = true;
  78969. }
  78970. });
  78971. this.audioSegmentLoader_.on("ended", () => {
  78972. this.logger_("audioSegmentLoader ended");
  78973. this.onEndOfStream();
  78974. });
  78975. }
  78976. mediaSecondsLoaded_() {
  78977. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  78978. }
  78979. load() {
  78980. this.mainSegmentLoader_.load();
  78981. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  78982. this.audioSegmentLoader_.load();
  78983. }
  78984. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  78985. this.subtitleSegmentLoader_.load();
  78986. }
  78987. }
  78988. fastQualityChange_(media = this.selectPlaylist()) {
  78989. if (media === this.mainPlaylistLoader_.media()) {
  78990. this.logger_("skipping fastQualityChange because new media is same as old");
  78991. return;
  78992. }
  78993. this.switchMedia_(media, "fast-quality");
  78994. this.mainSegmentLoader_.resetEverything(() => {
  78995. if (videojs$2.browser.IE_VERSION || videojs$2.browser.IS_EDGE) {
  78996. this.tech_.setCurrentTime(this.tech_.currentTime() + 0.04);
  78997. } else {
  78998. this.tech_.setCurrentTime(this.tech_.currentTime());
  78999. }
  79000. });
  79001. }
  79002. play() {
  79003. if (this.setupFirstPlay()) {
  79004. return;
  79005. }
  79006. if (this.tech_.ended()) {
  79007. this.tech_.setCurrentTime(0);
  79008. }
  79009. if (this.hasPlayed_) {
  79010. this.load();
  79011. }
  79012. const seekable3 = this.tech_.seekable();
  79013. if (this.tech_.duration() === Infinity) {
  79014. if (this.tech_.currentTime() < seekable3.start(0)) {
  79015. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  79016. }
  79017. }
  79018. }
  79019. setupFirstPlay() {
  79020. const media = this.mainPlaylistLoader_.media();
  79021. if (!media || this.tech_.paused() || this.hasPlayed_) {
  79022. return false;
  79023. }
  79024. if (!media.endList) {
  79025. const seekable3 = this.seekable();
  79026. if (!seekable3.length) {
  79027. return false;
  79028. }
  79029. if (videojs$2.browser.IE_VERSION && this.tech_.readyState() === 0) {
  79030. this.tech_.one("loadedmetadata", () => {
  79031. this.trigger("firstplay");
  79032. this.tech_.setCurrentTime(seekable3.end(0));
  79033. this.hasPlayed_ = true;
  79034. });
  79035. return false;
  79036. }
  79037. this.trigger("firstplay");
  79038. this.tech_.setCurrentTime(seekable3.end(0));
  79039. }
  79040. this.hasPlayed_ = true;
  79041. this.load();
  79042. return true;
  79043. }
  79044. handleSourceOpen_() {
  79045. this.tryToCreateSourceBuffers_();
  79046. if (this.tech_.autoplay()) {
  79047. const playPromise = this.tech_.play();
  79048. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  79049. playPromise.then(null, (e) => {
  79050. });
  79051. }
  79052. }
  79053. this.trigger("sourceopen");
  79054. }
  79055. handleSourceEnded_() {
  79056. if (!this.inbandTextTracks_.metadataTrack_) {
  79057. return;
  79058. }
  79059. const cues = this.inbandTextTracks_.metadataTrack_.cues;
  79060. if (!cues || !cues.length) {
  79061. return;
  79062. }
  79063. const duration5 = this.duration();
  79064. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  79065. }
  79066. handleDurationChange_() {
  79067. this.tech_.trigger("durationchange");
  79068. }
  79069. onEndOfStream() {
  79070. let isEndOfStream = this.mainSegmentLoader_.ended_;
  79071. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79072. const mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  79073. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  79074. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  79075. } else {
  79076. isEndOfStream = this.audioSegmentLoader_.ended_;
  79077. }
  79078. }
  79079. if (!isEndOfStream) {
  79080. return;
  79081. }
  79082. this.stopABRTimer_();
  79083. this.sourceUpdater_.endOfStream();
  79084. }
  79085. stuckAtPlaylistEnd_(playlist) {
  79086. const seekable3 = this.seekable();
  79087. if (!seekable3.length) {
  79088. return false;
  79089. }
  79090. const expired = this.syncController_.getExpiredTime(playlist, this.duration());
  79091. if (expired === null) {
  79092. return false;
  79093. }
  79094. const absolutePlaylistEnd = Vhs$1$1.Playlist.playlistEnd(playlist, expired);
  79095. const currentTime = this.tech_.currentTime();
  79096. const buffered = this.tech_.buffered();
  79097. if (!buffered.length) {
  79098. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA$1;
  79099. }
  79100. const bufferedEnd = buffered.end(buffered.length - 1);
  79101. return bufferedEnd - currentTime <= SAFE_TIME_DELTA$1 && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA$1;
  79102. }
  79103. excludePlaylist({
  79104. playlistToExclude = this.mainPlaylistLoader_.media(),
  79105. error = {},
  79106. playlistExclusionDuration
  79107. }) {
  79108. playlistToExclude = playlistToExclude || this.mainPlaylistLoader_.media();
  79109. playlistExclusionDuration = playlistExclusionDuration || error.playlistExclusionDuration || this.playlistExclusionDuration;
  79110. if (!playlistToExclude) {
  79111. this.error = error;
  79112. if (this.mediaSource.readyState !== "open") {
  79113. this.trigger("error");
  79114. } else {
  79115. this.sourceUpdater_.endOfStream("network");
  79116. }
  79117. return;
  79118. }
  79119. playlistToExclude.playlistErrors_++;
  79120. const playlists = this.mainPlaylistLoader_.main.playlists;
  79121. const enabledPlaylists = playlists.filter(isEnabled$1);
  79122. const isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === playlistToExclude;
  79123. if (playlists.length === 1 && playlistExclusionDuration !== Infinity) {
  79124. videojs$2.log.warn(`Problem encountered with playlist ${playlistToExclude.id}. Trying again since it is the only playlist.`);
  79125. this.tech_.trigger("retryplaylist");
  79126. return this.mainPlaylistLoader_.load(isFinalRendition);
  79127. }
  79128. if (isFinalRendition) {
  79129. let reincluded = false;
  79130. playlists.forEach((playlist) => {
  79131. if (playlist === playlistToExclude) {
  79132. return;
  79133. }
  79134. const excludeUntil2 = playlist.excludeUntil;
  79135. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  79136. reincluded = true;
  79137. delete playlist.excludeUntil;
  79138. }
  79139. });
  79140. if (reincluded) {
  79141. videojs$2.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  79142. this.tech_.trigger("retryplaylist");
  79143. }
  79144. }
  79145. let excludeUntil;
  79146. if (playlistToExclude.playlistErrors_ > this.maxPlaylistRetries) {
  79147. excludeUntil = Infinity;
  79148. } else {
  79149. excludeUntil = Date.now() + playlistExclusionDuration * 1e3;
  79150. }
  79151. playlistToExclude.excludeUntil = excludeUntil;
  79152. if (error.reason) {
  79153. playlistToExclude.lastExcludeReason_ = error.reason;
  79154. }
  79155. this.tech_.trigger("excludeplaylist");
  79156. this.tech_.trigger({
  79157. type: "usage",
  79158. name: "vhs-rendition-excluded"
  79159. });
  79160. const nextPlaylist = this.selectPlaylist();
  79161. if (!nextPlaylist) {
  79162. this.error = "Playback cannot continue. No available working or supported playlists.";
  79163. this.trigger("error");
  79164. return;
  79165. }
  79166. const logFn2 = error.internal ? this.logger_ : videojs$2.log.warn;
  79167. const errorMessage = error.message ? " " + error.message : "";
  79168. logFn2(`${error.internal ? "Internal problem" : "Problem"} encountered with playlist ${playlistToExclude.id}.${errorMessage} Switching to playlist ${nextPlaylist.id}.`);
  79169. if (nextPlaylist.attributes.AUDIO !== playlistToExclude.attributes.AUDIO) {
  79170. this.delegateLoaders_("audio", ["abort", "pause"]);
  79171. }
  79172. if (nextPlaylist.attributes.SUBTITLES !== playlistToExclude.attributes.SUBTITLES) {
  79173. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  79174. }
  79175. this.delegateLoaders_("main", ["abort", "pause"]);
  79176. const delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  79177. const shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  79178. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  79179. }
  79180. pauseLoading() {
  79181. this.delegateLoaders_("all", ["abort", "pause"]);
  79182. this.stopABRTimer_();
  79183. }
  79184. delegateLoaders_(filter, fnNames) {
  79185. const loaders = [];
  79186. const dontFilterPlaylist = filter === "all";
  79187. if (dontFilterPlaylist || filter === "main") {
  79188. loaders.push(this.mainPlaylistLoader_);
  79189. }
  79190. const mediaTypes2 = [];
  79191. if (dontFilterPlaylist || filter === "audio") {
  79192. mediaTypes2.push("AUDIO");
  79193. }
  79194. if (dontFilterPlaylist || filter === "subtitle") {
  79195. mediaTypes2.push("CLOSED-CAPTIONS");
  79196. mediaTypes2.push("SUBTITLES");
  79197. }
  79198. mediaTypes2.forEach((mediaType) => {
  79199. const loader = this.mediaTypes_[mediaType] && this.mediaTypes_[mediaType].activePlaylistLoader;
  79200. if (loader) {
  79201. loaders.push(loader);
  79202. }
  79203. });
  79204. ["main", "audio", "subtitle"].forEach((name) => {
  79205. const loader = this[`${name}SegmentLoader_`];
  79206. if (loader && (filter === name || filter === "all")) {
  79207. loaders.push(loader);
  79208. }
  79209. });
  79210. loaders.forEach((loader) => fnNames.forEach((fnName) => {
  79211. if (typeof loader[fnName] === "function") {
  79212. loader[fnName]();
  79213. }
  79214. }));
  79215. }
  79216. setCurrentTime(currentTime) {
  79217. const buffered = findRange$1(this.tech_.buffered(), currentTime);
  79218. if (!(this.mainPlaylistLoader_ && this.mainPlaylistLoader_.media())) {
  79219. return 0;
  79220. }
  79221. if (!this.mainPlaylistLoader_.media().segments) {
  79222. return 0;
  79223. }
  79224. if (buffered && buffered.length) {
  79225. return currentTime;
  79226. }
  79227. this.mainSegmentLoader_.resetEverything();
  79228. this.mainSegmentLoader_.abort();
  79229. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79230. this.audioSegmentLoader_.resetEverything();
  79231. this.audioSegmentLoader_.abort();
  79232. }
  79233. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  79234. this.subtitleSegmentLoader_.resetEverything();
  79235. this.subtitleSegmentLoader_.abort();
  79236. }
  79237. this.load();
  79238. }
  79239. duration() {
  79240. if (!this.mainPlaylistLoader_) {
  79241. return 0;
  79242. }
  79243. const media = this.mainPlaylistLoader_.media();
  79244. if (!media) {
  79245. return 0;
  79246. }
  79247. if (!media.endList) {
  79248. return Infinity;
  79249. }
  79250. if (this.mediaSource) {
  79251. return this.mediaSource.duration;
  79252. }
  79253. return Vhs$1$1.Playlist.duration(media);
  79254. }
  79255. seekable() {
  79256. return this.seekable_;
  79257. }
  79258. onSyncInfoUpdate_() {
  79259. let audioSeekable;
  79260. if (!this.mainPlaylistLoader_) {
  79261. return;
  79262. }
  79263. let media = this.mainPlaylistLoader_.media();
  79264. if (!media) {
  79265. return;
  79266. }
  79267. let expired = this.syncController_.getExpiredTime(media, this.duration());
  79268. if (expired === null) {
  79269. return;
  79270. }
  79271. const main = this.mainPlaylistLoader_.main;
  79272. const mainSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79273. if (mainSeekable.length === 0) {
  79274. return;
  79275. }
  79276. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79277. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  79278. expired = this.syncController_.getExpiredTime(media, this.duration());
  79279. if (expired === null) {
  79280. return;
  79281. }
  79282. audioSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79283. if (audioSeekable.length === 0) {
  79284. return;
  79285. }
  79286. }
  79287. let oldEnd;
  79288. let oldStart;
  79289. if (this.seekable_ && this.seekable_.length) {
  79290. oldEnd = this.seekable_.end(0);
  79291. oldStart = this.seekable_.start(0);
  79292. }
  79293. if (!audioSeekable) {
  79294. this.seekable_ = mainSeekable;
  79295. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  79296. this.seekable_ = mainSeekable;
  79297. } else {
  79298. 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)]]);
  79299. }
  79300. if (this.seekable_ && this.seekable_.length) {
  79301. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  79302. return;
  79303. }
  79304. }
  79305. this.logger_(`seekable updated [${printableRange$1(this.seekable_)}]`);
  79306. this.tech_.trigger("seekablechanged");
  79307. }
  79308. updateDuration(isLive) {
  79309. if (this.updateDuration_) {
  79310. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79311. this.updateDuration_ = null;
  79312. }
  79313. if (this.mediaSource.readyState !== "open") {
  79314. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  79315. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  79316. return;
  79317. }
  79318. if (isLive) {
  79319. const seekable3 = this.seekable();
  79320. if (!seekable3.length) {
  79321. return;
  79322. }
  79323. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  79324. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  79325. }
  79326. return;
  79327. }
  79328. const buffered = this.tech_.buffered();
  79329. let duration5 = Vhs$1$1.Playlist.duration(this.mainPlaylistLoader_.media());
  79330. if (buffered.length > 0) {
  79331. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  79332. }
  79333. if (this.mediaSource.duration !== duration5) {
  79334. this.sourceUpdater_.setDuration(duration5);
  79335. }
  79336. }
  79337. dispose() {
  79338. this.trigger("dispose");
  79339. this.decrypter_.terminate();
  79340. this.mainPlaylistLoader_.dispose();
  79341. this.mainSegmentLoader_.dispose();
  79342. if (this.loadOnPlay_) {
  79343. this.tech_.off("play", this.loadOnPlay_);
  79344. }
  79345. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  79346. const groups = this.mediaTypes_[type2].groups;
  79347. for (const id in groups) {
  79348. groups[id].forEach((group) => {
  79349. if (group.playlistLoader) {
  79350. group.playlistLoader.dispose();
  79351. }
  79352. });
  79353. }
  79354. });
  79355. this.audioSegmentLoader_.dispose();
  79356. this.subtitleSegmentLoader_.dispose();
  79357. this.sourceUpdater_.dispose();
  79358. this.timelineChangeController_.dispose();
  79359. this.stopABRTimer_();
  79360. if (this.updateDuration_) {
  79361. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79362. }
  79363. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  79364. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  79365. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  79366. this.off();
  79367. }
  79368. main() {
  79369. return this.mainPlaylistLoader_.main;
  79370. }
  79371. media() {
  79372. return this.mainPlaylistLoader_.media() || this.initialMedia_;
  79373. }
  79374. areMediaTypesKnown_() {
  79375. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79376. const hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  79377. const hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  79378. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  79379. return false;
  79380. }
  79381. return true;
  79382. }
  79383. getCodecsOrExclude_() {
  79384. const media = {
  79385. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  79386. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  79387. };
  79388. const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  79389. media.video = media.main;
  79390. const playlistCodecs = codecsForPlaylist$1(this.main(), playlist);
  79391. const codecs = {};
  79392. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79393. if (media.main.hasVideo) {
  79394. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC$1;
  79395. }
  79396. if (media.main.isMuxed) {
  79397. codecs.video += `,${playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC$1}`;
  79398. }
  79399. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  79400. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC$1;
  79401. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  79402. }
  79403. if (!codecs.audio && !codecs.video) {
  79404. this.excludePlaylist({
  79405. playlistToExclude: playlist,
  79406. error: {
  79407. message: "Could not determine codecs for playlist."
  79408. },
  79409. playlistExclusionDuration: Infinity
  79410. });
  79411. return;
  79412. }
  79413. const supportFunction = (isFmp4, codec) => isFmp4 ? browserSupportsCodec$1(codec) : muxerSupportsCodec$1(codec);
  79414. const unsupportedCodecs = {};
  79415. let unsupportedAudio;
  79416. ["video", "audio"].forEach(function(type2) {
  79417. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  79418. const supporter = media[type2].isFmp4 ? "browser" : "muxer";
  79419. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  79420. unsupportedCodecs[supporter].push(codecs[type2]);
  79421. if (type2 === "audio") {
  79422. unsupportedAudio = supporter;
  79423. }
  79424. }
  79425. });
  79426. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  79427. const audioGroup = playlist.attributes.AUDIO;
  79428. this.main().playlists.forEach((variant) => {
  79429. const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  79430. if (variantAudioGroup === audioGroup && variant !== playlist) {
  79431. variant.excludeUntil = Infinity;
  79432. }
  79433. });
  79434. this.logger_(`excluding audio group ${audioGroup} as ${unsupportedAudio} does not support codec(s): "${codecs.audio}"`);
  79435. }
  79436. if (Object.keys(unsupportedCodecs).length) {
  79437. const message = Object.keys(unsupportedCodecs).reduce((acc, supporter) => {
  79438. if (acc) {
  79439. acc += ", ";
  79440. }
  79441. acc += `${supporter} does not support codec(s): "${unsupportedCodecs[supporter].join(",")}"`;
  79442. return acc;
  79443. }, "") + ".";
  79444. this.excludePlaylist({
  79445. playlistToExclude: playlist,
  79446. error: {
  79447. internal: true,
  79448. message
  79449. },
  79450. playlistExclusionDuration: Infinity
  79451. });
  79452. return;
  79453. }
  79454. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  79455. const switchMessages = [];
  79456. ["video", "audio"].forEach((type2) => {
  79457. const newCodec = (parseCodecs$1(this.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  79458. const oldCodec = (parseCodecs$1(codecs[type2] || "")[0] || {}).type;
  79459. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  79460. switchMessages.push(`"${this.sourceUpdater_.codecs[type2]}" -> "${codecs[type2]}"`);
  79461. }
  79462. });
  79463. if (switchMessages.length) {
  79464. this.excludePlaylist({
  79465. playlistToExclude: playlist,
  79466. error: {
  79467. message: `Codec switching not supported: ${switchMessages.join(", ")}.`,
  79468. internal: true
  79469. },
  79470. playlistExclusionDuration: Infinity
  79471. });
  79472. return;
  79473. }
  79474. }
  79475. return codecs;
  79476. }
  79477. tryToCreateSourceBuffers_() {
  79478. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  79479. return;
  79480. }
  79481. if (!this.areMediaTypesKnown_()) {
  79482. return;
  79483. }
  79484. const codecs = this.getCodecsOrExclude_();
  79485. if (!codecs) {
  79486. return;
  79487. }
  79488. this.sourceUpdater_.createSourceBuffers(codecs);
  79489. const codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  79490. this.excludeIncompatibleVariants_(codecString);
  79491. }
  79492. excludeUnsupportedVariants_() {
  79493. const playlists = this.main().playlists;
  79494. const ids = [];
  79495. Object.keys(playlists).forEach((key) => {
  79496. const variant = playlists[key];
  79497. if (ids.indexOf(variant.id) !== -1) {
  79498. return;
  79499. }
  79500. ids.push(variant.id);
  79501. const codecs = codecsForPlaylist$1(this.main, variant);
  79502. const unsupported = [];
  79503. if (codecs.audio && !muxerSupportsCodec$1(codecs.audio) && !browserSupportsCodec$1(codecs.audio)) {
  79504. unsupported.push(`audio codec ${codecs.audio}`);
  79505. }
  79506. if (codecs.video && !muxerSupportsCodec$1(codecs.video) && !browserSupportsCodec$1(codecs.video)) {
  79507. unsupported.push(`video codec ${codecs.video}`);
  79508. }
  79509. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  79510. unsupported.push(`text codec ${codecs.text}`);
  79511. }
  79512. if (unsupported.length) {
  79513. variant.excludeUntil = Infinity;
  79514. this.logger_(`excluding ${variant.id} for unsupported: ${unsupported.join(", ")}`);
  79515. }
  79516. });
  79517. }
  79518. excludeIncompatibleVariants_(codecString) {
  79519. const ids = [];
  79520. const playlists = this.main().playlists;
  79521. const codecs = unwrapCodecList$1(parseCodecs$1(codecString));
  79522. const codecCount_ = codecCount$1(codecs);
  79523. const videoDetails = codecs.video && parseCodecs$1(codecs.video)[0] || null;
  79524. const audioDetails = codecs.audio && parseCodecs$1(codecs.audio)[0] || null;
  79525. Object.keys(playlists).forEach((key) => {
  79526. const variant = playlists[key];
  79527. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  79528. return;
  79529. }
  79530. ids.push(variant.id);
  79531. const exclusionReasons = [];
  79532. const variantCodecs = codecsForPlaylist$1(this.mainPlaylistLoader_.main, variant);
  79533. const variantCodecCount = codecCount$1(variantCodecs);
  79534. if (!variantCodecs.audio && !variantCodecs.video) {
  79535. return;
  79536. }
  79537. if (variantCodecCount !== codecCount_) {
  79538. exclusionReasons.push(`codec count "${variantCodecCount}" !== "${codecCount_}"`);
  79539. }
  79540. if (!this.sourceUpdater_.canChangeType()) {
  79541. const variantVideoDetails = variantCodecs.video && parseCodecs$1(variantCodecs.video)[0] || null;
  79542. const variantAudioDetails = variantCodecs.audio && parseCodecs$1(variantCodecs.audio)[0] || null;
  79543. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  79544. exclusionReasons.push(`video codec "${variantVideoDetails.type}" !== "${videoDetails.type}"`);
  79545. }
  79546. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  79547. exclusionReasons.push(`audio codec "${variantAudioDetails.type}" !== "${audioDetails.type}"`);
  79548. }
  79549. }
  79550. if (exclusionReasons.length) {
  79551. variant.excludeUntil = Infinity;
  79552. this.logger_(`excluding ${variant.id}: ${exclusionReasons.join(" && ")}`);
  79553. }
  79554. });
  79555. }
  79556. updateAdCues_(media) {
  79557. let offset = 0;
  79558. const seekable3 = this.seekable();
  79559. if (seekable3.length) {
  79560. offset = seekable3.start(0);
  79561. }
  79562. updateAdCues$1(media, this.cueTagsTrack_, offset);
  79563. }
  79564. goalBufferLength() {
  79565. const currentTime = this.tech_.currentTime();
  79566. const initial = Config$1.GOAL_BUFFER_LENGTH;
  79567. const rate = Config$1.GOAL_BUFFER_LENGTH_RATE;
  79568. const max2 = Math.max(initial, Config$1.MAX_GOAL_BUFFER_LENGTH);
  79569. return Math.min(initial + currentTime * rate, max2);
  79570. }
  79571. bufferLowWaterLine() {
  79572. const currentTime = this.tech_.currentTime();
  79573. const initial = Config$1.BUFFER_LOW_WATER_LINE;
  79574. const rate = Config$1.BUFFER_LOW_WATER_LINE_RATE;
  79575. const max2 = Math.max(initial, Config$1.MAX_BUFFER_LOW_WATER_LINE);
  79576. const newMax = Math.max(initial, Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  79577. return Math.min(initial + currentTime * rate, this.bufferBasedABR ? newMax : max2);
  79578. }
  79579. bufferHighWaterLine() {
  79580. return Config$1.BUFFER_HIGH_WATER_LINE;
  79581. }
  79582. }
  79583. const enableFunction$1 = (loader, playlistID, changePlaylistFn) => (enable) => {
  79584. const playlist = loader.main.playlists[playlistID];
  79585. const incompatible = isIncompatible$1(playlist);
  79586. const currentlyEnabled = isEnabled$1(playlist);
  79587. if (typeof enable === "undefined") {
  79588. return currentlyEnabled;
  79589. }
  79590. if (enable) {
  79591. delete playlist.disabled;
  79592. } else {
  79593. playlist.disabled = true;
  79594. }
  79595. if (enable !== currentlyEnabled && !incompatible) {
  79596. changePlaylistFn();
  79597. if (enable) {
  79598. loader.trigger("renditionenabled");
  79599. } else {
  79600. loader.trigger("renditiondisabled");
  79601. }
  79602. }
  79603. return enable;
  79604. };
  79605. class Representation$1 {
  79606. constructor(vhsHandler, playlist, id) {
  79607. const {
  79608. playlistController_: pc
  79609. } = vhsHandler;
  79610. const qualityChangeFunction = pc.fastQualityChange_.bind(pc);
  79611. if (playlist.attributes) {
  79612. const resolution = playlist.attributes.RESOLUTION;
  79613. this.width = resolution && resolution.width;
  79614. this.height = resolution && resolution.height;
  79615. this.bandwidth = playlist.attributes.BANDWIDTH;
  79616. this.frameRate = playlist.attributes["FRAME-RATE"];
  79617. }
  79618. this.codecs = codecsForPlaylist$1(pc.main(), playlist);
  79619. this.playlist = playlist;
  79620. this.id = id;
  79621. this.enabled = enableFunction$1(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  79622. }
  79623. }
  79624. const renditionSelectionMixin$1 = function(vhsHandler) {
  79625. vhsHandler.representations = () => {
  79626. const main = vhsHandler.playlistController_.main();
  79627. const playlists = isAudioOnly$1(main) ? vhsHandler.playlistController_.getAudioTrackPlaylists_() : main.playlists;
  79628. if (!playlists) {
  79629. return [];
  79630. }
  79631. return playlists.filter((media) => !isIncompatible$1(media)).map((e, i2) => new Representation$1(vhsHandler, e, e.id));
  79632. };
  79633. };
  79634. const timerCancelEvents$1 = ["seeking", "seeked", "pause", "playing", "error"];
  79635. class PlaybackWatcher$1 {
  79636. constructor(options2) {
  79637. this.playlistController_ = options2.playlistController;
  79638. this.tech_ = options2.tech;
  79639. this.seekable = options2.seekable;
  79640. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  79641. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  79642. this.media = options2.media;
  79643. this.consecutiveUpdates = 0;
  79644. this.lastRecordedTime = null;
  79645. this.checkCurrentTimeTimeout_ = null;
  79646. this.logger_ = logger$1("PlaybackWatcher");
  79647. this.logger_("initialize");
  79648. const playHandler = () => this.monitorCurrentTime_();
  79649. const canPlayHandler = () => this.monitorCurrentTime_();
  79650. const waitingHandler = () => this.techWaiting_();
  79651. const cancelTimerHandler = () => this.resetTimeUpdate_();
  79652. const pc = this.playlistController_;
  79653. const loaderTypes = ["main", "subtitle", "audio"];
  79654. const loaderChecks = {};
  79655. loaderTypes.forEach((type2) => {
  79656. loaderChecks[type2] = {
  79657. reset: () => this.resetSegmentDownloads_(type2),
  79658. updateend: () => this.checkSegmentDownloads_(type2)
  79659. };
  79660. pc[`${type2}SegmentLoader_`].on("appendsdone", loaderChecks[type2].updateend);
  79661. pc[`${type2}SegmentLoader_`].on("playlistupdate", loaderChecks[type2].reset);
  79662. this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  79663. });
  79664. const setSeekingHandlers = (fn2) => {
  79665. ["main", "audio"].forEach((type2) => {
  79666. pc[`${type2}SegmentLoader_`][fn2]("appended", this.seekingAppendCheck_);
  79667. });
  79668. };
  79669. this.seekingAppendCheck_ = () => {
  79670. if (this.fixesBadSeeks_()) {
  79671. this.consecutiveUpdates = 0;
  79672. this.lastRecordedTime = this.tech_.currentTime();
  79673. setSeekingHandlers("off");
  79674. }
  79675. };
  79676. this.clearSeekingAppendCheck_ = () => setSeekingHandlers("off");
  79677. this.watchForBadSeeking_ = () => {
  79678. this.clearSeekingAppendCheck_();
  79679. setSeekingHandlers("on");
  79680. };
  79681. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  79682. this.tech_.on("seeking", this.watchForBadSeeking_);
  79683. this.tech_.on("waiting", waitingHandler);
  79684. this.tech_.on(timerCancelEvents$1, cancelTimerHandler);
  79685. this.tech_.on("canplay", canPlayHandler);
  79686. this.tech_.one("play", playHandler);
  79687. this.dispose = () => {
  79688. this.clearSeekingAppendCheck_();
  79689. this.logger_("dispose");
  79690. this.tech_.off("waiting", waitingHandler);
  79691. this.tech_.off(timerCancelEvents$1, cancelTimerHandler);
  79692. this.tech_.off("canplay", canPlayHandler);
  79693. this.tech_.off("play", playHandler);
  79694. this.tech_.off("seeking", this.watchForBadSeeking_);
  79695. this.tech_.off("seeked", this.clearSeekingAppendCheck_);
  79696. loaderTypes.forEach((type2) => {
  79697. pc[`${type2}SegmentLoader_`].off("appendsdone", loaderChecks[type2].updateend);
  79698. pc[`${type2}SegmentLoader_`].off("playlistupdate", loaderChecks[type2].reset);
  79699. this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  79700. });
  79701. if (this.checkCurrentTimeTimeout_) {
  79702. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79703. }
  79704. this.resetTimeUpdate_();
  79705. };
  79706. }
  79707. monitorCurrentTime_() {
  79708. this.checkCurrentTime_();
  79709. if (this.checkCurrentTimeTimeout_) {
  79710. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79711. }
  79712. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  79713. }
  79714. resetSegmentDownloads_(type2) {
  79715. const loader = this.playlistController_[`${type2}SegmentLoader_`];
  79716. if (this[`${type2}StalledDownloads_`] > 0) {
  79717. this.logger_(`resetting possible stalled download count for ${type2} loader`);
  79718. }
  79719. this[`${type2}StalledDownloads_`] = 0;
  79720. this[`${type2}Buffered_`] = loader.buffered_();
  79721. }
  79722. checkSegmentDownloads_(type2) {
  79723. const pc = this.playlistController_;
  79724. const loader = pc[`${type2}SegmentLoader_`];
  79725. const buffered = loader.buffered_();
  79726. const isBufferedDifferent = isRangeDifferent$1(this[`${type2}Buffered_`], buffered);
  79727. this[`${type2}Buffered_`] = buffered;
  79728. if (isBufferedDifferent) {
  79729. this.resetSegmentDownloads_(type2);
  79730. return;
  79731. }
  79732. this[`${type2}StalledDownloads_`]++;
  79733. this.logger_(`found #${this[`${type2}StalledDownloads_`]} ${type2} appends that did not increase buffer (possible stalled download)`, {
  79734. playlistId: loader.playlist_ && loader.playlist_.id,
  79735. buffered: timeRangesToArray$1(buffered)
  79736. });
  79737. if (this[`${type2}StalledDownloads_`] < 10) {
  79738. return;
  79739. }
  79740. this.logger_(`${type2} loader stalled download exclusion`);
  79741. this.resetSegmentDownloads_(type2);
  79742. this.tech_.trigger({
  79743. type: "usage",
  79744. name: `vhs-${type2}-download-exclusion`
  79745. });
  79746. if (type2 === "subtitle") {
  79747. return;
  79748. }
  79749. pc.excludePlaylist({
  79750. error: {
  79751. message: `Excessive ${type2} segment downloading detected.`
  79752. },
  79753. playlistExclusionDuration: Infinity
  79754. });
  79755. }
  79756. checkCurrentTime_() {
  79757. if (this.tech_.paused() || this.tech_.seeking()) {
  79758. return;
  79759. }
  79760. const currentTime = this.tech_.currentTime();
  79761. const buffered = this.tech_.buffered();
  79762. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA$1 >= buffered.end(buffered.length - 1))) {
  79763. return this.techWaiting_();
  79764. }
  79765. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  79766. this.consecutiveUpdates++;
  79767. this.waiting_();
  79768. } else if (currentTime === this.lastRecordedTime) {
  79769. this.consecutiveUpdates++;
  79770. } else {
  79771. this.consecutiveUpdates = 0;
  79772. this.lastRecordedTime = currentTime;
  79773. }
  79774. }
  79775. resetTimeUpdate_() {
  79776. this.consecutiveUpdates = 0;
  79777. }
  79778. fixesBadSeeks_() {
  79779. const seeking = this.tech_.seeking();
  79780. if (!seeking) {
  79781. return false;
  79782. }
  79783. const seekable3 = this.seekable();
  79784. const currentTime = this.tech_.currentTime();
  79785. const isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  79786. let seekTo;
  79787. if (isAfterSeekableRange) {
  79788. const seekableEnd = seekable3.end(seekable3.length - 1);
  79789. seekTo = seekableEnd;
  79790. }
  79791. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79792. const seekableStart = seekable3.start(0);
  79793. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA$1);
  79794. }
  79795. if (typeof seekTo !== "undefined") {
  79796. this.logger_(`Trying to seek outside of seekable at time ${currentTime} with seekable range ${printableRange$1(seekable3)}. Seeking to ${seekTo}.`);
  79797. this.tech_.setCurrentTime(seekTo);
  79798. return true;
  79799. }
  79800. const sourceUpdater = this.playlistController_.sourceUpdater_;
  79801. const buffered = this.tech_.buffered();
  79802. const audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  79803. const videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  79804. const media = this.media();
  79805. const minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR$1) * 2;
  79806. const bufferedToCheck = [audioBuffered, videoBuffered];
  79807. for (let i2 = 0; i2 < bufferedToCheck.length; i2++) {
  79808. if (!bufferedToCheck[i2]) {
  79809. continue;
  79810. }
  79811. const timeAhead = timeAheadOf$1(bufferedToCheck[i2], currentTime);
  79812. if (timeAhead < minAppendedDuration) {
  79813. return false;
  79814. }
  79815. }
  79816. const nextRange = findNextRange$1(buffered, currentTime);
  79817. if (nextRange.length === 0) {
  79818. return false;
  79819. }
  79820. seekTo = nextRange.start(0) + SAFE_TIME_DELTA$1;
  79821. this.logger_(`Buffered region starts (${nextRange.start(0)}) just beyond seek point (${currentTime}). Seeking to ${seekTo}.`);
  79822. this.tech_.setCurrentTime(seekTo);
  79823. return true;
  79824. }
  79825. waiting_() {
  79826. if (this.techWaiting_()) {
  79827. return;
  79828. }
  79829. const currentTime = this.tech_.currentTime();
  79830. const buffered = this.tech_.buffered();
  79831. const currentRange = findRange$1(buffered, currentTime);
  79832. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  79833. this.resetTimeUpdate_();
  79834. this.tech_.setCurrentTime(currentTime);
  79835. 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.`);
  79836. this.tech_.trigger({
  79837. type: "usage",
  79838. name: "vhs-unknown-waiting"
  79839. });
  79840. return;
  79841. }
  79842. }
  79843. techWaiting_() {
  79844. const seekable3 = this.seekable();
  79845. const currentTime = this.tech_.currentTime();
  79846. if (this.tech_.seeking()) {
  79847. return true;
  79848. }
  79849. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79850. const livePoint = seekable3.end(seekable3.length - 1);
  79851. this.logger_(`Fell out of live window at time ${currentTime}. Seeking to live point (seekable end) ${livePoint}`);
  79852. this.resetTimeUpdate_();
  79853. this.tech_.setCurrentTime(livePoint);
  79854. this.tech_.trigger({
  79855. type: "usage",
  79856. name: "vhs-live-resync"
  79857. });
  79858. return true;
  79859. }
  79860. const sourceUpdater = this.tech_.vhs.playlistController_.sourceUpdater_;
  79861. const buffered = this.tech_.buffered();
  79862. const videoUnderflow = this.videoUnderflow_({
  79863. audioBuffered: sourceUpdater.audioBuffered(),
  79864. videoBuffered: sourceUpdater.videoBuffered(),
  79865. currentTime
  79866. });
  79867. if (videoUnderflow) {
  79868. this.resetTimeUpdate_();
  79869. this.tech_.setCurrentTime(currentTime);
  79870. this.tech_.trigger({
  79871. type: "usage",
  79872. name: "vhs-video-underflow"
  79873. });
  79874. return true;
  79875. }
  79876. const nextRange = findNextRange$1(buffered, currentTime);
  79877. if (nextRange.length > 0) {
  79878. this.logger_(`Stopped at ${currentTime} and seeking to ${nextRange.start(0)}`);
  79879. this.resetTimeUpdate_();
  79880. this.skipTheGap_(currentTime);
  79881. return true;
  79882. }
  79883. return false;
  79884. }
  79885. afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow = false) {
  79886. if (!seekable3.length) {
  79887. return false;
  79888. }
  79889. let allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA$1;
  79890. const isLive = !playlist.endList;
  79891. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  79892. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  79893. }
  79894. if (currentTime > allowedEnd) {
  79895. return true;
  79896. }
  79897. return false;
  79898. }
  79899. beforeSeekableWindow_(seekable3, currentTime) {
  79900. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  79901. return true;
  79902. }
  79903. return false;
  79904. }
  79905. videoUnderflow_({
  79906. videoBuffered,
  79907. audioBuffered,
  79908. currentTime
  79909. }) {
  79910. if (!videoBuffered) {
  79911. return;
  79912. }
  79913. let gap;
  79914. if (videoBuffered.length && audioBuffered.length) {
  79915. const lastVideoRange = findRange$1(videoBuffered, currentTime - 3);
  79916. const videoRange = findRange$1(videoBuffered, currentTime);
  79917. const audioRange = findRange$1(audioBuffered, currentTime);
  79918. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  79919. gap = {
  79920. start: lastVideoRange.end(0),
  79921. end: audioRange.end(0)
  79922. };
  79923. }
  79924. } else {
  79925. const nextRange = findNextRange$1(videoBuffered, currentTime);
  79926. if (!nextRange.length) {
  79927. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  79928. }
  79929. }
  79930. if (gap) {
  79931. this.logger_(`Encountered a gap in video from ${gap.start} to ${gap.end}. Seeking to current time ${currentTime}`);
  79932. return true;
  79933. }
  79934. return false;
  79935. }
  79936. skipTheGap_(scheduledCurrentTime) {
  79937. const buffered = this.tech_.buffered();
  79938. const currentTime = this.tech_.currentTime();
  79939. const nextRange = findNextRange$1(buffered, currentTime);
  79940. this.resetTimeUpdate_();
  79941. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  79942. return;
  79943. }
  79944. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  79945. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR$1);
  79946. this.tech_.trigger({
  79947. type: "usage",
  79948. name: "vhs-gap-skip"
  79949. });
  79950. }
  79951. gapFromVideoUnderflow_(buffered, currentTime) {
  79952. const gaps = findGaps$1(buffered);
  79953. for (let i2 = 0; i2 < gaps.length; i2++) {
  79954. const start2 = gaps.start(i2);
  79955. const end = gaps.end(i2);
  79956. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  79957. return {
  79958. start: start2,
  79959. end
  79960. };
  79961. }
  79962. }
  79963. return null;
  79964. }
  79965. }
  79966. const defaultOptions$1 = {
  79967. errorInterval: 30,
  79968. getSource(next) {
  79969. const tech = this.tech({
  79970. IWillNotUseThisInPlugins: true
  79971. });
  79972. const sourceObj = tech.currentSource_ || this.currentSource();
  79973. return next(sourceObj);
  79974. }
  79975. };
  79976. const initPlugin$2 = function(player, options2) {
  79977. let lastCalled = 0;
  79978. let seekTo = 0;
  79979. const localOptions = merge$2(defaultOptions$1, options2);
  79980. player.ready(() => {
  79981. player.trigger({
  79982. type: "usage",
  79983. name: "vhs-error-reload-initialized"
  79984. });
  79985. });
  79986. const loadedMetadataHandler = function() {
  79987. if (seekTo) {
  79988. player.currentTime(seekTo);
  79989. }
  79990. };
  79991. const setSource2 = function(sourceObj) {
  79992. if (sourceObj === null || sourceObj === void 0) {
  79993. return;
  79994. }
  79995. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  79996. player.one("loadedmetadata", loadedMetadataHandler);
  79997. player.src(sourceObj);
  79998. player.trigger({
  79999. type: "usage",
  80000. name: "vhs-error-reload"
  80001. });
  80002. player.play();
  80003. };
  80004. const errorHandler = function() {
  80005. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  80006. player.trigger({
  80007. type: "usage",
  80008. name: "vhs-error-reload-canceled"
  80009. });
  80010. return;
  80011. }
  80012. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  80013. videojs$2.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  80014. return;
  80015. }
  80016. lastCalled = Date.now();
  80017. return localOptions.getSource.call(player, setSource2);
  80018. };
  80019. const cleanupEvents = function() {
  80020. player.off("loadedmetadata", loadedMetadataHandler);
  80021. player.off("error", errorHandler);
  80022. player.off("dispose", cleanupEvents);
  80023. };
  80024. const reinitPlugin = function(newOptions) {
  80025. cleanupEvents();
  80026. initPlugin$2(player, newOptions);
  80027. };
  80028. player.on("error", errorHandler);
  80029. player.on("dispose", cleanupEvents);
  80030. player.reloadSourceOnError = reinitPlugin;
  80031. };
  80032. const reloadSourceOnError$1 = function(options2) {
  80033. initPlugin$2(this, options2);
  80034. };
  80035. var version$4$1 = "3.0.2";
  80036. var version$3$1 = "6.3.0";
  80037. var version$2$1 = "1.0.1";
  80038. var version$1$2 = "6.0.0";
  80039. var version$7 = "4.0.1";
  80040. const Vhs$2 = {
  80041. PlaylistLoader: PlaylistLoader$1,
  80042. Playlist: Playlist$1,
  80043. utils: utils$1,
  80044. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector$1,
  80045. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector$1,
  80046. lastBandwidthSelector: lastBandwidthSelector$1,
  80047. movingAverageBandwidthSelector: movingAverageBandwidthSelector$1,
  80048. comparePlaylistBandwidth: comparePlaylistBandwidth$1,
  80049. comparePlaylistResolution: comparePlaylistResolution$1,
  80050. xhr: xhrFactory$1()
  80051. };
  80052. Object.keys(Config$1).forEach((prop) => {
  80053. Object.defineProperty(Vhs$2, prop, {
  80054. get() {
  80055. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  80056. return Config$1[prop];
  80057. },
  80058. set(value) {
  80059. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  80060. if (typeof value !== "number" || value < 0) {
  80061. videojs$2.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);
  80062. return;
  80063. }
  80064. Config$1[prop] = value;
  80065. }
  80066. });
  80067. });
  80068. const LOCAL_STORAGE_KEY$2 = "videojs-vhs";
  80069. const handleVhsMediaChange$1 = function(qualityLevels2, playlistLoader) {
  80070. const newPlaylist = playlistLoader.media();
  80071. let selectedIndex = -1;
  80072. for (let i2 = 0; i2 < qualityLevels2.length; i2++) {
  80073. if (qualityLevels2[i2].id === newPlaylist.id) {
  80074. selectedIndex = i2;
  80075. break;
  80076. }
  80077. }
  80078. qualityLevels2.selectedIndex_ = selectedIndex;
  80079. qualityLevels2.trigger({
  80080. selectedIndex,
  80081. type: "change"
  80082. });
  80083. };
  80084. const handleVhsLoadedMetadata$1 = function(qualityLevels2, vhs) {
  80085. vhs.representations().forEach((rep2) => {
  80086. qualityLevels2.addQualityLevel(rep2);
  80087. });
  80088. handleVhsMediaChange$1(qualityLevels2, vhs.playlists);
  80089. };
  80090. Vhs$2.canPlaySource = function() {
  80091. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  80092. };
  80093. const emeKeySystems$1 = (keySystemOptions, mainPlaylist, audioPlaylist) => {
  80094. if (!keySystemOptions) {
  80095. return keySystemOptions;
  80096. }
  80097. let codecs = {};
  80098. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  80099. codecs = unwrapCodecList$1(parseCodecs$1(mainPlaylist.attributes.CODECS));
  80100. }
  80101. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  80102. codecs.audio = audioPlaylist.attributes.CODECS;
  80103. }
  80104. const videoContentType = getMimeForCodec$1(codecs.video);
  80105. const audioContentType = getMimeForCodec$1(codecs.audio);
  80106. const keySystemContentTypes = {};
  80107. for (const keySystem in keySystemOptions) {
  80108. keySystemContentTypes[keySystem] = {};
  80109. if (audioContentType) {
  80110. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  80111. }
  80112. if (videoContentType) {
  80113. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  80114. }
  80115. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  80116. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  80117. }
  80118. if (typeof keySystemOptions[keySystem] === "string") {
  80119. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  80120. }
  80121. }
  80122. return merge$2(keySystemOptions, keySystemContentTypes);
  80123. };
  80124. const getAllPsshKeySystemsOptions$1 = (playlists, keySystems) => {
  80125. return playlists.reduce((keySystemsArr, playlist) => {
  80126. if (!playlist.contentProtection) {
  80127. return keySystemsArr;
  80128. }
  80129. const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {
  80130. const keySystemOptions = playlist.contentProtection[keySystem];
  80131. if (keySystemOptions && keySystemOptions.pssh) {
  80132. keySystemsObj[keySystem] = {
  80133. pssh: keySystemOptions.pssh
  80134. };
  80135. }
  80136. return keySystemsObj;
  80137. }, {});
  80138. if (Object.keys(keySystemsOptions).length) {
  80139. keySystemsArr.push(keySystemsOptions);
  80140. }
  80141. return keySystemsArr;
  80142. }, []);
  80143. };
  80144. const waitForKeySessionCreation$1 = ({
  80145. player,
  80146. sourceKeySystems,
  80147. audioMedia,
  80148. mainPlaylists
  80149. }) => {
  80150. if (!player.eme.initializeMediaKeys) {
  80151. return Promise.resolve();
  80152. }
  80153. const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  80154. const keySystemsOptionsArr = getAllPsshKeySystemsOptions$1(playlists, Object.keys(sourceKeySystems));
  80155. const initializationFinishedPromises = [];
  80156. const keySessionCreatedPromises = [];
  80157. keySystemsOptionsArr.forEach((keySystemsOptions) => {
  80158. keySessionCreatedPromises.push(new Promise((resolve2, reject2) => {
  80159. player.tech_.one("keysessioncreated", resolve2);
  80160. }));
  80161. initializationFinishedPromises.push(new Promise((resolve2, reject2) => {
  80162. player.eme.initializeMediaKeys({
  80163. keySystems: keySystemsOptions
  80164. }, (err) => {
  80165. if (err) {
  80166. reject2(err);
  80167. return;
  80168. }
  80169. resolve2();
  80170. });
  80171. }));
  80172. });
  80173. return Promise.race([
  80174. Promise.all(initializationFinishedPromises),
  80175. Promise.race(keySessionCreatedPromises)
  80176. ]);
  80177. };
  80178. const setupEmeOptions$1 = ({
  80179. player,
  80180. sourceKeySystems,
  80181. media,
  80182. audioMedia
  80183. }) => {
  80184. const sourceOptions = emeKeySystems$1(sourceKeySystems, media, audioMedia);
  80185. if (!sourceOptions) {
  80186. return false;
  80187. }
  80188. player.currentSource().keySystems = sourceOptions;
  80189. if (sourceOptions && !player.eme) {
  80190. videojs$2.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  80191. return false;
  80192. }
  80193. return true;
  80194. };
  80195. const getVhsLocalStorage$1 = () => {
  80196. if (!window_1.localStorage) {
  80197. return null;
  80198. }
  80199. const storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY$2);
  80200. if (!storedObject) {
  80201. return null;
  80202. }
  80203. try {
  80204. return JSON.parse(storedObject);
  80205. } catch (e) {
  80206. return null;
  80207. }
  80208. };
  80209. const updateVhsLocalStorage$1 = (options2) => {
  80210. if (!window_1.localStorage) {
  80211. return false;
  80212. }
  80213. let objectToStore = getVhsLocalStorage$1();
  80214. objectToStore = objectToStore ? merge$2(objectToStore, options2) : options2;
  80215. try {
  80216. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$2, JSON.stringify(objectToStore));
  80217. } catch (e) {
  80218. return false;
  80219. }
  80220. return objectToStore;
  80221. };
  80222. const expandDataUri$1 = (dataUri) => {
  80223. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  80224. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  80225. }
  80226. return dataUri;
  80227. };
  80228. Vhs$2.supportsNativeHls = function() {
  80229. if (!document_1 || !document_1.createElement) {
  80230. return false;
  80231. }
  80232. const video = document_1.createElement("video");
  80233. if (!videojs$2.getTech("Html5").isSupported()) {
  80234. return false;
  80235. }
  80236. const canPlay = [
  80237. "application/vnd.apple.mpegurl",
  80238. "audio/mpegurl",
  80239. "audio/x-mpegurl",
  80240. "application/x-mpegurl",
  80241. "video/x-mpegurl",
  80242. "video/mpegurl",
  80243. "application/mpegurl"
  80244. ];
  80245. return canPlay.some(function(canItPlay) {
  80246. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  80247. });
  80248. }();
  80249. Vhs$2.supportsNativeDash = function() {
  80250. if (!document_1 || !document_1.createElement || !videojs$2.getTech("Html5").isSupported()) {
  80251. return false;
  80252. }
  80253. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  80254. }();
  80255. Vhs$2.supportsTypeNatively = (type2) => {
  80256. if (type2 === "hls") {
  80257. return Vhs$2.supportsNativeHls;
  80258. }
  80259. if (type2 === "dash") {
  80260. return Vhs$2.supportsNativeDash;
  80261. }
  80262. return false;
  80263. };
  80264. Vhs$2.isSupported = function() {
  80265. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  80266. };
  80267. const Component$2 = videojs$2.getComponent("Component");
  80268. class VhsHandler$1 extends Component$2 {
  80269. constructor(source, tech, options2) {
  80270. super(tech, options2.vhs);
  80271. if (typeof options2.initialBandwidth === "number") {
  80272. this.options_.bandwidth = options2.initialBandwidth;
  80273. }
  80274. this.logger_ = logger$1("VhsHandler");
  80275. if (tech.options_ && tech.options_.playerId) {
  80276. const _player = videojs$2.getPlayer(tech.options_.playerId);
  80277. this.player_ = _player;
  80278. }
  80279. this.tech_ = tech;
  80280. this.source_ = source;
  80281. this.stats = {};
  80282. this.ignoreNextSeekingEvent_ = false;
  80283. this.setOptions_();
  80284. if (this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  80285. tech.overrideNativeAudioTracks(true);
  80286. tech.overrideNativeVideoTracks(true);
  80287. } else if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  80288. throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");
  80289. }
  80290. this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], (event2) => {
  80291. const fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  80292. if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {
  80293. this.playlistController_.fastQualityChange_();
  80294. } else {
  80295. this.playlistController_.checkABR_();
  80296. }
  80297. });
  80298. this.on(this.tech_, "seeking", function() {
  80299. if (this.ignoreNextSeekingEvent_) {
  80300. this.ignoreNextSeekingEvent_ = false;
  80301. return;
  80302. }
  80303. this.setCurrentTime(this.tech_.currentTime());
  80304. });
  80305. this.on(this.tech_, "error", function() {
  80306. if (this.tech_.error() && this.playlistController_) {
  80307. this.playlistController_.pauseLoading();
  80308. }
  80309. });
  80310. this.on(this.tech_, "play", this.play);
  80311. }
  80312. setOptions_() {
  80313. this.options_.withCredentials = this.options_.withCredentials || false;
  80314. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  80315. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  80316. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  80317. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  80318. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  80319. this.options_.customTagParsers = this.options_.customTagParsers || [];
  80320. this.options_.customTagMappers = this.options_.customTagMappers || [];
  80321. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  80322. this.options_.llhls = this.options_.llhls === false ? false : true;
  80323. this.options_.bufferBasedABR = this.options_.bufferBasedABR || false;
  80324. if (typeof this.options_.playlistExclusionDuration !== "number") {
  80325. this.options_.playlistExclusionDuration = 5 * 60;
  80326. }
  80327. if (typeof this.options_.bandwidth !== "number") {
  80328. if (this.options_.useBandwidthFromLocalStorage) {
  80329. const storedObject = getVhsLocalStorage$1();
  80330. if (storedObject && storedObject.bandwidth) {
  80331. this.options_.bandwidth = storedObject.bandwidth;
  80332. this.tech_.trigger({
  80333. type: "usage",
  80334. name: "vhs-bandwidth-from-local-storage"
  80335. });
  80336. }
  80337. if (storedObject && storedObject.throughput) {
  80338. this.options_.throughput = storedObject.throughput;
  80339. this.tech_.trigger({
  80340. type: "usage",
  80341. name: "vhs-throughput-from-local-storage"
  80342. });
  80343. }
  80344. }
  80345. }
  80346. if (typeof this.options_.bandwidth !== "number") {
  80347. this.options_.bandwidth = Config$1.INITIAL_BANDWIDTH;
  80348. }
  80349. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config$1.INITIAL_BANDWIDTH;
  80350. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "customTagParsers", "customTagMappers", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "bufferBasedABR", "liveRangeSafeTimeDelta", "llhls", "useNetworkInformationApi", "useDtsForTimestampOffset", "exactManifestTimings", "leastPixelDiffSelector"].forEach((option) => {
  80351. if (typeof this.source_[option] !== "undefined") {
  80352. this.options_[option] = this.source_[option];
  80353. }
  80354. });
  80355. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  80356. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  80357. }
  80358. src(src, type2) {
  80359. if (!src) {
  80360. return;
  80361. }
  80362. this.setOptions_();
  80363. this.options_.src = expandDataUri$1(this.source_.src);
  80364. this.options_.tech = this.tech_;
  80365. this.options_.externVhs = Vhs$2;
  80366. this.options_.sourceType = simpleTypeFromSourceType$1(type2);
  80367. this.options_.seekTo = (time) => {
  80368. this.tech_.setCurrentTime(time);
  80369. };
  80370. this.playlistController_ = new PlaylistController(this.options_);
  80371. const playbackWatcherOptions = merge$2({
  80372. liveRangeSafeTimeDelta: SAFE_TIME_DELTA$1
  80373. }, this.options_, {
  80374. seekable: () => this.seekable(),
  80375. media: () => this.playlistController_.media(),
  80376. playlistController: this.playlistController_
  80377. });
  80378. this.playbackWatcher_ = new PlaybackWatcher$1(playbackWatcherOptions);
  80379. this.playlistController_.on("error", () => {
  80380. const player = videojs$2.players[this.tech_.options_.playerId];
  80381. let error = this.playlistController_.error;
  80382. if (typeof error === "object" && !error.code) {
  80383. error.code = 3;
  80384. } else if (typeof error === "string") {
  80385. error = {
  80386. message: error,
  80387. code: 3
  80388. };
  80389. }
  80390. player.error(error);
  80391. });
  80392. const defaultSelector = this.options_.bufferBasedABR ? Vhs$2.movingAverageBandwidthSelector(0.55) : Vhs$2.STANDARD_PLAYLIST_SELECTOR;
  80393. this.playlistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  80394. this.playlistController_.selectInitialPlaylist = Vhs$2.INITIAL_PLAYLIST_SELECTOR.bind(this);
  80395. this.playlists = this.playlistController_.mainPlaylistLoader_;
  80396. this.mediaSource = this.playlistController_.mediaSource;
  80397. Object.defineProperties(this, {
  80398. selectPlaylist: {
  80399. get() {
  80400. return this.playlistController_.selectPlaylist;
  80401. },
  80402. set(selectPlaylist) {
  80403. this.playlistController_.selectPlaylist = selectPlaylist.bind(this);
  80404. }
  80405. },
  80406. throughput: {
  80407. get() {
  80408. return this.playlistController_.mainSegmentLoader_.throughput.rate;
  80409. },
  80410. set(throughput) {
  80411. this.playlistController_.mainSegmentLoader_.throughput.rate = throughput;
  80412. this.playlistController_.mainSegmentLoader_.throughput.count = 1;
  80413. }
  80414. },
  80415. bandwidth: {
  80416. get() {
  80417. let playerBandwidthEst = this.playlistController_.mainSegmentLoader_.bandwidth;
  80418. const networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  80419. const tenMbpsAsBitsPerSecond = 1e7;
  80420. if (this.options_.useNetworkInformationApi && networkInformation) {
  80421. const networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  80422. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  80423. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  80424. } else {
  80425. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  80426. }
  80427. }
  80428. return playerBandwidthEst;
  80429. },
  80430. set(bandwidth2) {
  80431. this.playlistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  80432. this.playlistController_.mainSegmentLoader_.throughput = {
  80433. rate: 0,
  80434. count: 0
  80435. };
  80436. }
  80437. },
  80438. systemBandwidth: {
  80439. get() {
  80440. const invBandwidth = 1 / (this.bandwidth || 1);
  80441. let invThroughput;
  80442. if (this.throughput > 0) {
  80443. invThroughput = 1 / this.throughput;
  80444. } else {
  80445. invThroughput = 0;
  80446. }
  80447. const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  80448. return systemBitrate;
  80449. },
  80450. set() {
  80451. videojs$2.log.error('The "systemBandwidth" property is read-only');
  80452. }
  80453. }
  80454. });
  80455. if (this.options_.bandwidth) {
  80456. this.bandwidth = this.options_.bandwidth;
  80457. }
  80458. if (this.options_.throughput) {
  80459. this.throughput = this.options_.throughput;
  80460. }
  80461. Object.defineProperties(this.stats, {
  80462. bandwidth: {
  80463. get: () => this.bandwidth || 0,
  80464. enumerable: true
  80465. },
  80466. mediaRequests: {
  80467. get: () => this.playlistController_.mediaRequests_() || 0,
  80468. enumerable: true
  80469. },
  80470. mediaRequestsAborted: {
  80471. get: () => this.playlistController_.mediaRequestsAborted_() || 0,
  80472. enumerable: true
  80473. },
  80474. mediaRequestsTimedout: {
  80475. get: () => this.playlistController_.mediaRequestsTimedout_() || 0,
  80476. enumerable: true
  80477. },
  80478. mediaRequestsErrored: {
  80479. get: () => this.playlistController_.mediaRequestsErrored_() || 0,
  80480. enumerable: true
  80481. },
  80482. mediaTransferDuration: {
  80483. get: () => this.playlistController_.mediaTransferDuration_() || 0,
  80484. enumerable: true
  80485. },
  80486. mediaBytesTransferred: {
  80487. get: () => this.playlistController_.mediaBytesTransferred_() || 0,
  80488. enumerable: true
  80489. },
  80490. mediaSecondsLoaded: {
  80491. get: () => this.playlistController_.mediaSecondsLoaded_() || 0,
  80492. enumerable: true
  80493. },
  80494. mediaAppends: {
  80495. get: () => this.playlistController_.mediaAppends_() || 0,
  80496. enumerable: true
  80497. },
  80498. mainAppendsToLoadedData: {
  80499. get: () => this.playlistController_.mainAppendsToLoadedData_() || 0,
  80500. enumerable: true
  80501. },
  80502. audioAppendsToLoadedData: {
  80503. get: () => this.playlistController_.audioAppendsToLoadedData_() || 0,
  80504. enumerable: true
  80505. },
  80506. appendsToLoadedData: {
  80507. get: () => this.playlistController_.appendsToLoadedData_() || 0,
  80508. enumerable: true
  80509. },
  80510. timeToLoadedData: {
  80511. get: () => this.playlistController_.timeToLoadedData_() || 0,
  80512. enumerable: true
  80513. },
  80514. buffered: {
  80515. get: () => timeRangesToArray$1(this.tech_.buffered()),
  80516. enumerable: true
  80517. },
  80518. currentTime: {
  80519. get: () => this.tech_.currentTime(),
  80520. enumerable: true
  80521. },
  80522. currentSource: {
  80523. get: () => this.tech_.currentSource_,
  80524. enumerable: true
  80525. },
  80526. currentTech: {
  80527. get: () => this.tech_.name_,
  80528. enumerable: true
  80529. },
  80530. duration: {
  80531. get: () => this.tech_.duration(),
  80532. enumerable: true
  80533. },
  80534. main: {
  80535. get: () => this.playlists.main,
  80536. enumerable: true
  80537. },
  80538. playerDimensions: {
  80539. get: () => this.tech_.currentDimensions(),
  80540. enumerable: true
  80541. },
  80542. seekable: {
  80543. get: () => timeRangesToArray$1(this.tech_.seekable()),
  80544. enumerable: true
  80545. },
  80546. timestamp: {
  80547. get: () => Date.now(),
  80548. enumerable: true
  80549. },
  80550. videoPlaybackQuality: {
  80551. get: () => this.tech_.getVideoPlaybackQuality(),
  80552. enumerable: true
  80553. }
  80554. });
  80555. this.tech_.one("canplay", this.playlistController_.setupFirstPlay.bind(this.playlistController_));
  80556. this.tech_.on("bandwidthupdate", () => {
  80557. if (this.options_.useBandwidthFromLocalStorage) {
  80558. updateVhsLocalStorage$1({
  80559. bandwidth: this.bandwidth,
  80560. throughput: Math.round(this.throughput)
  80561. });
  80562. }
  80563. });
  80564. this.playlistController_.on("selectedinitialmedia", () => {
  80565. renditionSelectionMixin$1(this);
  80566. });
  80567. this.playlistController_.sourceUpdater_.on("createdsourcebuffers", () => {
  80568. this.setupEme_();
  80569. });
  80570. this.on(this.playlistController_, "progress", function() {
  80571. this.tech_.trigger("progress");
  80572. });
  80573. this.on(this.playlistController_, "firstplay", function() {
  80574. this.ignoreNextSeekingEvent_ = true;
  80575. });
  80576. this.setupQualityLevels_();
  80577. if (!this.tech_.el()) {
  80578. return;
  80579. }
  80580. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.playlistController_.mediaSource);
  80581. this.tech_.src(this.mediaSourceUrl_);
  80582. }
  80583. createKeySessions_() {
  80584. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80585. this.logger_("waiting for EME key session creation");
  80586. waitForKeySessionCreation$1({
  80587. player: this.player_,
  80588. sourceKeySystems: this.source_.keySystems,
  80589. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  80590. mainPlaylists: this.playlists.main.playlists
  80591. }).then(() => {
  80592. this.logger_("created EME key session");
  80593. this.playlistController_.sourceUpdater_.initializedEme();
  80594. }).catch((err) => {
  80595. this.logger_("error while creating EME key session", err);
  80596. this.player_.error({
  80597. message: "Failed to initialize media keys for EME",
  80598. code: 3
  80599. });
  80600. });
  80601. }
  80602. handleWaitingForKey_() {
  80603. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  80604. this.createKeySessions_();
  80605. }
  80606. setupEme_() {
  80607. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80608. const didSetupEmeOptions = setupEmeOptions$1({
  80609. player: this.player_,
  80610. sourceKeySystems: this.source_.keySystems,
  80611. media: this.playlists.media(),
  80612. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  80613. });
  80614. this.player_.tech_.on("keystatuschange", (e) => {
  80615. if (e.status !== "output-restricted") {
  80616. return;
  80617. }
  80618. const mainPlaylist = this.playlistController_.main();
  80619. if (!mainPlaylist || !mainPlaylist.playlists) {
  80620. return;
  80621. }
  80622. const excludedHDPlaylists = [];
  80623. mainPlaylist.playlists.forEach((playlist) => {
  80624. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  80625. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  80626. playlist.excludeUntil = Infinity;
  80627. excludedHDPlaylists.push(playlist);
  80628. }
  80629. }
  80630. });
  80631. if (excludedHDPlaylists.length) {
  80632. 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);
  80633. this.playlistController_.fastQualityChange_();
  80634. }
  80635. });
  80636. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  80637. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  80638. if (videojs$2.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  80639. this.playlistController_.sourceUpdater_.initializedEme();
  80640. return;
  80641. }
  80642. this.createKeySessions_();
  80643. }
  80644. setupQualityLevels_() {
  80645. const player = videojs$2.players[this.tech_.options_.playerId];
  80646. if (!player || !player.qualityLevels || this.qualityLevels_) {
  80647. return;
  80648. }
  80649. this.qualityLevels_ = player.qualityLevels();
  80650. this.playlistController_.on("selectedinitialmedia", () => {
  80651. handleVhsLoadedMetadata$1(this.qualityLevels_, this);
  80652. });
  80653. this.playlists.on("mediachange", () => {
  80654. handleVhsMediaChange$1(this.qualityLevels_, this.playlists);
  80655. });
  80656. }
  80657. static version() {
  80658. return {
  80659. "@videojs/http-streaming": version$4$1,
  80660. "mux.js": version$3$1,
  80661. "mpd-parser": version$2$1,
  80662. "m3u8-parser": version$1$2,
  80663. "aes-decrypter": version$7
  80664. };
  80665. }
  80666. version() {
  80667. return this.constructor.version();
  80668. }
  80669. canChangeType() {
  80670. return SourceUpdater$1.canChangeType();
  80671. }
  80672. play() {
  80673. this.playlistController_.play();
  80674. }
  80675. setCurrentTime(currentTime) {
  80676. this.playlistController_.setCurrentTime(currentTime);
  80677. }
  80678. duration() {
  80679. return this.playlistController_.duration();
  80680. }
  80681. seekable() {
  80682. return this.playlistController_.seekable();
  80683. }
  80684. dispose() {
  80685. if (this.playbackWatcher_) {
  80686. this.playbackWatcher_.dispose();
  80687. }
  80688. if (this.playlistController_) {
  80689. this.playlistController_.dispose();
  80690. }
  80691. if (this.qualityLevels_) {
  80692. this.qualityLevels_.dispose();
  80693. }
  80694. if (this.tech_ && this.tech_.vhs) {
  80695. delete this.tech_.vhs;
  80696. }
  80697. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  80698. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  80699. this.mediaSourceUrl_ = null;
  80700. }
  80701. if (this.tech_) {
  80702. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  80703. }
  80704. super.dispose();
  80705. }
  80706. convertToProgramTime(time, callback2) {
  80707. return getProgramTime$1({
  80708. playlist: this.playlistController_.media(),
  80709. time,
  80710. callback: callback2
  80711. });
  80712. }
  80713. seekToProgramTime(programTime, callback2, pauseAfterSeek = true, retryCount = 2) {
  80714. return seekToProgramTime$1({
  80715. programTime,
  80716. playlist: this.playlistController_.media(),
  80717. retryCount,
  80718. pauseAfterSeek,
  80719. seekTo: this.options_.seekTo,
  80720. tech: this.options_.tech,
  80721. callback: callback2
  80722. });
  80723. }
  80724. }
  80725. const VhsSourceHandler$1 = {
  80726. name: "videojs-http-streaming",
  80727. VERSION: version$4$1,
  80728. canHandleSource(srcObj, options2 = {}) {
  80729. const localOptions = merge$2(videojs$2.options, options2);
  80730. return VhsSourceHandler$1.canPlayType(srcObj.type, localOptions);
  80731. },
  80732. handleSource(source, tech, options2 = {}) {
  80733. const localOptions = merge$2(videojs$2.options, options2);
  80734. tech.vhs = new VhsHandler$1(source, tech, localOptions);
  80735. tech.vhs.xhr = xhrFactory$1();
  80736. tech.vhs.src(source.src, source.type);
  80737. return tech.vhs;
  80738. },
  80739. canPlayType(type2, options2) {
  80740. const simpleType = simpleTypeFromSourceType$1(type2);
  80741. if (!simpleType) {
  80742. return "";
  80743. }
  80744. const overrideNative = VhsSourceHandler$1.getOverrideNative(options2);
  80745. const supportsTypeNatively = Vhs$2.supportsTypeNatively(simpleType);
  80746. const canUseMsePlayback = !supportsTypeNatively || overrideNative;
  80747. return canUseMsePlayback ? "maybe" : "";
  80748. },
  80749. getOverrideNative(options2 = {}) {
  80750. const {
  80751. vhs = {}
  80752. } = options2;
  80753. const defaultOverrideNative = !(videojs$2.browser.IS_ANY_SAFARI || videojs$2.browser.IS_IOS);
  80754. const {
  80755. overrideNative = defaultOverrideNative
  80756. } = vhs;
  80757. return overrideNative;
  80758. }
  80759. };
  80760. const supportsNativeMediaSources$1 = () => {
  80761. return browserSupportsCodec$1("avc1.4d400d,mp4a.40.2");
  80762. };
  80763. if (supportsNativeMediaSources$1()) {
  80764. videojs$2.getTech("Html5").registerSourceHandler(VhsSourceHandler$1, 0);
  80765. }
  80766. videojs$2.VhsHandler = VhsHandler$1;
  80767. videojs$2.VhsSourceHandler = VhsSourceHandler$1;
  80768. videojs$2.Vhs = Vhs$2;
  80769. if (!videojs$2.use) {
  80770. videojs$2.registerComponent("Vhs", Vhs$2);
  80771. }
  80772. videojs$2.options.vhs = videojs$2.options.vhs || {};
  80773. if (!videojs$2.getPlugin || !videojs$2.getPlugin("reloadSourceOnError")) {
  80774. videojs$2.registerPlugin("reloadSourceOnError", reloadSourceOnError$1);
  80775. }
  80776. var videoJs = "";
  80777. function _assertThisInitialized(self2) {
  80778. if (self2 === void 0) {
  80779. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  80780. }
  80781. return self2;
  80782. }
  80783. function _setPrototypeOf(o, p) {
  80784. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  80785. o2.__proto__ = p2;
  80786. return o2;
  80787. };
  80788. return _setPrototypeOf(o, p);
  80789. }
  80790. function _inheritsLoose(subClass, superClass) {
  80791. subClass.prototype = Object.create(superClass.prototype);
  80792. subClass.prototype.constructor = subClass;
  80793. _setPrototypeOf(subClass, superClass);
  80794. }
  80795. function _isNativeReflectConstruct() {
  80796. if (typeof Reflect === "undefined" || !Reflect.construct)
  80797. return false;
  80798. if (Reflect.construct.sham)
  80799. return false;
  80800. if (typeof Proxy === "function")
  80801. return true;
  80802. try {
  80803. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  80804. }));
  80805. return true;
  80806. } catch (e) {
  80807. return false;
  80808. }
  80809. }
  80810. function _construct(Parent, args, Class) {
  80811. if (_isNativeReflectConstruct()) {
  80812. _construct = Reflect.construct.bind();
  80813. } else {
  80814. _construct = function _construct2(Parent2, args2, Class2) {
  80815. var a = [null];
  80816. a.push.apply(a, args2);
  80817. var Constructor = Function.bind.apply(Parent2, a);
  80818. var instance = new Constructor();
  80819. if (Class2)
  80820. _setPrototypeOf(instance, Class2.prototype);
  80821. return instance;
  80822. };
  80823. }
  80824. return _construct.apply(null, arguments);
  80825. }
  80826. function _inherits(subClass, superClass) {
  80827. if (typeof superClass !== "function" && superClass !== null) {
  80828. throw new TypeError("Super expression must either be null or a function");
  80829. }
  80830. subClass.prototype = Object.create(superClass && superClass.prototype, {
  80831. constructor: {
  80832. value: subClass,
  80833. writable: true,
  80834. configurable: true
  80835. }
  80836. });
  80837. Object.defineProperty(subClass, "prototype", {
  80838. writable: false
  80839. });
  80840. if (superClass)
  80841. _setPrototypeOf(subClass, superClass);
  80842. }
  80843. var DEFAULT_LOCATION = "http://example.com";
  80844. var resolveUrl$1 = function resolveUrl3(baseUrl, relativeUrl) {
  80845. if (/^[a-z]+:/i.test(relativeUrl)) {
  80846. return relativeUrl;
  80847. }
  80848. if (/^data:/.test(baseUrl)) {
  80849. baseUrl = window_1.location && window_1.location.href || "";
  80850. }
  80851. var nativeURL = typeof window_1.URL === "function";
  80852. var protocolLess = /^\/\//.test(baseUrl);
  80853. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  80854. if (nativeURL) {
  80855. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION);
  80856. } else if (!/\/\//i.test(baseUrl)) {
  80857. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  80858. }
  80859. if (nativeURL) {
  80860. var newUrl = new URL(relativeUrl, baseUrl);
  80861. if (removeLocation) {
  80862. return newUrl.href.slice(DEFAULT_LOCATION.length);
  80863. } else if (protocolLess) {
  80864. return newUrl.href.slice(newUrl.protocol.length);
  80865. }
  80866. return newUrl.href;
  80867. }
  80868. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  80869. };
  80870. var Stream = /* @__PURE__ */ function() {
  80871. function Stream2() {
  80872. this.listeners = {};
  80873. }
  80874. var _proto = Stream2.prototype;
  80875. _proto.on = function on3(type2, listener) {
  80876. if (!this.listeners[type2]) {
  80877. this.listeners[type2] = [];
  80878. }
  80879. this.listeners[type2].push(listener);
  80880. };
  80881. _proto.off = function off2(type2, listener) {
  80882. if (!this.listeners[type2]) {
  80883. return false;
  80884. }
  80885. var index2 = this.listeners[type2].indexOf(listener);
  80886. this.listeners[type2] = this.listeners[type2].slice(0);
  80887. this.listeners[type2].splice(index2, 1);
  80888. return index2 > -1;
  80889. };
  80890. _proto.trigger = function trigger2(type2) {
  80891. var callbacks = this.listeners[type2];
  80892. if (!callbacks) {
  80893. return;
  80894. }
  80895. if (arguments.length === 2) {
  80896. var length = callbacks.length;
  80897. for (var i2 = 0; i2 < length; ++i2) {
  80898. callbacks[i2].call(this, arguments[1]);
  80899. }
  80900. } else {
  80901. var args = Array.prototype.slice.call(arguments, 1);
  80902. var _length = callbacks.length;
  80903. for (var _i = 0; _i < _length; ++_i) {
  80904. callbacks[_i].apply(this, args);
  80905. }
  80906. }
  80907. };
  80908. _proto.dispose = function dispose() {
  80909. this.listeners = {};
  80910. };
  80911. _proto.pipe = function pipe(destination2) {
  80912. this.on("data", function(data) {
  80913. destination2.push(data);
  80914. });
  80915. };
  80916. return Stream2;
  80917. }();
  80918. var atob3 = function atob4(s) {
  80919. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  80920. };
  80921. function decodeB64ToUint8Array(b64Text) {
  80922. var decodedString = atob3(b64Text);
  80923. var array = new Uint8Array(decodedString.length);
  80924. for (var i2 = 0; i2 < decodedString.length; i2++) {
  80925. array[i2] = decodedString.charCodeAt(i2);
  80926. }
  80927. return array;
  80928. }
  80929. /*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */
  80930. var LineStream = /* @__PURE__ */ function(_Stream) {
  80931. _inheritsLoose(LineStream2, _Stream);
  80932. function LineStream2() {
  80933. var _this;
  80934. _this = _Stream.call(this) || this;
  80935. _this.buffer = "";
  80936. return _this;
  80937. }
  80938. var _proto = LineStream2.prototype;
  80939. _proto.push = function push(data) {
  80940. var nextNewline;
  80941. this.buffer += data;
  80942. nextNewline = this.buffer.indexOf("\n");
  80943. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  80944. this.trigger("data", this.buffer.substring(0, nextNewline));
  80945. this.buffer = this.buffer.substring(nextNewline + 1);
  80946. }
  80947. };
  80948. return LineStream2;
  80949. }(Stream);
  80950. var TAB = String.fromCharCode(9);
  80951. var parseByterange = function parseByterange2(byterangeString) {
  80952. var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  80953. var result = {};
  80954. if (match[1]) {
  80955. result.length = parseInt(match[1], 10);
  80956. }
  80957. if (match[2]) {
  80958. result.offset = parseInt(match[2], 10);
  80959. }
  80960. return result;
  80961. };
  80962. var attributeSeparator = function attributeSeparator2() {
  80963. var key = "[^=]*";
  80964. var value = '"[^"]*"|[^,]*';
  80965. var keyvalue = "(?:" + key + ")=(?:" + value + ")";
  80966. return new RegExp("(?:^|,)(" + keyvalue + ")");
  80967. };
  80968. var parseAttributes$1 = function parseAttributes(attributes) {
  80969. var attrs = attributes.split(attributeSeparator());
  80970. var result = {};
  80971. var i2 = attrs.length;
  80972. var attr;
  80973. while (i2--) {
  80974. if (attrs[i2] === "") {
  80975. continue;
  80976. }
  80977. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  80978. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  80979. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  80980. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  80981. result[attr[0]] = attr[1];
  80982. }
  80983. return result;
  80984. };
  80985. var ParseStream = /* @__PURE__ */ function(_Stream) {
  80986. _inheritsLoose(ParseStream2, _Stream);
  80987. function ParseStream2() {
  80988. var _this;
  80989. _this = _Stream.call(this) || this;
  80990. _this.customParsers = [];
  80991. _this.tagMappers = [];
  80992. return _this;
  80993. }
  80994. var _proto = ParseStream2.prototype;
  80995. _proto.push = function push(line) {
  80996. var _this2 = this;
  80997. var match;
  80998. var event2;
  80999. line = line.trim();
  81000. if (line.length === 0) {
  81001. return;
  81002. }
  81003. if (line[0] !== "#") {
  81004. this.trigger("data", {
  81005. type: "uri",
  81006. uri: line
  81007. });
  81008. return;
  81009. }
  81010. var newLines = this.tagMappers.reduce(function(acc, mapper) {
  81011. var mappedLine = mapper(line);
  81012. if (mappedLine === line) {
  81013. return acc;
  81014. }
  81015. return acc.concat([mappedLine]);
  81016. }, [line]);
  81017. newLines.forEach(function(newLine) {
  81018. for (var i2 = 0; i2 < _this2.customParsers.length; i2++) {
  81019. if (_this2.customParsers[i2].call(_this2, newLine)) {
  81020. return;
  81021. }
  81022. }
  81023. if (newLine.indexOf("#EXT") !== 0) {
  81024. _this2.trigger("data", {
  81025. type: "comment",
  81026. text: newLine.slice(1)
  81027. });
  81028. return;
  81029. }
  81030. newLine = newLine.replace("\r", "");
  81031. match = /^#EXTM3U/.exec(newLine);
  81032. if (match) {
  81033. _this2.trigger("data", {
  81034. type: "tag",
  81035. tagType: "m3u"
  81036. });
  81037. return;
  81038. }
  81039. match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine);
  81040. if (match) {
  81041. event2 = {
  81042. type: "tag",
  81043. tagType: "inf"
  81044. };
  81045. if (match[1]) {
  81046. event2.duration = parseFloat(match[1]);
  81047. }
  81048. if (match[2]) {
  81049. event2.title = match[2];
  81050. }
  81051. _this2.trigger("data", event2);
  81052. return;
  81053. }
  81054. match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine);
  81055. if (match) {
  81056. event2 = {
  81057. type: "tag",
  81058. tagType: "targetduration"
  81059. };
  81060. if (match[1]) {
  81061. event2.duration = parseInt(match[1], 10);
  81062. }
  81063. _this2.trigger("data", event2);
  81064. return;
  81065. }
  81066. match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine);
  81067. if (match) {
  81068. event2 = {
  81069. type: "tag",
  81070. tagType: "version"
  81071. };
  81072. if (match[1]) {
  81073. event2.version = parseInt(match[1], 10);
  81074. }
  81075. _this2.trigger("data", event2);
  81076. return;
  81077. }
  81078. match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  81079. if (match) {
  81080. event2 = {
  81081. type: "tag",
  81082. tagType: "media-sequence"
  81083. };
  81084. if (match[1]) {
  81085. event2.number = parseInt(match[1], 10);
  81086. }
  81087. _this2.trigger("data", event2);
  81088. return;
  81089. }
  81090. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  81091. if (match) {
  81092. event2 = {
  81093. type: "tag",
  81094. tagType: "discontinuity-sequence"
  81095. };
  81096. if (match[1]) {
  81097. event2.number = parseInt(match[1], 10);
  81098. }
  81099. _this2.trigger("data", event2);
  81100. return;
  81101. }
  81102. match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine);
  81103. if (match) {
  81104. event2 = {
  81105. type: "tag",
  81106. tagType: "playlist-type"
  81107. };
  81108. if (match[1]) {
  81109. event2.playlistType = match[1];
  81110. }
  81111. _this2.trigger("data", event2);
  81112. return;
  81113. }
  81114. match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine);
  81115. if (match) {
  81116. event2 = _extends$2(parseByterange(match[1]), {
  81117. type: "tag",
  81118. tagType: "byterange"
  81119. });
  81120. _this2.trigger("data", event2);
  81121. return;
  81122. }
  81123. match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine);
  81124. if (match) {
  81125. event2 = {
  81126. type: "tag",
  81127. tagType: "allow-cache"
  81128. };
  81129. if (match[1]) {
  81130. event2.allowed = !/NO/.test(match[1]);
  81131. }
  81132. _this2.trigger("data", event2);
  81133. return;
  81134. }
  81135. match = /^#EXT-X-MAP:?(.*)$/.exec(newLine);
  81136. if (match) {
  81137. event2 = {
  81138. type: "tag",
  81139. tagType: "map"
  81140. };
  81141. if (match[1]) {
  81142. var attributes = parseAttributes$1(match[1]);
  81143. if (attributes.URI) {
  81144. event2.uri = attributes.URI;
  81145. }
  81146. if (attributes.BYTERANGE) {
  81147. event2.byterange = parseByterange(attributes.BYTERANGE);
  81148. }
  81149. }
  81150. _this2.trigger("data", event2);
  81151. return;
  81152. }
  81153. match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine);
  81154. if (match) {
  81155. event2 = {
  81156. type: "tag",
  81157. tagType: "stream-inf"
  81158. };
  81159. if (match[1]) {
  81160. event2.attributes = parseAttributes$1(match[1]);
  81161. if (event2.attributes.RESOLUTION) {
  81162. var split2 = event2.attributes.RESOLUTION.split("x");
  81163. var resolution = {};
  81164. if (split2[0]) {
  81165. resolution.width = parseInt(split2[0], 10);
  81166. }
  81167. if (split2[1]) {
  81168. resolution.height = parseInt(split2[1], 10);
  81169. }
  81170. event2.attributes.RESOLUTION = resolution;
  81171. }
  81172. if (event2.attributes.BANDWIDTH) {
  81173. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  81174. }
  81175. if (event2.attributes["FRAME-RATE"]) {
  81176. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  81177. }
  81178. if (event2.attributes["PROGRAM-ID"]) {
  81179. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  81180. }
  81181. }
  81182. _this2.trigger("data", event2);
  81183. return;
  81184. }
  81185. match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine);
  81186. if (match) {
  81187. event2 = {
  81188. type: "tag",
  81189. tagType: "media"
  81190. };
  81191. if (match[1]) {
  81192. event2.attributes = parseAttributes$1(match[1]);
  81193. }
  81194. _this2.trigger("data", event2);
  81195. return;
  81196. }
  81197. match = /^#EXT-X-ENDLIST/.exec(newLine);
  81198. if (match) {
  81199. _this2.trigger("data", {
  81200. type: "tag",
  81201. tagType: "endlist"
  81202. });
  81203. return;
  81204. }
  81205. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  81206. if (match) {
  81207. _this2.trigger("data", {
  81208. type: "tag",
  81209. tagType: "discontinuity"
  81210. });
  81211. return;
  81212. }
  81213. match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine);
  81214. if (match) {
  81215. event2 = {
  81216. type: "tag",
  81217. tagType: "program-date-time"
  81218. };
  81219. if (match[1]) {
  81220. event2.dateTimeString = match[1];
  81221. event2.dateTimeObject = new Date(match[1]);
  81222. }
  81223. _this2.trigger("data", event2);
  81224. return;
  81225. }
  81226. match = /^#EXT-X-KEY:?(.*)$/.exec(newLine);
  81227. if (match) {
  81228. event2 = {
  81229. type: "tag",
  81230. tagType: "key"
  81231. };
  81232. if (match[1]) {
  81233. event2.attributes = parseAttributes$1(match[1]);
  81234. if (event2.attributes.IV) {
  81235. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  81236. event2.attributes.IV = event2.attributes.IV.substring(2);
  81237. }
  81238. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  81239. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  81240. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  81241. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  81242. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  81243. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  81244. }
  81245. }
  81246. _this2.trigger("data", event2);
  81247. return;
  81248. }
  81249. match = /^#EXT-X-START:?(.*)$/.exec(newLine);
  81250. if (match) {
  81251. event2 = {
  81252. type: "tag",
  81253. tagType: "start"
  81254. };
  81255. if (match[1]) {
  81256. event2.attributes = parseAttributes$1(match[1]);
  81257. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  81258. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  81259. }
  81260. _this2.trigger("data", event2);
  81261. return;
  81262. }
  81263. match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine);
  81264. if (match) {
  81265. event2 = {
  81266. type: "tag",
  81267. tagType: "cue-out-cont"
  81268. };
  81269. if (match[1]) {
  81270. event2.data = match[1];
  81271. } else {
  81272. event2.data = "";
  81273. }
  81274. _this2.trigger("data", event2);
  81275. return;
  81276. }
  81277. match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine);
  81278. if (match) {
  81279. event2 = {
  81280. type: "tag",
  81281. tagType: "cue-out"
  81282. };
  81283. if (match[1]) {
  81284. event2.data = match[1];
  81285. } else {
  81286. event2.data = "";
  81287. }
  81288. _this2.trigger("data", event2);
  81289. return;
  81290. }
  81291. match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine);
  81292. if (match) {
  81293. event2 = {
  81294. type: "tag",
  81295. tagType: "cue-in"
  81296. };
  81297. if (match[1]) {
  81298. event2.data = match[1];
  81299. } else {
  81300. event2.data = "";
  81301. }
  81302. _this2.trigger("data", event2);
  81303. return;
  81304. }
  81305. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  81306. if (match && match[1]) {
  81307. event2 = {
  81308. type: "tag",
  81309. tagType: "skip"
  81310. };
  81311. event2.attributes = parseAttributes$1(match[1]);
  81312. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  81313. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  81314. }
  81315. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  81316. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB);
  81317. }
  81318. _this2.trigger("data", event2);
  81319. return;
  81320. }
  81321. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  81322. if (match && match[1]) {
  81323. event2 = {
  81324. type: "tag",
  81325. tagType: "part"
  81326. };
  81327. event2.attributes = parseAttributes$1(match[1]);
  81328. ["DURATION"].forEach(function(key) {
  81329. if (event2.attributes.hasOwnProperty(key)) {
  81330. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81331. }
  81332. });
  81333. ["INDEPENDENT", "GAP"].forEach(function(key) {
  81334. if (event2.attributes.hasOwnProperty(key)) {
  81335. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81336. }
  81337. });
  81338. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  81339. event2.attributes.byterange = parseByterange(event2.attributes.BYTERANGE);
  81340. }
  81341. _this2.trigger("data", event2);
  81342. return;
  81343. }
  81344. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  81345. if (match && match[1]) {
  81346. event2 = {
  81347. type: "tag",
  81348. tagType: "server-control"
  81349. };
  81350. event2.attributes = parseAttributes$1(match[1]);
  81351. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  81352. if (event2.attributes.hasOwnProperty(key)) {
  81353. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81354. }
  81355. });
  81356. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  81357. if (event2.attributes.hasOwnProperty(key)) {
  81358. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81359. }
  81360. });
  81361. _this2.trigger("data", event2);
  81362. return;
  81363. }
  81364. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  81365. if (match && match[1]) {
  81366. event2 = {
  81367. type: "tag",
  81368. tagType: "part-inf"
  81369. };
  81370. event2.attributes = parseAttributes$1(match[1]);
  81371. ["PART-TARGET"].forEach(function(key) {
  81372. if (event2.attributes.hasOwnProperty(key)) {
  81373. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81374. }
  81375. });
  81376. _this2.trigger("data", event2);
  81377. return;
  81378. }
  81379. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  81380. if (match && match[1]) {
  81381. event2 = {
  81382. type: "tag",
  81383. tagType: "preload-hint"
  81384. };
  81385. event2.attributes = parseAttributes$1(match[1]);
  81386. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  81387. if (event2.attributes.hasOwnProperty(key)) {
  81388. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81389. var subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  81390. event2.attributes.byterange = event2.attributes.byterange || {};
  81391. event2.attributes.byterange[subkey] = event2.attributes[key];
  81392. delete event2.attributes[key];
  81393. }
  81394. });
  81395. _this2.trigger("data", event2);
  81396. return;
  81397. }
  81398. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  81399. if (match && match[1]) {
  81400. event2 = {
  81401. type: "tag",
  81402. tagType: "rendition-report"
  81403. };
  81404. event2.attributes = parseAttributes$1(match[1]);
  81405. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  81406. if (event2.attributes.hasOwnProperty(key)) {
  81407. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81408. }
  81409. });
  81410. _this2.trigger("data", event2);
  81411. return;
  81412. }
  81413. _this2.trigger("data", {
  81414. type: "tag",
  81415. data: newLine.slice(4)
  81416. });
  81417. });
  81418. };
  81419. _proto.addParser = function addParser(_ref) {
  81420. var _this3 = this;
  81421. var expression = _ref.expression, customType = _ref.customType, dataParser = _ref.dataParser, segment = _ref.segment;
  81422. if (typeof dataParser !== "function") {
  81423. dataParser = function dataParser2(line) {
  81424. return line;
  81425. };
  81426. }
  81427. this.customParsers.push(function(line) {
  81428. var match = expression.exec(line);
  81429. if (match) {
  81430. _this3.trigger("data", {
  81431. type: "custom",
  81432. data: dataParser(line),
  81433. customType,
  81434. segment
  81435. });
  81436. return true;
  81437. }
  81438. });
  81439. };
  81440. _proto.addTagMapper = function addTagMapper(_ref2) {
  81441. var expression = _ref2.expression, map = _ref2.map;
  81442. var mapFn = function mapFn2(line) {
  81443. if (expression.test(line)) {
  81444. return map(line);
  81445. }
  81446. return line;
  81447. };
  81448. this.tagMappers.push(mapFn);
  81449. };
  81450. return ParseStream2;
  81451. }(Stream);
  81452. var camelCase = function camelCase2(str) {
  81453. return str.toLowerCase().replace(/-(\w)/g, function(a) {
  81454. return a[1].toUpperCase();
  81455. });
  81456. };
  81457. var camelCaseKeys = function camelCaseKeys2(attributes) {
  81458. var result = {};
  81459. Object.keys(attributes).forEach(function(key) {
  81460. result[camelCase(key)] = attributes[key];
  81461. });
  81462. return result;
  81463. };
  81464. var setHoldBack = function setHoldBack2(manifest) {
  81465. var serverControl = manifest.serverControl, targetDuration = manifest.targetDuration, partTargetDuration = manifest.partTargetDuration;
  81466. if (!serverControl) {
  81467. return;
  81468. }
  81469. var tag = "#EXT-X-SERVER-CONTROL";
  81470. var hb = "holdBack";
  81471. var phb = "partHoldBack";
  81472. var minTargetDuration = targetDuration && targetDuration * 3;
  81473. var minPartDuration = partTargetDuration && partTargetDuration * 2;
  81474. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  81475. serverControl[hb] = minTargetDuration;
  81476. this.trigger("info", {
  81477. message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")."
  81478. });
  81479. }
  81480. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  81481. this.trigger("warn", {
  81482. message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")"
  81483. });
  81484. serverControl[hb] = minTargetDuration;
  81485. }
  81486. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  81487. serverControl[phb] = partTargetDuration * 3;
  81488. this.trigger("info", {
  81489. message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")."
  81490. });
  81491. }
  81492. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  81493. this.trigger("warn", {
  81494. message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")."
  81495. });
  81496. serverControl[phb] = minPartDuration;
  81497. }
  81498. };
  81499. var Parser = /* @__PURE__ */ function(_Stream) {
  81500. _inheritsLoose(Parser2, _Stream);
  81501. function Parser2() {
  81502. var _this;
  81503. _this = _Stream.call(this) || this;
  81504. _this.lineStream = new LineStream();
  81505. _this.parseStream = new ParseStream();
  81506. _this.lineStream.pipe(_this.parseStream);
  81507. var self2 = _assertThisInitialized(_this);
  81508. var uris = [];
  81509. var currentUri = {};
  81510. var currentMap;
  81511. var _key;
  81512. var hasParts = false;
  81513. var noop2 = function noop3() {
  81514. };
  81515. var defaultMediaGroups = {
  81516. "AUDIO": {},
  81517. "VIDEO": {},
  81518. "CLOSED-CAPTIONS": {},
  81519. "SUBTITLES": {}
  81520. };
  81521. var widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  81522. var currentTimeline = 0;
  81523. _this.manifest = {
  81524. allowCache: true,
  81525. discontinuityStarts: [],
  81526. segments: []
  81527. };
  81528. var lastByterangeEnd = 0;
  81529. var lastPartByterangeEnd = 0;
  81530. _this.on("end", function() {
  81531. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  81532. return;
  81533. }
  81534. if (!currentUri.map && currentMap) {
  81535. currentUri.map = currentMap;
  81536. }
  81537. if (!currentUri.key && _key) {
  81538. currentUri.key = _key;
  81539. }
  81540. if (!currentUri.timeline && typeof currentTimeline === "number") {
  81541. currentUri.timeline = currentTimeline;
  81542. }
  81543. _this.manifest.preloadSegment = currentUri;
  81544. });
  81545. _this.parseStream.on("data", function(entry) {
  81546. var mediaGroup;
  81547. var rendition;
  81548. ({
  81549. tag: function tag() {
  81550. ({
  81551. version: function version2() {
  81552. if (entry.version) {
  81553. this.manifest.version = entry.version;
  81554. }
  81555. },
  81556. "allow-cache": function allowCache() {
  81557. this.manifest.allowCache = entry.allowed;
  81558. if (!("allowed" in entry)) {
  81559. this.trigger("info", {
  81560. message: "defaulting allowCache to YES"
  81561. });
  81562. this.manifest.allowCache = true;
  81563. }
  81564. },
  81565. byterange: function byterange() {
  81566. var byterange2 = {};
  81567. if ("length" in entry) {
  81568. currentUri.byterange = byterange2;
  81569. byterange2.length = entry.length;
  81570. if (!("offset" in entry)) {
  81571. entry.offset = lastByterangeEnd;
  81572. }
  81573. }
  81574. if ("offset" in entry) {
  81575. currentUri.byterange = byterange2;
  81576. byterange2.offset = entry.offset;
  81577. }
  81578. lastByterangeEnd = byterange2.offset + byterange2.length;
  81579. },
  81580. endlist: function endlist() {
  81581. this.manifest.endList = true;
  81582. },
  81583. inf: function inf() {
  81584. if (!("mediaSequence" in this.manifest)) {
  81585. this.manifest.mediaSequence = 0;
  81586. this.trigger("info", {
  81587. message: "defaulting media sequence to zero"
  81588. });
  81589. }
  81590. if (!("discontinuitySequence" in this.manifest)) {
  81591. this.manifest.discontinuitySequence = 0;
  81592. this.trigger("info", {
  81593. message: "defaulting discontinuity sequence to zero"
  81594. });
  81595. }
  81596. if (entry.duration > 0) {
  81597. currentUri.duration = entry.duration;
  81598. }
  81599. if (entry.duration === 0) {
  81600. currentUri.duration = 0.01;
  81601. this.trigger("info", {
  81602. message: "updating zero segment duration to a small value"
  81603. });
  81604. }
  81605. this.manifest.segments = uris;
  81606. },
  81607. key: function key() {
  81608. if (!entry.attributes) {
  81609. this.trigger("warn", {
  81610. message: "ignoring key declaration without attribute list"
  81611. });
  81612. return;
  81613. }
  81614. if (entry.attributes.METHOD === "NONE") {
  81615. _key = null;
  81616. return;
  81617. }
  81618. if (!entry.attributes.URI) {
  81619. this.trigger("warn", {
  81620. message: "ignoring key declaration without URI"
  81621. });
  81622. return;
  81623. }
  81624. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  81625. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81626. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  81627. attributes: entry.attributes
  81628. };
  81629. return;
  81630. }
  81631. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  81632. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81633. this.manifest.contentProtection["com.microsoft.playready"] = {
  81634. uri: entry.attributes.URI
  81635. };
  81636. return;
  81637. }
  81638. if (entry.attributes.KEYFORMAT === widevineUuid) {
  81639. var VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  81640. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  81641. this.trigger("warn", {
  81642. message: "invalid key method provided for Widevine"
  81643. });
  81644. return;
  81645. }
  81646. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  81647. this.trigger("warn", {
  81648. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  81649. });
  81650. }
  81651. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  81652. this.trigger("warn", {
  81653. message: "invalid key URI provided for Widevine"
  81654. });
  81655. return;
  81656. }
  81657. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  81658. this.trigger("warn", {
  81659. message: "invalid key ID provided for Widevine"
  81660. });
  81661. return;
  81662. }
  81663. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81664. this.manifest.contentProtection["com.widevine.alpha"] = {
  81665. attributes: {
  81666. schemeIdUri: entry.attributes.KEYFORMAT,
  81667. keyId: entry.attributes.KEYID.substring(2)
  81668. },
  81669. pssh: decodeB64ToUint8Array(entry.attributes.URI.split(",")[1])
  81670. };
  81671. return;
  81672. }
  81673. if (!entry.attributes.METHOD) {
  81674. this.trigger("warn", {
  81675. message: "defaulting key method to AES-128"
  81676. });
  81677. }
  81678. _key = {
  81679. method: entry.attributes.METHOD || "AES-128",
  81680. uri: entry.attributes.URI
  81681. };
  81682. if (typeof entry.attributes.IV !== "undefined") {
  81683. _key.iv = entry.attributes.IV;
  81684. }
  81685. },
  81686. "media-sequence": function mediaSequence() {
  81687. if (!isFinite(entry.number)) {
  81688. this.trigger("warn", {
  81689. message: "ignoring invalid media sequence: " + entry.number
  81690. });
  81691. return;
  81692. }
  81693. this.manifest.mediaSequence = entry.number;
  81694. },
  81695. "discontinuity-sequence": function discontinuitySequence() {
  81696. if (!isFinite(entry.number)) {
  81697. this.trigger("warn", {
  81698. message: "ignoring invalid discontinuity sequence: " + entry.number
  81699. });
  81700. return;
  81701. }
  81702. this.manifest.discontinuitySequence = entry.number;
  81703. currentTimeline = entry.number;
  81704. },
  81705. "playlist-type": function playlistType() {
  81706. if (!/VOD|EVENT/.test(entry.playlistType)) {
  81707. this.trigger("warn", {
  81708. message: "ignoring unknown playlist type: " + entry.playlist
  81709. });
  81710. return;
  81711. }
  81712. this.manifest.playlistType = entry.playlistType;
  81713. },
  81714. map: function map() {
  81715. currentMap = {};
  81716. if (entry.uri) {
  81717. currentMap.uri = entry.uri;
  81718. }
  81719. if (entry.byterange) {
  81720. currentMap.byterange = entry.byterange;
  81721. }
  81722. if (_key) {
  81723. currentMap.key = _key;
  81724. }
  81725. },
  81726. "stream-inf": function streamInf() {
  81727. this.manifest.playlists = uris;
  81728. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81729. if (!entry.attributes) {
  81730. this.trigger("warn", {
  81731. message: "ignoring empty stream-inf attributes"
  81732. });
  81733. return;
  81734. }
  81735. if (!currentUri.attributes) {
  81736. currentUri.attributes = {};
  81737. }
  81738. _extends$2(currentUri.attributes, entry.attributes);
  81739. },
  81740. media: function media() {
  81741. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81742. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  81743. this.trigger("warn", {
  81744. message: "ignoring incomplete or missing media group"
  81745. });
  81746. return;
  81747. }
  81748. var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  81749. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  81750. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  81751. rendition = {
  81752. default: /yes/i.test(entry.attributes.DEFAULT)
  81753. };
  81754. if (rendition.default) {
  81755. rendition.autoselect = true;
  81756. } else {
  81757. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  81758. }
  81759. if (entry.attributes.LANGUAGE) {
  81760. rendition.language = entry.attributes.LANGUAGE;
  81761. }
  81762. if (entry.attributes.URI) {
  81763. rendition.uri = entry.attributes.URI;
  81764. }
  81765. if (entry.attributes["INSTREAM-ID"]) {
  81766. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  81767. }
  81768. if (entry.attributes.CHARACTERISTICS) {
  81769. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  81770. }
  81771. if (entry.attributes.FORCED) {
  81772. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  81773. }
  81774. mediaGroup[entry.attributes.NAME] = rendition;
  81775. },
  81776. discontinuity: function discontinuity() {
  81777. currentTimeline += 1;
  81778. currentUri.discontinuity = true;
  81779. this.manifest.discontinuityStarts.push(uris.length);
  81780. },
  81781. "program-date-time": function programDateTime() {
  81782. if (typeof this.manifest.dateTimeString === "undefined") {
  81783. this.manifest.dateTimeString = entry.dateTimeString;
  81784. this.manifest.dateTimeObject = entry.dateTimeObject;
  81785. }
  81786. currentUri.dateTimeString = entry.dateTimeString;
  81787. currentUri.dateTimeObject = entry.dateTimeObject;
  81788. },
  81789. targetduration: function targetduration() {
  81790. if (!isFinite(entry.duration) || entry.duration < 0) {
  81791. this.trigger("warn", {
  81792. message: "ignoring invalid target duration: " + entry.duration
  81793. });
  81794. return;
  81795. }
  81796. this.manifest.targetDuration = entry.duration;
  81797. setHoldBack.call(this, this.manifest);
  81798. },
  81799. start: function start2() {
  81800. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  81801. this.trigger("warn", {
  81802. message: "ignoring start declaration without appropriate attribute list"
  81803. });
  81804. return;
  81805. }
  81806. this.manifest.start = {
  81807. timeOffset: entry.attributes["TIME-OFFSET"],
  81808. precise: entry.attributes.PRECISE
  81809. };
  81810. },
  81811. "cue-out": function cueOut() {
  81812. currentUri.cueOut = entry.data;
  81813. },
  81814. "cue-out-cont": function cueOutCont() {
  81815. currentUri.cueOutCont = entry.data;
  81816. },
  81817. "cue-in": function cueIn() {
  81818. currentUri.cueIn = entry.data;
  81819. },
  81820. "skip": function skip() {
  81821. this.manifest.skip = camelCaseKeys(entry.attributes);
  81822. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  81823. },
  81824. "part": function part() {
  81825. var _this2 = this;
  81826. hasParts = true;
  81827. var segmentIndex = this.manifest.segments.length;
  81828. var part2 = camelCaseKeys(entry.attributes);
  81829. currentUri.parts = currentUri.parts || [];
  81830. currentUri.parts.push(part2);
  81831. if (part2.byterange) {
  81832. if (!part2.byterange.hasOwnProperty("offset")) {
  81833. part2.byterange.offset = lastPartByterangeEnd;
  81834. }
  81835. lastPartByterangeEnd = part2.byterange.offset + part2.byterange.length;
  81836. }
  81837. var partIndex = currentUri.parts.length - 1;
  81838. this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ["URI", "DURATION"]);
  81839. if (this.manifest.renditionReports) {
  81840. this.manifest.renditionReports.forEach(function(r2, i2) {
  81841. if (!r2.hasOwnProperty("lastPart")) {
  81842. _this2.trigger("warn", {
  81843. message: "#EXT-X-RENDITION-REPORT #" + i2 + " lacks required attribute(s): LAST-PART"
  81844. });
  81845. }
  81846. });
  81847. }
  81848. },
  81849. "server-control": function serverControl() {
  81850. var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes);
  81851. if (!attrs.hasOwnProperty("canBlockReload")) {
  81852. attrs.canBlockReload = false;
  81853. this.trigger("info", {
  81854. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  81855. });
  81856. }
  81857. setHoldBack.call(this, this.manifest);
  81858. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  81859. this.trigger("warn", {
  81860. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  81861. });
  81862. }
  81863. },
  81864. "preload-hint": function preloadHint() {
  81865. var segmentIndex = this.manifest.segments.length;
  81866. var hint = camelCaseKeys(entry.attributes);
  81867. var isPart = hint.type && hint.type === "PART";
  81868. currentUri.preloadHints = currentUri.preloadHints || [];
  81869. currentUri.preloadHints.push(hint);
  81870. if (hint.byterange) {
  81871. if (!hint.byterange.hasOwnProperty("offset")) {
  81872. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  81873. if (isPart) {
  81874. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  81875. }
  81876. }
  81877. }
  81878. var index2 = currentUri.preloadHints.length - 1;
  81879. this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex, entry.attributes, ["TYPE", "URI"]);
  81880. if (!hint.type) {
  81881. return;
  81882. }
  81883. for (var i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  81884. var otherHint = currentUri.preloadHints[i2];
  81885. if (!otherHint.type) {
  81886. continue;
  81887. }
  81888. if (otherHint.type === hint.type) {
  81889. this.trigger("warn", {
  81890. message: "#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i2
  81891. });
  81892. }
  81893. }
  81894. },
  81895. "rendition-report": function renditionReport() {
  81896. var report = camelCaseKeys(entry.attributes);
  81897. this.manifest.renditionReports = this.manifest.renditionReports || [];
  81898. this.manifest.renditionReports.push(report);
  81899. var index2 = this.manifest.renditionReports.length - 1;
  81900. var required = ["LAST-MSN", "URI"];
  81901. if (hasParts) {
  81902. required.push("LAST-PART");
  81903. }
  81904. this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index2, entry.attributes, required);
  81905. },
  81906. "part-inf": function partInf() {
  81907. this.manifest.partInf = camelCaseKeys(entry.attributes);
  81908. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  81909. if (this.manifest.partInf.partTarget) {
  81910. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  81911. }
  81912. setHoldBack.call(this, this.manifest);
  81913. }
  81914. }[entry.tagType] || noop2).call(self2);
  81915. },
  81916. uri: function uri() {
  81917. currentUri.uri = entry.uri;
  81918. uris.push(currentUri);
  81919. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  81920. this.trigger("warn", {
  81921. message: "defaulting segment duration to the target duration"
  81922. });
  81923. currentUri.duration = this.manifest.targetDuration;
  81924. }
  81925. if (_key) {
  81926. currentUri.key = _key;
  81927. }
  81928. currentUri.timeline = currentTimeline;
  81929. if (currentMap) {
  81930. currentUri.map = currentMap;
  81931. }
  81932. lastPartByterangeEnd = 0;
  81933. currentUri = {};
  81934. },
  81935. comment: function comment() {
  81936. },
  81937. custom: function custom() {
  81938. if (entry.segment) {
  81939. currentUri.custom = currentUri.custom || {};
  81940. currentUri.custom[entry.customType] = entry.data;
  81941. } else {
  81942. this.manifest.custom = this.manifest.custom || {};
  81943. this.manifest.custom[entry.customType] = entry.data;
  81944. }
  81945. }
  81946. })[entry.type].call(self2);
  81947. });
  81948. return _this;
  81949. }
  81950. var _proto = Parser2.prototype;
  81951. _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) {
  81952. var missing = [];
  81953. required.forEach(function(key) {
  81954. if (!attributes.hasOwnProperty(key)) {
  81955. missing.push(key);
  81956. }
  81957. });
  81958. if (missing.length) {
  81959. this.trigger("warn", {
  81960. message: identifier + " lacks required attribute(s): " + missing.join(", ")
  81961. });
  81962. }
  81963. };
  81964. _proto.push = function push(chunk) {
  81965. this.lineStream.push(chunk);
  81966. };
  81967. _proto.end = function end() {
  81968. this.lineStream.push("\n");
  81969. this.trigger("end");
  81970. };
  81971. _proto.addParser = function addParser(options2) {
  81972. this.parseStream.addParser(options2);
  81973. };
  81974. _proto.addTagMapper = function addTagMapper(options2) {
  81975. this.parseStream.addTagMapper(options2);
  81976. };
  81977. return Parser2;
  81978. }(Stream);
  81979. var regexs = {
  81980. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  81981. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  81982. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  81983. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  81984. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  81985. text: /^(stpp.ttml.im1t)/,
  81986. muxerVideo: /^(avc0?1)/,
  81987. muxerAudio: /^(mp4a)/,
  81988. muxerText: /a^/
  81989. };
  81990. var mediaTypes = ["video", "audio", "text"];
  81991. var upperMediaTypes = ["Video", "Audio", "Text"];
  81992. var translateLegacyCodec2 = function translateLegacyCodec3(codec) {
  81993. if (!codec) {
  81994. return codec;
  81995. }
  81996. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  81997. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  81998. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  81999. return "avc1." + profileHex + "00" + avcLevelHex;
  82000. });
  82001. };
  82002. var parseCodecs2 = function parseCodecs3(codecString) {
  82003. if (codecString === void 0) {
  82004. codecString = "";
  82005. }
  82006. var codecs = codecString.split(",");
  82007. var result = [];
  82008. codecs.forEach(function(codec) {
  82009. codec = codec.trim();
  82010. var codecType;
  82011. mediaTypes.forEach(function(name) {
  82012. var match = regexs[name].exec(codec.toLowerCase());
  82013. if (!match || match.length <= 1) {
  82014. return;
  82015. }
  82016. codecType = name;
  82017. var type2 = codec.substring(0, match[1].length);
  82018. var details = codec.replace(type2, "");
  82019. result.push({
  82020. type: type2,
  82021. details,
  82022. mediaType: name
  82023. });
  82024. });
  82025. if (!codecType) {
  82026. result.push({
  82027. type: codec,
  82028. details: "",
  82029. mediaType: "unknown"
  82030. });
  82031. }
  82032. });
  82033. return result;
  82034. };
  82035. var codecsFromDefault2 = function codecsFromDefault3(master, audioGroupId) {
  82036. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  82037. return null;
  82038. }
  82039. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  82040. if (!audioGroup) {
  82041. return null;
  82042. }
  82043. for (var name in audioGroup) {
  82044. var audioType = audioGroup[name];
  82045. if (audioType.default && audioType.playlists) {
  82046. return parseCodecs2(audioType.playlists[0].attributes.CODECS);
  82047. }
  82048. }
  82049. return null;
  82050. };
  82051. var isAudioCodec2 = function isAudioCodec3(codec) {
  82052. if (codec === void 0) {
  82053. codec = "";
  82054. }
  82055. return regexs.audio.test(codec.trim().toLowerCase());
  82056. };
  82057. var isTextCodec2 = function isTextCodec3(codec) {
  82058. if (codec === void 0) {
  82059. codec = "";
  82060. }
  82061. return regexs.text.test(codec.trim().toLowerCase());
  82062. };
  82063. var getMimeForCodec2 = function getMimeForCodec3(codecString) {
  82064. if (!codecString || typeof codecString !== "string") {
  82065. return;
  82066. }
  82067. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  82068. return translateLegacyCodec2(c.trim());
  82069. });
  82070. var type2 = "video";
  82071. if (codecs.length === 1 && isAudioCodec2(codecs[0])) {
  82072. type2 = "audio";
  82073. } else if (codecs.length === 1 && isTextCodec2(codecs[0])) {
  82074. type2 = "application";
  82075. }
  82076. var container = "mp4";
  82077. if (codecs.every(function(c) {
  82078. return regexs.mp4.test(c);
  82079. })) {
  82080. container = "mp4";
  82081. } else if (codecs.every(function(c) {
  82082. return regexs.webm.test(c);
  82083. })) {
  82084. container = "webm";
  82085. } else if (codecs.every(function(c) {
  82086. return regexs.ogg.test(c);
  82087. })) {
  82088. container = "ogg";
  82089. }
  82090. return type2 + "/" + container + ';codecs="' + codecString + '"';
  82091. };
  82092. var browserSupportsCodec2 = function browserSupportsCodec3(codecString) {
  82093. if (codecString === void 0) {
  82094. codecString = "";
  82095. }
  82096. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec2(codecString)) || false;
  82097. };
  82098. var muxerSupportsCodec2 = function muxerSupportsCodec3(codecString) {
  82099. if (codecString === void 0) {
  82100. codecString = "";
  82101. }
  82102. return codecString.toLowerCase().split(",").every(function(codec) {
  82103. codec = codec.trim();
  82104. for (var i2 = 0; i2 < upperMediaTypes.length; i2++) {
  82105. var type2 = upperMediaTypes[i2];
  82106. if (regexs["muxer" + type2].test(codec)) {
  82107. return true;
  82108. }
  82109. }
  82110. return false;
  82111. });
  82112. };
  82113. var DEFAULT_AUDIO_CODEC = "mp4a.40.2";
  82114. var DEFAULT_VIDEO_CODEC = "avc1.4d400d";
  82115. var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  82116. var DASH_REGEX = /^application\/dash\+xml/i;
  82117. var simpleTypeFromSourceType2 = function simpleTypeFromSourceType3(type2) {
  82118. if (MPEGURL_REGEX.test(type2)) {
  82119. return "hls";
  82120. }
  82121. if (DASH_REGEX.test(type2)) {
  82122. return "dash";
  82123. }
  82124. if (type2 === "application/vnd.videojs.vhs+json") {
  82125. return "vhs-json";
  82126. }
  82127. return null;
  82128. };
  82129. var countBits2 = function countBits3(x) {
  82130. return x.toString(2).length;
  82131. };
  82132. var countBytes2 = function countBytes3(x) {
  82133. return Math.ceil(countBits2(x) / 8);
  82134. };
  82135. var isArrayBufferView2 = function isArrayBufferView3(obj) {
  82136. if (ArrayBuffer.isView === "function") {
  82137. return ArrayBuffer.isView(obj);
  82138. }
  82139. return obj && obj.buffer instanceof ArrayBuffer;
  82140. };
  82141. var isTypedArray2 = function isTypedArray3(obj) {
  82142. return isArrayBufferView2(obj);
  82143. };
  82144. var toUint82 = function toUint83(bytes) {
  82145. if (bytes instanceof Uint8Array) {
  82146. return bytes;
  82147. }
  82148. if (!Array.isArray(bytes) && !isTypedArray2(bytes) && !(bytes instanceof ArrayBuffer)) {
  82149. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  82150. bytes = 0;
  82151. } else {
  82152. bytes = [bytes];
  82153. }
  82154. }
  82155. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  82156. };
  82157. var BigInt = window_1.BigInt || Number;
  82158. var BYTE_TABLE = [BigInt("0x1"), BigInt("0x100"), BigInt("0x10000"), BigInt("0x1000000"), BigInt("0x100000000"), BigInt("0x10000000000"), BigInt("0x1000000000000"), BigInt("0x100000000000000"), BigInt("0x10000000000000000")];
  82159. (function() {
  82160. var a = new Uint16Array([65484]);
  82161. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  82162. if (b[0] === 255) {
  82163. return "big";
  82164. }
  82165. if (b[0] === 204) {
  82166. return "little";
  82167. }
  82168. return "unknown";
  82169. })();
  82170. var bytesToNumber2 = function bytesToNumber3(bytes, _temp) {
  82171. 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;
  82172. bytes = toUint82(bytes);
  82173. var fn2 = le ? "reduce" : "reduceRight";
  82174. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  82175. var number = obj.call(bytes, function(total, byte, i2) {
  82176. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82177. return total + BigInt(byte) * BYTE_TABLE[exponent];
  82178. }, BigInt(0));
  82179. if (signed) {
  82180. var max2 = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);
  82181. number = BigInt(number);
  82182. if (number > max2) {
  82183. number -= max2;
  82184. number -= max2;
  82185. number -= BigInt(2);
  82186. }
  82187. }
  82188. return Number(number);
  82189. };
  82190. var numberToBytes2 = function numberToBytes3(number, _temp2) {
  82191. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  82192. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  82193. number = 0;
  82194. }
  82195. number = BigInt(number);
  82196. var byteCount = countBytes2(number);
  82197. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  82198. for (var i2 = 0; i2 < byteCount; i2++) {
  82199. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82200. bytes[byteIndex] = Number(number / BYTE_TABLE[i2] & BigInt(255));
  82201. if (number < 0) {
  82202. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  82203. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  82204. }
  82205. }
  82206. return bytes;
  82207. };
  82208. var stringToBytes2 = function stringToBytes3(string, stringIsBytes) {
  82209. if (typeof string !== "string" && string && typeof string.toString === "function") {
  82210. string = string.toString();
  82211. }
  82212. if (typeof string !== "string") {
  82213. return new Uint8Array();
  82214. }
  82215. if (!stringIsBytes) {
  82216. string = unescape(encodeURIComponent(string));
  82217. }
  82218. var view = new Uint8Array(string.length);
  82219. for (var i2 = 0; i2 < string.length; i2++) {
  82220. view[i2] = string.charCodeAt(i2);
  82221. }
  82222. return view;
  82223. };
  82224. var concatTypedArrays2 = function concatTypedArrays3() {
  82225. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  82226. buffers[_key] = arguments[_key];
  82227. }
  82228. buffers = buffers.filter(function(b) {
  82229. return b && (b.byteLength || b.length) && typeof b !== "string";
  82230. });
  82231. if (buffers.length <= 1) {
  82232. return toUint82(buffers[0]);
  82233. }
  82234. var totalLen = buffers.reduce(function(total, buf, i2) {
  82235. return total + (buf.byteLength || buf.length);
  82236. }, 0);
  82237. var tempBuffer = new Uint8Array(totalLen);
  82238. var offset = 0;
  82239. buffers.forEach(function(buf) {
  82240. buf = toUint82(buf);
  82241. tempBuffer.set(buf, offset);
  82242. offset += buf.byteLength;
  82243. });
  82244. return tempBuffer;
  82245. };
  82246. var bytesMatch2 = function bytesMatch3(a, b, _temp3) {
  82247. 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;
  82248. a = toUint82(a);
  82249. b = toUint82(b);
  82250. var fn2 = b.every ? b.every : Array.prototype.every;
  82251. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  82252. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  82253. return bByte === aByte;
  82254. });
  82255. };
  82256. var forEachMediaGroup$1 = function forEachMediaGroup2(master, groups, callback2) {
  82257. groups.forEach(function(mediaType) {
  82258. for (var groupKey in master.mediaGroups[mediaType]) {
  82259. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  82260. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  82261. callback2(mediaProperties, mediaType, groupKey, labelKey);
  82262. }
  82263. }
  82264. });
  82265. };
  82266. /*! @name mpd-parser @version 0.22.1 @license Apache-2.0 */
  82267. var isObject$1 = function isObject(obj) {
  82268. return !!obj && typeof obj === "object";
  82269. };
  82270. var merge = function merge2() {
  82271. for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
  82272. objects[_key] = arguments[_key];
  82273. }
  82274. return objects.reduce(function(result, source) {
  82275. if (typeof source !== "object") {
  82276. return result;
  82277. }
  82278. Object.keys(source).forEach(function(key) {
  82279. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  82280. result[key] = result[key].concat(source[key]);
  82281. } else if (isObject$1(result[key]) && isObject$1(source[key])) {
  82282. result[key] = merge2(result[key], source[key]);
  82283. } else {
  82284. result[key] = source[key];
  82285. }
  82286. });
  82287. return result;
  82288. }, {});
  82289. };
  82290. var values = function values2(o) {
  82291. return Object.keys(o).map(function(k) {
  82292. return o[k];
  82293. });
  82294. };
  82295. var range = function range2(start2, end) {
  82296. var result = [];
  82297. for (var i2 = start2; i2 < end; i2++) {
  82298. result.push(i2);
  82299. }
  82300. return result;
  82301. };
  82302. var flatten = function flatten2(lists) {
  82303. return lists.reduce(function(x, y) {
  82304. return x.concat(y);
  82305. }, []);
  82306. };
  82307. var from = function from2(list) {
  82308. if (!list.length) {
  82309. return [];
  82310. }
  82311. var result = [];
  82312. for (var i2 = 0; i2 < list.length; i2++) {
  82313. result.push(list[i2]);
  82314. }
  82315. return result;
  82316. };
  82317. var findIndexes = function findIndexes2(l, key) {
  82318. return l.reduce(function(a, e, i2) {
  82319. if (e[key]) {
  82320. a.push(i2);
  82321. }
  82322. return a;
  82323. }, []);
  82324. };
  82325. var findIndex = function findIndex2(list, matchingFunction) {
  82326. for (var i2 = 0; i2 < list.length; i2++) {
  82327. if (matchingFunction(list[i2])) {
  82328. return i2;
  82329. }
  82330. }
  82331. return -1;
  82332. };
  82333. var union = function union2(lists, keyFunction) {
  82334. return values(lists.reduce(function(acc, list) {
  82335. list.forEach(function(el) {
  82336. acc[keyFunction(el)] = el;
  82337. });
  82338. return acc;
  82339. }, {}));
  82340. };
  82341. var errors = {
  82342. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  82343. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  82344. DASH_INVALID_XML: "DASH_INVALID_XML",
  82345. NO_BASE_URL: "NO_BASE_URL",
  82346. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  82347. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  82348. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  82349. };
  82350. var urlTypeToSegment = function urlTypeToSegment2(_ref) {
  82351. 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;
  82352. var segment = {
  82353. uri: source,
  82354. resolvedUri: resolveUrl$1(baseUrl || "", source)
  82355. };
  82356. if (range3 || indexRange) {
  82357. var rangeStr = range3 ? range3 : indexRange;
  82358. var ranges = rangeStr.split("-");
  82359. var startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  82360. var endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  82361. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  82362. startRange = Number(startRange);
  82363. }
  82364. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  82365. endRange = Number(endRange);
  82366. }
  82367. var length;
  82368. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  82369. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  82370. } else {
  82371. length = endRange - startRange + 1;
  82372. }
  82373. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  82374. length = Number(length);
  82375. }
  82376. segment.byterange = {
  82377. length,
  82378. offset: startRange
  82379. };
  82380. }
  82381. return segment;
  82382. };
  82383. var byteRangeToString = function byteRangeToString2(byterange) {
  82384. var endRange;
  82385. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  82386. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  82387. } else {
  82388. endRange = byterange.offset + byterange.length - 1;
  82389. }
  82390. return byterange.offset + "-" + endRange;
  82391. };
  82392. var parseEndNumber = function parseEndNumber2(endNumber) {
  82393. if (endNumber && typeof endNumber !== "number") {
  82394. endNumber = parseInt(endNumber, 10);
  82395. }
  82396. if (isNaN(endNumber)) {
  82397. return null;
  82398. }
  82399. return endNumber;
  82400. };
  82401. var segmentRange = {
  82402. static: function _static(attributes) {
  82403. var duration5 = attributes.duration, _attributes$timescale = attributes.timescale, timescale2 = _attributes$timescale === void 0 ? 1 : _attributes$timescale, sourceDuration = attributes.sourceDuration, periodDuration = attributes.periodDuration;
  82404. var endNumber = parseEndNumber(attributes.endNumber);
  82405. var segmentDuration = duration5 / timescale2;
  82406. if (typeof endNumber === "number") {
  82407. return {
  82408. start: 0,
  82409. end: endNumber
  82410. };
  82411. }
  82412. if (typeof periodDuration === "number") {
  82413. return {
  82414. start: 0,
  82415. end: periodDuration / segmentDuration
  82416. };
  82417. }
  82418. return {
  82419. start: 0,
  82420. end: sourceDuration / segmentDuration
  82421. };
  82422. },
  82423. dynamic: function dynamic(attributes) {
  82424. 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;
  82425. var endNumber = parseEndNumber(attributes.endNumber);
  82426. var now2 = (NOW + clientOffset) / 1e3;
  82427. var periodStartWC = availabilityStartTime2 + periodStart;
  82428. var periodEndWC = now2 + minimumUpdatePeriod2;
  82429. var periodDuration = periodEndWC - periodStartWC;
  82430. var segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  82431. var availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  82432. var availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  82433. return {
  82434. start: Math.max(0, availableStart),
  82435. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  82436. };
  82437. }
  82438. };
  82439. var toSegments = function toSegments2(attributes) {
  82440. return function(number) {
  82441. 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;
  82442. return {
  82443. number: startNumber2 + number,
  82444. duration: duration5 / timescale2,
  82445. timeline: periodStart,
  82446. time: number * duration5
  82447. };
  82448. };
  82449. };
  82450. var parseByDuration = function parseByDuration2(attributes) {
  82451. 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;
  82452. var _segmentRange$type = segmentRange[type2](attributes), start2 = _segmentRange$type.start, end = _segmentRange$type.end;
  82453. var segments = range(start2, end).map(toSegments(attributes));
  82454. if (type2 === "static") {
  82455. var index2 = segments.length - 1;
  82456. var sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  82457. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  82458. }
  82459. return segments;
  82460. };
  82461. var segmentsFromBase = function segmentsFromBase2(attributes) {
  82462. 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;
  82463. if (!baseUrl) {
  82464. throw new Error(errors.NO_BASE_URL);
  82465. }
  82466. var initSegment = urlTypeToSegment({
  82467. baseUrl,
  82468. source: initialization.sourceURL,
  82469. range: initialization.range
  82470. });
  82471. var segment = urlTypeToSegment({
  82472. baseUrl,
  82473. source: baseUrl,
  82474. indexRange
  82475. });
  82476. segment.map = initSegment;
  82477. if (duration5) {
  82478. var segmentTimeInfo = parseByDuration(attributes);
  82479. if (segmentTimeInfo.length) {
  82480. segment.duration = segmentTimeInfo[0].duration;
  82481. segment.timeline = segmentTimeInfo[0].timeline;
  82482. }
  82483. } else if (sourceDuration) {
  82484. segment.duration = sourceDuration;
  82485. segment.timeline = periodStart;
  82486. }
  82487. segment.presentationTime = presentationTime || periodStart;
  82488. segment.number = number;
  82489. return [segment];
  82490. };
  82491. var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) {
  82492. var initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  82493. var sourceDuration = playlist.sidx.duration;
  82494. var timeline = playlist.timeline || 0;
  82495. var sidxByteRange = playlist.sidx.byterange;
  82496. var sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  82497. var timescale2 = sidx.timescale;
  82498. var mediaReferences = sidx.references.filter(function(r2) {
  82499. return r2.referenceType !== 1;
  82500. });
  82501. var segments = [];
  82502. var type2 = playlist.endList ? "static" : "dynamic";
  82503. var periodStart = playlist.sidx.timeline;
  82504. var presentationTime = periodStart;
  82505. var number = playlist.mediaSequence || 0;
  82506. var startIndex;
  82507. if (typeof sidx.firstOffset === "bigint") {
  82508. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  82509. } else {
  82510. startIndex = sidxEnd + sidx.firstOffset;
  82511. }
  82512. for (var i2 = 0; i2 < mediaReferences.length; i2++) {
  82513. var reference = sidx.references[i2];
  82514. var size = reference.referencedSize;
  82515. var duration5 = reference.subsegmentDuration;
  82516. var endIndex = void 0;
  82517. if (typeof startIndex === "bigint") {
  82518. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  82519. } else {
  82520. endIndex = startIndex + size - 1;
  82521. }
  82522. var indexRange = startIndex + "-" + endIndex;
  82523. var attributes = {
  82524. baseUrl,
  82525. timescale: timescale2,
  82526. timeline,
  82527. periodStart,
  82528. presentationTime,
  82529. number,
  82530. duration: duration5,
  82531. sourceDuration,
  82532. indexRange,
  82533. type: type2
  82534. };
  82535. var segment = segmentsFromBase(attributes)[0];
  82536. if (initSegment) {
  82537. segment.map = initSegment;
  82538. }
  82539. segments.push(segment);
  82540. if (typeof startIndex === "bigint") {
  82541. startIndex += window_1.BigInt(size);
  82542. } else {
  82543. startIndex += size;
  82544. }
  82545. presentationTime += duration5 / timescale2;
  82546. number++;
  82547. }
  82548. playlist.segments = segments;
  82549. return playlist;
  82550. };
  82551. var SUPPORTED_MEDIA_TYPES = ["AUDIO", "SUBTITLES"];
  82552. var TIME_FUDGE = 1 / 60;
  82553. var getUniqueTimelineStarts = function getUniqueTimelineStarts2(timelineStarts) {
  82554. return union(timelineStarts, function(_ref) {
  82555. var timeline = _ref.timeline;
  82556. return timeline;
  82557. }).sort(function(a, b) {
  82558. return a.timeline > b.timeline ? 1 : -1;
  82559. });
  82560. };
  82561. var findPlaylistWithName = function findPlaylistWithName2(playlists, name) {
  82562. for (var i2 = 0; i2 < playlists.length; i2++) {
  82563. if (playlists[i2].attributes.NAME === name) {
  82564. return playlists[i2];
  82565. }
  82566. }
  82567. return null;
  82568. };
  82569. var getMediaGroupPlaylists = function getMediaGroupPlaylists2(manifest) {
  82570. var mediaGroupPlaylists = [];
  82571. forEachMediaGroup$1(manifest, SUPPORTED_MEDIA_TYPES, function(properties, type2, group, label2) {
  82572. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  82573. });
  82574. return mediaGroupPlaylists;
  82575. };
  82576. var updateMediaSequenceForPlaylist = function updateMediaSequenceForPlaylist2(_ref2) {
  82577. var playlist = _ref2.playlist, mediaSequence = _ref2.mediaSequence;
  82578. playlist.mediaSequence = mediaSequence;
  82579. playlist.segments.forEach(function(segment, index2) {
  82580. segment.number = playlist.mediaSequence + index2;
  82581. });
  82582. };
  82583. var updateSequenceNumbers = function updateSequenceNumbers2(_ref3) {
  82584. var oldPlaylists = _ref3.oldPlaylists, newPlaylists = _ref3.newPlaylists, timelineStarts = _ref3.timelineStarts;
  82585. newPlaylists.forEach(function(playlist) {
  82586. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref4) {
  82587. var timeline = _ref4.timeline;
  82588. return timeline === playlist.timeline;
  82589. });
  82590. var oldPlaylist = findPlaylistWithName(oldPlaylists, playlist.attributes.NAME);
  82591. if (!oldPlaylist) {
  82592. return;
  82593. }
  82594. if (playlist.sidx) {
  82595. return;
  82596. }
  82597. var firstNewSegment = playlist.segments[0];
  82598. var oldMatchingSegmentIndex = findIndex(oldPlaylist.segments, function(oldSegment) {
  82599. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE;
  82600. });
  82601. if (oldMatchingSegmentIndex === -1) {
  82602. updateMediaSequenceForPlaylist({
  82603. playlist,
  82604. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  82605. });
  82606. playlist.segments[0].discontinuity = true;
  82607. playlist.discontinuityStarts.unshift(0);
  82608. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  82609. playlist.discontinuitySequence--;
  82610. }
  82611. return;
  82612. }
  82613. var oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  82614. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  82615. firstNewSegment.discontinuity = true;
  82616. playlist.discontinuityStarts.unshift(0);
  82617. playlist.discontinuitySequence--;
  82618. }
  82619. updateMediaSequenceForPlaylist({
  82620. playlist,
  82621. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  82622. });
  82623. });
  82624. };
  82625. var positionManifestOnTimeline = function positionManifestOnTimeline2(_ref5) {
  82626. var oldManifest = _ref5.oldManifest, newManifest = _ref5.newManifest;
  82627. var oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));
  82628. var newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists(newManifest));
  82629. newManifest.timelineStarts = getUniqueTimelineStarts([oldManifest.timelineStarts, newManifest.timelineStarts]);
  82630. updateSequenceNumbers({
  82631. oldPlaylists,
  82632. newPlaylists,
  82633. timelineStarts: newManifest.timelineStarts
  82634. });
  82635. return newManifest;
  82636. };
  82637. var generateSidxKey = function generateSidxKey2(sidx) {
  82638. return sidx && sidx.uri + "-" + byteRangeToString(sidx.byterange);
  82639. };
  82640. var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists2(playlists) {
  82641. var mergedPlaylists = values(playlists.reduce(function(acc, playlist) {
  82642. var name = playlist.attributes.id + (playlist.attributes.lang || "");
  82643. if (!acc[name]) {
  82644. acc[name] = playlist;
  82645. acc[name].attributes.timelineStarts = [];
  82646. } else {
  82647. if (playlist.segments) {
  82648. var _acc$name$segments;
  82649. if (playlist.segments[0]) {
  82650. playlist.segments[0].discontinuity = true;
  82651. }
  82652. (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments);
  82653. }
  82654. if (playlist.attributes.contentProtection) {
  82655. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  82656. }
  82657. }
  82658. acc[name].attributes.timelineStarts.push({
  82659. start: playlist.attributes.periodStart,
  82660. timeline: playlist.attributes.periodStart
  82661. });
  82662. return acc;
  82663. }, {}));
  82664. return mergedPlaylists.map(function(playlist) {
  82665. playlist.discontinuityStarts = findIndexes(playlist.segments || [], "discontinuity");
  82666. return playlist;
  82667. });
  82668. };
  82669. var addSidxSegmentsToPlaylist2 = function addSidxSegmentsToPlaylist3(playlist, sidxMapping) {
  82670. var sidxKey = generateSidxKey(playlist.sidx);
  82671. var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  82672. if (sidxMatch) {
  82673. addSidxSegmentsToPlaylist$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  82674. }
  82675. return playlist;
  82676. };
  82677. var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists2(playlists, sidxMapping) {
  82678. if (sidxMapping === void 0) {
  82679. sidxMapping = {};
  82680. }
  82681. if (!Object.keys(sidxMapping).length) {
  82682. return playlists;
  82683. }
  82684. for (var i2 in playlists) {
  82685. playlists[i2] = addSidxSegmentsToPlaylist2(playlists[i2], sidxMapping);
  82686. }
  82687. return playlists;
  82688. };
  82689. var formatAudioPlaylist = function formatAudioPlaylist2(_ref, isAudioOnly3) {
  82690. var _attributes;
  82691. var attributes = _ref.attributes, segments = _ref.segments, sidx = _ref.sidx, mediaSequence = _ref.mediaSequence, discontinuitySequence = _ref.discontinuitySequence, discontinuityStarts = _ref.discontinuityStarts;
  82692. var playlist = {
  82693. attributes: (_attributes = {
  82694. NAME: attributes.id,
  82695. BANDWIDTH: attributes.bandwidth,
  82696. CODECS: attributes.codecs
  82697. }, _attributes["PROGRAM-ID"] = 1, _attributes),
  82698. uri: "",
  82699. endList: attributes.type === "static",
  82700. timeline: attributes.periodStart,
  82701. resolvedUri: "",
  82702. targetDuration: attributes.duration,
  82703. discontinuitySequence,
  82704. discontinuityStarts,
  82705. timelineStarts: attributes.timelineStarts,
  82706. mediaSequence,
  82707. segments
  82708. };
  82709. if (attributes.contentProtection) {
  82710. playlist.contentProtection = attributes.contentProtection;
  82711. }
  82712. if (sidx) {
  82713. playlist.sidx = sidx;
  82714. }
  82715. if (isAudioOnly3) {
  82716. playlist.attributes.AUDIO = "audio";
  82717. playlist.attributes.SUBTITLES = "subs";
  82718. }
  82719. return playlist;
  82720. };
  82721. var formatVttPlaylist = function formatVttPlaylist2(_ref2) {
  82722. var _m3u8Attributes;
  82723. var attributes = _ref2.attributes, segments = _ref2.segments, mediaSequence = _ref2.mediaSequence, discontinuityStarts = _ref2.discontinuityStarts, discontinuitySequence = _ref2.discontinuitySequence;
  82724. if (typeof segments === "undefined") {
  82725. segments = [{
  82726. uri: attributes.baseUrl,
  82727. timeline: attributes.periodStart,
  82728. resolvedUri: attributes.baseUrl || "",
  82729. duration: attributes.sourceDuration,
  82730. number: 0
  82731. }];
  82732. attributes.duration = attributes.sourceDuration;
  82733. }
  82734. var m3u8Attributes = (_m3u8Attributes = {
  82735. NAME: attributes.id,
  82736. BANDWIDTH: attributes.bandwidth
  82737. }, _m3u8Attributes["PROGRAM-ID"] = 1, _m3u8Attributes);
  82738. if (attributes.codecs) {
  82739. m3u8Attributes.CODECS = attributes.codecs;
  82740. }
  82741. return {
  82742. attributes: m3u8Attributes,
  82743. uri: "",
  82744. endList: attributes.type === "static",
  82745. timeline: attributes.periodStart,
  82746. resolvedUri: attributes.baseUrl || "",
  82747. targetDuration: attributes.duration,
  82748. timelineStarts: attributes.timelineStarts,
  82749. discontinuityStarts,
  82750. discontinuitySequence,
  82751. mediaSequence,
  82752. segments
  82753. };
  82754. };
  82755. var organizeAudioPlaylists = function organizeAudioPlaylists2(playlists, sidxMapping, isAudioOnly3) {
  82756. if (sidxMapping === void 0) {
  82757. sidxMapping = {};
  82758. }
  82759. if (isAudioOnly3 === void 0) {
  82760. isAudioOnly3 = false;
  82761. }
  82762. var mainPlaylist;
  82763. var formattedPlaylists = playlists.reduce(function(a, playlist) {
  82764. var role = playlist.attributes.role && playlist.attributes.role.value || "";
  82765. var language = playlist.attributes.lang || "";
  82766. var label2 = playlist.attributes.label || "main";
  82767. if (language && !playlist.attributes.label) {
  82768. var roleLabel = role ? " (" + role + ")" : "";
  82769. label2 = "" + playlist.attributes.lang + roleLabel;
  82770. }
  82771. if (!a[label2]) {
  82772. a[label2] = {
  82773. language,
  82774. autoselect: true,
  82775. default: role === "main",
  82776. playlists: [],
  82777. uri: ""
  82778. };
  82779. }
  82780. var formatted = addSidxSegmentsToPlaylist2(formatAudioPlaylist(playlist, isAudioOnly3), sidxMapping);
  82781. a[label2].playlists.push(formatted);
  82782. if (typeof mainPlaylist === "undefined" && role === "main") {
  82783. mainPlaylist = playlist;
  82784. mainPlaylist.default = true;
  82785. }
  82786. return a;
  82787. }, {});
  82788. if (!mainPlaylist) {
  82789. var firstLabel = Object.keys(formattedPlaylists)[0];
  82790. formattedPlaylists[firstLabel].default = true;
  82791. }
  82792. return formattedPlaylists;
  82793. };
  82794. var organizeVttPlaylists = function organizeVttPlaylists2(playlists, sidxMapping) {
  82795. if (sidxMapping === void 0) {
  82796. sidxMapping = {};
  82797. }
  82798. return playlists.reduce(function(a, playlist) {
  82799. var label2 = playlist.attributes.lang || "text";
  82800. if (!a[label2]) {
  82801. a[label2] = {
  82802. language: label2,
  82803. default: false,
  82804. autoselect: false,
  82805. playlists: [],
  82806. uri: ""
  82807. };
  82808. }
  82809. a[label2].playlists.push(addSidxSegmentsToPlaylist2(formatVttPlaylist(playlist), sidxMapping));
  82810. return a;
  82811. }, {});
  82812. };
  82813. var organizeCaptionServices = function organizeCaptionServices2(captionServices) {
  82814. return captionServices.reduce(function(svcObj, svc) {
  82815. if (!svc) {
  82816. return svcObj;
  82817. }
  82818. svc.forEach(function(service) {
  82819. var channel = service.channel, language = service.language;
  82820. svcObj[language] = {
  82821. autoselect: false,
  82822. default: false,
  82823. instreamId: channel,
  82824. language
  82825. };
  82826. if (service.hasOwnProperty("aspectRatio")) {
  82827. svcObj[language].aspectRatio = service.aspectRatio;
  82828. }
  82829. if (service.hasOwnProperty("easyReader")) {
  82830. svcObj[language].easyReader = service.easyReader;
  82831. }
  82832. if (service.hasOwnProperty("3D")) {
  82833. svcObj[language]["3D"] = service["3D"];
  82834. }
  82835. });
  82836. return svcObj;
  82837. }, {});
  82838. };
  82839. var formatVideoPlaylist = function formatVideoPlaylist2(_ref3) {
  82840. var _attributes2;
  82841. var attributes = _ref3.attributes, segments = _ref3.segments, sidx = _ref3.sidx, discontinuityStarts = _ref3.discontinuityStarts;
  82842. var playlist = {
  82843. attributes: (_attributes2 = {
  82844. NAME: attributes.id,
  82845. AUDIO: "audio",
  82846. SUBTITLES: "subs",
  82847. RESOLUTION: {
  82848. width: attributes.width,
  82849. height: attributes.height
  82850. },
  82851. CODECS: attributes.codecs,
  82852. BANDWIDTH: attributes.bandwidth
  82853. }, _attributes2["PROGRAM-ID"] = 1, _attributes2),
  82854. uri: "",
  82855. endList: attributes.type === "static",
  82856. timeline: attributes.periodStart,
  82857. resolvedUri: "",
  82858. targetDuration: attributes.duration,
  82859. discontinuityStarts,
  82860. timelineStarts: attributes.timelineStarts,
  82861. segments
  82862. };
  82863. if (attributes.frameRate) {
  82864. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  82865. }
  82866. if (attributes.contentProtection) {
  82867. playlist.contentProtection = attributes.contentProtection;
  82868. }
  82869. if (sidx) {
  82870. playlist.sidx = sidx;
  82871. }
  82872. return playlist;
  82873. };
  82874. var videoOnly = function videoOnly2(_ref4) {
  82875. var attributes = _ref4.attributes;
  82876. return attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  82877. };
  82878. var audioOnly = function audioOnly2(_ref5) {
  82879. var attributes = _ref5.attributes;
  82880. return attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  82881. };
  82882. var vttOnly = function vttOnly2(_ref6) {
  82883. var attributes = _ref6.attributes;
  82884. return attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  82885. };
  82886. var addMediaSequenceValues = function addMediaSequenceValues2(playlists, timelineStarts) {
  82887. playlists.forEach(function(playlist) {
  82888. playlist.mediaSequence = 0;
  82889. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref7) {
  82890. var timeline = _ref7.timeline;
  82891. return timeline === playlist.timeline;
  82892. });
  82893. if (!playlist.segments) {
  82894. return;
  82895. }
  82896. playlist.segments.forEach(function(segment, index2) {
  82897. segment.number = index2;
  82898. });
  82899. });
  82900. };
  82901. var flattenMediaGroupPlaylists = function flattenMediaGroupPlaylists2(mediaGroupObject) {
  82902. if (!mediaGroupObject) {
  82903. return [];
  82904. }
  82905. return Object.keys(mediaGroupObject).reduce(function(acc, label2) {
  82906. var labelContents = mediaGroupObject[label2];
  82907. return acc.concat(labelContents.playlists);
  82908. }, []);
  82909. };
  82910. var toM3u8 = function toM3u82(_ref8) {
  82911. var _mediaGroups;
  82912. var dashPlaylists = _ref8.dashPlaylists, locations = _ref8.locations, _ref8$sidxMapping = _ref8.sidxMapping, sidxMapping = _ref8$sidxMapping === void 0 ? {} : _ref8$sidxMapping, previousManifest = _ref8.previousManifest;
  82913. if (!dashPlaylists.length) {
  82914. return {};
  82915. }
  82916. 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;
  82917. var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);
  82918. var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));
  82919. var vttPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));
  82920. var captions = dashPlaylists.map(function(playlist) {
  82921. return playlist.attributes.captionServices;
  82922. }).filter(Boolean);
  82923. var manifest = {
  82924. allowCache: true,
  82925. discontinuityStarts: [],
  82926. segments: [],
  82927. endList: true,
  82928. mediaGroups: (_mediaGroups = {
  82929. AUDIO: {},
  82930. VIDEO: {}
  82931. }, _mediaGroups["CLOSED-CAPTIONS"] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups),
  82932. uri: "",
  82933. duration: duration5,
  82934. playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping)
  82935. };
  82936. if (minimumUpdatePeriod2 >= 0) {
  82937. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  82938. }
  82939. if (locations) {
  82940. manifest.locations = locations;
  82941. }
  82942. if (type2 === "dynamic") {
  82943. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  82944. }
  82945. var isAudioOnly3 = manifest.playlists.length === 0;
  82946. var organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  82947. var organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists(vttPlaylists, sidxMapping) : null;
  82948. var formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup), flattenMediaGroupPlaylists(organizedVttGroup));
  82949. var playlistTimelineStarts = formattedPlaylists.map(function(_ref9) {
  82950. var timelineStarts = _ref9.timelineStarts;
  82951. return timelineStarts;
  82952. });
  82953. manifest.timelineStarts = getUniqueTimelineStarts(playlistTimelineStarts);
  82954. addMediaSequenceValues(formattedPlaylists, manifest.timelineStarts);
  82955. if (organizedAudioGroup) {
  82956. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  82957. }
  82958. if (organizedVttGroup) {
  82959. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  82960. }
  82961. if (captions.length) {
  82962. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices(captions);
  82963. }
  82964. if (previousManifest) {
  82965. return positionManifestOnTimeline({
  82966. oldManifest: previousManifest,
  82967. newManifest: manifest
  82968. });
  82969. }
  82970. return manifest;
  82971. };
  82972. var getLiveRValue = function getLiveRValue2(attributes, time, duration5) {
  82973. 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;
  82974. var now2 = (NOW + clientOffset) / 1e3;
  82975. var periodStartWC = availabilityStartTime2 + periodStart;
  82976. var periodEndWC = now2 + minimumUpdatePeriod2;
  82977. var periodDuration = periodEndWC - periodStartWC;
  82978. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  82979. };
  82980. var parseByTimeline = function parseByTimeline2(attributes, segmentTimeline) {
  82981. 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;
  82982. var segments = [];
  82983. var time = -1;
  82984. for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  82985. var S = segmentTimeline[sIndex];
  82986. var duration5 = S.d;
  82987. var repeat = S.r || 0;
  82988. var segmentTime = S.t || 0;
  82989. if (time < 0) {
  82990. time = segmentTime;
  82991. }
  82992. if (segmentTime && segmentTime > time) {
  82993. time = segmentTime;
  82994. }
  82995. var count = void 0;
  82996. if (repeat < 0) {
  82997. var nextS = sIndex + 1;
  82998. if (nextS === segmentTimeline.length) {
  82999. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  83000. count = getLiveRValue(attributes, time, duration5);
  83001. } else {
  83002. count = (sourceDuration * timescale2 - time) / duration5;
  83003. }
  83004. } else {
  83005. count = (segmentTimeline[nextS].t - time) / duration5;
  83006. }
  83007. } else {
  83008. count = repeat + 1;
  83009. }
  83010. var end = startNumber2 + segments.length + count;
  83011. var number = startNumber2 + segments.length;
  83012. while (number < end) {
  83013. segments.push({
  83014. number,
  83015. duration: duration5 / timescale2,
  83016. time,
  83017. timeline
  83018. });
  83019. time += duration5;
  83020. number++;
  83021. }
  83022. }
  83023. return segments;
  83024. };
  83025. var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  83026. var identifierReplacement = function identifierReplacement2(values3) {
  83027. return function(match, identifier, format, width2) {
  83028. if (match === "$$") {
  83029. return "$";
  83030. }
  83031. if (typeof values3[identifier] === "undefined") {
  83032. return match;
  83033. }
  83034. var value = "" + values3[identifier];
  83035. if (identifier === "RepresentationID") {
  83036. return value;
  83037. }
  83038. if (!format) {
  83039. width2 = 1;
  83040. } else {
  83041. width2 = parseInt(width2, 10);
  83042. }
  83043. if (value.length >= width2) {
  83044. return value;
  83045. }
  83046. return "" + new Array(width2 - value.length + 1).join("0") + value;
  83047. };
  83048. };
  83049. var constructTemplateUrl = function constructTemplateUrl2(url, values3) {
  83050. return url.replace(identifierPattern, identifierReplacement(values3));
  83051. };
  83052. var parseTemplateInfo = function parseTemplateInfo2(attributes, segmentTimeline) {
  83053. if (!attributes.duration && !segmentTimeline) {
  83054. return [{
  83055. number: attributes.startNumber || 1,
  83056. duration: attributes.sourceDuration,
  83057. time: 0,
  83058. timeline: attributes.periodStart
  83059. }];
  83060. }
  83061. if (attributes.duration) {
  83062. return parseByDuration(attributes);
  83063. }
  83064. return parseByTimeline(attributes, segmentTimeline);
  83065. };
  83066. var segmentsFromTemplate = function segmentsFromTemplate2(attributes, segmentTimeline) {
  83067. var templateValues = {
  83068. RepresentationID: attributes.id,
  83069. Bandwidth: attributes.bandwidth || 0
  83070. };
  83071. var _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {
  83072. sourceURL: "",
  83073. range: ""
  83074. } : _attributes$initializ;
  83075. var mapSegment = urlTypeToSegment({
  83076. baseUrl: attributes.baseUrl,
  83077. source: constructTemplateUrl(initialization.sourceURL, templateValues),
  83078. range: initialization.range
  83079. });
  83080. var segments = parseTemplateInfo(attributes, segmentTimeline);
  83081. return segments.map(function(segment) {
  83082. templateValues.Number = segment.number;
  83083. templateValues.Time = segment.time;
  83084. var uri = constructTemplateUrl(attributes.media || "", templateValues);
  83085. var timescale2 = attributes.timescale || 1;
  83086. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  83087. var presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  83088. var map = {
  83089. uri,
  83090. timeline: segment.timeline,
  83091. duration: segment.duration,
  83092. resolvedUri: resolveUrl$1(attributes.baseUrl || "", uri),
  83093. map: mapSegment,
  83094. number: segment.number,
  83095. presentationTime
  83096. };
  83097. return map;
  83098. });
  83099. };
  83100. var SegmentURLToSegmentObject = function SegmentURLToSegmentObject2(attributes, segmentUrl) {
  83101. var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ;
  83102. var initSegment = urlTypeToSegment({
  83103. baseUrl,
  83104. source: initialization.sourceURL,
  83105. range: initialization.range
  83106. });
  83107. var segment = urlTypeToSegment({
  83108. baseUrl,
  83109. source: segmentUrl.media,
  83110. range: segmentUrl.mediaRange
  83111. });
  83112. segment.map = initSegment;
  83113. return segment;
  83114. };
  83115. var segmentsFromList = function segmentsFromList2(attributes, segmentTimeline) {
  83116. var duration5 = attributes.duration, _attributes$segmentUr = attributes.segmentUrls, segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr, periodStart = attributes.periodStart;
  83117. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  83118. throw new Error(errors.SEGMENT_TIME_UNSPECIFIED);
  83119. }
  83120. var segmentUrlMap = segmentUrls.map(function(segmentUrlObject) {
  83121. return SegmentURLToSegmentObject(attributes, segmentUrlObject);
  83122. });
  83123. var segmentTimeInfo;
  83124. if (duration5) {
  83125. segmentTimeInfo = parseByDuration(attributes);
  83126. }
  83127. if (segmentTimeline) {
  83128. segmentTimeInfo = parseByTimeline(attributes, segmentTimeline);
  83129. }
  83130. var segments = segmentTimeInfo.map(function(segmentTime, index2) {
  83131. if (segmentUrlMap[index2]) {
  83132. var segment = segmentUrlMap[index2];
  83133. var timescale2 = attributes.timescale || 1;
  83134. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  83135. segment.timeline = segmentTime.timeline;
  83136. segment.duration = segmentTime.duration;
  83137. segment.number = segmentTime.number;
  83138. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  83139. return segment;
  83140. }
  83141. }).filter(function(segment) {
  83142. return segment;
  83143. });
  83144. return segments;
  83145. };
  83146. var generateSegments = function generateSegments2(_ref) {
  83147. var attributes = _ref.attributes, segmentInfo = _ref.segmentInfo;
  83148. var segmentAttributes;
  83149. var segmentsFn;
  83150. if (segmentInfo.template) {
  83151. segmentsFn = segmentsFromTemplate;
  83152. segmentAttributes = merge(attributes, segmentInfo.template);
  83153. } else if (segmentInfo.base) {
  83154. segmentsFn = segmentsFromBase;
  83155. segmentAttributes = merge(attributes, segmentInfo.base);
  83156. } else if (segmentInfo.list) {
  83157. segmentsFn = segmentsFromList;
  83158. segmentAttributes = merge(attributes, segmentInfo.list);
  83159. }
  83160. var segmentsInfo = {
  83161. attributes
  83162. };
  83163. if (!segmentsFn) {
  83164. return segmentsInfo;
  83165. }
  83166. var segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  83167. if (segmentAttributes.duration) {
  83168. var _segmentAttributes = segmentAttributes, duration5 = _segmentAttributes.duration, _segmentAttributes$ti = _segmentAttributes.timescale, timescale2 = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti;
  83169. segmentAttributes.duration = duration5 / timescale2;
  83170. } else if (segments.length) {
  83171. segmentAttributes.duration = segments.reduce(function(max2, segment) {
  83172. return Math.max(max2, Math.ceil(segment.duration));
  83173. }, 0);
  83174. } else {
  83175. segmentAttributes.duration = 0;
  83176. }
  83177. segmentsInfo.attributes = segmentAttributes;
  83178. segmentsInfo.segments = segments;
  83179. if (segmentInfo.base && segmentAttributes.indexRange) {
  83180. segmentsInfo.sidx = segments[0];
  83181. segmentsInfo.segments = [];
  83182. }
  83183. return segmentsInfo;
  83184. };
  83185. var toPlaylists = function toPlaylists2(representations) {
  83186. return representations.map(generateSegments);
  83187. };
  83188. var findChildren = function findChildren2(element, name) {
  83189. return from(element.childNodes).filter(function(_ref) {
  83190. var tagName = _ref.tagName;
  83191. return tagName === name;
  83192. });
  83193. };
  83194. var getContent = function getContent2(element) {
  83195. return element.textContent.trim();
  83196. };
  83197. var parseDivisionValue = function parseDivisionValue2(value) {
  83198. return parseFloat(value.split("/").reduce(function(prev, current) {
  83199. return prev / current;
  83200. }));
  83201. };
  83202. var parseDuration = function parseDuration2(str) {
  83203. var SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  83204. var SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  83205. var SECONDS_IN_DAY = 24 * 60 * 60;
  83206. var SECONDS_IN_HOUR = 60 * 60;
  83207. var SECONDS_IN_MIN = 60;
  83208. var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  83209. var match = durationRegex.exec(str);
  83210. if (!match) {
  83211. return 0;
  83212. }
  83213. 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];
  83214. 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);
  83215. };
  83216. var parseDate = function parseDate2(str) {
  83217. var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  83218. if (dateRegex.test(str)) {
  83219. str += "Z";
  83220. }
  83221. return Date.parse(str);
  83222. };
  83223. var parsers = {
  83224. mediaPresentationDuration: function mediaPresentationDuration(value) {
  83225. return parseDuration(value);
  83226. },
  83227. availabilityStartTime: function availabilityStartTime(value) {
  83228. return parseDate(value) / 1e3;
  83229. },
  83230. minimumUpdatePeriod: function minimumUpdatePeriod(value) {
  83231. return parseDuration(value);
  83232. },
  83233. suggestedPresentationDelay: function suggestedPresentationDelay(value) {
  83234. return parseDuration(value);
  83235. },
  83236. type: function type(value) {
  83237. return value;
  83238. },
  83239. timeShiftBufferDepth: function timeShiftBufferDepth(value) {
  83240. return parseDuration(value);
  83241. },
  83242. start: function start(value) {
  83243. return parseDuration(value);
  83244. },
  83245. width: function width(value) {
  83246. return parseInt(value, 10);
  83247. },
  83248. height: function height(value) {
  83249. return parseInt(value, 10);
  83250. },
  83251. bandwidth: function bandwidth(value) {
  83252. return parseInt(value, 10);
  83253. },
  83254. frameRate: function frameRate(value) {
  83255. return parseDivisionValue(value);
  83256. },
  83257. startNumber: function startNumber(value) {
  83258. return parseInt(value, 10);
  83259. },
  83260. timescale: function timescale(value) {
  83261. return parseInt(value, 10);
  83262. },
  83263. presentationTimeOffset: function presentationTimeOffset(value) {
  83264. return parseInt(value, 10);
  83265. },
  83266. duration: function duration(value) {
  83267. var parsedValue = parseInt(value, 10);
  83268. if (isNaN(parsedValue)) {
  83269. return parseDuration(value);
  83270. }
  83271. return parsedValue;
  83272. },
  83273. d: function d(value) {
  83274. return parseInt(value, 10);
  83275. },
  83276. t: function t(value) {
  83277. return parseInt(value, 10);
  83278. },
  83279. r: function r(value) {
  83280. return parseInt(value, 10);
  83281. },
  83282. DEFAULT: function DEFAULT(value) {
  83283. return value;
  83284. }
  83285. };
  83286. var parseAttributes2 = function parseAttributes3(el) {
  83287. if (!(el && el.attributes)) {
  83288. return {};
  83289. }
  83290. return from(el.attributes).reduce(function(a, e) {
  83291. var parseFn = parsers[e.name] || parsers.DEFAULT;
  83292. a[e.name] = parseFn(e.value);
  83293. return a;
  83294. }, {});
  83295. };
  83296. var keySystemsMap = {
  83297. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  83298. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  83299. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  83300. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  83301. };
  83302. var buildBaseUrls = function buildBaseUrls2(referenceUrls, baseUrlElements) {
  83303. if (!baseUrlElements.length) {
  83304. return referenceUrls;
  83305. }
  83306. return flatten(referenceUrls.map(function(reference) {
  83307. return baseUrlElements.map(function(baseUrlElement) {
  83308. return resolveUrl$1(reference, getContent(baseUrlElement));
  83309. });
  83310. }));
  83311. };
  83312. var getSegmentInformation = function getSegmentInformation2(adaptationSet) {
  83313. var segmentTemplate = findChildren(adaptationSet, "SegmentTemplate")[0];
  83314. var segmentList = findChildren(adaptationSet, "SegmentList")[0];
  83315. var segmentUrls = segmentList && findChildren(segmentList, "SegmentURL").map(function(s) {
  83316. return merge({
  83317. tag: "SegmentURL"
  83318. }, parseAttributes2(s));
  83319. });
  83320. var segmentBase = findChildren(adaptationSet, "SegmentBase")[0];
  83321. var segmentTimelineParentNode = segmentList || segmentTemplate;
  83322. var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, "SegmentTimeline")[0];
  83323. var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  83324. var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, "Initialization")[0];
  83325. var template = segmentTemplate && parseAttributes2(segmentTemplate);
  83326. if (template && segmentInitialization) {
  83327. template.initialization = segmentInitialization && parseAttributes2(segmentInitialization);
  83328. } else if (template && template.initialization) {
  83329. template.initialization = {
  83330. sourceURL: template.initialization
  83331. };
  83332. }
  83333. var segmentInfo = {
  83334. template,
  83335. segmentTimeline: segmentTimeline && findChildren(segmentTimeline, "S").map(function(s) {
  83336. return parseAttributes2(s);
  83337. }),
  83338. list: segmentList && merge(parseAttributes2(segmentList), {
  83339. segmentUrls,
  83340. initialization: parseAttributes2(segmentInitialization)
  83341. }),
  83342. base: segmentBase && merge(parseAttributes2(segmentBase), {
  83343. initialization: parseAttributes2(segmentInitialization)
  83344. })
  83345. };
  83346. Object.keys(segmentInfo).forEach(function(key) {
  83347. if (!segmentInfo[key]) {
  83348. delete segmentInfo[key];
  83349. }
  83350. });
  83351. return segmentInfo;
  83352. };
  83353. var inheritBaseUrls = function inheritBaseUrls2(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) {
  83354. return function(representation) {
  83355. var repBaseUrlElements = findChildren(representation, "BaseURL");
  83356. var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements);
  83357. var attributes = merge(adaptationSetAttributes, parseAttributes2(representation));
  83358. var representationSegmentInfo = getSegmentInformation(representation);
  83359. return repBaseUrls.map(function(baseUrl) {
  83360. return {
  83361. segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo),
  83362. attributes: merge(attributes, {
  83363. baseUrl
  83364. })
  83365. };
  83366. });
  83367. };
  83368. };
  83369. var generateKeySystemInformation = function generateKeySystemInformation2(contentProtectionNodes) {
  83370. return contentProtectionNodes.reduce(function(acc, node) {
  83371. var attributes = parseAttributes2(node);
  83372. if (attributes.schemeIdUri) {
  83373. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  83374. }
  83375. var keySystem = keySystemsMap[attributes.schemeIdUri];
  83376. if (keySystem) {
  83377. acc[keySystem] = {
  83378. attributes
  83379. };
  83380. var psshNode = findChildren(node, "cenc:pssh")[0];
  83381. if (psshNode) {
  83382. var pssh = getContent(psshNode);
  83383. acc[keySystem].pssh = pssh && decodeB64ToUint8Array(pssh);
  83384. }
  83385. }
  83386. return acc;
  83387. }, {});
  83388. };
  83389. var parseCaptionServiceMetadata = function parseCaptionServiceMetadata2(service) {
  83390. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  83391. var values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  83392. return values3.map(function(value) {
  83393. var channel;
  83394. var language;
  83395. language = value;
  83396. if (/^CC\d=/.test(value)) {
  83397. var _value$split = value.split("=");
  83398. channel = _value$split[0];
  83399. language = _value$split[1];
  83400. } else if (/^CC\d$/.test(value)) {
  83401. channel = value;
  83402. }
  83403. return {
  83404. channel,
  83405. language
  83406. };
  83407. });
  83408. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  83409. var _values = typeof service.value !== "string" ? [] : service.value.split(";");
  83410. return _values.map(function(value) {
  83411. var flags = {
  83412. "channel": void 0,
  83413. "language": void 0,
  83414. "aspectRatio": 1,
  83415. "easyReader": 0,
  83416. "3D": 0
  83417. };
  83418. if (/=/.test(value)) {
  83419. var _value$split2 = value.split("="), channel = _value$split2[0], _value$split2$ = _value$split2[1], opts = _value$split2$ === void 0 ? "" : _value$split2$;
  83420. flags.channel = channel;
  83421. flags.language = value;
  83422. opts.split(",").forEach(function(opt) {
  83423. var _opt$split = opt.split(":"), name = _opt$split[0], val = _opt$split[1];
  83424. if (name === "lang") {
  83425. flags.language = val;
  83426. } else if (name === "er") {
  83427. flags.easyReader = Number(val);
  83428. } else if (name === "war") {
  83429. flags.aspectRatio = Number(val);
  83430. } else if (name === "3D") {
  83431. flags["3D"] = Number(val);
  83432. }
  83433. });
  83434. } else {
  83435. flags.language = value;
  83436. }
  83437. if (flags.channel) {
  83438. flags.channel = "SERVICE" + flags.channel;
  83439. }
  83440. return flags;
  83441. });
  83442. }
  83443. };
  83444. var toRepresentations = function toRepresentations2(periodAttributes, periodBaseUrls, periodSegmentInfo) {
  83445. return function(adaptationSet) {
  83446. var adaptationSetAttributes = parseAttributes2(adaptationSet);
  83447. var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, "BaseURL"));
  83448. var role = findChildren(adaptationSet, "Role")[0];
  83449. var roleAttributes = {
  83450. role: parseAttributes2(role)
  83451. };
  83452. var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes);
  83453. var accessibility = findChildren(adaptationSet, "Accessibility")[0];
  83454. var captionServices = parseCaptionServiceMetadata(parseAttributes2(accessibility));
  83455. if (captionServices) {
  83456. attrs = merge(attrs, {
  83457. captionServices
  83458. });
  83459. }
  83460. var label2 = findChildren(adaptationSet, "Label")[0];
  83461. if (label2 && label2.childNodes.length) {
  83462. var labelVal = label2.childNodes[0].nodeValue.trim();
  83463. attrs = merge(attrs, {
  83464. label: labelVal
  83465. });
  83466. }
  83467. var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, "ContentProtection"));
  83468. if (Object.keys(contentProtection).length) {
  83469. attrs = merge(attrs, {
  83470. contentProtection
  83471. });
  83472. }
  83473. var segmentInfo = getSegmentInformation(adaptationSet);
  83474. var representations = findChildren(adaptationSet, "Representation");
  83475. var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo);
  83476. return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  83477. };
  83478. };
  83479. var toAdaptationSets = function toAdaptationSets2(mpdAttributes, mpdBaseUrls) {
  83480. return function(period, index2) {
  83481. var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period.node, "BaseURL"));
  83482. var periodAttributes = merge(mpdAttributes, {
  83483. periodStart: period.attributes.start
  83484. });
  83485. if (typeof period.attributes.duration === "number") {
  83486. periodAttributes.periodDuration = period.attributes.duration;
  83487. }
  83488. var adaptationSets = findChildren(period.node, "AdaptationSet");
  83489. var periodSegmentInfo = getSegmentInformation(period.node);
  83490. return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  83491. };
  83492. };
  83493. var getPeriodStart = function getPeriodStart2(_ref) {
  83494. var attributes = _ref.attributes, priorPeriodAttributes = _ref.priorPeriodAttributes, mpdType = _ref.mpdType;
  83495. if (typeof attributes.start === "number") {
  83496. return attributes.start;
  83497. }
  83498. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  83499. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  83500. }
  83501. if (!priorPeriodAttributes && mpdType === "static") {
  83502. return 0;
  83503. }
  83504. return null;
  83505. };
  83506. var inheritAttributes = function inheritAttributes2(mpd, options2) {
  83507. if (options2 === void 0) {
  83508. options2 = {};
  83509. }
  83510. 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;
  83511. var periodNodes = findChildren(mpd, "Period");
  83512. if (!periodNodes.length) {
  83513. throw new Error(errors.INVALID_NUMBER_OF_PERIOD);
  83514. }
  83515. var locations = findChildren(mpd, "Location");
  83516. var mpdAttributes = parseAttributes2(mpd);
  83517. var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, "BaseURL"));
  83518. mpdAttributes.type = mpdAttributes.type || "static";
  83519. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  83520. mpdAttributes.NOW = NOW;
  83521. mpdAttributes.clientOffset = clientOffset;
  83522. if (locations.length) {
  83523. mpdAttributes.locations = locations.map(getContent);
  83524. }
  83525. var periods = [];
  83526. periodNodes.forEach(function(node, index2) {
  83527. var attributes = parseAttributes2(node);
  83528. var priorPeriod = periods[index2 - 1];
  83529. attributes.start = getPeriodStart({
  83530. attributes,
  83531. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  83532. mpdType: mpdAttributes.type
  83533. });
  83534. periods.push({
  83535. node,
  83536. attributes
  83537. });
  83538. });
  83539. return {
  83540. locations: mpdAttributes.locations,
  83541. representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls)))
  83542. };
  83543. };
  83544. var stringToMpdXml = function stringToMpdXml2(manifestString) {
  83545. if (manifestString === "") {
  83546. throw new Error(errors.DASH_EMPTY_MANIFEST);
  83547. }
  83548. var parser2 = new DOMParser();
  83549. var xml;
  83550. var mpd;
  83551. try {
  83552. xml = parser2.parseFromString(manifestString, "application/xml");
  83553. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  83554. } catch (e) {
  83555. }
  83556. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  83557. throw new Error(errors.DASH_INVALID_XML);
  83558. }
  83559. return mpd;
  83560. };
  83561. var parseUTCTimingScheme = function parseUTCTimingScheme2(mpd) {
  83562. var UTCTimingNode = findChildren(mpd, "UTCTiming")[0];
  83563. if (!UTCTimingNode) {
  83564. return null;
  83565. }
  83566. var attributes = parseAttributes2(UTCTimingNode);
  83567. switch (attributes.schemeIdUri) {
  83568. case "urn:mpeg:dash:utc:http-head:2014":
  83569. case "urn:mpeg:dash:utc:http-head:2012":
  83570. attributes.method = "HEAD";
  83571. break;
  83572. case "urn:mpeg:dash:utc:http-xsdate:2014":
  83573. case "urn:mpeg:dash:utc:http-iso:2014":
  83574. case "urn:mpeg:dash:utc:http-xsdate:2012":
  83575. case "urn:mpeg:dash:utc:http-iso:2012":
  83576. attributes.method = "GET";
  83577. break;
  83578. case "urn:mpeg:dash:utc:direct:2014":
  83579. case "urn:mpeg:dash:utc:direct:2012":
  83580. attributes.method = "DIRECT";
  83581. attributes.value = Date.parse(attributes.value);
  83582. break;
  83583. case "urn:mpeg:dash:utc:http-ntp:2014":
  83584. case "urn:mpeg:dash:utc:ntp:2014":
  83585. case "urn:mpeg:dash:utc:sntp:2014":
  83586. default:
  83587. throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
  83588. }
  83589. return attributes;
  83590. };
  83591. var parse = function parse2(manifestString, options2) {
  83592. if (options2 === void 0) {
  83593. options2 = {};
  83594. }
  83595. var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options2);
  83596. var playlists = toPlaylists(parsedManifestInfo.representationInfo);
  83597. return toM3u8({
  83598. dashPlaylists: playlists,
  83599. locations: parsedManifestInfo.locations,
  83600. sidxMapping: options2.sidxMapping,
  83601. previousManifest: options2.previousManifest
  83602. });
  83603. };
  83604. var parseUTCTiming = function parseUTCTiming2(manifestString) {
  83605. return parseUTCTimingScheme(stringToMpdXml(manifestString));
  83606. };
  83607. var MAX_UINT32 = Math.pow(2, 32);
  83608. var getUint64$1 = function(uint8) {
  83609. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  83610. var value;
  83611. if (dv.getBigUint64) {
  83612. value = dv.getBigUint64(0);
  83613. if (value < Number.MAX_SAFE_INTEGER) {
  83614. return Number(value);
  83615. }
  83616. return value;
  83617. }
  83618. return dv.getUint32(0) * MAX_UINT32 + dv.getUint32(4);
  83619. };
  83620. var numbers = {
  83621. getUint64: getUint64$1,
  83622. MAX_UINT32
  83623. };
  83624. var getUint64 = numbers.getUint64;
  83625. var parseSidx = function(data) {
  83626. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  83627. version: data[0],
  83628. flags: new Uint8Array(data.subarray(1, 4)),
  83629. references: [],
  83630. referenceId: view.getUint32(4),
  83631. timescale: view.getUint32(8)
  83632. }, i2 = 12;
  83633. if (result.version === 0) {
  83634. result.earliestPresentationTime = view.getUint32(i2);
  83635. result.firstOffset = view.getUint32(i2 + 4);
  83636. i2 += 8;
  83637. } else {
  83638. result.earliestPresentationTime = getUint64(data.subarray(i2));
  83639. result.firstOffset = getUint64(data.subarray(i2 + 8));
  83640. i2 += 16;
  83641. }
  83642. i2 += 2;
  83643. var referenceCount = view.getUint16(i2);
  83644. i2 += 2;
  83645. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  83646. result.references.push({
  83647. referenceType: (data[i2] & 128) >>> 7,
  83648. referencedSize: view.getUint32(i2) & 2147483647,
  83649. subsegmentDuration: view.getUint32(i2 + 4),
  83650. startsWithSap: !!(data[i2 + 8] & 128),
  83651. sapType: (data[i2 + 8] & 112) >>> 4,
  83652. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  83653. });
  83654. }
  83655. return result;
  83656. };
  83657. var parseSidx_1 = parseSidx;
  83658. var ID3 = toUint82([73, 68, 51]);
  83659. var getId3Size2 = function getId3Size3(bytes, offset) {
  83660. if (offset === void 0) {
  83661. offset = 0;
  83662. }
  83663. bytes = toUint82(bytes);
  83664. var flags = bytes[offset + 5];
  83665. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  83666. var footerPresent = (flags & 16) >> 4;
  83667. if (footerPresent) {
  83668. return returnSize + 20;
  83669. }
  83670. return returnSize + 10;
  83671. };
  83672. var getId3Offset2 = function getId3Offset3(bytes, offset) {
  83673. if (offset === void 0) {
  83674. offset = 0;
  83675. }
  83676. bytes = toUint82(bytes);
  83677. if (bytes.length - offset < 10 || !bytesMatch2(bytes, ID3, {
  83678. offset
  83679. })) {
  83680. return offset;
  83681. }
  83682. offset += getId3Size2(bytes, offset);
  83683. return getId3Offset3(bytes, offset);
  83684. };
  83685. var normalizePath$1 = function normalizePath3(path) {
  83686. if (typeof path === "string") {
  83687. return stringToBytes2(path);
  83688. }
  83689. if (typeof path === "number") {
  83690. return path;
  83691. }
  83692. return path;
  83693. };
  83694. var normalizePaths$1 = function normalizePaths3(paths) {
  83695. if (!Array.isArray(paths)) {
  83696. return [normalizePath$1(paths)];
  83697. }
  83698. return paths.map(function(p) {
  83699. return normalizePath$1(p);
  83700. });
  83701. };
  83702. var findBox2 = function findBox3(bytes, paths, complete) {
  83703. if (complete === void 0) {
  83704. complete = false;
  83705. }
  83706. paths = normalizePaths$1(paths);
  83707. bytes = toUint82(bytes);
  83708. var results = [];
  83709. if (!paths.length) {
  83710. return results;
  83711. }
  83712. var i2 = 0;
  83713. while (i2 < bytes.length) {
  83714. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  83715. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  83716. if (size === 0) {
  83717. break;
  83718. }
  83719. var end = i2 + size;
  83720. if (end > bytes.length) {
  83721. if (complete) {
  83722. break;
  83723. }
  83724. end = bytes.length;
  83725. }
  83726. var data = bytes.subarray(i2 + 8, end);
  83727. if (bytesMatch2(type2, paths[0])) {
  83728. if (paths.length === 1) {
  83729. results.push(data);
  83730. } else {
  83731. results.push.apply(results, findBox3(data, paths.slice(1), complete));
  83732. }
  83733. }
  83734. i2 = end;
  83735. }
  83736. return results;
  83737. };
  83738. var EBML_TAGS = {
  83739. EBML: toUint82([26, 69, 223, 163]),
  83740. DocType: toUint82([66, 130]),
  83741. Segment: toUint82([24, 83, 128, 103]),
  83742. SegmentInfo: toUint82([21, 73, 169, 102]),
  83743. Tracks: toUint82([22, 84, 174, 107]),
  83744. Track: toUint82([174]),
  83745. TrackNumber: toUint82([215]),
  83746. DefaultDuration: toUint82([35, 227, 131]),
  83747. TrackEntry: toUint82([174]),
  83748. TrackType: toUint82([131]),
  83749. FlagDefault: toUint82([136]),
  83750. CodecID: toUint82([134]),
  83751. CodecPrivate: toUint82([99, 162]),
  83752. VideoTrack: toUint82([224]),
  83753. AudioTrack: toUint82([225]),
  83754. Cluster: toUint82([31, 67, 182, 117]),
  83755. Timestamp: toUint82([231]),
  83756. TimestampScale: toUint82([42, 215, 177]),
  83757. BlockGroup: toUint82([160]),
  83758. BlockDuration: toUint82([155]),
  83759. Block: toUint82([161]),
  83760. SimpleBlock: toUint82([163])
  83761. };
  83762. var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];
  83763. var getLength2 = function getLength3(byte) {
  83764. var len = 1;
  83765. for (var i2 = 0; i2 < LENGTH_TABLE.length; i2++) {
  83766. if (byte & LENGTH_TABLE[i2]) {
  83767. break;
  83768. }
  83769. len++;
  83770. }
  83771. return len;
  83772. };
  83773. var getvint2 = function getvint3(bytes, offset, removeLength, signed) {
  83774. if (removeLength === void 0) {
  83775. removeLength = true;
  83776. }
  83777. if (signed === void 0) {
  83778. signed = false;
  83779. }
  83780. var length = getLength2(bytes[offset]);
  83781. var valueBytes = bytes.subarray(offset, offset + length);
  83782. if (removeLength) {
  83783. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  83784. valueBytes[0] ^= LENGTH_TABLE[length - 1];
  83785. }
  83786. return {
  83787. length,
  83788. value: bytesToNumber2(valueBytes, {
  83789. signed
  83790. }),
  83791. bytes: valueBytes
  83792. };
  83793. };
  83794. var normalizePath4 = function normalizePath5(path) {
  83795. if (typeof path === "string") {
  83796. return path.match(/.{1,2}/g).map(function(p) {
  83797. return normalizePath5(p);
  83798. });
  83799. }
  83800. if (typeof path === "number") {
  83801. return numberToBytes2(path);
  83802. }
  83803. return path;
  83804. };
  83805. var normalizePaths4 = function normalizePaths5(paths) {
  83806. if (!Array.isArray(paths)) {
  83807. return [normalizePath4(paths)];
  83808. }
  83809. return paths.map(function(p) {
  83810. return normalizePath4(p);
  83811. });
  83812. };
  83813. var getInfinityDataSize2 = function getInfinityDataSize3(id, bytes, offset) {
  83814. if (offset >= bytes.length) {
  83815. return bytes.length;
  83816. }
  83817. var innerid = getvint2(bytes, offset, false);
  83818. if (bytesMatch2(id.bytes, innerid.bytes)) {
  83819. return offset;
  83820. }
  83821. var dataHeader = getvint2(bytes, offset + innerid.length);
  83822. return getInfinityDataSize3(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  83823. };
  83824. var findEbml2 = function findEbml3(bytes, paths) {
  83825. paths = normalizePaths4(paths);
  83826. bytes = toUint82(bytes);
  83827. var results = [];
  83828. if (!paths.length) {
  83829. return results;
  83830. }
  83831. var i2 = 0;
  83832. while (i2 < bytes.length) {
  83833. var id = getvint2(bytes, i2, false);
  83834. var dataHeader = getvint2(bytes, i2 + id.length);
  83835. var dataStart = i2 + id.length + dataHeader.length;
  83836. if (dataHeader.value === 127) {
  83837. dataHeader.value = getInfinityDataSize2(id, bytes, dataStart);
  83838. if (dataHeader.value !== bytes.length) {
  83839. dataHeader.value -= dataStart;
  83840. }
  83841. }
  83842. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  83843. var data = bytes.subarray(dataStart, dataEnd);
  83844. if (bytesMatch2(paths[0], id.bytes)) {
  83845. if (paths.length === 1) {
  83846. results.push(data);
  83847. } else {
  83848. results = results.concat(findEbml3(data, paths.slice(1)));
  83849. }
  83850. }
  83851. var totalLength = id.length + dataHeader.length + data.length;
  83852. i2 += totalLength;
  83853. }
  83854. return results;
  83855. };
  83856. var NAL_TYPE_ONE = toUint82([0, 0, 0, 1]);
  83857. var NAL_TYPE_TWO = toUint82([0, 0, 1]);
  83858. var EMULATION_PREVENTION = toUint82([0, 0, 3]);
  83859. var discardEmulationPreventionBytes2 = function discardEmulationPreventionBytes3(bytes) {
  83860. var positions = [];
  83861. var i2 = 1;
  83862. while (i2 < bytes.length - 2) {
  83863. if (bytesMatch2(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION)) {
  83864. positions.push(i2 + 2);
  83865. i2++;
  83866. }
  83867. i2++;
  83868. }
  83869. if (positions.length === 0) {
  83870. return bytes;
  83871. }
  83872. var newLength = bytes.length - positions.length;
  83873. var newData = new Uint8Array(newLength);
  83874. var sourceIndex = 0;
  83875. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  83876. if (sourceIndex === positions[0]) {
  83877. sourceIndex++;
  83878. positions.shift();
  83879. }
  83880. newData[i2] = bytes[sourceIndex];
  83881. }
  83882. return newData;
  83883. };
  83884. var findNal2 = function findNal3(bytes, dataType, types, nalLimit) {
  83885. if (nalLimit === void 0) {
  83886. nalLimit = Infinity;
  83887. }
  83888. bytes = toUint82(bytes);
  83889. types = [].concat(types);
  83890. var i2 = 0;
  83891. var nalStart;
  83892. var nalsFound = 0;
  83893. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  83894. var nalOffset = void 0;
  83895. if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_ONE)) {
  83896. nalOffset = 4;
  83897. } else if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_TWO)) {
  83898. nalOffset = 3;
  83899. }
  83900. if (!nalOffset) {
  83901. i2++;
  83902. continue;
  83903. }
  83904. nalsFound++;
  83905. if (nalStart) {
  83906. return discardEmulationPreventionBytes2(bytes.subarray(nalStart, i2));
  83907. }
  83908. var nalType = void 0;
  83909. if (dataType === "h264") {
  83910. nalType = bytes[i2 + nalOffset] & 31;
  83911. } else if (dataType === "h265") {
  83912. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  83913. }
  83914. if (types.indexOf(nalType) !== -1) {
  83915. nalStart = i2 + nalOffset;
  83916. }
  83917. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  83918. }
  83919. return bytes.subarray(0, 0);
  83920. };
  83921. var findH264Nal2 = function findH264Nal3(bytes, type2, nalLimit) {
  83922. return findNal2(bytes, "h264", type2, nalLimit);
  83923. };
  83924. var findH265Nal2 = function findH265Nal3(bytes, type2, nalLimit) {
  83925. return findNal2(bytes, "h265", type2, nalLimit);
  83926. };
  83927. var CONSTANTS = {
  83928. "webm": toUint82([119, 101, 98, 109]),
  83929. "matroska": toUint82([109, 97, 116, 114, 111, 115, 107, 97]),
  83930. "flac": toUint82([102, 76, 97, 67]),
  83931. "ogg": toUint82([79, 103, 103, 83]),
  83932. "ac3": toUint82([11, 119]),
  83933. "riff": toUint82([82, 73, 70, 70]),
  83934. "avi": toUint82([65, 86, 73]),
  83935. "wav": toUint82([87, 65, 86, 69]),
  83936. "3gp": toUint82([102, 116, 121, 112, 51, 103]),
  83937. "mp4": toUint82([102, 116, 121, 112]),
  83938. "fmp4": toUint82([115, 116, 121, 112]),
  83939. "mov": toUint82([102, 116, 121, 112, 113, 116]),
  83940. "moov": toUint82([109, 111, 111, 118]),
  83941. "moof": toUint82([109, 111, 111, 102])
  83942. };
  83943. var _isLikely = {
  83944. aac: function aac2(bytes) {
  83945. var offset = getId3Offset2(bytes);
  83946. return bytesMatch2(bytes, [255, 16], {
  83947. offset,
  83948. mask: [255, 22]
  83949. });
  83950. },
  83951. mp3: function mp32(bytes) {
  83952. var offset = getId3Offset2(bytes);
  83953. return bytesMatch2(bytes, [255, 2], {
  83954. offset,
  83955. mask: [255, 6]
  83956. });
  83957. },
  83958. webm: function webm2(bytes) {
  83959. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83960. return bytesMatch2(docType, CONSTANTS.webm);
  83961. },
  83962. mkv: function mkv2(bytes) {
  83963. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83964. return bytesMatch2(docType, CONSTANTS.matroska);
  83965. },
  83966. mp4: function mp42(bytes) {
  83967. if (_isLikely["3gp"](bytes) || _isLikely.mov(bytes)) {
  83968. return false;
  83969. }
  83970. if (bytesMatch2(bytes, CONSTANTS.mp4, {
  83971. offset: 4
  83972. }) || bytesMatch2(bytes, CONSTANTS.fmp4, {
  83973. offset: 4
  83974. })) {
  83975. return true;
  83976. }
  83977. if (bytesMatch2(bytes, CONSTANTS.moof, {
  83978. offset: 4
  83979. }) || bytesMatch2(bytes, CONSTANTS.moov, {
  83980. offset: 4
  83981. })) {
  83982. return true;
  83983. }
  83984. },
  83985. mov: function mov2(bytes) {
  83986. return bytesMatch2(bytes, CONSTANTS.mov, {
  83987. offset: 4
  83988. });
  83989. },
  83990. "3gp": function gp2(bytes) {
  83991. return bytesMatch2(bytes, CONSTANTS["3gp"], {
  83992. offset: 4
  83993. });
  83994. },
  83995. ac3: function ac32(bytes) {
  83996. var offset = getId3Offset2(bytes);
  83997. return bytesMatch2(bytes, CONSTANTS.ac3, {
  83998. offset
  83999. });
  84000. },
  84001. ts: function ts2(bytes) {
  84002. if (bytes.length < 189 && bytes.length >= 1) {
  84003. return bytes[0] === 71;
  84004. }
  84005. var i2 = 0;
  84006. while (i2 + 188 < bytes.length && i2 < 188) {
  84007. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  84008. return true;
  84009. }
  84010. i2 += 1;
  84011. }
  84012. return false;
  84013. },
  84014. flac: function flac2(bytes) {
  84015. var offset = getId3Offset2(bytes);
  84016. return bytesMatch2(bytes, CONSTANTS.flac, {
  84017. offset
  84018. });
  84019. },
  84020. ogg: function ogg2(bytes) {
  84021. return bytesMatch2(bytes, CONSTANTS.ogg);
  84022. },
  84023. avi: function avi2(bytes) {
  84024. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.avi, {
  84025. offset: 8
  84026. });
  84027. },
  84028. wav: function wav2(bytes) {
  84029. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.wav, {
  84030. offset: 8
  84031. });
  84032. },
  84033. "h264": function h2642(bytes) {
  84034. return findH264Nal2(bytes, 7, 3).length;
  84035. },
  84036. "h265": function h2652(bytes) {
  84037. return findH265Nal2(bytes, [32, 33], 3).length;
  84038. }
  84039. };
  84040. var isLikelyTypes = Object.keys(_isLikely).filter(function(t2) {
  84041. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  84042. }).concat(["ts", "h264", "h265"]);
  84043. isLikelyTypes.forEach(function(type2) {
  84044. var isLikelyFn = _isLikely[type2];
  84045. _isLikely[type2] = function(bytes) {
  84046. return isLikelyFn(toUint82(bytes));
  84047. };
  84048. });
  84049. var isLikely = _isLikely;
  84050. var detectContainerForBytes2 = function detectContainerForBytes3(bytes) {
  84051. bytes = toUint82(bytes);
  84052. for (var i2 = 0; i2 < isLikelyTypes.length; i2++) {
  84053. var type2 = isLikelyTypes[i2];
  84054. if (isLikely[type2](bytes)) {
  84055. return type2;
  84056. }
  84057. }
  84058. return "";
  84059. };
  84060. var isLikelyFmp4MediaSegment2 = function isLikelyFmp4MediaSegment3(bytes) {
  84061. return findBox2(bytes, ["moof"]).length > 0;
  84062. };
  84063. var ONE_SECOND_IN_TS = 9e4, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds;
  84064. secondsToVideoTs = function(seconds) {
  84065. return seconds * ONE_SECOND_IN_TS;
  84066. };
  84067. secondsToAudioTs = function(seconds, sampleRate) {
  84068. return seconds * sampleRate;
  84069. };
  84070. videoTsToSeconds = function(timestamp) {
  84071. return timestamp / ONE_SECOND_IN_TS;
  84072. };
  84073. audioTsToSeconds = function(timestamp, sampleRate) {
  84074. return timestamp / sampleRate;
  84075. };
  84076. audioTsToVideoTs = function(timestamp, sampleRate) {
  84077. return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));
  84078. };
  84079. videoTsToAudioTs = function(timestamp, sampleRate) {
  84080. return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);
  84081. };
  84082. metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  84083. return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  84084. };
  84085. var clock = {
  84086. ONE_SECOND_IN_TS,
  84087. secondsToVideoTs,
  84088. secondsToAudioTs,
  84089. videoTsToSeconds,
  84090. audioTsToSeconds,
  84091. audioTsToVideoTs,
  84092. videoTsToAudioTs,
  84093. metadataTsToSeconds
  84094. };
  84095. function _getPrototypeOf(o) {
  84096. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  84097. return o2.__proto__ || Object.getPrototypeOf(o2);
  84098. };
  84099. return _getPrototypeOf(o);
  84100. }
  84101. function _isNativeFunction(fn2) {
  84102. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  84103. }
  84104. function _wrapNativeSuper(Class) {
  84105. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  84106. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  84107. if (Class2 === null || !_isNativeFunction(Class2))
  84108. return Class2;
  84109. if (typeof Class2 !== "function") {
  84110. throw new TypeError("Super expression must either be null or a function");
  84111. }
  84112. if (typeof _cache !== "undefined") {
  84113. if (_cache.has(Class2))
  84114. return _cache.get(Class2);
  84115. _cache.set(Class2, Wrapper);
  84116. }
  84117. function Wrapper() {
  84118. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  84119. }
  84120. Wrapper.prototype = Object.create(Class2.prototype, {
  84121. constructor: {
  84122. value: Wrapper,
  84123. enumerable: false,
  84124. writable: true,
  84125. configurable: true
  84126. }
  84127. });
  84128. return _setPrototypeOf(Wrapper, Class2);
  84129. };
  84130. return _wrapNativeSuper(Class);
  84131. }
  84132. /**
  84133. * @license
  84134. * Video.js 7.21.4 <http://videojs.com/>
  84135. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  84136. * Available under Apache License Version 2.0
  84137. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  84138. *
  84139. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  84140. * Available under Apache License Version 2.0
  84141. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  84142. */
  84143. var version$5 = "7.21.4";
  84144. var hooks_ = {};
  84145. var hooks = function hooks2(type2, fn2) {
  84146. hooks_[type2] = hooks_[type2] || [];
  84147. if (fn2) {
  84148. hooks_[type2] = hooks_[type2].concat(fn2);
  84149. }
  84150. return hooks_[type2];
  84151. };
  84152. var hook = function hook2(type2, fn2) {
  84153. hooks(type2, fn2);
  84154. };
  84155. var removeHook = function removeHook2(type2, fn2) {
  84156. var index2 = hooks(type2).indexOf(fn2);
  84157. if (index2 <= -1) {
  84158. return false;
  84159. }
  84160. hooks_[type2] = hooks_[type2].slice();
  84161. hooks_[type2].splice(index2, 1);
  84162. return true;
  84163. };
  84164. var hookOnce = function hookOnce2(type2, fn2) {
  84165. hooks(type2, [].concat(fn2).map(function(original) {
  84166. var wrapper = function wrapper2() {
  84167. removeHook(type2, wrapper2);
  84168. return original.apply(void 0, arguments);
  84169. };
  84170. return wrapper;
  84171. }));
  84172. };
  84173. var FullscreenApi = {
  84174. prefixed: true
  84175. };
  84176. var apiMap = [
  84177. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  84178. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  84179. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  84180. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  84181. ];
  84182. var specApi = apiMap[0];
  84183. var browserApi;
  84184. for (var i$2 = 0; i$2 < apiMap.length; i$2++) {
  84185. if (apiMap[i$2][1] in document_1) {
  84186. browserApi = apiMap[i$2];
  84187. break;
  84188. }
  84189. }
  84190. if (browserApi) {
  84191. for (var _i$1 = 0; _i$1 < browserApi.length; _i$1++) {
  84192. FullscreenApi[specApi[_i$1]] = browserApi[_i$1];
  84193. }
  84194. FullscreenApi.prefixed = browserApi[0] !== specApi[0];
  84195. }
  84196. var history = [];
  84197. var LogByTypeFactory = function LogByTypeFactory2(name, log2) {
  84198. return function(type2, level, args) {
  84199. var lvl = log2.levels[level];
  84200. var lvlRegExp = new RegExp("^(" + lvl + ")$");
  84201. if (type2 !== "log") {
  84202. args.unshift(type2.toUpperCase() + ":");
  84203. }
  84204. args.unshift(name + ":");
  84205. if (history) {
  84206. history.push([].concat(args));
  84207. var splice2 = history.length - 1e3;
  84208. history.splice(0, splice2 > 0 ? splice2 : 0);
  84209. }
  84210. if (!window_1.console) {
  84211. return;
  84212. }
  84213. var fn2 = window_1.console[type2];
  84214. if (!fn2 && type2 === "debug") {
  84215. fn2 = window_1.console.info || window_1.console.log;
  84216. }
  84217. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  84218. return;
  84219. }
  84220. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  84221. };
  84222. };
  84223. function createLogger$1(name) {
  84224. var level = "info";
  84225. var logByType;
  84226. var log2 = function log3() {
  84227. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  84228. args[_key] = arguments[_key];
  84229. }
  84230. logByType("log", level, args);
  84231. };
  84232. logByType = LogByTypeFactory(name, log2);
  84233. log2.createLogger = function(subname) {
  84234. return createLogger$1(name + ": " + subname);
  84235. };
  84236. log2.levels = {
  84237. all: "debug|log|warn|error",
  84238. off: "",
  84239. debug: "debug|log|warn|error",
  84240. info: "log|warn|error",
  84241. warn: "warn|error",
  84242. error: "error",
  84243. DEFAULT: level
  84244. };
  84245. log2.level = function(lvl) {
  84246. if (typeof lvl === "string") {
  84247. if (!log2.levels.hasOwnProperty(lvl)) {
  84248. throw new Error('"' + lvl + '" in not a valid log level');
  84249. }
  84250. level = lvl;
  84251. }
  84252. return level;
  84253. };
  84254. log2.history = function() {
  84255. return history ? [].concat(history) : [];
  84256. };
  84257. log2.history.filter = function(fname) {
  84258. return (history || []).filter(function(historyItem) {
  84259. return new RegExp(".*" + fname + ".*").test(historyItem[0]);
  84260. });
  84261. };
  84262. log2.history.clear = function() {
  84263. if (history) {
  84264. history.length = 0;
  84265. }
  84266. };
  84267. log2.history.disable = function() {
  84268. if (history !== null) {
  84269. history.length = 0;
  84270. history = null;
  84271. }
  84272. };
  84273. log2.history.enable = function() {
  84274. if (history === null) {
  84275. history = [];
  84276. }
  84277. };
  84278. log2.error = function() {
  84279. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  84280. args[_key2] = arguments[_key2];
  84281. }
  84282. return logByType("error", level, args);
  84283. };
  84284. log2.warn = function() {
  84285. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  84286. args[_key3] = arguments[_key3];
  84287. }
  84288. return logByType("warn", level, args);
  84289. };
  84290. log2.debug = function() {
  84291. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  84292. args[_key4] = arguments[_key4];
  84293. }
  84294. return logByType("debug", level, args);
  84295. };
  84296. return log2;
  84297. }
  84298. var log$1 = createLogger$1("VIDEOJS");
  84299. var createLogger = log$1.createLogger;
  84300. var toString = Object.prototype.toString;
  84301. var keys = function keys2(object) {
  84302. return isObject2(object) ? Object.keys(object) : [];
  84303. };
  84304. function each(object, fn2) {
  84305. keys(object).forEach(function(key) {
  84306. return fn2(object[key], key);
  84307. });
  84308. }
  84309. function reduce(object, fn2, initial) {
  84310. if (initial === void 0) {
  84311. initial = 0;
  84312. }
  84313. return keys(object).reduce(function(accum, key) {
  84314. return fn2(accum, object[key], key);
  84315. }, initial);
  84316. }
  84317. function assign(target) {
  84318. for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  84319. sources[_key - 1] = arguments[_key];
  84320. }
  84321. if (Object.assign) {
  84322. return _extends$2.apply(void 0, [target].concat(sources));
  84323. }
  84324. sources.forEach(function(source) {
  84325. if (!source) {
  84326. return;
  84327. }
  84328. each(source, function(value, key) {
  84329. target[key] = value;
  84330. });
  84331. });
  84332. return target;
  84333. }
  84334. function isObject2(value) {
  84335. return !!value && typeof value === "object";
  84336. }
  84337. function isPlain(value) {
  84338. return isObject2(value) && toString.call(value) === "[object Object]" && value.constructor === Object;
  84339. }
  84340. function computedStyle(el, prop) {
  84341. if (!el || !prop) {
  84342. return "";
  84343. }
  84344. if (typeof window_1.getComputedStyle === "function") {
  84345. var computedStyleValue;
  84346. try {
  84347. computedStyleValue = window_1.getComputedStyle(el);
  84348. } catch (e) {
  84349. return "";
  84350. }
  84351. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  84352. }
  84353. return "";
  84354. }
  84355. var USER_AGENT = window_1.navigator && window_1.navigator.userAgent || "";
  84356. var webkitVersionMap = /AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);
  84357. var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;
  84358. var IS_IPOD = /iPod/i.test(USER_AGENT);
  84359. var IOS_VERSION = function() {
  84360. var match = USER_AGENT.match(/OS (\d+)_/i);
  84361. if (match && match[1]) {
  84362. return match[1];
  84363. }
  84364. return null;
  84365. }();
  84366. var IS_ANDROID = /Android/i.test(USER_AGENT);
  84367. var ANDROID_VERSION = function() {
  84368. var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  84369. if (!match) {
  84370. return null;
  84371. }
  84372. var major = match[1] && parseFloat(match[1]);
  84373. var minor = match[2] && parseFloat(match[2]);
  84374. if (major && minor) {
  84375. return parseFloat(match[1] + "." + match[2]);
  84376. } else if (major) {
  84377. return major;
  84378. }
  84379. return null;
  84380. }();
  84381. var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;
  84382. var IS_FIREFOX = /Firefox/i.test(USER_AGENT);
  84383. var IS_EDGE = /Edg/i.test(USER_AGENT);
  84384. var IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));
  84385. var CHROME_VERSION = function() {
  84386. var match = USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);
  84387. if (match && match[2]) {
  84388. return parseFloat(match[2]);
  84389. }
  84390. return null;
  84391. }();
  84392. var IE_VERSION = function() {
  84393. var result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT);
  84394. var version2 = result && parseFloat(result[1]);
  84395. if (!version2 && /Trident\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {
  84396. version2 = 11;
  84397. }
  84398. return version2;
  84399. }();
  84400. var IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;
  84401. var IS_WINDOWS = /Windows/i.test(USER_AGENT);
  84402. var TOUCH_ENABLED = Boolean(isReal() && ("ontouchstart" in window_1 || window_1.navigator.maxTouchPoints || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch));
  84403. var IS_IPAD = /iPad/i.test(USER_AGENT) || IS_SAFARI && TOUCH_ENABLED && !/iPhone/i.test(USER_AGENT);
  84404. var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;
  84405. var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;
  84406. var IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;
  84407. var browser = /* @__PURE__ */ Object.freeze({
  84408. __proto__: null,
  84409. IS_IPOD,
  84410. IOS_VERSION,
  84411. IS_ANDROID,
  84412. ANDROID_VERSION,
  84413. IS_NATIVE_ANDROID,
  84414. IS_FIREFOX,
  84415. IS_EDGE,
  84416. IS_CHROME,
  84417. CHROME_VERSION,
  84418. IE_VERSION,
  84419. IS_SAFARI,
  84420. IS_WINDOWS,
  84421. TOUCH_ENABLED,
  84422. IS_IPAD,
  84423. IS_IPHONE,
  84424. IS_IOS,
  84425. IS_ANY_SAFARI
  84426. });
  84427. function isNonBlankString(str) {
  84428. return typeof str === "string" && Boolean(str.trim());
  84429. }
  84430. function throwIfWhitespace(str) {
  84431. if (str.indexOf(" ") >= 0) {
  84432. throw new Error("class has illegal whitespace characters");
  84433. }
  84434. }
  84435. function classRegExp(className) {
  84436. return new RegExp("(^|\\s)" + className + "($|\\s)");
  84437. }
  84438. function isReal() {
  84439. return document_1 === window_1.document;
  84440. }
  84441. function isEl(value) {
  84442. return isObject2(value) && value.nodeType === 1;
  84443. }
  84444. function isInFrame() {
  84445. try {
  84446. return window_1.parent !== window_1.self;
  84447. } catch (x) {
  84448. return true;
  84449. }
  84450. }
  84451. function createQuerier(method) {
  84452. return function(selector, context) {
  84453. if (!isNonBlankString(selector)) {
  84454. return document_1[method](null);
  84455. }
  84456. if (isNonBlankString(context)) {
  84457. context = document_1.querySelector(context);
  84458. }
  84459. var ctx = isEl(context) ? context : document_1;
  84460. return ctx[method] && ctx[method](selector);
  84461. };
  84462. }
  84463. function createEl(tagName, properties, attributes, content) {
  84464. if (tagName === void 0) {
  84465. tagName = "div";
  84466. }
  84467. if (properties === void 0) {
  84468. properties = {};
  84469. }
  84470. if (attributes === void 0) {
  84471. attributes = {};
  84472. }
  84473. var el = document_1.createElement(tagName);
  84474. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  84475. var val = properties[propName];
  84476. if (propName.indexOf("aria-") !== -1 || propName === "role" || propName === "type") {
  84477. 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 + "."));
  84478. el.setAttribute(propName, val);
  84479. } else if (propName === "textContent") {
  84480. textContent(el, val);
  84481. } else if (el[propName] !== val || propName === "tabIndex") {
  84482. el[propName] = val;
  84483. }
  84484. });
  84485. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84486. el.setAttribute(attrName, attributes[attrName]);
  84487. });
  84488. if (content) {
  84489. appendContent(el, content);
  84490. }
  84491. return el;
  84492. }
  84493. function textContent(el, text) {
  84494. if (typeof el.textContent === "undefined") {
  84495. el.innerText = text;
  84496. } else {
  84497. el.textContent = text;
  84498. }
  84499. return el;
  84500. }
  84501. function prependTo(child, parent) {
  84502. if (parent.firstChild) {
  84503. parent.insertBefore(child, parent.firstChild);
  84504. } else {
  84505. parent.appendChild(child);
  84506. }
  84507. }
  84508. function hasClass(element, classToCheck) {
  84509. throwIfWhitespace(classToCheck);
  84510. if (element.classList) {
  84511. return element.classList.contains(classToCheck);
  84512. }
  84513. return classRegExp(classToCheck).test(element.className);
  84514. }
  84515. function addClass(element, classToAdd) {
  84516. if (element.classList) {
  84517. element.classList.add(classToAdd);
  84518. } else if (!hasClass(element, classToAdd)) {
  84519. element.className = (element.className + " " + classToAdd).trim();
  84520. }
  84521. return element;
  84522. }
  84523. function removeClass(element, classToRemove) {
  84524. if (!element) {
  84525. log$1.warn("removeClass was called with an element that doesn't exist");
  84526. return null;
  84527. }
  84528. if (element.classList) {
  84529. element.classList.remove(classToRemove);
  84530. } else {
  84531. throwIfWhitespace(classToRemove);
  84532. element.className = element.className.split(/\s+/).filter(function(c) {
  84533. return c !== classToRemove;
  84534. }).join(" ");
  84535. }
  84536. return element;
  84537. }
  84538. function toggleClass(element, classToToggle, predicate) {
  84539. var has = hasClass(element, classToToggle);
  84540. if (typeof predicate === "function") {
  84541. predicate = predicate(element, classToToggle);
  84542. }
  84543. if (typeof predicate !== "boolean") {
  84544. predicate = !has;
  84545. }
  84546. if (predicate === has) {
  84547. return;
  84548. }
  84549. if (predicate) {
  84550. addClass(element, classToToggle);
  84551. } else {
  84552. removeClass(element, classToToggle);
  84553. }
  84554. return element;
  84555. }
  84556. function setAttributes(el, attributes) {
  84557. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84558. var attrValue = attributes[attrName];
  84559. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  84560. el.removeAttribute(attrName);
  84561. } else {
  84562. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  84563. }
  84564. });
  84565. }
  84566. function getAttributes(tag) {
  84567. var obj = {};
  84568. var knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  84569. if (tag && tag.attributes && tag.attributes.length > 0) {
  84570. var attrs = tag.attributes;
  84571. for (var i2 = attrs.length - 1; i2 >= 0; i2--) {
  84572. var attrName = attrs[i2].name;
  84573. var attrVal = attrs[i2].value;
  84574. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  84575. attrVal = attrVal !== null ? true : false;
  84576. }
  84577. obj[attrName] = attrVal;
  84578. }
  84579. }
  84580. return obj;
  84581. }
  84582. function getAttribute(el, attribute) {
  84583. return el.getAttribute(attribute);
  84584. }
  84585. function setAttribute(el, attribute, value) {
  84586. el.setAttribute(attribute, value);
  84587. }
  84588. function removeAttribute(el, attribute) {
  84589. el.removeAttribute(attribute);
  84590. }
  84591. function blockTextSelection() {
  84592. document_1.body.focus();
  84593. document_1.onselectstart = function() {
  84594. return false;
  84595. };
  84596. }
  84597. function unblockTextSelection() {
  84598. document_1.onselectstart = function() {
  84599. return true;
  84600. };
  84601. }
  84602. function getBoundingClientRect(el) {
  84603. if (el && el.getBoundingClientRect && el.parentNode) {
  84604. var rect = el.getBoundingClientRect();
  84605. var result = {};
  84606. ["bottom", "height", "left", "right", "top", "width"].forEach(function(k) {
  84607. if (rect[k] !== void 0) {
  84608. result[k] = rect[k];
  84609. }
  84610. });
  84611. if (!result.height) {
  84612. result.height = parseFloat(computedStyle(el, "height"));
  84613. }
  84614. if (!result.width) {
  84615. result.width = parseFloat(computedStyle(el, "width"));
  84616. }
  84617. return result;
  84618. }
  84619. }
  84620. function findPosition(el) {
  84621. if (!el || el && !el.offsetParent) {
  84622. return {
  84623. left: 0,
  84624. top: 0,
  84625. width: 0,
  84626. height: 0
  84627. };
  84628. }
  84629. var width2 = el.offsetWidth;
  84630. var height2 = el.offsetHeight;
  84631. var left = 0;
  84632. var top = 0;
  84633. while (el.offsetParent && el !== document_1[FullscreenApi.fullscreenElement]) {
  84634. left += el.offsetLeft;
  84635. top += el.offsetTop;
  84636. el = el.offsetParent;
  84637. }
  84638. return {
  84639. left,
  84640. top,
  84641. width: width2,
  84642. height: height2
  84643. };
  84644. }
  84645. function getPointerPosition(el, event2) {
  84646. var translated = {
  84647. x: 0,
  84648. y: 0
  84649. };
  84650. if (IS_IOS) {
  84651. var item = el;
  84652. while (item && item.nodeName.toLowerCase() !== "html") {
  84653. var transform3 = computedStyle(item, "transform");
  84654. if (/^matrix/.test(transform3)) {
  84655. var values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  84656. translated.x += values3[4];
  84657. translated.y += values3[5];
  84658. } else if (/^matrix3d/.test(transform3)) {
  84659. var _values = transform3.slice(9, -1).split(/,\s/).map(Number);
  84660. translated.x += _values[12];
  84661. translated.y += _values[13];
  84662. }
  84663. item = item.parentNode;
  84664. }
  84665. }
  84666. var position2 = {};
  84667. var boxTarget = findPosition(event2.target);
  84668. var box = findPosition(el);
  84669. var boxW = box.width;
  84670. var boxH = box.height;
  84671. var offsetY = event2.offsetY - (box.top - boxTarget.top);
  84672. var offsetX = event2.offsetX - (box.left - boxTarget.left);
  84673. if (event2.changedTouches) {
  84674. offsetX = event2.changedTouches[0].pageX - box.left;
  84675. offsetY = event2.changedTouches[0].pageY + box.top;
  84676. if (IS_IOS) {
  84677. offsetX -= translated.x;
  84678. offsetY -= translated.y;
  84679. }
  84680. }
  84681. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  84682. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  84683. return position2;
  84684. }
  84685. function isTextNode(value) {
  84686. return isObject2(value) && value.nodeType === 3;
  84687. }
  84688. function emptyEl(el) {
  84689. while (el.firstChild) {
  84690. el.removeChild(el.firstChild);
  84691. }
  84692. return el;
  84693. }
  84694. function normalizeContent(content) {
  84695. if (typeof content === "function") {
  84696. content = content();
  84697. }
  84698. return (Array.isArray(content) ? content : [content]).map(function(value) {
  84699. if (typeof value === "function") {
  84700. value = value();
  84701. }
  84702. if (isEl(value) || isTextNode(value)) {
  84703. return value;
  84704. }
  84705. if (typeof value === "string" && /\S/.test(value)) {
  84706. return document_1.createTextNode(value);
  84707. }
  84708. }).filter(function(value) {
  84709. return value;
  84710. });
  84711. }
  84712. function appendContent(el, content) {
  84713. normalizeContent(content).forEach(function(node) {
  84714. return el.appendChild(node);
  84715. });
  84716. return el;
  84717. }
  84718. function insertContent(el, content) {
  84719. return appendContent(emptyEl(el), content);
  84720. }
  84721. function isSingleLeftClick(event2) {
  84722. if (event2.button === void 0 && event2.buttons === void 0) {
  84723. return true;
  84724. }
  84725. if (event2.button === 0 && event2.buttons === void 0) {
  84726. return true;
  84727. }
  84728. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  84729. return true;
  84730. }
  84731. if (event2.button !== 0 || event2.buttons !== 1) {
  84732. return false;
  84733. }
  84734. return true;
  84735. }
  84736. var $ = createQuerier("querySelector");
  84737. var $$ = createQuerier("querySelectorAll");
  84738. var Dom$1 = /* @__PURE__ */ Object.freeze({
  84739. __proto__: null,
  84740. isReal,
  84741. isEl,
  84742. isInFrame,
  84743. createEl,
  84744. textContent,
  84745. prependTo,
  84746. hasClass,
  84747. addClass,
  84748. removeClass,
  84749. toggleClass,
  84750. setAttributes,
  84751. getAttributes,
  84752. getAttribute,
  84753. setAttribute,
  84754. removeAttribute,
  84755. blockTextSelection,
  84756. unblockTextSelection,
  84757. getBoundingClientRect,
  84758. findPosition,
  84759. getPointerPosition,
  84760. isTextNode,
  84761. emptyEl,
  84762. normalizeContent,
  84763. appendContent,
  84764. insertContent,
  84765. isSingleLeftClick,
  84766. $,
  84767. $$
  84768. });
  84769. var _windowLoaded = false;
  84770. var videojs$1;
  84771. var autoSetup = function autoSetup2() {
  84772. if (videojs$1.options.autoSetup === false) {
  84773. return;
  84774. }
  84775. var vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  84776. var audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  84777. var divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  84778. var mediaEls = vids.concat(audios, divs);
  84779. if (mediaEls && mediaEls.length > 0) {
  84780. for (var i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  84781. var mediaEl = mediaEls[i2];
  84782. if (mediaEl && mediaEl.getAttribute) {
  84783. if (mediaEl.player === void 0) {
  84784. var options2 = mediaEl.getAttribute("data-setup");
  84785. if (options2 !== null) {
  84786. videojs$1(mediaEl);
  84787. }
  84788. }
  84789. } else {
  84790. autoSetupTimeout(1);
  84791. break;
  84792. }
  84793. }
  84794. } else if (!_windowLoaded) {
  84795. autoSetupTimeout(1);
  84796. }
  84797. };
  84798. function autoSetupTimeout(wait, vjs) {
  84799. if (!isReal()) {
  84800. return;
  84801. }
  84802. if (vjs) {
  84803. videojs$1 = vjs;
  84804. }
  84805. window_1.setTimeout(autoSetup, wait);
  84806. }
  84807. function setWindowLoaded() {
  84808. _windowLoaded = true;
  84809. window_1.removeEventListener("load", setWindowLoaded);
  84810. }
  84811. if (isReal()) {
  84812. if (document_1.readyState === "complete") {
  84813. setWindowLoaded();
  84814. } else {
  84815. window_1.addEventListener("load", setWindowLoaded);
  84816. }
  84817. }
  84818. var createStyleElement = function createStyleElement2(className) {
  84819. var style = document_1.createElement("style");
  84820. style.className = className;
  84821. return style;
  84822. };
  84823. var setTextContent = function setTextContent2(el, content) {
  84824. if (el.styleSheet) {
  84825. el.styleSheet.cssText = content;
  84826. } else {
  84827. el.textContent = content;
  84828. }
  84829. };
  84830. var _initialGuid = 3;
  84831. var _guid = _initialGuid;
  84832. function newGUID() {
  84833. return _guid++;
  84834. }
  84835. var FakeWeakMap;
  84836. if (!window_1.WeakMap) {
  84837. FakeWeakMap = /* @__PURE__ */ function() {
  84838. function FakeWeakMap2() {
  84839. this.vdata = "vdata" + Math.floor(window_1.performance && window_1.performance.now() || Date.now());
  84840. this.data = {};
  84841. }
  84842. var _proto = FakeWeakMap2.prototype;
  84843. _proto.set = function set4(key, value) {
  84844. var access = key[this.vdata] || newGUID();
  84845. if (!key[this.vdata]) {
  84846. key[this.vdata] = access;
  84847. }
  84848. this.data[access] = value;
  84849. return this;
  84850. };
  84851. _proto.get = function get7(key) {
  84852. var access = key[this.vdata];
  84853. if (access) {
  84854. return this.data[access];
  84855. }
  84856. log$1("We have no data for this element", key);
  84857. return void 0;
  84858. };
  84859. _proto.has = function has(key) {
  84860. var access = key[this.vdata];
  84861. return access in this.data;
  84862. };
  84863. _proto["delete"] = function _delete(key) {
  84864. var access = key[this.vdata];
  84865. if (access) {
  84866. delete this.data[access];
  84867. delete key[this.vdata];
  84868. }
  84869. };
  84870. return FakeWeakMap2;
  84871. }();
  84872. }
  84873. var DomData = window_1.WeakMap ? /* @__PURE__ */ new WeakMap() : new FakeWeakMap();
  84874. function _cleanUpEvents(elem, type2) {
  84875. if (!DomData.has(elem)) {
  84876. return;
  84877. }
  84878. var data = DomData.get(elem);
  84879. if (data.handlers[type2].length === 0) {
  84880. delete data.handlers[type2];
  84881. if (elem.removeEventListener) {
  84882. elem.removeEventListener(type2, data.dispatcher, false);
  84883. } else if (elem.detachEvent) {
  84884. elem.detachEvent("on" + type2, data.dispatcher);
  84885. }
  84886. }
  84887. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  84888. delete data.handlers;
  84889. delete data.dispatcher;
  84890. delete data.disabled;
  84891. }
  84892. if (Object.getOwnPropertyNames(data).length === 0) {
  84893. DomData["delete"](elem);
  84894. }
  84895. }
  84896. function _handleMultipleEvents(fn2, elem, types, callback2) {
  84897. types.forEach(function(type2) {
  84898. fn2(elem, type2, callback2);
  84899. });
  84900. }
  84901. function fixEvent(event2) {
  84902. if (event2.fixed_) {
  84903. return event2;
  84904. }
  84905. function returnTrue() {
  84906. return true;
  84907. }
  84908. function returnFalse() {
  84909. return false;
  84910. }
  84911. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  84912. var old = event2 || window_1.event;
  84913. event2 = {};
  84914. for (var key in old) {
  84915. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  84916. if (!(key === "returnValue" && old.preventDefault)) {
  84917. event2[key] = old[key];
  84918. }
  84919. }
  84920. }
  84921. if (!event2.target) {
  84922. event2.target = event2.srcElement || document_1;
  84923. }
  84924. if (!event2.relatedTarget) {
  84925. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  84926. }
  84927. event2.preventDefault = function() {
  84928. if (old.preventDefault) {
  84929. old.preventDefault();
  84930. }
  84931. event2.returnValue = false;
  84932. old.returnValue = false;
  84933. event2.defaultPrevented = true;
  84934. };
  84935. event2.defaultPrevented = false;
  84936. event2.stopPropagation = function() {
  84937. if (old.stopPropagation) {
  84938. old.stopPropagation();
  84939. }
  84940. event2.cancelBubble = true;
  84941. old.cancelBubble = true;
  84942. event2.isPropagationStopped = returnTrue;
  84943. };
  84944. event2.isPropagationStopped = returnFalse;
  84945. event2.stopImmediatePropagation = function() {
  84946. if (old.stopImmediatePropagation) {
  84947. old.stopImmediatePropagation();
  84948. }
  84949. event2.isImmediatePropagationStopped = returnTrue;
  84950. event2.stopPropagation();
  84951. };
  84952. event2.isImmediatePropagationStopped = returnFalse;
  84953. if (event2.clientX !== null && event2.clientX !== void 0) {
  84954. var doc = document_1.documentElement;
  84955. var body = document_1.body;
  84956. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  84957. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  84958. }
  84959. event2.which = event2.charCode || event2.keyCode;
  84960. if (event2.button !== null && event2.button !== void 0) {
  84961. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  84962. }
  84963. }
  84964. event2.fixed_ = true;
  84965. return event2;
  84966. }
  84967. var _supportsPassive;
  84968. var supportsPassive = function supportsPassive2() {
  84969. if (typeof _supportsPassive !== "boolean") {
  84970. _supportsPassive = false;
  84971. try {
  84972. var opts = Object.defineProperty({}, "passive", {
  84973. get: function get7() {
  84974. _supportsPassive = true;
  84975. }
  84976. });
  84977. window_1.addEventListener("test", null, opts);
  84978. window_1.removeEventListener("test", null, opts);
  84979. } catch (e) {
  84980. }
  84981. }
  84982. return _supportsPassive;
  84983. };
  84984. var passiveEvents = ["touchstart", "touchmove"];
  84985. function on(elem, type2, fn2) {
  84986. if (Array.isArray(type2)) {
  84987. return _handleMultipleEvents(on, elem, type2, fn2);
  84988. }
  84989. if (!DomData.has(elem)) {
  84990. DomData.set(elem, {});
  84991. }
  84992. var data = DomData.get(elem);
  84993. if (!data.handlers) {
  84994. data.handlers = {};
  84995. }
  84996. if (!data.handlers[type2]) {
  84997. data.handlers[type2] = [];
  84998. }
  84999. if (!fn2.guid) {
  85000. fn2.guid = newGUID();
  85001. }
  85002. data.handlers[type2].push(fn2);
  85003. if (!data.dispatcher) {
  85004. data.disabled = false;
  85005. data.dispatcher = function(event2, hash) {
  85006. if (data.disabled) {
  85007. return;
  85008. }
  85009. event2 = fixEvent(event2);
  85010. var handlers = data.handlers[event2.type];
  85011. if (handlers) {
  85012. var handlersCopy = handlers.slice(0);
  85013. for (var m = 0, n = handlersCopy.length; m < n; m++) {
  85014. if (event2.isImmediatePropagationStopped()) {
  85015. break;
  85016. } else {
  85017. try {
  85018. handlersCopy[m].call(elem, event2, hash);
  85019. } catch (e) {
  85020. log$1.error(e);
  85021. }
  85022. }
  85023. }
  85024. }
  85025. };
  85026. }
  85027. if (data.handlers[type2].length === 1) {
  85028. if (elem.addEventListener) {
  85029. var options2 = false;
  85030. if (supportsPassive() && passiveEvents.indexOf(type2) > -1) {
  85031. options2 = {
  85032. passive: true
  85033. };
  85034. }
  85035. elem.addEventListener(type2, data.dispatcher, options2);
  85036. } else if (elem.attachEvent) {
  85037. elem.attachEvent("on" + type2, data.dispatcher);
  85038. }
  85039. }
  85040. }
  85041. function off(elem, type2, fn2) {
  85042. if (!DomData.has(elem)) {
  85043. return;
  85044. }
  85045. var data = DomData.get(elem);
  85046. if (!data.handlers) {
  85047. return;
  85048. }
  85049. if (Array.isArray(type2)) {
  85050. return _handleMultipleEvents(off, elem, type2, fn2);
  85051. }
  85052. var removeType = function removeType2(el, t3) {
  85053. data.handlers[t3] = [];
  85054. _cleanUpEvents(el, t3);
  85055. };
  85056. if (type2 === void 0) {
  85057. for (var t2 in data.handlers) {
  85058. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  85059. removeType(elem, t2);
  85060. }
  85061. }
  85062. return;
  85063. }
  85064. var handlers = data.handlers[type2];
  85065. if (!handlers) {
  85066. return;
  85067. }
  85068. if (!fn2) {
  85069. removeType(elem, type2);
  85070. return;
  85071. }
  85072. if (fn2.guid) {
  85073. for (var n = 0; n < handlers.length; n++) {
  85074. if (handlers[n].guid === fn2.guid) {
  85075. handlers.splice(n--, 1);
  85076. }
  85077. }
  85078. }
  85079. _cleanUpEvents(elem, type2);
  85080. }
  85081. function trigger(elem, event2, hash) {
  85082. var elemData = DomData.has(elem) ? DomData.get(elem) : {};
  85083. var parent = elem.parentNode || elem.ownerDocument;
  85084. if (typeof event2 === "string") {
  85085. event2 = {
  85086. type: event2,
  85087. target: elem
  85088. };
  85089. } else if (!event2.target) {
  85090. event2.target = elem;
  85091. }
  85092. event2 = fixEvent(event2);
  85093. if (elemData.dispatcher) {
  85094. elemData.dispatcher.call(elem, event2, hash);
  85095. }
  85096. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  85097. trigger.call(null, parent, event2, hash);
  85098. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  85099. if (!DomData.has(event2.target)) {
  85100. DomData.set(event2.target, {});
  85101. }
  85102. var targetData = DomData.get(event2.target);
  85103. if (event2.target[event2.type]) {
  85104. targetData.disabled = true;
  85105. if (typeof event2.target[event2.type] === "function") {
  85106. event2.target[event2.type]();
  85107. }
  85108. targetData.disabled = false;
  85109. }
  85110. }
  85111. return !event2.defaultPrevented;
  85112. }
  85113. function one(elem, type2, fn2) {
  85114. if (Array.isArray(type2)) {
  85115. return _handleMultipleEvents(one, elem, type2, fn2);
  85116. }
  85117. var func = function func2() {
  85118. off(elem, type2, func2);
  85119. fn2.apply(this, arguments);
  85120. };
  85121. func.guid = fn2.guid = fn2.guid || newGUID();
  85122. on(elem, type2, func);
  85123. }
  85124. function any(elem, type2, fn2) {
  85125. var func = function func2() {
  85126. off(elem, type2, func2);
  85127. fn2.apply(this, arguments);
  85128. };
  85129. func.guid = fn2.guid = fn2.guid || newGUID();
  85130. on(elem, type2, func);
  85131. }
  85132. var Events = /* @__PURE__ */ Object.freeze({
  85133. __proto__: null,
  85134. fixEvent,
  85135. on,
  85136. off,
  85137. trigger,
  85138. one,
  85139. any
  85140. });
  85141. var UPDATE_REFRESH_INTERVAL = 30;
  85142. var bind = function bind2(context, fn2, uid) {
  85143. if (!fn2.guid) {
  85144. fn2.guid = newGUID();
  85145. }
  85146. var bound = fn2.bind(context);
  85147. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  85148. return bound;
  85149. };
  85150. var throttle = function throttle2(fn2, wait) {
  85151. var last = window_1.performance.now();
  85152. var throttled = function throttled2() {
  85153. var now2 = window_1.performance.now();
  85154. if (now2 - last >= wait) {
  85155. fn2.apply(void 0, arguments);
  85156. last = now2;
  85157. }
  85158. };
  85159. return throttled;
  85160. };
  85161. var debounce = function debounce2(func, wait, immediate, context) {
  85162. if (context === void 0) {
  85163. context = window_1;
  85164. }
  85165. var timeout;
  85166. var cancel = function cancel2() {
  85167. context.clearTimeout(timeout);
  85168. timeout = null;
  85169. };
  85170. var debounced = function debounced2() {
  85171. var self2 = this;
  85172. var args = arguments;
  85173. var _later = function later() {
  85174. timeout = null;
  85175. _later = null;
  85176. if (!immediate) {
  85177. func.apply(self2, args);
  85178. }
  85179. };
  85180. if (!timeout && immediate) {
  85181. func.apply(self2, args);
  85182. }
  85183. context.clearTimeout(timeout);
  85184. timeout = context.setTimeout(_later, wait);
  85185. };
  85186. debounced.cancel = cancel;
  85187. return debounced;
  85188. };
  85189. var EventTarget$2 = function EventTarget() {
  85190. };
  85191. EventTarget$2.prototype.allowedEvents_ = {};
  85192. EventTarget$2.prototype.on = function(type2, fn2) {
  85193. var ael = this.addEventListener;
  85194. this.addEventListener = function() {
  85195. };
  85196. on(this, type2, fn2);
  85197. this.addEventListener = ael;
  85198. };
  85199. EventTarget$2.prototype.addEventListener = EventTarget$2.prototype.on;
  85200. EventTarget$2.prototype.off = function(type2, fn2) {
  85201. off(this, type2, fn2);
  85202. };
  85203. EventTarget$2.prototype.removeEventListener = EventTarget$2.prototype.off;
  85204. EventTarget$2.prototype.one = function(type2, fn2) {
  85205. var ael = this.addEventListener;
  85206. this.addEventListener = function() {
  85207. };
  85208. one(this, type2, fn2);
  85209. this.addEventListener = ael;
  85210. };
  85211. EventTarget$2.prototype.any = function(type2, fn2) {
  85212. var ael = this.addEventListener;
  85213. this.addEventListener = function() {
  85214. };
  85215. any(this, type2, fn2);
  85216. this.addEventListener = ael;
  85217. };
  85218. EventTarget$2.prototype.trigger = function(event2) {
  85219. var type2 = event2.type || event2;
  85220. if (typeof event2 === "string") {
  85221. event2 = {
  85222. type: type2
  85223. };
  85224. }
  85225. event2 = fixEvent(event2);
  85226. if (this.allowedEvents_[type2] && this["on" + type2]) {
  85227. this["on" + type2](event2);
  85228. }
  85229. trigger(this, event2);
  85230. };
  85231. EventTarget$2.prototype.dispatchEvent = EventTarget$2.prototype.trigger;
  85232. var EVENT_MAP;
  85233. EventTarget$2.prototype.queueTrigger = function(event2) {
  85234. var _this = this;
  85235. if (!EVENT_MAP) {
  85236. EVENT_MAP = /* @__PURE__ */ new Map();
  85237. }
  85238. var type2 = event2.type || event2;
  85239. var map = EVENT_MAP.get(this);
  85240. if (!map) {
  85241. map = /* @__PURE__ */ new Map();
  85242. EVENT_MAP.set(this, map);
  85243. }
  85244. var oldTimeout = map.get(type2);
  85245. map["delete"](type2);
  85246. window_1.clearTimeout(oldTimeout);
  85247. var timeout = window_1.setTimeout(function() {
  85248. map["delete"](type2);
  85249. if (map.size === 0) {
  85250. map = null;
  85251. EVENT_MAP["delete"](_this);
  85252. }
  85253. _this.trigger(event2);
  85254. }, 0);
  85255. map.set(type2, timeout);
  85256. };
  85257. var objName = function objName2(obj) {
  85258. if (typeof obj.name === "function") {
  85259. return obj.name();
  85260. }
  85261. if (typeof obj.name === "string") {
  85262. return obj.name;
  85263. }
  85264. if (obj.name_) {
  85265. return obj.name_;
  85266. }
  85267. if (obj.constructor && obj.constructor.name) {
  85268. return obj.constructor.name;
  85269. }
  85270. return typeof obj;
  85271. };
  85272. var isEvented = function isEvented2(object) {
  85273. return object instanceof EventTarget$2 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(k) {
  85274. return typeof object[k] === "function";
  85275. });
  85276. };
  85277. var addEventedCallback = function addEventedCallback2(target, callback2) {
  85278. if (isEvented(target)) {
  85279. callback2();
  85280. } else {
  85281. if (!target.eventedCallbacks) {
  85282. target.eventedCallbacks = [];
  85283. }
  85284. target.eventedCallbacks.push(callback2);
  85285. }
  85286. };
  85287. var isValidEventType = function isValidEventType2(type2) {
  85288. return typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  85289. };
  85290. var validateTarget = function validateTarget2(target, obj, fnName) {
  85291. if (!target || !target.nodeName && !isEvented(target)) {
  85292. throw new Error("Invalid target for " + objName(obj) + "#" + fnName + "; must be a DOM node or evented object.");
  85293. }
  85294. };
  85295. var validateEventType = function validateEventType2(type2, obj, fnName) {
  85296. if (!isValidEventType(type2)) {
  85297. throw new Error("Invalid event type for " + objName(obj) + "#" + fnName + "; must be a non-empty string or array.");
  85298. }
  85299. };
  85300. var validateListener = function validateListener2(listener, obj, fnName) {
  85301. if (typeof listener !== "function") {
  85302. throw new Error("Invalid listener for " + objName(obj) + "#" + fnName + "; must be a function.");
  85303. }
  85304. };
  85305. var normalizeListenArgs = function normalizeListenArgs2(self2, args, fnName) {
  85306. var isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  85307. var target;
  85308. var type2;
  85309. var listener;
  85310. if (isTargetingSelf) {
  85311. target = self2.eventBusEl_;
  85312. if (args.length >= 3) {
  85313. args.shift();
  85314. }
  85315. type2 = args[0];
  85316. listener = args[1];
  85317. } else {
  85318. target = args[0];
  85319. type2 = args[1];
  85320. listener = args[2];
  85321. }
  85322. validateTarget(target, self2, fnName);
  85323. validateEventType(type2, self2, fnName);
  85324. validateListener(listener, self2, fnName);
  85325. listener = bind(self2, listener);
  85326. return {
  85327. isTargetingSelf,
  85328. target,
  85329. type: type2,
  85330. listener
  85331. };
  85332. };
  85333. var listen = function listen2(target, method, type2, listener) {
  85334. validateTarget(target, target, method);
  85335. if (target.nodeName) {
  85336. Events[method](target, type2, listener);
  85337. } else {
  85338. target[method](type2, listener);
  85339. }
  85340. };
  85341. var EventedMixin = {
  85342. on: function on2() {
  85343. var _this = this;
  85344. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  85345. args[_key] = arguments[_key];
  85346. }
  85347. var _normalizeListenArgs = normalizeListenArgs(this, args, "on"), isTargetingSelf = _normalizeListenArgs.isTargetingSelf, target = _normalizeListenArgs.target, type2 = _normalizeListenArgs.type, listener = _normalizeListenArgs.listener;
  85348. listen(target, "on", type2, listener);
  85349. if (!isTargetingSelf) {
  85350. var removeListenerOnDispose = function removeListenerOnDispose2() {
  85351. return _this.off(target, type2, listener);
  85352. };
  85353. removeListenerOnDispose.guid = listener.guid;
  85354. var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose2() {
  85355. return _this.off("dispose", removeListenerOnDispose);
  85356. };
  85357. removeRemoverOnTargetDispose.guid = listener.guid;
  85358. listen(this, "on", "dispose", removeListenerOnDispose);
  85359. listen(target, "on", "dispose", removeRemoverOnTargetDispose);
  85360. }
  85361. },
  85362. one: function one2() {
  85363. var _this2 = this;
  85364. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  85365. args[_key2] = arguments[_key2];
  85366. }
  85367. var _normalizeListenArgs2 = normalizeListenArgs(this, args, "one"), isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, target = _normalizeListenArgs2.target, type2 = _normalizeListenArgs2.type, listener = _normalizeListenArgs2.listener;
  85368. if (isTargetingSelf) {
  85369. listen(target, "one", type2, listener);
  85370. } else {
  85371. var wrapper = function wrapper2() {
  85372. _this2.off(target, type2, wrapper2);
  85373. for (var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  85374. largs[_key3] = arguments[_key3];
  85375. }
  85376. listener.apply(null, largs);
  85377. };
  85378. wrapper.guid = listener.guid;
  85379. listen(target, "one", type2, wrapper);
  85380. }
  85381. },
  85382. any: function any2() {
  85383. var _this3 = this;
  85384. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  85385. args[_key4] = arguments[_key4];
  85386. }
  85387. var _normalizeListenArgs3 = normalizeListenArgs(this, args, "any"), isTargetingSelf = _normalizeListenArgs3.isTargetingSelf, target = _normalizeListenArgs3.target, type2 = _normalizeListenArgs3.type, listener = _normalizeListenArgs3.listener;
  85388. if (isTargetingSelf) {
  85389. listen(target, "any", type2, listener);
  85390. } else {
  85391. var wrapper = function wrapper2() {
  85392. _this3.off(target, type2, wrapper2);
  85393. for (var _len5 = arguments.length, largs = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  85394. largs[_key5] = arguments[_key5];
  85395. }
  85396. listener.apply(null, largs);
  85397. };
  85398. wrapper.guid = listener.guid;
  85399. listen(target, "any", type2, wrapper);
  85400. }
  85401. },
  85402. off: function off$12(targetOrType, typeOrListener, listener) {
  85403. if (!targetOrType || isValidEventType(targetOrType)) {
  85404. off(this.eventBusEl_, targetOrType, typeOrListener);
  85405. } else {
  85406. var target = targetOrType;
  85407. var type2 = typeOrListener;
  85408. validateTarget(target, this, "off");
  85409. validateEventType(type2, this, "off");
  85410. validateListener(listener, this, "off");
  85411. listener = bind(this, listener);
  85412. this.off("dispose", listener);
  85413. if (target.nodeName) {
  85414. off(target, type2, listener);
  85415. off(target, "dispose", listener);
  85416. } else if (isEvented(target)) {
  85417. target.off(type2, listener);
  85418. target.off("dispose", listener);
  85419. }
  85420. }
  85421. },
  85422. trigger: function trigger$12(event2, hash) {
  85423. validateTarget(this.eventBusEl_, this, "trigger");
  85424. var type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  85425. if (!isValidEventType(type2)) {
  85426. 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.";
  85427. if (event2) {
  85428. (this.log || log$1).error(error);
  85429. } else {
  85430. throw new Error(error);
  85431. }
  85432. }
  85433. return trigger(this.eventBusEl_, event2, hash);
  85434. }
  85435. };
  85436. function evented(target, options2) {
  85437. if (options2 === void 0) {
  85438. options2 = {};
  85439. }
  85440. var _options = options2, eventBusKey = _options.eventBusKey;
  85441. if (eventBusKey) {
  85442. if (!target[eventBusKey].nodeName) {
  85443. throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.');
  85444. }
  85445. target.eventBusEl_ = target[eventBusKey];
  85446. } else {
  85447. target.eventBusEl_ = createEl("span", {
  85448. className: "vjs-event-bus"
  85449. });
  85450. }
  85451. assign(target, EventedMixin);
  85452. if (target.eventedCallbacks) {
  85453. target.eventedCallbacks.forEach(function(callback2) {
  85454. callback2();
  85455. });
  85456. }
  85457. target.on("dispose", function() {
  85458. target.off();
  85459. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  85460. if (val && DomData.has(val)) {
  85461. DomData["delete"](val);
  85462. }
  85463. });
  85464. window_1.setTimeout(function() {
  85465. target.eventBusEl_ = null;
  85466. }, 0);
  85467. });
  85468. return target;
  85469. }
  85470. var StatefulMixin = {
  85471. state: {},
  85472. setState: function setState(stateUpdates) {
  85473. var _this = this;
  85474. if (typeof stateUpdates === "function") {
  85475. stateUpdates = stateUpdates();
  85476. }
  85477. var changes;
  85478. each(stateUpdates, function(value, key) {
  85479. if (_this.state[key] !== value) {
  85480. changes = changes || {};
  85481. changes[key] = {
  85482. from: _this.state[key],
  85483. to: value
  85484. };
  85485. }
  85486. _this.state[key] = value;
  85487. });
  85488. if (changes && isEvented(this)) {
  85489. this.trigger({
  85490. changes,
  85491. type: "statechanged"
  85492. });
  85493. }
  85494. return changes;
  85495. }
  85496. };
  85497. function stateful(target, defaultState) {
  85498. assign(target, StatefulMixin);
  85499. target.state = assign({}, target.state, defaultState);
  85500. if (typeof target.handleStateChanged === "function" && isEvented(target)) {
  85501. target.on("statechanged", target.handleStateChanged);
  85502. }
  85503. return target;
  85504. }
  85505. var toLowerCase = function toLowerCase2(string) {
  85506. if (typeof string !== "string") {
  85507. return string;
  85508. }
  85509. return string.replace(/./, function(w) {
  85510. return w.toLowerCase();
  85511. });
  85512. };
  85513. var toTitleCase$1 = function toTitleCase(string) {
  85514. if (typeof string !== "string") {
  85515. return string;
  85516. }
  85517. return string.replace(/./, function(w) {
  85518. return w.toUpperCase();
  85519. });
  85520. };
  85521. var titleCaseEquals = function titleCaseEquals2(str1, str2) {
  85522. return toTitleCase$1(str1) === toTitleCase$1(str2);
  85523. };
  85524. function mergeOptions$3() {
  85525. var result = {};
  85526. for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
  85527. sources[_key] = arguments[_key];
  85528. }
  85529. sources.forEach(function(source) {
  85530. if (!source) {
  85531. return;
  85532. }
  85533. each(source, function(value, key) {
  85534. if (!isPlain(value)) {
  85535. result[key] = value;
  85536. return;
  85537. }
  85538. if (!isPlain(result[key])) {
  85539. result[key] = {};
  85540. }
  85541. result[key] = mergeOptions$3(result[key], value);
  85542. });
  85543. });
  85544. return result;
  85545. }
  85546. var MapSham = /* @__PURE__ */ function() {
  85547. function MapSham2() {
  85548. this.map_ = {};
  85549. }
  85550. var _proto = MapSham2.prototype;
  85551. _proto.has = function has(key) {
  85552. return key in this.map_;
  85553. };
  85554. _proto["delete"] = function _delete(key) {
  85555. var has = this.has(key);
  85556. delete this.map_[key];
  85557. return has;
  85558. };
  85559. _proto.set = function set4(key, value) {
  85560. this.map_[key] = value;
  85561. return this;
  85562. };
  85563. _proto.forEach = function forEach(callback2, thisArg) {
  85564. for (var key in this.map_) {
  85565. callback2.call(thisArg, this.map_[key], key, this);
  85566. }
  85567. };
  85568. return MapSham2;
  85569. }();
  85570. var Map$1 = window_1.Map ? window_1.Map : MapSham;
  85571. var SetSham = /* @__PURE__ */ function() {
  85572. function SetSham2() {
  85573. this.set_ = {};
  85574. }
  85575. var _proto = SetSham2.prototype;
  85576. _proto.has = function has(key) {
  85577. return key in this.set_;
  85578. };
  85579. _proto["delete"] = function _delete(key) {
  85580. var has = this.has(key);
  85581. delete this.set_[key];
  85582. return has;
  85583. };
  85584. _proto.add = function add(key) {
  85585. this.set_[key] = 1;
  85586. return this;
  85587. };
  85588. _proto.forEach = function forEach(callback2, thisArg) {
  85589. for (var key in this.set_) {
  85590. callback2.call(thisArg, key, key, this);
  85591. }
  85592. };
  85593. return SetSham2;
  85594. }();
  85595. var Set$1 = window_1.Set ? window_1.Set : SetSham;
  85596. var Component$1 = /* @__PURE__ */ function() {
  85597. function Component2(player, options2, ready) {
  85598. var _this = this;
  85599. if (!player && this.play) {
  85600. this.player_ = player = this;
  85601. } else {
  85602. this.player_ = player;
  85603. }
  85604. this.isDisposed_ = false;
  85605. this.parentComponent_ = null;
  85606. this.options_ = mergeOptions$3({}, this.options_);
  85607. options2 = this.options_ = mergeOptions$3(this.options_, options2);
  85608. this.id_ = options2.id || options2.el && options2.el.id;
  85609. if (!this.id_) {
  85610. var id = player && player.id && player.id() || "no_player";
  85611. this.id_ = id + "_component_" + newGUID();
  85612. }
  85613. this.name_ = options2.name || null;
  85614. if (options2.el) {
  85615. this.el_ = options2.el;
  85616. } else if (options2.createEl !== false) {
  85617. this.el_ = this.createEl();
  85618. }
  85619. if (options2.className && this.el_) {
  85620. options2.className.split(" ").forEach(function(c) {
  85621. return _this.addClass(c);
  85622. });
  85623. }
  85624. if (options2.evented !== false) {
  85625. evented(this, {
  85626. eventBusKey: this.el_ ? "el_" : null
  85627. });
  85628. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  85629. this.on(this.player_, "languagechange", this.handleLanguagechange);
  85630. }
  85631. stateful(this, this.constructor.defaultState);
  85632. this.children_ = [];
  85633. this.childIndex_ = {};
  85634. this.childNameIndex_ = {};
  85635. this.setTimeoutIds_ = new Set$1();
  85636. this.setIntervalIds_ = new Set$1();
  85637. this.rafIds_ = new Set$1();
  85638. this.namedRafs_ = new Map$1();
  85639. this.clearingTimersOnDispose_ = false;
  85640. if (options2.initChildren !== false) {
  85641. this.initChildren();
  85642. }
  85643. this.ready(ready);
  85644. if (options2.reportTouchActivity !== false) {
  85645. this.enableTouchActivity();
  85646. }
  85647. }
  85648. var _proto = Component2.prototype;
  85649. _proto.dispose = function dispose(options2) {
  85650. if (options2 === void 0) {
  85651. options2 = {};
  85652. }
  85653. if (this.isDisposed_) {
  85654. return;
  85655. }
  85656. if (this.readyQueue_) {
  85657. this.readyQueue_.length = 0;
  85658. }
  85659. this.trigger({
  85660. type: "dispose",
  85661. bubbles: false
  85662. });
  85663. this.isDisposed_ = true;
  85664. if (this.children_) {
  85665. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85666. if (this.children_[i2].dispose) {
  85667. this.children_[i2].dispose();
  85668. }
  85669. }
  85670. }
  85671. this.children_ = null;
  85672. this.childIndex_ = null;
  85673. this.childNameIndex_ = null;
  85674. this.parentComponent_ = null;
  85675. if (this.el_) {
  85676. if (this.el_.parentNode) {
  85677. if (options2.restoreEl) {
  85678. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  85679. } else {
  85680. this.el_.parentNode.removeChild(this.el_);
  85681. }
  85682. }
  85683. this.el_ = null;
  85684. }
  85685. this.player_ = null;
  85686. };
  85687. _proto.isDisposed = function isDisposed() {
  85688. return Boolean(this.isDisposed_);
  85689. };
  85690. _proto.player = function player() {
  85691. return this.player_;
  85692. };
  85693. _proto.options = function options2(obj) {
  85694. if (!obj) {
  85695. return this.options_;
  85696. }
  85697. this.options_ = mergeOptions$3(this.options_, obj);
  85698. return this.options_;
  85699. };
  85700. _proto.el = function el() {
  85701. return this.el_;
  85702. };
  85703. _proto.createEl = function createEl$12(tagName, properties, attributes) {
  85704. return createEl(tagName, properties, attributes);
  85705. };
  85706. _proto.localize = function localize(string, tokens, defaultValue2) {
  85707. if (defaultValue2 === void 0) {
  85708. defaultValue2 = string;
  85709. }
  85710. var code = this.player_.language && this.player_.language();
  85711. var languages = this.player_.languages && this.player_.languages();
  85712. var language = languages && languages[code];
  85713. var primaryCode = code && code.split("-")[0];
  85714. var primaryLang = languages && languages[primaryCode];
  85715. var localizedString = defaultValue2;
  85716. if (language && language[string]) {
  85717. localizedString = language[string];
  85718. } else if (primaryLang && primaryLang[string]) {
  85719. localizedString = primaryLang[string];
  85720. }
  85721. if (tokens) {
  85722. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  85723. var value = tokens[index2 - 1];
  85724. var ret = value;
  85725. if (typeof value === "undefined") {
  85726. ret = match;
  85727. }
  85728. return ret;
  85729. });
  85730. }
  85731. return localizedString;
  85732. };
  85733. _proto.handleLanguagechange = function handleLanguagechange() {
  85734. };
  85735. _proto.contentEl = function contentEl() {
  85736. return this.contentEl_ || this.el_;
  85737. };
  85738. _proto.id = function id() {
  85739. return this.id_;
  85740. };
  85741. _proto.name = function name() {
  85742. return this.name_;
  85743. };
  85744. _proto.children = function children() {
  85745. return this.children_;
  85746. };
  85747. _proto.getChildById = function getChildById(id) {
  85748. return this.childIndex_[id];
  85749. };
  85750. _proto.getChild = function getChild(name) {
  85751. if (!name) {
  85752. return;
  85753. }
  85754. return this.childNameIndex_[name];
  85755. };
  85756. _proto.getDescendant = function getDescendant() {
  85757. for (var _len = arguments.length, names2 = new Array(_len), _key = 0; _key < _len; _key++) {
  85758. names2[_key] = arguments[_key];
  85759. }
  85760. names2 = names2.reduce(function(acc, n) {
  85761. return acc.concat(n);
  85762. }, []);
  85763. var currentChild = this;
  85764. for (var i2 = 0; i2 < names2.length; i2++) {
  85765. currentChild = currentChild.getChild(names2[i2]);
  85766. if (!currentChild || !currentChild.getChild) {
  85767. return;
  85768. }
  85769. }
  85770. return currentChild;
  85771. };
  85772. _proto.addChild = function addChild(child, options2, index2) {
  85773. if (options2 === void 0) {
  85774. options2 = {};
  85775. }
  85776. if (index2 === void 0) {
  85777. index2 = this.children_.length;
  85778. }
  85779. var component;
  85780. var componentName;
  85781. if (typeof child === "string") {
  85782. componentName = toTitleCase$1(child);
  85783. var componentClassName = options2.componentClass || componentName;
  85784. options2.name = componentName;
  85785. var ComponentClass = Component2.getComponent(componentClassName);
  85786. if (!ComponentClass) {
  85787. throw new Error("Component " + componentClassName + " does not exist");
  85788. }
  85789. if (typeof ComponentClass !== "function") {
  85790. return null;
  85791. }
  85792. component = new ComponentClass(this.player_ || this, options2);
  85793. } else {
  85794. component = child;
  85795. }
  85796. if (component.parentComponent_) {
  85797. component.parentComponent_.removeChild(component);
  85798. }
  85799. this.children_.splice(index2, 0, component);
  85800. component.parentComponent_ = this;
  85801. if (typeof component.id === "function") {
  85802. this.childIndex_[component.id()] = component;
  85803. }
  85804. componentName = componentName || component.name && toTitleCase$1(component.name());
  85805. if (componentName) {
  85806. this.childNameIndex_[componentName] = component;
  85807. this.childNameIndex_[toLowerCase(componentName)] = component;
  85808. }
  85809. if (typeof component.el === "function" && component.el()) {
  85810. var refNode = null;
  85811. if (this.children_[index2 + 1]) {
  85812. if (this.children_[index2 + 1].el_) {
  85813. refNode = this.children_[index2 + 1].el_;
  85814. } else if (isEl(this.children_[index2 + 1])) {
  85815. refNode = this.children_[index2 + 1];
  85816. }
  85817. }
  85818. this.contentEl().insertBefore(component.el(), refNode);
  85819. }
  85820. return component;
  85821. };
  85822. _proto.removeChild = function removeChild(component) {
  85823. if (typeof component === "string") {
  85824. component = this.getChild(component);
  85825. }
  85826. if (!component || !this.children_) {
  85827. return;
  85828. }
  85829. var childFound = false;
  85830. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85831. if (this.children_[i2] === component) {
  85832. childFound = true;
  85833. this.children_.splice(i2, 1);
  85834. break;
  85835. }
  85836. }
  85837. if (!childFound) {
  85838. return;
  85839. }
  85840. component.parentComponent_ = null;
  85841. this.childIndex_[component.id()] = null;
  85842. this.childNameIndex_[toTitleCase$1(component.name())] = null;
  85843. this.childNameIndex_[toLowerCase(component.name())] = null;
  85844. var compEl = component.el();
  85845. if (compEl && compEl.parentNode === this.contentEl()) {
  85846. this.contentEl().removeChild(component.el());
  85847. }
  85848. };
  85849. _proto.initChildren = function initChildren() {
  85850. var _this2 = this;
  85851. var children = this.options_.children;
  85852. if (children) {
  85853. var parentOptions = this.options_;
  85854. var handleAdd = function handleAdd2(child) {
  85855. var name = child.name;
  85856. var opts = child.opts;
  85857. if (parentOptions[name] !== void 0) {
  85858. opts = parentOptions[name];
  85859. }
  85860. if (opts === false) {
  85861. return;
  85862. }
  85863. if (opts === true) {
  85864. opts = {};
  85865. }
  85866. opts.playerOptions = _this2.options_.playerOptions;
  85867. var newChild = _this2.addChild(name, opts);
  85868. if (newChild) {
  85869. _this2[name] = newChild;
  85870. }
  85871. };
  85872. var workingChildren;
  85873. var Tech2 = Component2.getComponent("Tech");
  85874. if (Array.isArray(children)) {
  85875. workingChildren = children;
  85876. } else {
  85877. workingChildren = Object.keys(children);
  85878. }
  85879. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  85880. return !workingChildren.some(function(wchild) {
  85881. if (typeof wchild === "string") {
  85882. return child === wchild;
  85883. }
  85884. return child === wchild.name;
  85885. });
  85886. })).map(function(child) {
  85887. var name;
  85888. var opts;
  85889. if (typeof child === "string") {
  85890. name = child;
  85891. opts = children[name] || _this2.options_[name] || {};
  85892. } else {
  85893. name = child.name;
  85894. opts = child;
  85895. }
  85896. return {
  85897. name,
  85898. opts
  85899. };
  85900. }).filter(function(child) {
  85901. var c = Component2.getComponent(child.opts.componentClass || toTitleCase$1(child.name));
  85902. return c && !Tech2.isTech(c);
  85903. }).forEach(handleAdd);
  85904. }
  85905. };
  85906. _proto.buildCSSClass = function buildCSSClass() {
  85907. return "";
  85908. };
  85909. _proto.ready = function ready(fn2, sync) {
  85910. if (sync === void 0) {
  85911. sync = false;
  85912. }
  85913. if (!fn2) {
  85914. return;
  85915. }
  85916. if (!this.isReady_) {
  85917. this.readyQueue_ = this.readyQueue_ || [];
  85918. this.readyQueue_.push(fn2);
  85919. return;
  85920. }
  85921. if (sync) {
  85922. fn2.call(this);
  85923. } else {
  85924. this.setTimeout(fn2, 1);
  85925. }
  85926. };
  85927. _proto.triggerReady = function triggerReady() {
  85928. this.isReady_ = true;
  85929. this.setTimeout(function() {
  85930. var readyQueue = this.readyQueue_;
  85931. this.readyQueue_ = [];
  85932. if (readyQueue && readyQueue.length > 0) {
  85933. readyQueue.forEach(function(fn2) {
  85934. fn2.call(this);
  85935. }, this);
  85936. }
  85937. this.trigger("ready");
  85938. }, 1);
  85939. };
  85940. _proto.$ = function $$12(selector, context) {
  85941. return $(selector, context || this.contentEl());
  85942. };
  85943. _proto.$$ = function $$$12(selector, context) {
  85944. return $$(selector, context || this.contentEl());
  85945. };
  85946. _proto.hasClass = function hasClass$12(classToCheck) {
  85947. return hasClass(this.el_, classToCheck);
  85948. };
  85949. _proto.addClass = function addClass$12(classToAdd) {
  85950. addClass(this.el_, classToAdd);
  85951. };
  85952. _proto.removeClass = function removeClass$12(classToRemove) {
  85953. removeClass(this.el_, classToRemove);
  85954. };
  85955. _proto.toggleClass = function toggleClass$12(classToToggle, predicate) {
  85956. toggleClass(this.el_, classToToggle, predicate);
  85957. };
  85958. _proto.show = function show() {
  85959. this.removeClass("vjs-hidden");
  85960. };
  85961. _proto.hide = function hide() {
  85962. this.addClass("vjs-hidden");
  85963. };
  85964. _proto.lockShowing = function lockShowing() {
  85965. this.addClass("vjs-lock-showing");
  85966. };
  85967. _proto.unlockShowing = function unlockShowing() {
  85968. this.removeClass("vjs-lock-showing");
  85969. };
  85970. _proto.getAttribute = function getAttribute$12(attribute) {
  85971. return getAttribute(this.el_, attribute);
  85972. };
  85973. _proto.setAttribute = function setAttribute$12(attribute, value) {
  85974. setAttribute(this.el_, attribute, value);
  85975. };
  85976. _proto.removeAttribute = function removeAttribute$12(attribute) {
  85977. removeAttribute(this.el_, attribute);
  85978. };
  85979. _proto.width = function width2(num, skipListeners) {
  85980. return this.dimension("width", num, skipListeners);
  85981. };
  85982. _proto.height = function height2(num, skipListeners) {
  85983. return this.dimension("height", num, skipListeners);
  85984. };
  85985. _proto.dimensions = function dimensions(width2, height2) {
  85986. this.width(width2, true);
  85987. this.height(height2);
  85988. };
  85989. _proto.dimension = function dimension(widthOrHeight, num, skipListeners) {
  85990. if (num !== void 0) {
  85991. if (num === null || num !== num) {
  85992. num = 0;
  85993. }
  85994. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  85995. this.el_.style[widthOrHeight] = num;
  85996. } else if (num === "auto") {
  85997. this.el_.style[widthOrHeight] = "";
  85998. } else {
  85999. this.el_.style[widthOrHeight] = num + "px";
  86000. }
  86001. if (!skipListeners) {
  86002. this.trigger("componentresize");
  86003. }
  86004. return;
  86005. }
  86006. if (!this.el_) {
  86007. return 0;
  86008. }
  86009. var val = this.el_.style[widthOrHeight];
  86010. var pxIndex = val.indexOf("px");
  86011. if (pxIndex !== -1) {
  86012. return parseInt(val.slice(0, pxIndex), 10);
  86013. }
  86014. return parseInt(this.el_["offset" + toTitleCase$1(widthOrHeight)], 10);
  86015. };
  86016. _proto.currentDimension = function currentDimension(widthOrHeight) {
  86017. var computedWidthOrHeight = 0;
  86018. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  86019. throw new Error("currentDimension only accepts width or height value");
  86020. }
  86021. computedWidthOrHeight = computedStyle(this.el_, widthOrHeight);
  86022. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  86023. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  86024. var rule = "offset" + toTitleCase$1(widthOrHeight);
  86025. computedWidthOrHeight = this.el_[rule];
  86026. }
  86027. return computedWidthOrHeight;
  86028. };
  86029. _proto.currentDimensions = function currentDimensions() {
  86030. return {
  86031. width: this.currentDimension("width"),
  86032. height: this.currentDimension("height")
  86033. };
  86034. };
  86035. _proto.currentWidth = function currentWidth() {
  86036. return this.currentDimension("width");
  86037. };
  86038. _proto.currentHeight = function currentHeight() {
  86039. return this.currentDimension("height");
  86040. };
  86041. _proto.focus = function focus() {
  86042. this.el_.focus();
  86043. };
  86044. _proto.blur = function blur() {
  86045. this.el_.blur();
  86046. };
  86047. _proto.handleKeyDown = function handleKeyDown(event2) {
  86048. if (this.player_) {
  86049. if (!keycode.isEventKey(event2, "Tab")) {
  86050. event2.stopPropagation();
  86051. }
  86052. this.player_.handleKeyDown(event2);
  86053. }
  86054. };
  86055. _proto.handleKeyPress = function handleKeyPress(event2) {
  86056. this.handleKeyDown(event2);
  86057. };
  86058. _proto.emitTapEvents = function emitTapEvents() {
  86059. var touchStart = 0;
  86060. var firstTouch = null;
  86061. var tapMovementThreshold = 10;
  86062. var touchTimeThreshold = 200;
  86063. var couldBeTap;
  86064. this.on("touchstart", function(event2) {
  86065. if (event2.touches.length === 1) {
  86066. firstTouch = {
  86067. pageX: event2.touches[0].pageX,
  86068. pageY: event2.touches[0].pageY
  86069. };
  86070. touchStart = window_1.performance.now();
  86071. couldBeTap = true;
  86072. }
  86073. });
  86074. this.on("touchmove", function(event2) {
  86075. if (event2.touches.length > 1) {
  86076. couldBeTap = false;
  86077. } else if (firstTouch) {
  86078. var xdiff = event2.touches[0].pageX - firstTouch.pageX;
  86079. var ydiff = event2.touches[0].pageY - firstTouch.pageY;
  86080. var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  86081. if (touchDistance > tapMovementThreshold) {
  86082. couldBeTap = false;
  86083. }
  86084. }
  86085. });
  86086. var noTap = function noTap2() {
  86087. couldBeTap = false;
  86088. };
  86089. this.on("touchleave", noTap);
  86090. this.on("touchcancel", noTap);
  86091. this.on("touchend", function(event2) {
  86092. firstTouch = null;
  86093. if (couldBeTap === true) {
  86094. var touchTime = window_1.performance.now() - touchStart;
  86095. if (touchTime < touchTimeThreshold) {
  86096. event2.preventDefault();
  86097. this.trigger("tap");
  86098. }
  86099. }
  86100. });
  86101. };
  86102. _proto.enableTouchActivity = function enableTouchActivity() {
  86103. if (!this.player() || !this.player().reportUserActivity) {
  86104. return;
  86105. }
  86106. var report = bind(this.player(), this.player().reportUserActivity);
  86107. var touchHolding;
  86108. this.on("touchstart", function() {
  86109. report();
  86110. this.clearInterval(touchHolding);
  86111. touchHolding = this.setInterval(report, 250);
  86112. });
  86113. var touchEnd = function touchEnd2(event2) {
  86114. report();
  86115. this.clearInterval(touchHolding);
  86116. };
  86117. this.on("touchmove", report);
  86118. this.on("touchend", touchEnd);
  86119. this.on("touchcancel", touchEnd);
  86120. };
  86121. _proto.setTimeout = function setTimeout2(fn2, timeout) {
  86122. var _this3 = this;
  86123. var timeoutId;
  86124. fn2 = bind(this, fn2);
  86125. this.clearTimersOnDispose_();
  86126. timeoutId = window_1.setTimeout(function() {
  86127. if (_this3.setTimeoutIds_.has(timeoutId)) {
  86128. _this3.setTimeoutIds_["delete"](timeoutId);
  86129. }
  86130. fn2();
  86131. }, timeout);
  86132. this.setTimeoutIds_.add(timeoutId);
  86133. return timeoutId;
  86134. };
  86135. _proto.clearTimeout = function clearTimeout2(timeoutId) {
  86136. if (this.setTimeoutIds_.has(timeoutId)) {
  86137. this.setTimeoutIds_["delete"](timeoutId);
  86138. window_1.clearTimeout(timeoutId);
  86139. }
  86140. return timeoutId;
  86141. };
  86142. _proto.setInterval = function setInterval2(fn2, interval) {
  86143. fn2 = bind(this, fn2);
  86144. this.clearTimersOnDispose_();
  86145. var intervalId = window_1.setInterval(fn2, interval);
  86146. this.setIntervalIds_.add(intervalId);
  86147. return intervalId;
  86148. };
  86149. _proto.clearInterval = function clearInterval2(intervalId) {
  86150. if (this.setIntervalIds_.has(intervalId)) {
  86151. this.setIntervalIds_["delete"](intervalId);
  86152. window_1.clearInterval(intervalId);
  86153. }
  86154. return intervalId;
  86155. };
  86156. _proto.requestAnimationFrame = function requestAnimationFrame(fn2) {
  86157. var _this4 = this;
  86158. if (!this.supportsRaf_) {
  86159. return this.setTimeout(fn2, 1e3 / 60);
  86160. }
  86161. this.clearTimersOnDispose_();
  86162. var id;
  86163. fn2 = bind(this, fn2);
  86164. id = window_1.requestAnimationFrame(function() {
  86165. if (_this4.rafIds_.has(id)) {
  86166. _this4.rafIds_["delete"](id);
  86167. }
  86168. fn2();
  86169. });
  86170. this.rafIds_.add(id);
  86171. return id;
  86172. };
  86173. _proto.requestNamedAnimationFrame = function requestNamedAnimationFrame(name, fn2) {
  86174. var _this5 = this;
  86175. if (this.namedRafs_.has(name)) {
  86176. return;
  86177. }
  86178. this.clearTimersOnDispose_();
  86179. fn2 = bind(this, fn2);
  86180. var id = this.requestAnimationFrame(function() {
  86181. fn2();
  86182. if (_this5.namedRafs_.has(name)) {
  86183. _this5.namedRafs_["delete"](name);
  86184. }
  86185. });
  86186. this.namedRafs_.set(name, id);
  86187. return name;
  86188. };
  86189. _proto.cancelNamedAnimationFrame = function cancelNamedAnimationFrame(name) {
  86190. if (!this.namedRafs_.has(name)) {
  86191. return;
  86192. }
  86193. this.cancelAnimationFrame(this.namedRafs_.get(name));
  86194. this.namedRafs_["delete"](name);
  86195. };
  86196. _proto.cancelAnimationFrame = function cancelAnimationFrame(id) {
  86197. if (!this.supportsRaf_) {
  86198. return this.clearTimeout(id);
  86199. }
  86200. if (this.rafIds_.has(id)) {
  86201. this.rafIds_["delete"](id);
  86202. window_1.cancelAnimationFrame(id);
  86203. }
  86204. return id;
  86205. };
  86206. _proto.clearTimersOnDispose_ = function clearTimersOnDispose_() {
  86207. var _this6 = this;
  86208. if (this.clearingTimersOnDispose_) {
  86209. return;
  86210. }
  86211. this.clearingTimersOnDispose_ = true;
  86212. this.one("dispose", function() {
  86213. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(function(_ref) {
  86214. var idName = _ref[0], cancelName = _ref[1];
  86215. _this6[idName].forEach(function(val, key) {
  86216. return _this6[cancelName](key);
  86217. });
  86218. });
  86219. _this6.clearingTimersOnDispose_ = false;
  86220. });
  86221. };
  86222. Component2.registerComponent = function registerComponent(name, ComponentToRegister) {
  86223. if (typeof name !== "string" || !name) {
  86224. throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.');
  86225. }
  86226. var Tech2 = Component2.getComponent("Tech");
  86227. var isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  86228. var isComp = Component2 === ComponentToRegister || Component2.prototype.isPrototypeOf(ComponentToRegister.prototype);
  86229. if (isTech || !isComp) {
  86230. var reason;
  86231. if (isTech) {
  86232. reason = "techs must be registered using Tech.registerTech()";
  86233. } else {
  86234. reason = "must be a Component subclass";
  86235. }
  86236. throw new Error('Illegal component, "' + name + '"; ' + reason + ".");
  86237. }
  86238. name = toTitleCase$1(name);
  86239. if (!Component2.components_) {
  86240. Component2.components_ = {};
  86241. }
  86242. var Player2 = Component2.getComponent("Player");
  86243. if (name === "Player" && Player2 && Player2.players) {
  86244. var players = Player2.players;
  86245. var playerNames = Object.keys(players);
  86246. if (players && playerNames.length > 0 && playerNames.map(function(pname) {
  86247. return players[pname];
  86248. }).every(Boolean)) {
  86249. throw new Error("Can not register Player component after player has been created.");
  86250. }
  86251. }
  86252. Component2.components_[name] = ComponentToRegister;
  86253. Component2.components_[toLowerCase(name)] = ComponentToRegister;
  86254. return ComponentToRegister;
  86255. };
  86256. Component2.getComponent = function getComponent(name) {
  86257. if (!name || !Component2.components_) {
  86258. return;
  86259. }
  86260. return Component2.components_[name];
  86261. };
  86262. return Component2;
  86263. }();
  86264. Component$1.prototype.supportsRaf_ = typeof window_1.requestAnimationFrame === "function" && typeof window_1.cancelAnimationFrame === "function";
  86265. Component$1.registerComponent("Component", Component$1);
  86266. function rangeCheck(fnName, index2, maxIndex) {
  86267. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  86268. throw new Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index2 + ") is non-numeric or out of bounds (0-" + maxIndex + ").");
  86269. }
  86270. }
  86271. function getRange(fnName, valueIndex, ranges, rangeIndex) {
  86272. rangeCheck(fnName, rangeIndex, ranges.length - 1);
  86273. return ranges[rangeIndex][valueIndex];
  86274. }
  86275. function createTimeRangesObj(ranges) {
  86276. var timeRangesObj;
  86277. if (ranges === void 0 || ranges.length === 0) {
  86278. timeRangesObj = {
  86279. length: 0,
  86280. start: function start2() {
  86281. throw new Error("This TimeRanges object is empty");
  86282. },
  86283. end: function end() {
  86284. throw new Error("This TimeRanges object is empty");
  86285. }
  86286. };
  86287. } else {
  86288. timeRangesObj = {
  86289. length: ranges.length,
  86290. start: getRange.bind(null, "start", 0, ranges),
  86291. end: getRange.bind(null, "end", 1, ranges)
  86292. };
  86293. }
  86294. if (window_1.Symbol && window_1.Symbol.iterator) {
  86295. timeRangesObj[window_1.Symbol.iterator] = function() {
  86296. return (ranges || []).values();
  86297. };
  86298. }
  86299. return timeRangesObj;
  86300. }
  86301. function createTimeRanges(start2, end) {
  86302. if (Array.isArray(start2)) {
  86303. return createTimeRangesObj(start2);
  86304. } else if (start2 === void 0 || end === void 0) {
  86305. return createTimeRangesObj();
  86306. }
  86307. return createTimeRangesObj([[start2, end]]);
  86308. }
  86309. function bufferedPercent(buffered, duration5) {
  86310. var bufferedDuration = 0;
  86311. var start2;
  86312. var end;
  86313. if (!duration5) {
  86314. return 0;
  86315. }
  86316. if (!buffered || !buffered.length) {
  86317. buffered = createTimeRanges(0, 0);
  86318. }
  86319. for (var i2 = 0; i2 < buffered.length; i2++) {
  86320. start2 = buffered.start(i2);
  86321. end = buffered.end(i2);
  86322. if (end > duration5) {
  86323. end = duration5;
  86324. }
  86325. bufferedDuration += end - start2;
  86326. }
  86327. return bufferedDuration / duration5;
  86328. }
  86329. function MediaError(value) {
  86330. if (value instanceof MediaError) {
  86331. return value;
  86332. }
  86333. if (typeof value === "number") {
  86334. this.code = value;
  86335. } else if (typeof value === "string") {
  86336. this.message = value;
  86337. } else if (isObject2(value)) {
  86338. if (typeof value.code === "number") {
  86339. this.code = value.code;
  86340. }
  86341. assign(this, value);
  86342. }
  86343. if (!this.message) {
  86344. this.message = MediaError.defaultMessages[this.code] || "";
  86345. }
  86346. }
  86347. MediaError.prototype.code = 0;
  86348. MediaError.prototype.message = "";
  86349. MediaError.prototype.status = null;
  86350. MediaError.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  86351. MediaError.defaultMessages = {
  86352. 1: "You aborted the media playback",
  86353. 2: "A network error caused the media download to fail part-way.",
  86354. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  86355. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  86356. 5: "The media is encrypted and we do not have the keys to decrypt it."
  86357. };
  86358. for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {
  86359. MediaError[MediaError.errorTypes[errNum]] = errNum;
  86360. MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;
  86361. }
  86362. function isPromise(value) {
  86363. return value !== void 0 && value !== null && typeof value.then === "function";
  86364. }
  86365. function silencePromise(value) {
  86366. if (isPromise(value)) {
  86367. value.then(null, function(e) {
  86368. });
  86369. }
  86370. }
  86371. var trackToJson_ = function trackToJson_2(track) {
  86372. var ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(acc, prop, i2) {
  86373. if (track[prop]) {
  86374. acc[prop] = track[prop];
  86375. }
  86376. return acc;
  86377. }, {
  86378. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  86379. return {
  86380. startTime: cue.startTime,
  86381. endTime: cue.endTime,
  86382. text: cue.text,
  86383. id: cue.id
  86384. };
  86385. })
  86386. });
  86387. return ret;
  86388. };
  86389. var textTracksToJson = function textTracksToJson2(tech) {
  86390. var trackEls = tech.$$("track");
  86391. var trackObjs = Array.prototype.map.call(trackEls, function(t2) {
  86392. return t2.track;
  86393. });
  86394. var tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  86395. var json = trackToJson_(trackEl.track);
  86396. if (trackEl.src) {
  86397. json.src = trackEl.src;
  86398. }
  86399. return json;
  86400. });
  86401. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  86402. return trackObjs.indexOf(track) === -1;
  86403. }).map(trackToJson_));
  86404. };
  86405. var jsonToTextTracks = function jsonToTextTracks2(json, tech) {
  86406. json.forEach(function(track) {
  86407. var addedTrack = tech.addRemoteTextTrack(track).track;
  86408. if (!track.src && track.cues) {
  86409. track.cues.forEach(function(cue) {
  86410. return addedTrack.addCue(cue);
  86411. });
  86412. }
  86413. });
  86414. return tech.textTracks();
  86415. };
  86416. var textTrackConverter = {
  86417. textTracksToJson,
  86418. jsonToTextTracks,
  86419. trackToJson_
  86420. };
  86421. var MODAL_CLASS_NAME = "vjs-modal-dialog";
  86422. var ModalDialog = /* @__PURE__ */ function(_Component) {
  86423. _inheritsLoose(ModalDialog2, _Component);
  86424. function ModalDialog2(player, options2) {
  86425. var _this;
  86426. _this = _Component.call(this, player, options2) || this;
  86427. _this.handleKeyDown_ = function(e) {
  86428. return _this.handleKeyDown(e);
  86429. };
  86430. _this.close_ = function(e) {
  86431. return _this.close(e);
  86432. };
  86433. _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;
  86434. _this.closeable(!_this.options_.uncloseable);
  86435. _this.content(_this.options_.content);
  86436. _this.contentEl_ = createEl("div", {
  86437. className: MODAL_CLASS_NAME + "-content"
  86438. }, {
  86439. role: "document"
  86440. });
  86441. _this.descEl_ = createEl("p", {
  86442. className: MODAL_CLASS_NAME + "-description vjs-control-text",
  86443. id: _this.el().getAttribute("aria-describedby")
  86444. });
  86445. textContent(_this.descEl_, _this.description());
  86446. _this.el_.appendChild(_this.descEl_);
  86447. _this.el_.appendChild(_this.contentEl_);
  86448. return _this;
  86449. }
  86450. var _proto = ModalDialog2.prototype;
  86451. _proto.createEl = function createEl2() {
  86452. return _Component.prototype.createEl.call(this, "div", {
  86453. className: this.buildCSSClass(),
  86454. tabIndex: -1
  86455. }, {
  86456. "aria-describedby": this.id() + "_description",
  86457. "aria-hidden": "true",
  86458. "aria-label": this.label(),
  86459. "role": "dialog"
  86460. });
  86461. };
  86462. _proto.dispose = function dispose() {
  86463. this.contentEl_ = null;
  86464. this.descEl_ = null;
  86465. this.previouslyActiveEl_ = null;
  86466. _Component.prototype.dispose.call(this);
  86467. };
  86468. _proto.buildCSSClass = function buildCSSClass() {
  86469. return MODAL_CLASS_NAME + " vjs-hidden " + _Component.prototype.buildCSSClass.call(this);
  86470. };
  86471. _proto.label = function label2() {
  86472. return this.localize(this.options_.label || "Modal Window");
  86473. };
  86474. _proto.description = function description() {
  86475. var desc = this.options_.description || this.localize("This is a modal window.");
  86476. if (this.closeable()) {
  86477. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  86478. }
  86479. return desc;
  86480. };
  86481. _proto.open = function open() {
  86482. if (!this.opened_) {
  86483. var player = this.player();
  86484. this.trigger("beforemodalopen");
  86485. this.opened_ = true;
  86486. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  86487. this.fill();
  86488. }
  86489. this.wasPlaying_ = !player.paused();
  86490. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  86491. player.pause();
  86492. }
  86493. this.on("keydown", this.handleKeyDown_);
  86494. this.hadControls_ = player.controls();
  86495. player.controls(false);
  86496. this.show();
  86497. this.conditionalFocus_();
  86498. this.el().setAttribute("aria-hidden", "false");
  86499. this.trigger("modalopen");
  86500. this.hasBeenOpened_ = true;
  86501. }
  86502. };
  86503. _proto.opened = function opened(value) {
  86504. if (typeof value === "boolean") {
  86505. this[value ? "open" : "close"]();
  86506. }
  86507. return this.opened_;
  86508. };
  86509. _proto.close = function close() {
  86510. if (!this.opened_) {
  86511. return;
  86512. }
  86513. var player = this.player();
  86514. this.trigger("beforemodalclose");
  86515. this.opened_ = false;
  86516. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  86517. player.play();
  86518. }
  86519. this.off("keydown", this.handleKeyDown_);
  86520. if (this.hadControls_) {
  86521. player.controls(true);
  86522. }
  86523. this.hide();
  86524. this.el().setAttribute("aria-hidden", "true");
  86525. this.trigger("modalclose");
  86526. this.conditionalBlur_();
  86527. if (this.options_.temporary) {
  86528. this.dispose();
  86529. }
  86530. };
  86531. _proto.closeable = function closeable(value) {
  86532. if (typeof value === "boolean") {
  86533. var closeable2 = this.closeable_ = !!value;
  86534. var close = this.getChild("closeButton");
  86535. if (closeable2 && !close) {
  86536. var temp = this.contentEl_;
  86537. this.contentEl_ = this.el_;
  86538. close = this.addChild("closeButton", {
  86539. controlText: "Close Modal Dialog"
  86540. });
  86541. this.contentEl_ = temp;
  86542. this.on(close, "close", this.close_);
  86543. }
  86544. if (!closeable2 && close) {
  86545. this.off(close, "close", this.close_);
  86546. this.removeChild(close);
  86547. close.dispose();
  86548. }
  86549. }
  86550. return this.closeable_;
  86551. };
  86552. _proto.fill = function fill() {
  86553. this.fillWith(this.content());
  86554. };
  86555. _proto.fillWith = function fillWith(content) {
  86556. var contentEl = this.contentEl();
  86557. var parentEl = contentEl.parentNode;
  86558. var nextSiblingEl = contentEl.nextSibling;
  86559. this.trigger("beforemodalfill");
  86560. this.hasBeenFilled_ = true;
  86561. parentEl.removeChild(contentEl);
  86562. this.empty();
  86563. insertContent(contentEl, content);
  86564. this.trigger("modalfill");
  86565. if (nextSiblingEl) {
  86566. parentEl.insertBefore(contentEl, nextSiblingEl);
  86567. } else {
  86568. parentEl.appendChild(contentEl);
  86569. }
  86570. var closeButton = this.getChild("closeButton");
  86571. if (closeButton) {
  86572. parentEl.appendChild(closeButton.el_);
  86573. }
  86574. };
  86575. _proto.empty = function empty() {
  86576. this.trigger("beforemodalempty");
  86577. emptyEl(this.contentEl());
  86578. this.trigger("modalempty");
  86579. };
  86580. _proto.content = function content(value) {
  86581. if (typeof value !== "undefined") {
  86582. this.content_ = value;
  86583. }
  86584. return this.content_;
  86585. };
  86586. _proto.conditionalFocus_ = function conditionalFocus_() {
  86587. var activeEl = document_1.activeElement;
  86588. var playerEl = this.player_.el_;
  86589. this.previouslyActiveEl_ = null;
  86590. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  86591. this.previouslyActiveEl_ = activeEl;
  86592. this.focus();
  86593. }
  86594. };
  86595. _proto.conditionalBlur_ = function conditionalBlur_() {
  86596. if (this.previouslyActiveEl_) {
  86597. this.previouslyActiveEl_.focus();
  86598. this.previouslyActiveEl_ = null;
  86599. }
  86600. };
  86601. _proto.handleKeyDown = function handleKeyDown(event2) {
  86602. event2.stopPropagation();
  86603. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  86604. event2.preventDefault();
  86605. this.close();
  86606. return;
  86607. }
  86608. if (!keycode.isEventKey(event2, "Tab")) {
  86609. return;
  86610. }
  86611. var focusableEls = this.focusableEls_();
  86612. var activeEl = this.el_.querySelector(":focus");
  86613. var focusIndex;
  86614. for (var i2 = 0; i2 < focusableEls.length; i2++) {
  86615. if (activeEl === focusableEls[i2]) {
  86616. focusIndex = i2;
  86617. break;
  86618. }
  86619. }
  86620. if (document_1.activeElement === this.el_) {
  86621. focusIndex = 0;
  86622. }
  86623. if (event2.shiftKey && focusIndex === 0) {
  86624. focusableEls[focusableEls.length - 1].focus();
  86625. event2.preventDefault();
  86626. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  86627. focusableEls[0].focus();
  86628. event2.preventDefault();
  86629. }
  86630. };
  86631. _proto.focusableEls_ = function focusableEls_() {
  86632. var allChildren = this.el_.querySelectorAll("*");
  86633. return Array.prototype.filter.call(allChildren, function(child) {
  86634. 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");
  86635. });
  86636. };
  86637. return ModalDialog2;
  86638. }(Component$1);
  86639. ModalDialog.prototype.options_ = {
  86640. pauseOnOpen: true,
  86641. temporary: true
  86642. };
  86643. Component$1.registerComponent("ModalDialog", ModalDialog);
  86644. var TrackList = /* @__PURE__ */ function(_EventTarget) {
  86645. _inheritsLoose(TrackList2, _EventTarget);
  86646. function TrackList2(tracks) {
  86647. var _this;
  86648. if (tracks === void 0) {
  86649. tracks = [];
  86650. }
  86651. _this = _EventTarget.call(this) || this;
  86652. _this.tracks_ = [];
  86653. Object.defineProperty(_assertThisInitialized(_this), "length", {
  86654. get: function get7() {
  86655. return this.tracks_.length;
  86656. }
  86657. });
  86658. for (var i2 = 0; i2 < tracks.length; i2++) {
  86659. _this.addTrack(tracks[i2]);
  86660. }
  86661. return _this;
  86662. }
  86663. var _proto = TrackList2.prototype;
  86664. _proto.addTrack = function addTrack(track) {
  86665. var _this2 = this;
  86666. var index2 = this.tracks_.length;
  86667. if (!("" + index2 in this)) {
  86668. Object.defineProperty(this, index2, {
  86669. get: function get7() {
  86670. return this.tracks_[index2];
  86671. }
  86672. });
  86673. }
  86674. if (this.tracks_.indexOf(track) === -1) {
  86675. this.tracks_.push(track);
  86676. this.trigger({
  86677. track,
  86678. type: "addtrack",
  86679. target: this
  86680. });
  86681. }
  86682. track.labelchange_ = function() {
  86683. _this2.trigger({
  86684. track,
  86685. type: "labelchange",
  86686. target: _this2
  86687. });
  86688. };
  86689. if (isEvented(track)) {
  86690. track.addEventListener("labelchange", track.labelchange_);
  86691. }
  86692. };
  86693. _proto.removeTrack = function removeTrack(rtrack) {
  86694. var track;
  86695. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86696. if (this[i2] === rtrack) {
  86697. track = this[i2];
  86698. if (track.off) {
  86699. track.off();
  86700. }
  86701. this.tracks_.splice(i2, 1);
  86702. break;
  86703. }
  86704. }
  86705. if (!track) {
  86706. return;
  86707. }
  86708. this.trigger({
  86709. track,
  86710. type: "removetrack",
  86711. target: this
  86712. });
  86713. };
  86714. _proto.getTrackById = function getTrackById(id) {
  86715. var result = null;
  86716. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86717. var track = this[i2];
  86718. if (track.id === id) {
  86719. result = track;
  86720. break;
  86721. }
  86722. }
  86723. return result;
  86724. };
  86725. return TrackList2;
  86726. }(EventTarget$2);
  86727. TrackList.prototype.allowedEvents_ = {
  86728. change: "change",
  86729. addtrack: "addtrack",
  86730. removetrack: "removetrack",
  86731. labelchange: "labelchange"
  86732. };
  86733. for (var event$1 in TrackList.prototype.allowedEvents_) {
  86734. TrackList.prototype["on" + event$1] = null;
  86735. }
  86736. var disableOthers$1 = function disableOthers(list, track) {
  86737. for (var i2 = 0; i2 < list.length; i2++) {
  86738. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86739. continue;
  86740. }
  86741. list[i2].enabled = false;
  86742. }
  86743. };
  86744. var AudioTrackList = /* @__PURE__ */ function(_TrackList) {
  86745. _inheritsLoose(AudioTrackList2, _TrackList);
  86746. function AudioTrackList2(tracks) {
  86747. var _this;
  86748. if (tracks === void 0) {
  86749. tracks = [];
  86750. }
  86751. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86752. if (tracks[i2].enabled) {
  86753. disableOthers$1(tracks, tracks[i2]);
  86754. break;
  86755. }
  86756. }
  86757. _this = _TrackList.call(this, tracks) || this;
  86758. _this.changing_ = false;
  86759. return _this;
  86760. }
  86761. var _proto = AudioTrackList2.prototype;
  86762. _proto.addTrack = function addTrack(track) {
  86763. var _this2 = this;
  86764. if (track.enabled) {
  86765. disableOthers$1(this, track);
  86766. }
  86767. _TrackList.prototype.addTrack.call(this, track);
  86768. if (!track.addEventListener) {
  86769. return;
  86770. }
  86771. track.enabledChange_ = function() {
  86772. if (_this2.changing_) {
  86773. return;
  86774. }
  86775. _this2.changing_ = true;
  86776. disableOthers$1(_this2, track);
  86777. _this2.changing_ = false;
  86778. _this2.trigger("change");
  86779. };
  86780. track.addEventListener("enabledchange", track.enabledChange_);
  86781. };
  86782. _proto.removeTrack = function removeTrack(rtrack) {
  86783. _TrackList.prototype.removeTrack.call(this, rtrack);
  86784. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  86785. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  86786. rtrack.enabledChange_ = null;
  86787. }
  86788. };
  86789. return AudioTrackList2;
  86790. }(TrackList);
  86791. var disableOthers2 = function disableOthers3(list, track) {
  86792. for (var i2 = 0; i2 < list.length; i2++) {
  86793. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86794. continue;
  86795. }
  86796. list[i2].selected = false;
  86797. }
  86798. };
  86799. var VideoTrackList = /* @__PURE__ */ function(_TrackList) {
  86800. _inheritsLoose(VideoTrackList2, _TrackList);
  86801. function VideoTrackList2(tracks) {
  86802. var _this;
  86803. if (tracks === void 0) {
  86804. tracks = [];
  86805. }
  86806. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86807. if (tracks[i2].selected) {
  86808. disableOthers2(tracks, tracks[i2]);
  86809. break;
  86810. }
  86811. }
  86812. _this = _TrackList.call(this, tracks) || this;
  86813. _this.changing_ = false;
  86814. Object.defineProperty(_assertThisInitialized(_this), "selectedIndex", {
  86815. get: function get7() {
  86816. for (var _i = 0; _i < this.length; _i++) {
  86817. if (this[_i].selected) {
  86818. return _i;
  86819. }
  86820. }
  86821. return -1;
  86822. },
  86823. set: function set4() {
  86824. }
  86825. });
  86826. return _this;
  86827. }
  86828. var _proto = VideoTrackList2.prototype;
  86829. _proto.addTrack = function addTrack(track) {
  86830. var _this2 = this;
  86831. if (track.selected) {
  86832. disableOthers2(this, track);
  86833. }
  86834. _TrackList.prototype.addTrack.call(this, track);
  86835. if (!track.addEventListener) {
  86836. return;
  86837. }
  86838. track.selectedChange_ = function() {
  86839. if (_this2.changing_) {
  86840. return;
  86841. }
  86842. _this2.changing_ = true;
  86843. disableOthers2(_this2, track);
  86844. _this2.changing_ = false;
  86845. _this2.trigger("change");
  86846. };
  86847. track.addEventListener("selectedchange", track.selectedChange_);
  86848. };
  86849. _proto.removeTrack = function removeTrack(rtrack) {
  86850. _TrackList.prototype.removeTrack.call(this, rtrack);
  86851. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  86852. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  86853. rtrack.selectedChange_ = null;
  86854. }
  86855. };
  86856. return VideoTrackList2;
  86857. }(TrackList);
  86858. var TextTrackList = /* @__PURE__ */ function(_TrackList) {
  86859. _inheritsLoose(TextTrackList2, _TrackList);
  86860. function TextTrackList2() {
  86861. return _TrackList.apply(this, arguments) || this;
  86862. }
  86863. var _proto = TextTrackList2.prototype;
  86864. _proto.addTrack = function addTrack(track) {
  86865. var _this = this;
  86866. _TrackList.prototype.addTrack.call(this, track);
  86867. if (!this.queueChange_) {
  86868. this.queueChange_ = function() {
  86869. return _this.queueTrigger("change");
  86870. };
  86871. }
  86872. if (!this.triggerSelectedlanguagechange) {
  86873. this.triggerSelectedlanguagechange_ = function() {
  86874. return _this.trigger("selectedlanguagechange");
  86875. };
  86876. }
  86877. track.addEventListener("modechange", this.queueChange_);
  86878. var nonLanguageTextTrackKind = ["metadata", "chapters"];
  86879. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  86880. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  86881. }
  86882. };
  86883. _proto.removeTrack = function removeTrack(rtrack) {
  86884. _TrackList.prototype.removeTrack.call(this, rtrack);
  86885. if (rtrack.removeEventListener) {
  86886. if (this.queueChange_) {
  86887. rtrack.removeEventListener("modechange", this.queueChange_);
  86888. }
  86889. if (this.selectedlanguagechange_) {
  86890. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  86891. }
  86892. }
  86893. };
  86894. return TextTrackList2;
  86895. }(TrackList);
  86896. var HtmlTrackElementList = /* @__PURE__ */ function() {
  86897. function HtmlTrackElementList2(trackElements) {
  86898. if (trackElements === void 0) {
  86899. trackElements = [];
  86900. }
  86901. this.trackElements_ = [];
  86902. Object.defineProperty(this, "length", {
  86903. get: function get7() {
  86904. return this.trackElements_.length;
  86905. }
  86906. });
  86907. for (var i2 = 0, length = trackElements.length; i2 < length; i2++) {
  86908. this.addTrackElement_(trackElements[i2]);
  86909. }
  86910. }
  86911. var _proto = HtmlTrackElementList2.prototype;
  86912. _proto.addTrackElement_ = function addTrackElement_(trackElement) {
  86913. var index2 = this.trackElements_.length;
  86914. if (!("" + index2 in this)) {
  86915. Object.defineProperty(this, index2, {
  86916. get: function get7() {
  86917. return this.trackElements_[index2];
  86918. }
  86919. });
  86920. }
  86921. if (this.trackElements_.indexOf(trackElement) === -1) {
  86922. this.trackElements_.push(trackElement);
  86923. }
  86924. };
  86925. _proto.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {
  86926. var trackElement_;
  86927. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86928. if (track === this.trackElements_[i2].track) {
  86929. trackElement_ = this.trackElements_[i2];
  86930. break;
  86931. }
  86932. }
  86933. return trackElement_;
  86934. };
  86935. _proto.removeTrackElement_ = function removeTrackElement_(trackElement) {
  86936. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86937. if (trackElement === this.trackElements_[i2]) {
  86938. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  86939. this.trackElements_[i2].track.off();
  86940. }
  86941. if (typeof this.trackElements_[i2].off === "function") {
  86942. this.trackElements_[i2].off();
  86943. }
  86944. this.trackElements_.splice(i2, 1);
  86945. break;
  86946. }
  86947. }
  86948. };
  86949. return HtmlTrackElementList2;
  86950. }();
  86951. var TextTrackCueList = /* @__PURE__ */ function() {
  86952. function TextTrackCueList2(cues) {
  86953. TextTrackCueList2.prototype.setCues_.call(this, cues);
  86954. Object.defineProperty(this, "length", {
  86955. get: function get7() {
  86956. return this.length_;
  86957. }
  86958. });
  86959. }
  86960. var _proto = TextTrackCueList2.prototype;
  86961. _proto.setCues_ = function setCues_(cues) {
  86962. var oldLength = this.length || 0;
  86963. var i2 = 0;
  86964. var l = cues.length;
  86965. this.cues_ = cues;
  86966. this.length_ = cues.length;
  86967. var defineProp = function defineProp2(index2) {
  86968. if (!("" + index2 in this)) {
  86969. Object.defineProperty(this, "" + index2, {
  86970. get: function get7() {
  86971. return this.cues_[index2];
  86972. }
  86973. });
  86974. }
  86975. };
  86976. if (oldLength < l) {
  86977. i2 = oldLength;
  86978. for (; i2 < l; i2++) {
  86979. defineProp.call(this, i2);
  86980. }
  86981. }
  86982. };
  86983. _proto.getCueById = function getCueById(id) {
  86984. var result = null;
  86985. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86986. var cue = this[i2];
  86987. if (cue.id === id) {
  86988. result = cue;
  86989. break;
  86990. }
  86991. }
  86992. return result;
  86993. };
  86994. return TextTrackCueList2;
  86995. }();
  86996. var VideoTrackKind = {
  86997. alternative: "alternative",
  86998. captions: "captions",
  86999. main: "main",
  87000. sign: "sign",
  87001. subtitles: "subtitles",
  87002. commentary: "commentary"
  87003. };
  87004. var AudioTrackKind = {
  87005. "alternative": "alternative",
  87006. "descriptions": "descriptions",
  87007. "main": "main",
  87008. "main-desc": "main-desc",
  87009. "translation": "translation",
  87010. "commentary": "commentary"
  87011. };
  87012. var TextTrackKind = {
  87013. subtitles: "subtitles",
  87014. captions: "captions",
  87015. descriptions: "descriptions",
  87016. chapters: "chapters",
  87017. metadata: "metadata"
  87018. };
  87019. var TextTrackMode = {
  87020. disabled: "disabled",
  87021. hidden: "hidden",
  87022. showing: "showing"
  87023. };
  87024. var Track = /* @__PURE__ */ function(_EventTarget) {
  87025. _inheritsLoose(Track2, _EventTarget);
  87026. function Track2(options2) {
  87027. var _this;
  87028. if (options2 === void 0) {
  87029. options2 = {};
  87030. }
  87031. _this = _EventTarget.call(this) || this;
  87032. var trackProps = {
  87033. id: options2.id || "vjs_track_" + newGUID(),
  87034. kind: options2.kind || "",
  87035. language: options2.language || ""
  87036. };
  87037. var label2 = options2.label || "";
  87038. var _loop = function _loop2(key2) {
  87039. Object.defineProperty(_assertThisInitialized(_this), key2, {
  87040. get: function get7() {
  87041. return trackProps[key2];
  87042. },
  87043. set: function set4() {
  87044. }
  87045. });
  87046. };
  87047. for (var key in trackProps) {
  87048. _loop(key);
  87049. }
  87050. Object.defineProperty(_assertThisInitialized(_this), "label", {
  87051. get: function get7() {
  87052. return label2;
  87053. },
  87054. set: function set4(newLabel) {
  87055. if (newLabel !== label2) {
  87056. label2 = newLabel;
  87057. this.trigger("labelchange");
  87058. }
  87059. }
  87060. });
  87061. return _this;
  87062. }
  87063. return Track2;
  87064. }(EventTarget$2);
  87065. var parseUrl = function parseUrl2(url) {
  87066. var props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  87067. var a = document_1.createElement("a");
  87068. a.href = url;
  87069. var details = {};
  87070. for (var i2 = 0; i2 < props.length; i2++) {
  87071. details[props[i2]] = a[props[i2]];
  87072. }
  87073. if (details.protocol === "http:") {
  87074. details.host = details.host.replace(/:80$/, "");
  87075. }
  87076. if (details.protocol === "https:") {
  87077. details.host = details.host.replace(/:443$/, "");
  87078. }
  87079. if (!details.protocol) {
  87080. details.protocol = window_1.location.protocol;
  87081. }
  87082. if (!details.host) {
  87083. details.host = window_1.location.host;
  87084. }
  87085. return details;
  87086. };
  87087. var getAbsoluteURL = function getAbsoluteURL2(url) {
  87088. if (!url.match(/^https?:\/\//)) {
  87089. var a = document_1.createElement("a");
  87090. a.href = url;
  87091. url = a.href;
  87092. }
  87093. return url;
  87094. };
  87095. var getFileExtension = function getFileExtension2(path) {
  87096. if (typeof path === "string") {
  87097. var splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  87098. var pathParts = splitPathRe.exec(path);
  87099. if (pathParts) {
  87100. return pathParts.pop().toLowerCase();
  87101. }
  87102. }
  87103. return "";
  87104. };
  87105. var isCrossOrigin = function isCrossOrigin2(url, winLoc) {
  87106. if (winLoc === void 0) {
  87107. winLoc = window_1.location;
  87108. }
  87109. var urlInfo = parseUrl(url);
  87110. var srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  87111. var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  87112. return crossOrigin;
  87113. };
  87114. var Url$1 = /* @__PURE__ */ Object.freeze({
  87115. __proto__: null,
  87116. parseUrl,
  87117. getAbsoluteURL,
  87118. getFileExtension,
  87119. isCrossOrigin
  87120. });
  87121. var parseCues = function parseCues2(srcContent, track) {
  87122. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  87123. var errors2 = [];
  87124. parser2.oncue = function(cue) {
  87125. track.addCue(cue);
  87126. };
  87127. parser2.onparsingerror = function(error) {
  87128. errors2.push(error);
  87129. };
  87130. parser2.onflush = function() {
  87131. track.trigger({
  87132. type: "loadeddata",
  87133. target: track
  87134. });
  87135. };
  87136. parser2.parse(srcContent);
  87137. if (errors2.length > 0) {
  87138. if (window_1.console && window_1.console.groupCollapsed) {
  87139. window_1.console.groupCollapsed("Text Track parsing errors for " + track.src);
  87140. }
  87141. errors2.forEach(function(error) {
  87142. return log$1.error(error);
  87143. });
  87144. if (window_1.console && window_1.console.groupEnd) {
  87145. window_1.console.groupEnd();
  87146. }
  87147. }
  87148. parser2.flush();
  87149. };
  87150. var loadTrack = function loadTrack2(src, track) {
  87151. var opts = {
  87152. uri: src
  87153. };
  87154. var crossOrigin = isCrossOrigin(src);
  87155. if (crossOrigin) {
  87156. opts.cors = crossOrigin;
  87157. }
  87158. var withCredentials = track.tech_.crossOrigin() === "use-credentials";
  87159. if (withCredentials) {
  87160. opts.withCredentials = withCredentials;
  87161. }
  87162. XHR(opts, bind(this, function(err, response, responseBody) {
  87163. if (err) {
  87164. return log$1.error(err, response);
  87165. }
  87166. track.loaded_ = true;
  87167. if (typeof window_1.WebVTT !== "function") {
  87168. if (track.tech_) {
  87169. track.tech_.any(["vttjsloaded", "vttjserror"], function(event2) {
  87170. if (event2.type === "vttjserror") {
  87171. log$1.error("vttjs failed to load, stopping trying to process " + track.src);
  87172. return;
  87173. }
  87174. return parseCues(responseBody, track);
  87175. });
  87176. }
  87177. } else {
  87178. parseCues(responseBody, track);
  87179. }
  87180. }));
  87181. };
  87182. var TextTrack = /* @__PURE__ */ function(_Track) {
  87183. _inheritsLoose(TextTrack2, _Track);
  87184. function TextTrack2(options2) {
  87185. var _this;
  87186. if (options2 === void 0) {
  87187. options2 = {};
  87188. }
  87189. if (!options2.tech) {
  87190. throw new Error("A tech was not provided.");
  87191. }
  87192. var settings = mergeOptions$3(options2, {
  87193. kind: TextTrackKind[options2.kind] || "subtitles",
  87194. language: options2.language || options2.srclang || ""
  87195. });
  87196. var mode = TextTrackMode[settings.mode] || "disabled";
  87197. var default_ = settings["default"];
  87198. if (settings.kind === "metadata" || settings.kind === "chapters") {
  87199. mode = "hidden";
  87200. }
  87201. _this = _Track.call(this, settings) || this;
  87202. _this.tech_ = settings.tech;
  87203. _this.cues_ = [];
  87204. _this.activeCues_ = [];
  87205. _this.preload_ = _this.tech_.preloadTextTracks !== false;
  87206. var cues = new TextTrackCueList(_this.cues_);
  87207. var activeCues = new TextTrackCueList(_this.activeCues_);
  87208. var changed = false;
  87209. _this.timeupdateHandler = bind(_assertThisInitialized(_this), function(event2) {
  87210. if (event2 === void 0) {
  87211. event2 = {};
  87212. }
  87213. if (this.tech_.isDisposed()) {
  87214. return;
  87215. }
  87216. if (!this.tech_.isReady_) {
  87217. if (event2.type !== "timeupdate") {
  87218. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87219. }
  87220. return;
  87221. }
  87222. this.activeCues = this.activeCues;
  87223. if (changed) {
  87224. this.trigger("cuechange");
  87225. changed = false;
  87226. }
  87227. if (event2.type !== "timeupdate") {
  87228. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87229. }
  87230. });
  87231. var disposeHandler = function disposeHandler2() {
  87232. _this.stopTracking();
  87233. };
  87234. _this.tech_.one("dispose", disposeHandler);
  87235. if (mode !== "disabled") {
  87236. _this.startTracking();
  87237. }
  87238. Object.defineProperties(_assertThisInitialized(_this), {
  87239. "default": {
  87240. get: function get7() {
  87241. return default_;
  87242. },
  87243. set: function set4() {
  87244. }
  87245. },
  87246. mode: {
  87247. get: function get7() {
  87248. return mode;
  87249. },
  87250. set: function set4(newMode) {
  87251. if (!TextTrackMode[newMode]) {
  87252. return;
  87253. }
  87254. if (mode === newMode) {
  87255. return;
  87256. }
  87257. mode = newMode;
  87258. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  87259. loadTrack(this.src, this);
  87260. }
  87261. this.stopTracking();
  87262. if (mode !== "disabled") {
  87263. this.startTracking();
  87264. }
  87265. this.trigger("modechange");
  87266. }
  87267. },
  87268. cues: {
  87269. get: function get7() {
  87270. if (!this.loaded_) {
  87271. return null;
  87272. }
  87273. return cues;
  87274. },
  87275. set: function set4() {
  87276. }
  87277. },
  87278. activeCues: {
  87279. get: function get7() {
  87280. if (!this.loaded_) {
  87281. return null;
  87282. }
  87283. if (this.cues.length === 0) {
  87284. return activeCues;
  87285. }
  87286. var ct2 = this.tech_.currentTime();
  87287. var active = [];
  87288. for (var i2 = 0, l = this.cues.length; i2 < l; i2++) {
  87289. var cue = this.cues[i2];
  87290. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  87291. active.push(cue);
  87292. } else if (cue.startTime === cue.endTime && cue.startTime <= ct2 && cue.startTime + 0.5 >= ct2) {
  87293. active.push(cue);
  87294. }
  87295. }
  87296. changed = false;
  87297. if (active.length !== this.activeCues_.length) {
  87298. changed = true;
  87299. } else {
  87300. for (var _i = 0; _i < active.length; _i++) {
  87301. if (this.activeCues_.indexOf(active[_i]) === -1) {
  87302. changed = true;
  87303. }
  87304. }
  87305. }
  87306. this.activeCues_ = active;
  87307. activeCues.setCues_(this.activeCues_);
  87308. return activeCues;
  87309. },
  87310. set: function set4() {
  87311. }
  87312. }
  87313. });
  87314. if (settings.src) {
  87315. _this.src = settings.src;
  87316. if (!_this.preload_) {
  87317. _this.loaded_ = true;
  87318. }
  87319. if (_this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  87320. loadTrack(_this.src, _assertThisInitialized(_this));
  87321. }
  87322. } else {
  87323. _this.loaded_ = true;
  87324. }
  87325. return _this;
  87326. }
  87327. var _proto = TextTrack2.prototype;
  87328. _proto.startTracking = function startTracking() {
  87329. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87330. this.tech_.on("timeupdate", this.timeupdateHandler);
  87331. };
  87332. _proto.stopTracking = function stopTracking() {
  87333. if (this.rvf_) {
  87334. this.tech_.cancelVideoFrameCallback(this.rvf_);
  87335. this.rvf_ = void 0;
  87336. }
  87337. this.tech_.off("timeupdate", this.timeupdateHandler);
  87338. };
  87339. _proto.addCue = function addCue(originalCue) {
  87340. var cue = originalCue;
  87341. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  87342. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  87343. for (var prop in originalCue) {
  87344. if (!(prop in cue)) {
  87345. cue[prop] = originalCue[prop];
  87346. }
  87347. }
  87348. cue.id = originalCue.id;
  87349. cue.originalCue_ = originalCue;
  87350. }
  87351. var tracks = this.tech_.textTracks();
  87352. for (var i2 = 0; i2 < tracks.length; i2++) {
  87353. if (tracks[i2] !== this) {
  87354. tracks[i2].removeCue(cue);
  87355. }
  87356. }
  87357. this.cues_.push(cue);
  87358. this.cues.setCues_(this.cues_);
  87359. };
  87360. _proto.removeCue = function removeCue(_removeCue) {
  87361. var i2 = this.cues_.length;
  87362. while (i2--) {
  87363. var cue = this.cues_[i2];
  87364. if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {
  87365. this.cues_.splice(i2, 1);
  87366. this.cues.setCues_(this.cues_);
  87367. break;
  87368. }
  87369. }
  87370. };
  87371. return TextTrack2;
  87372. }(Track);
  87373. TextTrack.prototype.allowedEvents_ = {
  87374. cuechange: "cuechange"
  87375. };
  87376. var AudioTrack = /* @__PURE__ */ function(_Track) {
  87377. _inheritsLoose(AudioTrack2, _Track);
  87378. function AudioTrack2(options2) {
  87379. var _this;
  87380. if (options2 === void 0) {
  87381. options2 = {};
  87382. }
  87383. var settings = mergeOptions$3(options2, {
  87384. kind: AudioTrackKind[options2.kind] || ""
  87385. });
  87386. _this = _Track.call(this, settings) || this;
  87387. var enabled = false;
  87388. Object.defineProperty(_assertThisInitialized(_this), "enabled", {
  87389. get: function get7() {
  87390. return enabled;
  87391. },
  87392. set: function set4(newEnabled) {
  87393. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  87394. return;
  87395. }
  87396. enabled = newEnabled;
  87397. this.trigger("enabledchange");
  87398. }
  87399. });
  87400. if (settings.enabled) {
  87401. _this.enabled = settings.enabled;
  87402. }
  87403. _this.loaded_ = true;
  87404. return _this;
  87405. }
  87406. return AudioTrack2;
  87407. }(Track);
  87408. var VideoTrack = /* @__PURE__ */ function(_Track) {
  87409. _inheritsLoose(VideoTrack2, _Track);
  87410. function VideoTrack2(options2) {
  87411. var _this;
  87412. if (options2 === void 0) {
  87413. options2 = {};
  87414. }
  87415. var settings = mergeOptions$3(options2, {
  87416. kind: VideoTrackKind[options2.kind] || ""
  87417. });
  87418. _this = _Track.call(this, settings) || this;
  87419. var selected = false;
  87420. Object.defineProperty(_assertThisInitialized(_this), "selected", {
  87421. get: function get7() {
  87422. return selected;
  87423. },
  87424. set: function set4(newSelected) {
  87425. if (typeof newSelected !== "boolean" || newSelected === selected) {
  87426. return;
  87427. }
  87428. selected = newSelected;
  87429. this.trigger("selectedchange");
  87430. }
  87431. });
  87432. if (settings.selected) {
  87433. _this.selected = settings.selected;
  87434. }
  87435. return _this;
  87436. }
  87437. return VideoTrack2;
  87438. }(Track);
  87439. var NONE = 0;
  87440. var LOADING = 1;
  87441. var LOADED = 2;
  87442. var ERROR = 3;
  87443. var HTMLTrackElement = /* @__PURE__ */ function(_EventTarget) {
  87444. _inheritsLoose(HTMLTrackElement2, _EventTarget);
  87445. function HTMLTrackElement2(options2) {
  87446. var _this;
  87447. if (options2 === void 0) {
  87448. options2 = {};
  87449. }
  87450. _this = _EventTarget.call(this) || this;
  87451. var readyState;
  87452. var track = new TextTrack(options2);
  87453. _this.kind = track.kind;
  87454. _this.src = track.src;
  87455. _this.srclang = track.language;
  87456. _this.label = track.label;
  87457. _this["default"] = track["default"];
  87458. Object.defineProperties(_assertThisInitialized(_this), {
  87459. readyState: {
  87460. get: function get7() {
  87461. return readyState;
  87462. }
  87463. },
  87464. track: {
  87465. get: function get7() {
  87466. return track;
  87467. }
  87468. }
  87469. });
  87470. readyState = NONE;
  87471. track.addEventListener("loadeddata", function() {
  87472. readyState = LOADED;
  87473. _this.trigger({
  87474. type: "load",
  87475. target: _assertThisInitialized(_this)
  87476. });
  87477. });
  87478. return _this;
  87479. }
  87480. return HTMLTrackElement2;
  87481. }(EventTarget$2);
  87482. HTMLTrackElement.prototype.allowedEvents_ = {
  87483. load: "load"
  87484. };
  87485. HTMLTrackElement.NONE = NONE;
  87486. HTMLTrackElement.LOADING = LOADING;
  87487. HTMLTrackElement.LOADED = LOADED;
  87488. HTMLTrackElement.ERROR = ERROR;
  87489. var NORMAL = {
  87490. audio: {
  87491. ListClass: AudioTrackList,
  87492. TrackClass: AudioTrack,
  87493. capitalName: "Audio"
  87494. },
  87495. video: {
  87496. ListClass: VideoTrackList,
  87497. TrackClass: VideoTrack,
  87498. capitalName: "Video"
  87499. },
  87500. text: {
  87501. ListClass: TextTrackList,
  87502. TrackClass: TextTrack,
  87503. capitalName: "Text"
  87504. }
  87505. };
  87506. Object.keys(NORMAL).forEach(function(type2) {
  87507. NORMAL[type2].getterName = type2 + "Tracks";
  87508. NORMAL[type2].privateName = type2 + "Tracks_";
  87509. });
  87510. var REMOTE = {
  87511. remoteText: {
  87512. ListClass: TextTrackList,
  87513. TrackClass: TextTrack,
  87514. capitalName: "RemoteText",
  87515. getterName: "remoteTextTracks",
  87516. privateName: "remoteTextTracks_"
  87517. },
  87518. remoteTextEl: {
  87519. ListClass: HtmlTrackElementList,
  87520. TrackClass: HTMLTrackElement,
  87521. capitalName: "RemoteTextTrackEls",
  87522. getterName: "remoteTextTrackEls",
  87523. privateName: "remoteTextTrackEls_"
  87524. }
  87525. };
  87526. var ALL = _extends$2({}, NORMAL, REMOTE);
  87527. REMOTE.names = Object.keys(REMOTE);
  87528. NORMAL.names = Object.keys(NORMAL);
  87529. ALL.names = [].concat(REMOTE.names).concat(NORMAL.names);
  87530. function createTrackHelper(self2, kind, label2, language, options2) {
  87531. if (options2 === void 0) {
  87532. options2 = {};
  87533. }
  87534. var tracks = self2.textTracks();
  87535. options2.kind = kind;
  87536. if (label2) {
  87537. options2.label = label2;
  87538. }
  87539. if (language) {
  87540. options2.language = language;
  87541. }
  87542. options2.tech = self2;
  87543. var track = new ALL.text.TrackClass(options2);
  87544. tracks.addTrack(track);
  87545. return track;
  87546. }
  87547. var Tech$1 = /* @__PURE__ */ function(_Component) {
  87548. _inheritsLoose(Tech2, _Component);
  87549. function Tech2(options2, ready) {
  87550. var _this;
  87551. if (options2 === void 0) {
  87552. options2 = {};
  87553. }
  87554. if (ready === void 0) {
  87555. ready = function ready2() {
  87556. };
  87557. }
  87558. options2.reportTouchActivity = false;
  87559. _this = _Component.call(this, null, options2, ready) || this;
  87560. _this.onDurationChange_ = function(e) {
  87561. return _this.onDurationChange(e);
  87562. };
  87563. _this.trackProgress_ = function(e) {
  87564. return _this.trackProgress(e);
  87565. };
  87566. _this.trackCurrentTime_ = function(e) {
  87567. return _this.trackCurrentTime(e);
  87568. };
  87569. _this.stopTrackingCurrentTime_ = function(e) {
  87570. return _this.stopTrackingCurrentTime(e);
  87571. };
  87572. _this.disposeSourceHandler_ = function(e) {
  87573. return _this.disposeSourceHandler(e);
  87574. };
  87575. _this.queuedHanders_ = /* @__PURE__ */ new Set();
  87576. _this.hasStarted_ = false;
  87577. _this.on("playing", function() {
  87578. this.hasStarted_ = true;
  87579. });
  87580. _this.on("loadstart", function() {
  87581. this.hasStarted_ = false;
  87582. });
  87583. ALL.names.forEach(function(name) {
  87584. var props = ALL[name];
  87585. if (options2 && options2[props.getterName]) {
  87586. _this[props.privateName] = options2[props.getterName];
  87587. }
  87588. });
  87589. if (!_this.featuresProgressEvents) {
  87590. _this.manualProgressOn();
  87591. }
  87592. if (!_this.featuresTimeupdateEvents) {
  87593. _this.manualTimeUpdatesOn();
  87594. }
  87595. ["Text", "Audio", "Video"].forEach(function(track) {
  87596. if (options2["native" + track + "Tracks"] === false) {
  87597. _this["featuresNative" + track + "Tracks"] = false;
  87598. }
  87599. });
  87600. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  87601. _this.featuresNativeTextTracks = false;
  87602. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  87603. _this.featuresNativeTextTracks = true;
  87604. }
  87605. if (!_this.featuresNativeTextTracks) {
  87606. _this.emulateTextTracks();
  87607. }
  87608. _this.preloadTextTracks = options2.preloadTextTracks !== false;
  87609. _this.autoRemoteTextTracks_ = new ALL.text.ListClass();
  87610. _this.initTrackListeners();
  87611. if (!options2.nativeControlsForTouch) {
  87612. _this.emitTapEvents();
  87613. }
  87614. if (_this.constructor) {
  87615. _this.name_ = _this.constructor.name || "Unknown Tech";
  87616. }
  87617. return _this;
  87618. }
  87619. var _proto = Tech2.prototype;
  87620. _proto.triggerSourceset = function triggerSourceset(src) {
  87621. var _this2 = this;
  87622. if (!this.isReady_) {
  87623. this.one("ready", function() {
  87624. return _this2.setTimeout(function() {
  87625. return _this2.triggerSourceset(src);
  87626. }, 1);
  87627. });
  87628. }
  87629. this.trigger({
  87630. src,
  87631. type: "sourceset"
  87632. });
  87633. };
  87634. _proto.manualProgressOn = function manualProgressOn() {
  87635. this.on("durationchange", this.onDurationChange_);
  87636. this.manualProgress = true;
  87637. this.one("ready", this.trackProgress_);
  87638. };
  87639. _proto.manualProgressOff = function manualProgressOff() {
  87640. this.manualProgress = false;
  87641. this.stopTrackingProgress();
  87642. this.off("durationchange", this.onDurationChange_);
  87643. };
  87644. _proto.trackProgress = function trackProgress(event2) {
  87645. this.stopTrackingProgress();
  87646. this.progressInterval = this.setInterval(bind(this, function() {
  87647. var numBufferedPercent = this.bufferedPercent();
  87648. if (this.bufferedPercent_ !== numBufferedPercent) {
  87649. this.trigger("progress");
  87650. }
  87651. this.bufferedPercent_ = numBufferedPercent;
  87652. if (numBufferedPercent === 1) {
  87653. this.stopTrackingProgress();
  87654. }
  87655. }), 500);
  87656. };
  87657. _proto.onDurationChange = function onDurationChange(event2) {
  87658. this.duration_ = this.duration();
  87659. };
  87660. _proto.buffered = function buffered() {
  87661. return createTimeRanges(0, 0);
  87662. };
  87663. _proto.bufferedPercent = function bufferedPercent$12() {
  87664. return bufferedPercent(this.buffered(), this.duration_);
  87665. };
  87666. _proto.stopTrackingProgress = function stopTrackingProgress() {
  87667. this.clearInterval(this.progressInterval);
  87668. };
  87669. _proto.manualTimeUpdatesOn = function manualTimeUpdatesOn() {
  87670. this.manualTimeUpdates = true;
  87671. this.on("play", this.trackCurrentTime_);
  87672. this.on("pause", this.stopTrackingCurrentTime_);
  87673. };
  87674. _proto.manualTimeUpdatesOff = function manualTimeUpdatesOff() {
  87675. this.manualTimeUpdates = false;
  87676. this.stopTrackingCurrentTime();
  87677. this.off("play", this.trackCurrentTime_);
  87678. this.off("pause", this.stopTrackingCurrentTime_);
  87679. };
  87680. _proto.trackCurrentTime = function trackCurrentTime() {
  87681. if (this.currentTimeInterval) {
  87682. this.stopTrackingCurrentTime();
  87683. }
  87684. this.currentTimeInterval = this.setInterval(function() {
  87685. this.trigger({
  87686. type: "timeupdate",
  87687. target: this,
  87688. manuallyTriggered: true
  87689. });
  87690. }, 250);
  87691. };
  87692. _proto.stopTrackingCurrentTime = function stopTrackingCurrentTime() {
  87693. this.clearInterval(this.currentTimeInterval);
  87694. this.trigger({
  87695. type: "timeupdate",
  87696. target: this,
  87697. manuallyTriggered: true
  87698. });
  87699. };
  87700. _proto.dispose = function dispose() {
  87701. this.clearTracks(NORMAL.names);
  87702. if (this.manualProgress) {
  87703. this.manualProgressOff();
  87704. }
  87705. if (this.manualTimeUpdates) {
  87706. this.manualTimeUpdatesOff();
  87707. }
  87708. _Component.prototype.dispose.call(this);
  87709. };
  87710. _proto.clearTracks = function clearTracks(types) {
  87711. var _this3 = this;
  87712. types = [].concat(types);
  87713. types.forEach(function(type2) {
  87714. var list = _this3[type2 + "Tracks"]() || [];
  87715. var i2 = list.length;
  87716. while (i2--) {
  87717. var track = list[i2];
  87718. if (type2 === "text") {
  87719. _this3.removeRemoteTextTrack(track);
  87720. }
  87721. list.removeTrack(track);
  87722. }
  87723. });
  87724. };
  87725. _proto.cleanupAutoTextTracks = function cleanupAutoTextTracks() {
  87726. var list = this.autoRemoteTextTracks_ || [];
  87727. var i2 = list.length;
  87728. while (i2--) {
  87729. var track = list[i2];
  87730. this.removeRemoteTextTrack(track);
  87731. }
  87732. };
  87733. _proto.reset = function reset3() {
  87734. };
  87735. _proto.crossOrigin = function crossOrigin() {
  87736. };
  87737. _proto.setCrossOrigin = function setCrossOrigin() {
  87738. };
  87739. _proto.error = function error(err) {
  87740. if (err !== void 0) {
  87741. this.error_ = new MediaError(err);
  87742. this.trigger("error");
  87743. }
  87744. return this.error_;
  87745. };
  87746. _proto.played = function played() {
  87747. if (this.hasStarted_) {
  87748. return createTimeRanges(0, 0);
  87749. }
  87750. return createTimeRanges();
  87751. };
  87752. _proto.play = function play() {
  87753. };
  87754. _proto.setScrubbing = function setScrubbing() {
  87755. };
  87756. _proto.scrubbing = function scrubbing() {
  87757. };
  87758. _proto.setCurrentTime = function setCurrentTime() {
  87759. if (this.manualTimeUpdates) {
  87760. this.trigger({
  87761. type: "timeupdate",
  87762. target: this,
  87763. manuallyTriggered: true
  87764. });
  87765. }
  87766. };
  87767. _proto.initTrackListeners = function initTrackListeners() {
  87768. var _this4 = this;
  87769. NORMAL.names.forEach(function(name) {
  87770. var props = NORMAL[name];
  87771. var trackListChanges = function trackListChanges2() {
  87772. _this4.trigger(name + "trackchange");
  87773. };
  87774. var tracks = _this4[props.getterName]();
  87775. tracks.addEventListener("removetrack", trackListChanges);
  87776. tracks.addEventListener("addtrack", trackListChanges);
  87777. _this4.on("dispose", function() {
  87778. tracks.removeEventListener("removetrack", trackListChanges);
  87779. tracks.removeEventListener("addtrack", trackListChanges);
  87780. });
  87781. });
  87782. };
  87783. _proto.addWebVttScript_ = function addWebVttScript_() {
  87784. var _this5 = this;
  87785. if (window_1.WebVTT) {
  87786. return;
  87787. }
  87788. if (document_1.body.contains(this.el())) {
  87789. if (!this.options_["vtt.js"] && isPlain(vtt) && Object.keys(vtt).length > 0) {
  87790. this.trigger("vttjsloaded");
  87791. return;
  87792. }
  87793. var script = document_1.createElement("script");
  87794. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  87795. script.onload = function() {
  87796. _this5.trigger("vttjsloaded");
  87797. };
  87798. script.onerror = function() {
  87799. _this5.trigger("vttjserror");
  87800. };
  87801. this.on("dispose", function() {
  87802. script.onload = null;
  87803. script.onerror = null;
  87804. });
  87805. window_1.WebVTT = true;
  87806. this.el().parentNode.appendChild(script);
  87807. } else {
  87808. this.ready(this.addWebVttScript_);
  87809. }
  87810. };
  87811. _proto.emulateTextTracks = function emulateTextTracks() {
  87812. var _this6 = this;
  87813. var tracks = this.textTracks();
  87814. var remoteTracks = this.remoteTextTracks();
  87815. var handleAddTrack = function handleAddTrack2(e) {
  87816. return tracks.addTrack(e.track);
  87817. };
  87818. var handleRemoveTrack = function handleRemoveTrack2(e) {
  87819. return tracks.removeTrack(e.track);
  87820. };
  87821. remoteTracks.on("addtrack", handleAddTrack);
  87822. remoteTracks.on("removetrack", handleRemoveTrack);
  87823. this.addWebVttScript_();
  87824. var updateDisplay = function updateDisplay2() {
  87825. return _this6.trigger("texttrackchange");
  87826. };
  87827. var textTracksChanges = function textTracksChanges2() {
  87828. updateDisplay();
  87829. for (var i2 = 0; i2 < tracks.length; i2++) {
  87830. var track = tracks[i2];
  87831. track.removeEventListener("cuechange", updateDisplay);
  87832. if (track.mode === "showing") {
  87833. track.addEventListener("cuechange", updateDisplay);
  87834. }
  87835. }
  87836. };
  87837. textTracksChanges();
  87838. tracks.addEventListener("change", textTracksChanges);
  87839. tracks.addEventListener("addtrack", textTracksChanges);
  87840. tracks.addEventListener("removetrack", textTracksChanges);
  87841. this.on("dispose", function() {
  87842. remoteTracks.off("addtrack", handleAddTrack);
  87843. remoteTracks.off("removetrack", handleRemoveTrack);
  87844. tracks.removeEventListener("change", textTracksChanges);
  87845. tracks.removeEventListener("addtrack", textTracksChanges);
  87846. tracks.removeEventListener("removetrack", textTracksChanges);
  87847. for (var i2 = 0; i2 < tracks.length; i2++) {
  87848. var track = tracks[i2];
  87849. track.removeEventListener("cuechange", updateDisplay);
  87850. }
  87851. });
  87852. };
  87853. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  87854. if (!kind) {
  87855. throw new Error("TextTrack kind is required but was not provided");
  87856. }
  87857. return createTrackHelper(this, kind, label2, language);
  87858. };
  87859. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  87860. var track = mergeOptions$3(options2, {
  87861. tech: this
  87862. });
  87863. return new REMOTE.remoteTextEl.TrackClass(track);
  87864. };
  87865. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  87866. var _this7 = this;
  87867. if (options2 === void 0) {
  87868. options2 = {};
  87869. }
  87870. var htmlTrackElement = this.createRemoteTextTrack(options2);
  87871. if (manualCleanup !== true && manualCleanup !== false) {
  87872. 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');
  87873. manualCleanup = true;
  87874. }
  87875. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  87876. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  87877. if (manualCleanup !== true) {
  87878. this.ready(function() {
  87879. return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);
  87880. });
  87881. }
  87882. return htmlTrackElement;
  87883. };
  87884. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  87885. var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  87886. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  87887. this.remoteTextTracks().removeTrack(track);
  87888. this.autoRemoteTextTracks_.removeTrack(track);
  87889. };
  87890. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  87891. return {};
  87892. };
  87893. _proto.requestPictureInPicture = function requestPictureInPicture() {
  87894. var PromiseClass = this.options_.Promise || window_1.Promise;
  87895. if (PromiseClass) {
  87896. return PromiseClass.reject();
  87897. }
  87898. };
  87899. _proto.disablePictureInPicture = function disablePictureInPicture() {
  87900. return true;
  87901. };
  87902. _proto.setDisablePictureInPicture = function setDisablePictureInPicture() {
  87903. };
  87904. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  87905. var _this8 = this;
  87906. var id = newGUID();
  87907. if (!this.isReady_ || this.paused()) {
  87908. this.queuedHanders_.add(id);
  87909. this.one("playing", function() {
  87910. if (_this8.queuedHanders_.has(id)) {
  87911. _this8.queuedHanders_["delete"](id);
  87912. cb();
  87913. }
  87914. });
  87915. } else {
  87916. this.requestNamedAnimationFrame(id, cb);
  87917. }
  87918. return id;
  87919. };
  87920. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  87921. if (this.queuedHanders_.has(id)) {
  87922. this.queuedHanders_["delete"](id);
  87923. } else {
  87924. this.cancelNamedAnimationFrame(id);
  87925. }
  87926. };
  87927. _proto.setPoster = function setPoster() {
  87928. };
  87929. _proto.playsinline = function playsinline() {
  87930. };
  87931. _proto.setPlaysinline = function setPlaysinline() {
  87932. };
  87933. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks() {
  87934. };
  87935. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks() {
  87936. };
  87937. _proto.canPlayType = function canPlayType3() {
  87938. return "";
  87939. };
  87940. Tech2.canPlayType = function canPlayType3() {
  87941. return "";
  87942. };
  87943. Tech2.canPlaySource = function canPlaySource(srcObj, options2) {
  87944. return Tech2.canPlayType(srcObj.type);
  87945. };
  87946. Tech2.isTech = function isTech(component) {
  87947. return component.prototype instanceof Tech2 || component instanceof Tech2 || component === Tech2;
  87948. };
  87949. Tech2.registerTech = function registerTech(name, tech) {
  87950. if (!Tech2.techs_) {
  87951. Tech2.techs_ = {};
  87952. }
  87953. if (!Tech2.isTech(tech)) {
  87954. throw new Error("Tech " + name + " must be a Tech");
  87955. }
  87956. if (!Tech2.canPlayType) {
  87957. throw new Error("Techs must have a static canPlayType method on them");
  87958. }
  87959. if (!Tech2.canPlaySource) {
  87960. throw new Error("Techs must have a static canPlaySource method on them");
  87961. }
  87962. name = toTitleCase$1(name);
  87963. Tech2.techs_[name] = tech;
  87964. Tech2.techs_[toLowerCase(name)] = tech;
  87965. if (name !== "Tech") {
  87966. Tech2.defaultTechOrder_.push(name);
  87967. }
  87968. return tech;
  87969. };
  87970. Tech2.getTech = function getTech(name) {
  87971. if (!name) {
  87972. return;
  87973. }
  87974. if (Tech2.techs_ && Tech2.techs_[name]) {
  87975. return Tech2.techs_[name];
  87976. }
  87977. name = toTitleCase$1(name);
  87978. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  87979. log$1.warn("The " + name + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)");
  87980. return window_1.videojs[name];
  87981. }
  87982. };
  87983. return Tech2;
  87984. }(Component$1);
  87985. ALL.names.forEach(function(name) {
  87986. var props = ALL[name];
  87987. Tech$1.prototype[props.getterName] = function() {
  87988. this[props.privateName] = this[props.privateName] || new props.ListClass();
  87989. return this[props.privateName];
  87990. };
  87991. });
  87992. Tech$1.prototype.featuresVolumeControl = true;
  87993. Tech$1.prototype.featuresMuteControl = true;
  87994. Tech$1.prototype.featuresFullscreenResize = false;
  87995. Tech$1.prototype.featuresPlaybackRate = false;
  87996. Tech$1.prototype.featuresProgressEvents = false;
  87997. Tech$1.prototype.featuresSourceset = false;
  87998. Tech$1.prototype.featuresTimeupdateEvents = false;
  87999. Tech$1.prototype.featuresNativeTextTracks = false;
  88000. Tech$1.prototype.featuresVideoFrameCallback = false;
  88001. Tech$1.withSourceHandlers = function(_Tech) {
  88002. _Tech.registerSourceHandler = function(handler, index2) {
  88003. var handlers = _Tech.sourceHandlers;
  88004. if (!handlers) {
  88005. handlers = _Tech.sourceHandlers = [];
  88006. }
  88007. if (index2 === void 0) {
  88008. index2 = handlers.length;
  88009. }
  88010. handlers.splice(index2, 0, handler);
  88011. };
  88012. _Tech.canPlayType = function(type2) {
  88013. var handlers = _Tech.sourceHandlers || [];
  88014. var can;
  88015. for (var i2 = 0; i2 < handlers.length; i2++) {
  88016. can = handlers[i2].canPlayType(type2);
  88017. if (can) {
  88018. return can;
  88019. }
  88020. }
  88021. return "";
  88022. };
  88023. _Tech.selectSourceHandler = function(source, options2) {
  88024. var handlers = _Tech.sourceHandlers || [];
  88025. var can;
  88026. for (var i2 = 0; i2 < handlers.length; i2++) {
  88027. can = handlers[i2].canHandleSource(source, options2);
  88028. if (can) {
  88029. return handlers[i2];
  88030. }
  88031. }
  88032. return null;
  88033. };
  88034. _Tech.canPlaySource = function(srcObj, options2) {
  88035. var sh = _Tech.selectSourceHandler(srcObj, options2);
  88036. if (sh) {
  88037. return sh.canHandleSource(srcObj, options2);
  88038. }
  88039. return "";
  88040. };
  88041. var deferrable = ["seekable", "seeking", "duration"];
  88042. deferrable.forEach(function(fnName) {
  88043. var originalFn = this[fnName];
  88044. if (typeof originalFn !== "function") {
  88045. return;
  88046. }
  88047. this[fnName] = function() {
  88048. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  88049. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  88050. }
  88051. return originalFn.apply(this, arguments);
  88052. };
  88053. }, _Tech.prototype);
  88054. _Tech.prototype.setSource = function(source) {
  88055. var sh = _Tech.selectSourceHandler(source, this.options_);
  88056. if (!sh) {
  88057. if (_Tech.nativeSourceHandler) {
  88058. sh = _Tech.nativeSourceHandler;
  88059. } else {
  88060. log$1.error("No source handler found for the current source.");
  88061. }
  88062. }
  88063. this.disposeSourceHandler();
  88064. this.off("dispose", this.disposeSourceHandler_);
  88065. if (sh !== _Tech.nativeSourceHandler) {
  88066. this.currentSource_ = source;
  88067. }
  88068. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  88069. this.one("dispose", this.disposeSourceHandler_);
  88070. };
  88071. _Tech.prototype.disposeSourceHandler = function() {
  88072. if (this.currentSource_) {
  88073. this.clearTracks(["audio", "video"]);
  88074. this.currentSource_ = null;
  88075. }
  88076. this.cleanupAutoTextTracks();
  88077. if (this.sourceHandler_) {
  88078. if (this.sourceHandler_.dispose) {
  88079. this.sourceHandler_.dispose();
  88080. }
  88081. this.sourceHandler_ = null;
  88082. }
  88083. };
  88084. };
  88085. Component$1.registerComponent("Tech", Tech$1);
  88086. Tech$1.registerTech("Tech", Tech$1);
  88087. Tech$1.defaultTechOrder_ = [];
  88088. var middlewares = {};
  88089. var middlewareInstances = {};
  88090. var TERMINATOR = {};
  88091. function use(type2, middleware) {
  88092. middlewares[type2] = middlewares[type2] || [];
  88093. middlewares[type2].push(middleware);
  88094. }
  88095. function setSource(player, src, next) {
  88096. player.setTimeout(function() {
  88097. return setSourceHelper(src, middlewares[src.type], next, player);
  88098. }, 1);
  88099. }
  88100. function setTech(middleware, tech) {
  88101. middleware.forEach(function(mw) {
  88102. return mw.setTech && mw.setTech(tech);
  88103. });
  88104. }
  88105. function get(middleware, tech, method) {
  88106. return middleware.reduceRight(middlewareIterator(method), tech[method]());
  88107. }
  88108. function set(middleware, tech, method, arg) {
  88109. return tech[method](middleware.reduce(middlewareIterator(method), arg));
  88110. }
  88111. function mediate(middleware, tech, method, arg) {
  88112. if (arg === void 0) {
  88113. arg = null;
  88114. }
  88115. var callMethod = "call" + toTitleCase$1(method);
  88116. var middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg);
  88117. var terminated = middlewareValue === TERMINATOR;
  88118. var returnValue = terminated ? null : tech[method](middlewareValue);
  88119. executeRight(middleware, method, returnValue, terminated);
  88120. return returnValue;
  88121. }
  88122. var allowedGetters = {
  88123. buffered: 1,
  88124. currentTime: 1,
  88125. duration: 1,
  88126. muted: 1,
  88127. played: 1,
  88128. paused: 1,
  88129. seekable: 1,
  88130. volume: 1,
  88131. ended: 1
  88132. };
  88133. var allowedSetters = {
  88134. setCurrentTime: 1,
  88135. setMuted: 1,
  88136. setVolume: 1
  88137. };
  88138. var allowedMediators = {
  88139. play: 1,
  88140. pause: 1
  88141. };
  88142. function middlewareIterator(method) {
  88143. return function(value, mw) {
  88144. if (value === TERMINATOR) {
  88145. return TERMINATOR;
  88146. }
  88147. if (mw[method]) {
  88148. return mw[method](value);
  88149. }
  88150. return value;
  88151. };
  88152. }
  88153. function executeRight(mws, method, value, terminated) {
  88154. for (var i2 = mws.length - 1; i2 >= 0; i2--) {
  88155. var mw = mws[i2];
  88156. if (mw[method]) {
  88157. mw[method](terminated, value);
  88158. }
  88159. }
  88160. }
  88161. function clearCacheForPlayer(player) {
  88162. middlewareInstances[player.id()] = null;
  88163. }
  88164. function getOrCreateFactory(player, mwFactory) {
  88165. var mws = middlewareInstances[player.id()];
  88166. var mw = null;
  88167. if (mws === void 0 || mws === null) {
  88168. mw = mwFactory(player);
  88169. middlewareInstances[player.id()] = [[mwFactory, mw]];
  88170. return mw;
  88171. }
  88172. for (var i2 = 0; i2 < mws.length; i2++) {
  88173. var _mws$i = mws[i2], mwf = _mws$i[0], mwi = _mws$i[1];
  88174. if (mwf !== mwFactory) {
  88175. continue;
  88176. }
  88177. mw = mwi;
  88178. }
  88179. if (mw === null) {
  88180. mw = mwFactory(player);
  88181. mws.push([mwFactory, mw]);
  88182. }
  88183. return mw;
  88184. }
  88185. function setSourceHelper(src, middleware, next, player, acc, lastRun) {
  88186. if (src === void 0) {
  88187. src = {};
  88188. }
  88189. if (middleware === void 0) {
  88190. middleware = [];
  88191. }
  88192. if (acc === void 0) {
  88193. acc = [];
  88194. }
  88195. if (lastRun === void 0) {
  88196. lastRun = false;
  88197. }
  88198. var _middleware = middleware, mwFactory = _middleware[0], mwrest = _middleware.slice(1);
  88199. if (typeof mwFactory === "string") {
  88200. setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun);
  88201. } else if (mwFactory) {
  88202. var mw = getOrCreateFactory(player, mwFactory);
  88203. if (!mw.setSource) {
  88204. acc.push(mw);
  88205. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88206. }
  88207. mw.setSource(assign({}, src), function(err, _src) {
  88208. if (err) {
  88209. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88210. }
  88211. acc.push(mw);
  88212. setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun);
  88213. });
  88214. } else if (mwrest.length) {
  88215. setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88216. } else if (lastRun) {
  88217. next(src, acc);
  88218. } else {
  88219. setSourceHelper(src, middlewares["*"], next, player, acc, true);
  88220. }
  88221. }
  88222. var MimetypesKind = {
  88223. opus: "video/ogg",
  88224. ogv: "video/ogg",
  88225. mp4: "video/mp4",
  88226. mov: "video/mp4",
  88227. m4v: "video/mp4",
  88228. mkv: "video/x-matroska",
  88229. m4a: "audio/mp4",
  88230. mp3: "audio/mpeg",
  88231. aac: "audio/aac",
  88232. caf: "audio/x-caf",
  88233. flac: "audio/flac",
  88234. oga: "audio/ogg",
  88235. wav: "audio/wav",
  88236. m3u8: "application/x-mpegURL",
  88237. mpd: "application/dash+xml",
  88238. jpg: "image/jpeg",
  88239. jpeg: "image/jpeg",
  88240. gif: "image/gif",
  88241. png: "image/png",
  88242. svg: "image/svg+xml",
  88243. webp: "image/webp"
  88244. };
  88245. var getMimetype = function getMimetype2(src) {
  88246. if (src === void 0) {
  88247. src = "";
  88248. }
  88249. var ext = getFileExtension(src);
  88250. var mimetype = MimetypesKind[ext.toLowerCase()];
  88251. return mimetype || "";
  88252. };
  88253. var findMimetype = function findMimetype2(player, src) {
  88254. if (!src) {
  88255. return "";
  88256. }
  88257. if (player.cache_.source.src === src && player.cache_.source.type) {
  88258. return player.cache_.source.type;
  88259. }
  88260. var matchingSources = player.cache_.sources.filter(function(s2) {
  88261. return s2.src === src;
  88262. });
  88263. if (matchingSources.length) {
  88264. return matchingSources[0].type;
  88265. }
  88266. var sources = player.$$("source");
  88267. for (var i2 = 0; i2 < sources.length; i2++) {
  88268. var s = sources[i2];
  88269. if (s.type && s.src && s.src === src) {
  88270. return s.type;
  88271. }
  88272. }
  88273. return getMimetype(src);
  88274. };
  88275. var filterSource = function filterSource2(src) {
  88276. if (Array.isArray(src)) {
  88277. var newsrc = [];
  88278. src.forEach(function(srcobj) {
  88279. srcobj = filterSource2(srcobj);
  88280. if (Array.isArray(srcobj)) {
  88281. newsrc = newsrc.concat(srcobj);
  88282. } else if (isObject2(srcobj)) {
  88283. newsrc.push(srcobj);
  88284. }
  88285. });
  88286. src = newsrc;
  88287. } else if (typeof src === "string" && src.trim()) {
  88288. src = [fixSource({
  88289. src
  88290. })];
  88291. } else if (isObject2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  88292. src = [fixSource(src)];
  88293. } else {
  88294. src = [];
  88295. }
  88296. return src;
  88297. };
  88298. function fixSource(src) {
  88299. if (!src.type) {
  88300. var mimetype = getMimetype(src.src);
  88301. if (mimetype) {
  88302. src.type = mimetype;
  88303. }
  88304. }
  88305. return src;
  88306. }
  88307. var MediaLoader = /* @__PURE__ */ function(_Component) {
  88308. _inheritsLoose(MediaLoader2, _Component);
  88309. function MediaLoader2(player, options2, ready) {
  88310. var _this;
  88311. var options_ = mergeOptions$3({
  88312. createEl: false
  88313. }, options2);
  88314. _this = _Component.call(this, player, options_, ready) || this;
  88315. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  88316. for (var i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  88317. var techName = toTitleCase$1(j[i2]);
  88318. var tech = Tech$1.getTech(techName);
  88319. if (!techName) {
  88320. tech = Component$1.getComponent(techName);
  88321. }
  88322. if (tech && tech.isSupported()) {
  88323. player.loadTech_(techName);
  88324. break;
  88325. }
  88326. }
  88327. } else {
  88328. player.src(options2.playerOptions.sources);
  88329. }
  88330. return _this;
  88331. }
  88332. return MediaLoader2;
  88333. }(Component$1);
  88334. Component$1.registerComponent("MediaLoader", MediaLoader);
  88335. var ClickableComponent = /* @__PURE__ */ function(_Component) {
  88336. _inheritsLoose(ClickableComponent2, _Component);
  88337. function ClickableComponent2(player, options2) {
  88338. var _this;
  88339. _this = _Component.call(this, player, options2) || this;
  88340. if (_this.options_.controlText) {
  88341. _this.controlText(_this.options_.controlText);
  88342. }
  88343. _this.handleMouseOver_ = function(e) {
  88344. return _this.handleMouseOver(e);
  88345. };
  88346. _this.handleMouseOut_ = function(e) {
  88347. return _this.handleMouseOut(e);
  88348. };
  88349. _this.handleClick_ = function(e) {
  88350. return _this.handleClick(e);
  88351. };
  88352. _this.handleKeyDown_ = function(e) {
  88353. return _this.handleKeyDown(e);
  88354. };
  88355. _this.emitTapEvents();
  88356. _this.enable();
  88357. return _this;
  88358. }
  88359. var _proto = ClickableComponent2.prototype;
  88360. _proto.createEl = function createEl$12(tag, props, attributes) {
  88361. if (tag === void 0) {
  88362. tag = "div";
  88363. }
  88364. if (props === void 0) {
  88365. props = {};
  88366. }
  88367. if (attributes === void 0) {
  88368. attributes = {};
  88369. }
  88370. props = assign({
  88371. className: this.buildCSSClass(),
  88372. tabIndex: 0
  88373. }, props);
  88374. if (tag === "button") {
  88375. log$1.error("Creating a ClickableComponent with an HTML element of " + tag + " is not supported; use a Button instead.");
  88376. }
  88377. attributes = assign({
  88378. role: "button"
  88379. }, attributes);
  88380. this.tabIndex_ = props.tabIndex;
  88381. var el = createEl(tag, props, attributes);
  88382. el.appendChild(createEl("span", {
  88383. className: "vjs-icon-placeholder"
  88384. }, {
  88385. "aria-hidden": true
  88386. }));
  88387. this.createControlTextEl(el);
  88388. return el;
  88389. };
  88390. _proto.dispose = function dispose() {
  88391. this.controlTextEl_ = null;
  88392. _Component.prototype.dispose.call(this);
  88393. };
  88394. _proto.createControlTextEl = function createControlTextEl(el) {
  88395. this.controlTextEl_ = createEl("span", {
  88396. className: "vjs-control-text"
  88397. }, {
  88398. "aria-live": "polite"
  88399. });
  88400. if (el) {
  88401. el.appendChild(this.controlTextEl_);
  88402. }
  88403. this.controlText(this.controlText_, el);
  88404. return this.controlTextEl_;
  88405. };
  88406. _proto.controlText = function controlText(text, el) {
  88407. if (el === void 0) {
  88408. el = this.el();
  88409. }
  88410. if (text === void 0) {
  88411. return this.controlText_ || "Need Text";
  88412. }
  88413. var localizedText = this.localize(text);
  88414. this.controlText_ = text;
  88415. textContent(this.controlTextEl_, localizedText);
  88416. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  88417. el.setAttribute("title", localizedText);
  88418. }
  88419. };
  88420. _proto.buildCSSClass = function buildCSSClass() {
  88421. return "vjs-control vjs-button " + _Component.prototype.buildCSSClass.call(this);
  88422. };
  88423. _proto.enable = function enable() {
  88424. if (!this.enabled_) {
  88425. this.enabled_ = true;
  88426. this.removeClass("vjs-disabled");
  88427. this.el_.setAttribute("aria-disabled", "false");
  88428. if (typeof this.tabIndex_ !== "undefined") {
  88429. this.el_.setAttribute("tabIndex", this.tabIndex_);
  88430. }
  88431. this.on(["tap", "click"], this.handleClick_);
  88432. this.on("keydown", this.handleKeyDown_);
  88433. }
  88434. };
  88435. _proto.disable = function disable() {
  88436. this.enabled_ = false;
  88437. this.addClass("vjs-disabled");
  88438. this.el_.setAttribute("aria-disabled", "true");
  88439. if (typeof this.tabIndex_ !== "undefined") {
  88440. this.el_.removeAttribute("tabIndex");
  88441. }
  88442. this.off("mouseover", this.handleMouseOver_);
  88443. this.off("mouseout", this.handleMouseOut_);
  88444. this.off(["tap", "click"], this.handleClick_);
  88445. this.off("keydown", this.handleKeyDown_);
  88446. };
  88447. _proto.handleLanguagechange = function handleLanguagechange() {
  88448. this.controlText(this.controlText_);
  88449. };
  88450. _proto.handleClick = function handleClick(event2) {
  88451. if (this.options_.clickHandler) {
  88452. this.options_.clickHandler.call(this, arguments);
  88453. }
  88454. };
  88455. _proto.handleKeyDown = function handleKeyDown(event2) {
  88456. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88457. event2.preventDefault();
  88458. event2.stopPropagation();
  88459. this.trigger("click");
  88460. } else {
  88461. _Component.prototype.handleKeyDown.call(this, event2);
  88462. }
  88463. };
  88464. return ClickableComponent2;
  88465. }(Component$1);
  88466. Component$1.registerComponent("ClickableComponent", ClickableComponent);
  88467. var PosterImage = /* @__PURE__ */ function(_ClickableComponent) {
  88468. _inheritsLoose(PosterImage2, _ClickableComponent);
  88469. function PosterImage2(player, options2) {
  88470. var _this;
  88471. _this = _ClickableComponent.call(this, player, options2) || this;
  88472. _this.update();
  88473. _this.update_ = function(e) {
  88474. return _this.update(e);
  88475. };
  88476. player.on("posterchange", _this.update_);
  88477. return _this;
  88478. }
  88479. var _proto = PosterImage2.prototype;
  88480. _proto.dispose = function dispose() {
  88481. this.player().off("posterchange", this.update_);
  88482. _ClickableComponent.prototype.dispose.call(this);
  88483. };
  88484. _proto.createEl = function createEl$12() {
  88485. var el = createEl("div", {
  88486. className: "vjs-poster",
  88487. tabIndex: -1
  88488. });
  88489. return el;
  88490. };
  88491. _proto.update = function update(event2) {
  88492. var url = this.player().poster();
  88493. this.setSrc(url);
  88494. if (url) {
  88495. this.show();
  88496. } else {
  88497. this.hide();
  88498. }
  88499. };
  88500. _proto.setSrc = function setSrc(url) {
  88501. var backgroundImage = "";
  88502. if (url) {
  88503. backgroundImage = 'url("' + url + '")';
  88504. }
  88505. this.el_.style.backgroundImage = backgroundImage;
  88506. };
  88507. _proto.handleClick = function handleClick(event2) {
  88508. if (!this.player_.controls()) {
  88509. return;
  88510. }
  88511. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88512. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88513. this.player_.tech(true).focus();
  88514. }
  88515. if (this.player_.paused()) {
  88516. silencePromise(this.player_.play());
  88517. } else {
  88518. this.player_.pause();
  88519. }
  88520. };
  88521. return PosterImage2;
  88522. }(ClickableComponent);
  88523. Component$1.registerComponent("PosterImage", PosterImage);
  88524. var darkGray = "#222";
  88525. var lightGray = "#ccc";
  88526. var fontMap = {
  88527. monospace: "monospace",
  88528. sansSerif: "sans-serif",
  88529. serif: "serif",
  88530. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  88531. monospaceSerif: '"Courier New", monospace',
  88532. proportionalSansSerif: "sans-serif",
  88533. proportionalSerif: "serif",
  88534. casual: '"Comic Sans MS", Impact, fantasy',
  88535. script: '"Monotype Corsiva", cursive',
  88536. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  88537. };
  88538. function constructColor(color2, opacity) {
  88539. var hex;
  88540. if (color2.length === 4) {
  88541. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  88542. } else if (color2.length === 7) {
  88543. hex = color2.slice(1);
  88544. } else {
  88545. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  88546. }
  88547. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  88548. }
  88549. function tryUpdateStyle(el, style, rule) {
  88550. try {
  88551. el.style[style] = rule;
  88552. } catch (e) {
  88553. return;
  88554. }
  88555. }
  88556. var TextTrackDisplay = /* @__PURE__ */ function(_Component) {
  88557. _inheritsLoose(TextTrackDisplay2, _Component);
  88558. function TextTrackDisplay2(player, options2, ready) {
  88559. var _this;
  88560. _this = _Component.call(this, player, options2, ready) || this;
  88561. var updateDisplayHandler = function updateDisplayHandler2(e) {
  88562. return _this.updateDisplay(e);
  88563. };
  88564. player.on("loadstart", function(e) {
  88565. return _this.toggleDisplay(e);
  88566. });
  88567. player.on("texttrackchange", updateDisplayHandler);
  88568. player.on("loadedmetadata", function(e) {
  88569. return _this.preselectTrack(e);
  88570. });
  88571. player.ready(bind(_assertThisInitialized(_this), function() {
  88572. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  88573. this.hide();
  88574. return;
  88575. }
  88576. player.on("fullscreenchange", updateDisplayHandler);
  88577. player.on("playerresize", updateDisplayHandler);
  88578. window_1.addEventListener("orientationchange", updateDisplayHandler);
  88579. player.on("dispose", function() {
  88580. return window_1.removeEventListener("orientationchange", updateDisplayHandler);
  88581. });
  88582. var tracks = this.options_.playerOptions.tracks || [];
  88583. for (var i2 = 0; i2 < tracks.length; i2++) {
  88584. this.player_.addRemoteTextTrack(tracks[i2], true);
  88585. }
  88586. this.preselectTrack();
  88587. }));
  88588. return _this;
  88589. }
  88590. var _proto = TextTrackDisplay2.prototype;
  88591. _proto.preselectTrack = function preselectTrack() {
  88592. var modes = {
  88593. captions: 1,
  88594. subtitles: 1
  88595. };
  88596. var trackList = this.player_.textTracks();
  88597. var userPref = this.player_.cache_.selectedLanguage;
  88598. var firstDesc;
  88599. var firstCaptions;
  88600. var preferredTrack;
  88601. for (var i2 = 0; i2 < trackList.length; i2++) {
  88602. var track = trackList[i2];
  88603. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  88604. if (track.kind === userPref.kind) {
  88605. preferredTrack = track;
  88606. } else if (!preferredTrack) {
  88607. preferredTrack = track;
  88608. }
  88609. } else if (userPref && !userPref.enabled) {
  88610. preferredTrack = null;
  88611. firstDesc = null;
  88612. firstCaptions = null;
  88613. } else if (track["default"]) {
  88614. if (track.kind === "descriptions" && !firstDesc) {
  88615. firstDesc = track;
  88616. } else if (track.kind in modes && !firstCaptions) {
  88617. firstCaptions = track;
  88618. }
  88619. }
  88620. }
  88621. if (preferredTrack) {
  88622. preferredTrack.mode = "showing";
  88623. } else if (firstCaptions) {
  88624. firstCaptions.mode = "showing";
  88625. } else if (firstDesc) {
  88626. firstDesc.mode = "showing";
  88627. }
  88628. };
  88629. _proto.toggleDisplay = function toggleDisplay() {
  88630. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  88631. this.hide();
  88632. } else {
  88633. this.show();
  88634. }
  88635. };
  88636. _proto.createEl = function createEl2() {
  88637. return _Component.prototype.createEl.call(this, "div", {
  88638. className: "vjs-text-track-display"
  88639. }, {
  88640. "translate": "yes",
  88641. "aria-live": "off",
  88642. "aria-atomic": "true"
  88643. });
  88644. };
  88645. _proto.clearDisplay = function clearDisplay() {
  88646. if (typeof window_1.WebVTT === "function") {
  88647. window_1.WebVTT.processCues(window_1, [], this.el_);
  88648. }
  88649. };
  88650. _proto.updateDisplay = function updateDisplay() {
  88651. var tracks = this.player_.textTracks();
  88652. var allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  88653. this.clearDisplay();
  88654. if (allowMultipleShowingTracks) {
  88655. var showingTracks = [];
  88656. for (var _i = 0; _i < tracks.length; ++_i) {
  88657. var track = tracks[_i];
  88658. if (track.mode !== "showing") {
  88659. continue;
  88660. }
  88661. showingTracks.push(track);
  88662. }
  88663. this.updateForTrack(showingTracks);
  88664. return;
  88665. }
  88666. var descriptionsTrack = null;
  88667. var captionsSubtitlesTrack = null;
  88668. var i2 = tracks.length;
  88669. while (i2--) {
  88670. var _track = tracks[i2];
  88671. if (_track.mode === "showing") {
  88672. if (_track.kind === "descriptions") {
  88673. descriptionsTrack = _track;
  88674. } else {
  88675. captionsSubtitlesTrack = _track;
  88676. }
  88677. }
  88678. }
  88679. if (captionsSubtitlesTrack) {
  88680. if (this.getAttribute("aria-live") !== "off") {
  88681. this.setAttribute("aria-live", "off");
  88682. }
  88683. this.updateForTrack(captionsSubtitlesTrack);
  88684. } else if (descriptionsTrack) {
  88685. if (this.getAttribute("aria-live") !== "assertive") {
  88686. this.setAttribute("aria-live", "assertive");
  88687. }
  88688. this.updateForTrack(descriptionsTrack);
  88689. }
  88690. };
  88691. _proto.updateDisplayState = function updateDisplayState(track) {
  88692. var overrides = this.player_.textTrackSettings.getValues();
  88693. var cues = track.activeCues;
  88694. var i2 = cues.length;
  88695. while (i2--) {
  88696. var cue = cues[i2];
  88697. if (!cue) {
  88698. continue;
  88699. }
  88700. var cueDiv = cue.displayState;
  88701. if (overrides.color) {
  88702. cueDiv.firstChild.style.color = overrides.color;
  88703. }
  88704. if (overrides.textOpacity) {
  88705. tryUpdateStyle(cueDiv.firstChild, "color", constructColor(overrides.color || "#fff", overrides.textOpacity));
  88706. }
  88707. if (overrides.backgroundColor) {
  88708. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  88709. }
  88710. if (overrides.backgroundOpacity) {
  88711. tryUpdateStyle(cueDiv.firstChild, "backgroundColor", constructColor(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  88712. }
  88713. if (overrides.windowColor) {
  88714. if (overrides.windowOpacity) {
  88715. tryUpdateStyle(cueDiv, "backgroundColor", constructColor(overrides.windowColor, overrides.windowOpacity));
  88716. } else {
  88717. cueDiv.style.backgroundColor = overrides.windowColor;
  88718. }
  88719. }
  88720. if (overrides.edgeStyle) {
  88721. if (overrides.edgeStyle === "dropshadow") {
  88722. cueDiv.firstChild.style.textShadow = "2px 2px 3px " + darkGray + ", 2px 2px 4px " + darkGray + ", 2px 2px 5px " + darkGray;
  88723. } else if (overrides.edgeStyle === "raised") {
  88724. cueDiv.firstChild.style.textShadow = "1px 1px " + darkGray + ", 2px 2px " + darkGray + ", 3px 3px " + darkGray;
  88725. } else if (overrides.edgeStyle === "depressed") {
  88726. cueDiv.firstChild.style.textShadow = "1px 1px " + lightGray + ", 0 1px " + lightGray + ", -1px -1px " + darkGray + ", 0 -1px " + darkGray;
  88727. } else if (overrides.edgeStyle === "uniform") {
  88728. cueDiv.firstChild.style.textShadow = "0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray;
  88729. }
  88730. }
  88731. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  88732. var fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  88733. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  88734. cueDiv.style.height = "auto";
  88735. cueDiv.style.top = "auto";
  88736. }
  88737. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  88738. if (overrides.fontFamily === "small-caps") {
  88739. cueDiv.firstChild.style.fontVariant = "small-caps";
  88740. } else {
  88741. cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];
  88742. }
  88743. }
  88744. }
  88745. };
  88746. _proto.updateForTrack = function updateForTrack(tracks) {
  88747. if (!Array.isArray(tracks)) {
  88748. tracks = [tracks];
  88749. }
  88750. if (typeof window_1.WebVTT !== "function" || tracks.every(function(track2) {
  88751. return !track2.activeCues;
  88752. })) {
  88753. return;
  88754. }
  88755. var cues = [];
  88756. for (var i2 = 0; i2 < tracks.length; ++i2) {
  88757. var track = tracks[i2];
  88758. for (var j = 0; j < track.activeCues.length; ++j) {
  88759. cues.push(track.activeCues[j]);
  88760. }
  88761. }
  88762. window_1.WebVTT.processCues(window_1, cues, this.el_);
  88763. for (var _i2 = 0; _i2 < tracks.length; ++_i2) {
  88764. var _track2 = tracks[_i2];
  88765. for (var _j = 0; _j < _track2.activeCues.length; ++_j) {
  88766. var cueEl = _track2.activeCues[_j].displayState;
  88767. addClass(cueEl, "vjs-text-track-cue");
  88768. addClass(cueEl, "vjs-text-track-cue-" + (_track2.language ? _track2.language : _i2));
  88769. if (_track2.language) {
  88770. setAttribute(cueEl, "lang", _track2.language);
  88771. }
  88772. }
  88773. if (this.player_.textTrackSettings) {
  88774. this.updateDisplayState(_track2);
  88775. }
  88776. }
  88777. };
  88778. return TextTrackDisplay2;
  88779. }(Component$1);
  88780. Component$1.registerComponent("TextTrackDisplay", TextTrackDisplay);
  88781. var LoadingSpinner = /* @__PURE__ */ function(_Component) {
  88782. _inheritsLoose(LoadingSpinner2, _Component);
  88783. function LoadingSpinner2() {
  88784. return _Component.apply(this, arguments) || this;
  88785. }
  88786. var _proto = LoadingSpinner2.prototype;
  88787. _proto.createEl = function createEl$12() {
  88788. var isAudio = this.player_.isAudio();
  88789. var playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  88790. var controlText = createEl("span", {
  88791. className: "vjs-control-text",
  88792. textContent: this.localize("{1} is loading.", [playerType])
  88793. });
  88794. var el = _Component.prototype.createEl.call(this, "div", {
  88795. className: "vjs-loading-spinner",
  88796. dir: "ltr"
  88797. });
  88798. el.appendChild(controlText);
  88799. return el;
  88800. };
  88801. return LoadingSpinner2;
  88802. }(Component$1);
  88803. Component$1.registerComponent("LoadingSpinner", LoadingSpinner);
  88804. var Button = /* @__PURE__ */ function(_ClickableComponent) {
  88805. _inheritsLoose(Button2, _ClickableComponent);
  88806. function Button2() {
  88807. return _ClickableComponent.apply(this, arguments) || this;
  88808. }
  88809. var _proto = Button2.prototype;
  88810. _proto.createEl = function createEl$12(tag, props, attributes) {
  88811. if (props === void 0) {
  88812. props = {};
  88813. }
  88814. if (attributes === void 0) {
  88815. attributes = {};
  88816. }
  88817. tag = "button";
  88818. props = assign({
  88819. className: this.buildCSSClass()
  88820. }, props);
  88821. attributes = assign({
  88822. type: "button"
  88823. }, attributes);
  88824. var el = createEl(tag, props, attributes);
  88825. el.appendChild(createEl("span", {
  88826. className: "vjs-icon-placeholder"
  88827. }, {
  88828. "aria-hidden": true
  88829. }));
  88830. this.createControlTextEl(el);
  88831. return el;
  88832. };
  88833. _proto.addChild = function addChild(child, options2) {
  88834. if (options2 === void 0) {
  88835. options2 = {};
  88836. }
  88837. var className = this.constructor.name;
  88838. log$1.warn("Adding an actionable (user controllable) child to a Button (" + className + ") is not supported; use a ClickableComponent instead.");
  88839. return Component$1.prototype.addChild.call(this, child, options2);
  88840. };
  88841. _proto.enable = function enable() {
  88842. _ClickableComponent.prototype.enable.call(this);
  88843. this.el_.removeAttribute("disabled");
  88844. };
  88845. _proto.disable = function disable() {
  88846. _ClickableComponent.prototype.disable.call(this);
  88847. this.el_.setAttribute("disabled", "disabled");
  88848. };
  88849. _proto.handleKeyDown = function handleKeyDown(event2) {
  88850. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88851. event2.stopPropagation();
  88852. return;
  88853. }
  88854. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  88855. };
  88856. return Button2;
  88857. }(ClickableComponent);
  88858. Component$1.registerComponent("Button", Button);
  88859. var BigPlayButton = /* @__PURE__ */ function(_Button) {
  88860. _inheritsLoose(BigPlayButton2, _Button);
  88861. function BigPlayButton2(player, options2) {
  88862. var _this;
  88863. _this = _Button.call(this, player, options2) || this;
  88864. _this.mouseused_ = false;
  88865. _this.on("mousedown", function(e) {
  88866. return _this.handleMouseDown(e);
  88867. });
  88868. return _this;
  88869. }
  88870. var _proto = BigPlayButton2.prototype;
  88871. _proto.buildCSSClass = function buildCSSClass() {
  88872. return "vjs-big-play-button";
  88873. };
  88874. _proto.handleClick = function handleClick(event2) {
  88875. var playPromise = this.player_.play();
  88876. if (this.mouseused_ && event2.clientX && event2.clientY) {
  88877. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88878. silencePromise(playPromise);
  88879. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88880. this.player_.tech(true).focus();
  88881. }
  88882. return;
  88883. }
  88884. var cb = this.player_.getChild("controlBar");
  88885. var playToggle = cb && cb.getChild("playToggle");
  88886. if (!playToggle) {
  88887. this.player_.tech(true).focus();
  88888. return;
  88889. }
  88890. var playFocus = function playFocus2() {
  88891. return playToggle.focus();
  88892. };
  88893. if (isPromise(playPromise)) {
  88894. playPromise.then(playFocus, function() {
  88895. });
  88896. } else {
  88897. this.setTimeout(playFocus, 1);
  88898. }
  88899. };
  88900. _proto.handleKeyDown = function handleKeyDown(event2) {
  88901. this.mouseused_ = false;
  88902. _Button.prototype.handleKeyDown.call(this, event2);
  88903. };
  88904. _proto.handleMouseDown = function handleMouseDown(event2) {
  88905. this.mouseused_ = true;
  88906. };
  88907. return BigPlayButton2;
  88908. }(Button);
  88909. BigPlayButton.prototype.controlText_ = "Play Video";
  88910. Component$1.registerComponent("BigPlayButton", BigPlayButton);
  88911. var CloseButton = /* @__PURE__ */ function(_Button) {
  88912. _inheritsLoose(CloseButton2, _Button);
  88913. function CloseButton2(player, options2) {
  88914. var _this;
  88915. _this = _Button.call(this, player, options2) || this;
  88916. _this.controlText(options2 && options2.controlText || _this.localize("Close"));
  88917. return _this;
  88918. }
  88919. var _proto = CloseButton2.prototype;
  88920. _proto.buildCSSClass = function buildCSSClass() {
  88921. return "vjs-close-button " + _Button.prototype.buildCSSClass.call(this);
  88922. };
  88923. _proto.handleClick = function handleClick(event2) {
  88924. this.trigger({
  88925. type: "close",
  88926. bubbles: false
  88927. });
  88928. };
  88929. _proto.handleKeyDown = function handleKeyDown(event2) {
  88930. if (keycode.isEventKey(event2, "Esc")) {
  88931. event2.preventDefault();
  88932. event2.stopPropagation();
  88933. this.trigger("click");
  88934. } else {
  88935. _Button.prototype.handleKeyDown.call(this, event2);
  88936. }
  88937. };
  88938. return CloseButton2;
  88939. }(Button);
  88940. Component$1.registerComponent("CloseButton", CloseButton);
  88941. var PlayToggle = /* @__PURE__ */ function(_Button) {
  88942. _inheritsLoose(PlayToggle2, _Button);
  88943. function PlayToggle2(player, options2) {
  88944. var _this;
  88945. if (options2 === void 0) {
  88946. options2 = {};
  88947. }
  88948. _this = _Button.call(this, player, options2) || this;
  88949. options2.replay = options2.replay === void 0 || options2.replay;
  88950. _this.on(player, "play", function(e) {
  88951. return _this.handlePlay(e);
  88952. });
  88953. _this.on(player, "pause", function(e) {
  88954. return _this.handlePause(e);
  88955. });
  88956. if (options2.replay) {
  88957. _this.on(player, "ended", function(e) {
  88958. return _this.handleEnded(e);
  88959. });
  88960. }
  88961. return _this;
  88962. }
  88963. var _proto = PlayToggle2.prototype;
  88964. _proto.buildCSSClass = function buildCSSClass() {
  88965. return "vjs-play-control " + _Button.prototype.buildCSSClass.call(this);
  88966. };
  88967. _proto.handleClick = function handleClick(event2) {
  88968. if (this.player_.paused()) {
  88969. silencePromise(this.player_.play());
  88970. } else {
  88971. this.player_.pause();
  88972. }
  88973. };
  88974. _proto.handleSeeked = function handleSeeked(event2) {
  88975. this.removeClass("vjs-ended");
  88976. if (this.player_.paused()) {
  88977. this.handlePause(event2);
  88978. } else {
  88979. this.handlePlay(event2);
  88980. }
  88981. };
  88982. _proto.handlePlay = function handlePlay(event2) {
  88983. this.removeClass("vjs-ended");
  88984. this.removeClass("vjs-paused");
  88985. this.addClass("vjs-playing");
  88986. this.controlText("Pause");
  88987. };
  88988. _proto.handlePause = function handlePause(event2) {
  88989. this.removeClass("vjs-playing");
  88990. this.addClass("vjs-paused");
  88991. this.controlText("Play");
  88992. };
  88993. _proto.handleEnded = function handleEnded(event2) {
  88994. var _this2 = this;
  88995. this.removeClass("vjs-playing");
  88996. this.addClass("vjs-ended");
  88997. this.controlText("Replay");
  88998. this.one(this.player_, "seeked", function(e) {
  88999. return _this2.handleSeeked(e);
  89000. });
  89001. };
  89002. return PlayToggle2;
  89003. }(Button);
  89004. PlayToggle.prototype.controlText_ = "Play";
  89005. Component$1.registerComponent("PlayToggle", PlayToggle);
  89006. var defaultImplementation = function defaultImplementation2(seconds, guide) {
  89007. seconds = seconds < 0 ? 0 : seconds;
  89008. var s = Math.floor(seconds % 60);
  89009. var m = Math.floor(seconds / 60 % 60);
  89010. var h2 = Math.floor(seconds / 3600);
  89011. var gm = Math.floor(guide / 60 % 60);
  89012. var gh = Math.floor(guide / 3600);
  89013. if (isNaN(seconds) || seconds === Infinity) {
  89014. h2 = m = s = "-";
  89015. }
  89016. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  89017. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  89018. s = s < 10 ? "0" + s : s;
  89019. return h2 + m + s;
  89020. };
  89021. var implementation = defaultImplementation;
  89022. function setFormatTime(customImplementation) {
  89023. implementation = customImplementation;
  89024. }
  89025. function resetFormatTime() {
  89026. implementation = defaultImplementation;
  89027. }
  89028. function formatTime(seconds, guide) {
  89029. if (guide === void 0) {
  89030. guide = seconds;
  89031. }
  89032. return implementation(seconds, guide);
  89033. }
  89034. var TimeDisplay = /* @__PURE__ */ function(_Component) {
  89035. _inheritsLoose(TimeDisplay2, _Component);
  89036. function TimeDisplay2(player, options2) {
  89037. var _this;
  89038. _this = _Component.call(this, player, options2) || this;
  89039. _this.on(player, ["timeupdate", "ended"], function(e) {
  89040. return _this.updateContent(e);
  89041. });
  89042. _this.updateTextNode_();
  89043. return _this;
  89044. }
  89045. var _proto = TimeDisplay2.prototype;
  89046. _proto.createEl = function createEl$12() {
  89047. var className = this.buildCSSClass();
  89048. var el = _Component.prototype.createEl.call(this, "div", {
  89049. className: className + " vjs-time-control vjs-control"
  89050. });
  89051. var span = createEl("span", {
  89052. className: "vjs-control-text",
  89053. textContent: this.localize(this.labelText_) + "\xA0"
  89054. }, {
  89055. role: "presentation"
  89056. });
  89057. el.appendChild(span);
  89058. this.contentEl_ = createEl("span", {
  89059. className: className + "-display"
  89060. }, {
  89061. "aria-live": "off",
  89062. "role": "presentation"
  89063. });
  89064. el.appendChild(this.contentEl_);
  89065. return el;
  89066. };
  89067. _proto.dispose = function dispose() {
  89068. this.contentEl_ = null;
  89069. this.textNode_ = null;
  89070. _Component.prototype.dispose.call(this);
  89071. };
  89072. _proto.updateTextNode_ = function updateTextNode_(time) {
  89073. var _this2 = this;
  89074. if (time === void 0) {
  89075. time = 0;
  89076. }
  89077. time = formatTime(time);
  89078. if (this.formattedTime_ === time) {
  89079. return;
  89080. }
  89081. this.formattedTime_ = time;
  89082. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", function() {
  89083. if (!_this2.contentEl_) {
  89084. return;
  89085. }
  89086. var oldNode = _this2.textNode_;
  89087. if (oldNode && _this2.contentEl_.firstChild !== oldNode) {
  89088. oldNode = null;
  89089. 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.");
  89090. }
  89091. _this2.textNode_ = document_1.createTextNode(_this2.formattedTime_);
  89092. if (!_this2.textNode_) {
  89093. return;
  89094. }
  89095. if (oldNode) {
  89096. _this2.contentEl_.replaceChild(_this2.textNode_, oldNode);
  89097. } else {
  89098. _this2.contentEl_.appendChild(_this2.textNode_);
  89099. }
  89100. });
  89101. };
  89102. _proto.updateContent = function updateContent(event2) {
  89103. };
  89104. return TimeDisplay2;
  89105. }(Component$1);
  89106. TimeDisplay.prototype.labelText_ = "Time";
  89107. TimeDisplay.prototype.controlText_ = "Time";
  89108. Component$1.registerComponent("TimeDisplay", TimeDisplay);
  89109. var CurrentTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89110. _inheritsLoose(CurrentTimeDisplay2, _TimeDisplay);
  89111. function CurrentTimeDisplay2() {
  89112. return _TimeDisplay.apply(this, arguments) || this;
  89113. }
  89114. var _proto = CurrentTimeDisplay2.prototype;
  89115. _proto.buildCSSClass = function buildCSSClass() {
  89116. return "vjs-current-time";
  89117. };
  89118. _proto.updateContent = function updateContent(event2) {
  89119. var time;
  89120. if (this.player_.ended()) {
  89121. time = this.player_.duration();
  89122. } else {
  89123. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89124. }
  89125. this.updateTextNode_(time);
  89126. };
  89127. return CurrentTimeDisplay2;
  89128. }(TimeDisplay);
  89129. CurrentTimeDisplay.prototype.labelText_ = "Current Time";
  89130. CurrentTimeDisplay.prototype.controlText_ = "Current Time";
  89131. Component$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay);
  89132. var DurationDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89133. _inheritsLoose(DurationDisplay2, _TimeDisplay);
  89134. function DurationDisplay2(player, options2) {
  89135. var _this;
  89136. _this = _TimeDisplay.call(this, player, options2) || this;
  89137. var updateContent = function updateContent2(e) {
  89138. return _this.updateContent(e);
  89139. };
  89140. _this.on(player, "durationchange", updateContent);
  89141. _this.on(player, "loadstart", updateContent);
  89142. _this.on(player, "loadedmetadata", updateContent);
  89143. return _this;
  89144. }
  89145. var _proto = DurationDisplay2.prototype;
  89146. _proto.buildCSSClass = function buildCSSClass() {
  89147. return "vjs-duration";
  89148. };
  89149. _proto.updateContent = function updateContent(event2) {
  89150. var duration5 = this.player_.duration();
  89151. this.updateTextNode_(duration5);
  89152. };
  89153. return DurationDisplay2;
  89154. }(TimeDisplay);
  89155. DurationDisplay.prototype.labelText_ = "Duration";
  89156. DurationDisplay.prototype.controlText_ = "Duration";
  89157. Component$1.registerComponent("DurationDisplay", DurationDisplay);
  89158. var TimeDivider = /* @__PURE__ */ function(_Component) {
  89159. _inheritsLoose(TimeDivider2, _Component);
  89160. function TimeDivider2() {
  89161. return _Component.apply(this, arguments) || this;
  89162. }
  89163. var _proto = TimeDivider2.prototype;
  89164. _proto.createEl = function createEl2() {
  89165. var el = _Component.prototype.createEl.call(this, "div", {
  89166. className: "vjs-time-control vjs-time-divider"
  89167. }, {
  89168. "aria-hidden": true
  89169. });
  89170. var div = _Component.prototype.createEl.call(this, "div");
  89171. var span = _Component.prototype.createEl.call(this, "span", {
  89172. textContent: "/"
  89173. });
  89174. div.appendChild(span);
  89175. el.appendChild(div);
  89176. return el;
  89177. };
  89178. return TimeDivider2;
  89179. }(Component$1);
  89180. Component$1.registerComponent("TimeDivider", TimeDivider);
  89181. var RemainingTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89182. _inheritsLoose(RemainingTimeDisplay2, _TimeDisplay);
  89183. function RemainingTimeDisplay2(player, options2) {
  89184. var _this;
  89185. _this = _TimeDisplay.call(this, player, options2) || this;
  89186. _this.on(player, "durationchange", function(e) {
  89187. return _this.updateContent(e);
  89188. });
  89189. return _this;
  89190. }
  89191. var _proto = RemainingTimeDisplay2.prototype;
  89192. _proto.buildCSSClass = function buildCSSClass() {
  89193. return "vjs-remaining-time";
  89194. };
  89195. _proto.createEl = function createEl$12() {
  89196. var el = _TimeDisplay.prototype.createEl.call(this);
  89197. if (this.options_.displayNegative !== false) {
  89198. el.insertBefore(createEl("span", {}, {
  89199. "aria-hidden": true
  89200. }, "-"), this.contentEl_);
  89201. }
  89202. return el;
  89203. };
  89204. _proto.updateContent = function updateContent(event2) {
  89205. if (typeof this.player_.duration() !== "number") {
  89206. return;
  89207. }
  89208. var time;
  89209. if (this.player_.ended()) {
  89210. time = 0;
  89211. } else if (this.player_.remainingTimeDisplay) {
  89212. time = this.player_.remainingTimeDisplay();
  89213. } else {
  89214. time = this.player_.remainingTime();
  89215. }
  89216. this.updateTextNode_(time);
  89217. };
  89218. return RemainingTimeDisplay2;
  89219. }(TimeDisplay);
  89220. RemainingTimeDisplay.prototype.labelText_ = "Remaining Time";
  89221. RemainingTimeDisplay.prototype.controlText_ = "Remaining Time";
  89222. Component$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay);
  89223. var LiveDisplay = /* @__PURE__ */ function(_Component) {
  89224. _inheritsLoose(LiveDisplay2, _Component);
  89225. function LiveDisplay2(player, options2) {
  89226. var _this;
  89227. _this = _Component.call(this, player, options2) || this;
  89228. _this.updateShowing();
  89229. _this.on(_this.player(), "durationchange", function(e) {
  89230. return _this.updateShowing(e);
  89231. });
  89232. return _this;
  89233. }
  89234. var _proto = LiveDisplay2.prototype;
  89235. _proto.createEl = function createEl$12() {
  89236. var el = _Component.prototype.createEl.call(this, "div", {
  89237. className: "vjs-live-control vjs-control"
  89238. });
  89239. this.contentEl_ = createEl("div", {
  89240. className: "vjs-live-display"
  89241. }, {
  89242. "aria-live": "off"
  89243. });
  89244. this.contentEl_.appendChild(createEl("span", {
  89245. className: "vjs-control-text",
  89246. textContent: this.localize("Stream Type") + "\xA0"
  89247. }));
  89248. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  89249. el.appendChild(this.contentEl_);
  89250. return el;
  89251. };
  89252. _proto.dispose = function dispose() {
  89253. this.contentEl_ = null;
  89254. _Component.prototype.dispose.call(this);
  89255. };
  89256. _proto.updateShowing = function updateShowing(event2) {
  89257. if (this.player().duration() === Infinity) {
  89258. this.show();
  89259. } else {
  89260. this.hide();
  89261. }
  89262. };
  89263. return LiveDisplay2;
  89264. }(Component$1);
  89265. Component$1.registerComponent("LiveDisplay", LiveDisplay);
  89266. var SeekToLive = /* @__PURE__ */ function(_Button) {
  89267. _inheritsLoose(SeekToLive2, _Button);
  89268. function SeekToLive2(player, options2) {
  89269. var _this;
  89270. _this = _Button.call(this, player, options2) || this;
  89271. _this.updateLiveEdgeStatus();
  89272. if (_this.player_.liveTracker) {
  89273. _this.updateLiveEdgeStatusHandler_ = function(e) {
  89274. return _this.updateLiveEdgeStatus(e);
  89275. };
  89276. _this.on(_this.player_.liveTracker, "liveedgechange", _this.updateLiveEdgeStatusHandler_);
  89277. }
  89278. return _this;
  89279. }
  89280. var _proto = SeekToLive2.prototype;
  89281. _proto.createEl = function createEl$12() {
  89282. var el = _Button.prototype.createEl.call(this, "button", {
  89283. className: "vjs-seek-to-live-control vjs-control"
  89284. });
  89285. this.textEl_ = createEl("span", {
  89286. className: "vjs-seek-to-live-text",
  89287. textContent: this.localize("LIVE")
  89288. }, {
  89289. "aria-hidden": "true"
  89290. });
  89291. el.appendChild(this.textEl_);
  89292. return el;
  89293. };
  89294. _proto.updateLiveEdgeStatus = function updateLiveEdgeStatus() {
  89295. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  89296. this.setAttribute("aria-disabled", true);
  89297. this.addClass("vjs-at-live-edge");
  89298. this.controlText("Seek to live, currently playing live");
  89299. } else {
  89300. this.setAttribute("aria-disabled", false);
  89301. this.removeClass("vjs-at-live-edge");
  89302. this.controlText("Seek to live, currently behind live");
  89303. }
  89304. };
  89305. _proto.handleClick = function handleClick() {
  89306. this.player_.liveTracker.seekToLiveEdge();
  89307. };
  89308. _proto.dispose = function dispose() {
  89309. if (this.player_.liveTracker) {
  89310. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  89311. }
  89312. this.textEl_ = null;
  89313. _Button.prototype.dispose.call(this);
  89314. };
  89315. return SeekToLive2;
  89316. }(Button);
  89317. SeekToLive.prototype.controlText_ = "Seek to live, currently playing live";
  89318. Component$1.registerComponent("SeekToLive", SeekToLive);
  89319. var clamp = function clamp2(number, min2, max2) {
  89320. number = Number(number);
  89321. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  89322. };
  89323. var Slider = /* @__PURE__ */ function(_Component) {
  89324. _inheritsLoose(Slider2, _Component);
  89325. function Slider2(player, options2) {
  89326. var _this;
  89327. _this = _Component.call(this, player, options2) || this;
  89328. _this.handleMouseDown_ = function(e) {
  89329. return _this.handleMouseDown(e);
  89330. };
  89331. _this.handleMouseUp_ = function(e) {
  89332. return _this.handleMouseUp(e);
  89333. };
  89334. _this.handleKeyDown_ = function(e) {
  89335. return _this.handleKeyDown(e);
  89336. };
  89337. _this.handleClick_ = function(e) {
  89338. return _this.handleClick(e);
  89339. };
  89340. _this.handleMouseMove_ = function(e) {
  89341. return _this.handleMouseMove(e);
  89342. };
  89343. _this.update_ = function(e) {
  89344. return _this.update(e);
  89345. };
  89346. _this.bar = _this.getChild(_this.options_.barName);
  89347. _this.vertical(!!_this.options_.vertical);
  89348. _this.enable();
  89349. return _this;
  89350. }
  89351. var _proto = Slider2.prototype;
  89352. _proto.enabled = function enabled() {
  89353. return this.enabled_;
  89354. };
  89355. _proto.enable = function enable() {
  89356. if (this.enabled()) {
  89357. return;
  89358. }
  89359. this.on("mousedown", this.handleMouseDown_);
  89360. this.on("touchstart", this.handleMouseDown_);
  89361. this.on("keydown", this.handleKeyDown_);
  89362. this.on("click", this.handleClick_);
  89363. this.on(this.player_, "controlsvisible", this.update);
  89364. if (this.playerEvent) {
  89365. this.on(this.player_, this.playerEvent, this.update);
  89366. }
  89367. this.removeClass("disabled");
  89368. this.setAttribute("tabindex", 0);
  89369. this.enabled_ = true;
  89370. };
  89371. _proto.disable = function disable() {
  89372. if (!this.enabled()) {
  89373. return;
  89374. }
  89375. var doc = this.bar.el_.ownerDocument;
  89376. this.off("mousedown", this.handleMouseDown_);
  89377. this.off("touchstart", this.handleMouseDown_);
  89378. this.off("keydown", this.handleKeyDown_);
  89379. this.off("click", this.handleClick_);
  89380. this.off(this.player_, "controlsvisible", this.update_);
  89381. this.off(doc, "mousemove", this.handleMouseMove_);
  89382. this.off(doc, "mouseup", this.handleMouseUp_);
  89383. this.off(doc, "touchmove", this.handleMouseMove_);
  89384. this.off(doc, "touchend", this.handleMouseUp_);
  89385. this.removeAttribute("tabindex");
  89386. this.addClass("disabled");
  89387. if (this.playerEvent) {
  89388. this.off(this.player_, this.playerEvent, this.update);
  89389. }
  89390. this.enabled_ = false;
  89391. };
  89392. _proto.createEl = function createEl2(type2, props, attributes) {
  89393. if (props === void 0) {
  89394. props = {};
  89395. }
  89396. if (attributes === void 0) {
  89397. attributes = {};
  89398. }
  89399. props.className = props.className + " vjs-slider";
  89400. props = assign({
  89401. tabIndex: 0
  89402. }, props);
  89403. attributes = assign({
  89404. "role": "slider",
  89405. "aria-valuenow": 0,
  89406. "aria-valuemin": 0,
  89407. "aria-valuemax": 100,
  89408. "tabIndex": 0
  89409. }, attributes);
  89410. return _Component.prototype.createEl.call(this, type2, props, attributes);
  89411. };
  89412. _proto.handleMouseDown = function handleMouseDown(event2) {
  89413. var doc = this.bar.el_.ownerDocument;
  89414. if (event2.type === "mousedown") {
  89415. event2.preventDefault();
  89416. }
  89417. if (event2.type === "touchstart" && !IS_CHROME) {
  89418. event2.preventDefault();
  89419. }
  89420. blockTextSelection();
  89421. this.addClass("vjs-sliding");
  89422. this.trigger("slideractive");
  89423. this.on(doc, "mousemove", this.handleMouseMove_);
  89424. this.on(doc, "mouseup", this.handleMouseUp_);
  89425. this.on(doc, "touchmove", this.handleMouseMove_);
  89426. this.on(doc, "touchend", this.handleMouseUp_);
  89427. this.handleMouseMove(event2, true);
  89428. };
  89429. _proto.handleMouseMove = function handleMouseMove(event2) {
  89430. };
  89431. _proto.handleMouseUp = function handleMouseUp() {
  89432. var doc = this.bar.el_.ownerDocument;
  89433. unblockTextSelection();
  89434. this.removeClass("vjs-sliding");
  89435. this.trigger("sliderinactive");
  89436. this.off(doc, "mousemove", this.handleMouseMove_);
  89437. this.off(doc, "mouseup", this.handleMouseUp_);
  89438. this.off(doc, "touchmove", this.handleMouseMove_);
  89439. this.off(doc, "touchend", this.handleMouseUp_);
  89440. this.update();
  89441. };
  89442. _proto.update = function update() {
  89443. var _this2 = this;
  89444. if (!this.el_ || !this.bar) {
  89445. return;
  89446. }
  89447. var progress = this.getProgress();
  89448. if (progress === this.progress_) {
  89449. return progress;
  89450. }
  89451. this.progress_ = progress;
  89452. this.requestNamedAnimationFrame("Slider#update", function() {
  89453. var sizeKey = _this2.vertical() ? "height" : "width";
  89454. _this2.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  89455. });
  89456. return progress;
  89457. };
  89458. _proto.getProgress = function getProgress() {
  89459. return Number(clamp(this.getPercent(), 0, 1).toFixed(4));
  89460. };
  89461. _proto.calculateDistance = function calculateDistance(event2) {
  89462. var position2 = getPointerPosition(this.el_, event2);
  89463. if (this.vertical()) {
  89464. return position2.y;
  89465. }
  89466. return position2.x;
  89467. };
  89468. _proto.handleKeyDown = function handleKeyDown(event2) {
  89469. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  89470. event2.preventDefault();
  89471. event2.stopPropagation();
  89472. this.stepBack();
  89473. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  89474. event2.preventDefault();
  89475. event2.stopPropagation();
  89476. this.stepForward();
  89477. } else {
  89478. _Component.prototype.handleKeyDown.call(this, event2);
  89479. }
  89480. };
  89481. _proto.handleClick = function handleClick(event2) {
  89482. event2.stopPropagation();
  89483. event2.preventDefault();
  89484. };
  89485. _proto.vertical = function vertical(bool) {
  89486. if (bool === void 0) {
  89487. return this.vertical_ || false;
  89488. }
  89489. this.vertical_ = !!bool;
  89490. if (this.vertical_) {
  89491. this.addClass("vjs-slider-vertical");
  89492. } else {
  89493. this.addClass("vjs-slider-horizontal");
  89494. }
  89495. };
  89496. return Slider2;
  89497. }(Component$1);
  89498. Component$1.registerComponent("Slider", Slider);
  89499. var percentify = function percentify2(time, end) {
  89500. return clamp(time / end * 100, 0, 100).toFixed(2) + "%";
  89501. };
  89502. var LoadProgressBar = /* @__PURE__ */ function(_Component) {
  89503. _inheritsLoose(LoadProgressBar2, _Component);
  89504. function LoadProgressBar2(player, options2) {
  89505. var _this;
  89506. _this = _Component.call(this, player, options2) || this;
  89507. _this.partEls_ = [];
  89508. _this.on(player, "progress", function(e) {
  89509. return _this.update(e);
  89510. });
  89511. return _this;
  89512. }
  89513. var _proto = LoadProgressBar2.prototype;
  89514. _proto.createEl = function createEl$12() {
  89515. var el = _Component.prototype.createEl.call(this, "div", {
  89516. className: "vjs-load-progress"
  89517. });
  89518. var wrapper = createEl("span", {
  89519. className: "vjs-control-text"
  89520. });
  89521. var loadedText = createEl("span", {
  89522. textContent: this.localize("Loaded")
  89523. });
  89524. var separator = document_1.createTextNode(": ");
  89525. this.percentageEl_ = createEl("span", {
  89526. className: "vjs-control-text-loaded-percentage",
  89527. textContent: "0%"
  89528. });
  89529. el.appendChild(wrapper);
  89530. wrapper.appendChild(loadedText);
  89531. wrapper.appendChild(separator);
  89532. wrapper.appendChild(this.percentageEl_);
  89533. return el;
  89534. };
  89535. _proto.dispose = function dispose() {
  89536. this.partEls_ = null;
  89537. this.percentageEl_ = null;
  89538. _Component.prototype.dispose.call(this);
  89539. };
  89540. _proto.update = function update(event2) {
  89541. var _this2 = this;
  89542. this.requestNamedAnimationFrame("LoadProgressBar#update", function() {
  89543. var liveTracker = _this2.player_.liveTracker;
  89544. var buffered = _this2.player_.buffered();
  89545. var duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : _this2.player_.duration();
  89546. var bufferedEnd = _this2.player_.bufferedEnd();
  89547. var children = _this2.partEls_;
  89548. var percent = percentify(bufferedEnd, duration5);
  89549. if (_this2.percent_ !== percent) {
  89550. _this2.el_.style.width = percent;
  89551. textContent(_this2.percentageEl_, percent);
  89552. _this2.percent_ = percent;
  89553. }
  89554. for (var i2 = 0; i2 < buffered.length; i2++) {
  89555. var start2 = buffered.start(i2);
  89556. var end = buffered.end(i2);
  89557. var part = children[i2];
  89558. if (!part) {
  89559. part = _this2.el_.appendChild(createEl());
  89560. children[i2] = part;
  89561. }
  89562. if (part.dataset.start === start2 && part.dataset.end === end) {
  89563. continue;
  89564. }
  89565. part.dataset.start = start2;
  89566. part.dataset.end = end;
  89567. part.style.left = percentify(start2, bufferedEnd);
  89568. part.style.width = percentify(end - start2, bufferedEnd);
  89569. }
  89570. for (var _i = children.length; _i > buffered.length; _i--) {
  89571. _this2.el_.removeChild(children[_i - 1]);
  89572. }
  89573. children.length = buffered.length;
  89574. });
  89575. };
  89576. return LoadProgressBar2;
  89577. }(Component$1);
  89578. Component$1.registerComponent("LoadProgressBar", LoadProgressBar);
  89579. var TimeTooltip = /* @__PURE__ */ function(_Component) {
  89580. _inheritsLoose(TimeTooltip2, _Component);
  89581. function TimeTooltip2(player, options2) {
  89582. var _this;
  89583. _this = _Component.call(this, player, options2) || this;
  89584. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89585. return _this;
  89586. }
  89587. var _proto = TimeTooltip2.prototype;
  89588. _proto.createEl = function createEl2() {
  89589. return _Component.prototype.createEl.call(this, "div", {
  89590. className: "vjs-time-tooltip"
  89591. }, {
  89592. "aria-hidden": "true"
  89593. });
  89594. };
  89595. _proto.update = function update(seekBarRect, seekBarPoint, content) {
  89596. var tooltipRect = findPosition(this.el_);
  89597. var playerRect = getBoundingClientRect(this.player_.el());
  89598. var seekBarPointPx = seekBarRect.width * seekBarPoint;
  89599. if (!playerRect || !tooltipRect) {
  89600. return;
  89601. }
  89602. var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  89603. var spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  89604. var pullTooltipBy = tooltipRect.width / 2;
  89605. if (spaceLeftOfPoint < pullTooltipBy) {
  89606. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  89607. } else if (spaceRightOfPoint < pullTooltipBy) {
  89608. pullTooltipBy = spaceRightOfPoint;
  89609. }
  89610. if (pullTooltipBy < 0) {
  89611. pullTooltipBy = 0;
  89612. } else if (pullTooltipBy > tooltipRect.width) {
  89613. pullTooltipBy = tooltipRect.width;
  89614. }
  89615. pullTooltipBy = Math.round(pullTooltipBy);
  89616. this.el_.style.right = "-" + pullTooltipBy + "px";
  89617. this.write(content);
  89618. };
  89619. _proto.write = function write(content) {
  89620. textContent(this.el_, content);
  89621. };
  89622. _proto.updateTime = function updateTime(seekBarRect, seekBarPoint, time, cb) {
  89623. var _this2 = this;
  89624. this.requestNamedAnimationFrame("TimeTooltip#updateTime", function() {
  89625. var content;
  89626. var duration5 = _this2.player_.duration();
  89627. if (_this2.player_.liveTracker && _this2.player_.liveTracker.isLive()) {
  89628. var liveWindow = _this2.player_.liveTracker.liveWindow();
  89629. var secondsBehind = liveWindow - seekBarPoint * liveWindow;
  89630. content = (secondsBehind < 1 ? "" : "-") + formatTime(secondsBehind, liveWindow);
  89631. } else {
  89632. content = formatTime(time, duration5);
  89633. }
  89634. _this2.update(seekBarRect, seekBarPoint, content);
  89635. if (cb) {
  89636. cb();
  89637. }
  89638. });
  89639. };
  89640. return TimeTooltip2;
  89641. }(Component$1);
  89642. Component$1.registerComponent("TimeTooltip", TimeTooltip);
  89643. var PlayProgressBar = /* @__PURE__ */ function(_Component) {
  89644. _inheritsLoose(PlayProgressBar2, _Component);
  89645. function PlayProgressBar2(player, options2) {
  89646. var _this;
  89647. _this = _Component.call(this, player, options2) || this;
  89648. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89649. return _this;
  89650. }
  89651. var _proto = PlayProgressBar2.prototype;
  89652. _proto.createEl = function createEl2() {
  89653. return _Component.prototype.createEl.call(this, "div", {
  89654. className: "vjs-play-progress vjs-slider-bar"
  89655. }, {
  89656. "aria-hidden": "true"
  89657. });
  89658. };
  89659. _proto.update = function update(seekBarRect, seekBarPoint) {
  89660. var timeTooltip = this.getChild("timeTooltip");
  89661. if (!timeTooltip) {
  89662. return;
  89663. }
  89664. var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89665. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  89666. };
  89667. return PlayProgressBar2;
  89668. }(Component$1);
  89669. PlayProgressBar.prototype.options_ = {
  89670. children: []
  89671. };
  89672. if (!IS_IOS && !IS_ANDROID) {
  89673. PlayProgressBar.prototype.options_.children.push("timeTooltip");
  89674. }
  89675. Component$1.registerComponent("PlayProgressBar", PlayProgressBar);
  89676. var MouseTimeDisplay = /* @__PURE__ */ function(_Component) {
  89677. _inheritsLoose(MouseTimeDisplay2, _Component);
  89678. function MouseTimeDisplay2(player, options2) {
  89679. var _this;
  89680. _this = _Component.call(this, player, options2) || this;
  89681. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89682. return _this;
  89683. }
  89684. var _proto = MouseTimeDisplay2.prototype;
  89685. _proto.createEl = function createEl2() {
  89686. return _Component.prototype.createEl.call(this, "div", {
  89687. className: "vjs-mouse-display"
  89688. });
  89689. };
  89690. _proto.update = function update(seekBarRect, seekBarPoint) {
  89691. var _this2 = this;
  89692. var time = seekBarPoint * this.player_.duration();
  89693. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, function() {
  89694. _this2.el_.style.left = seekBarRect.width * seekBarPoint + "px";
  89695. });
  89696. };
  89697. return MouseTimeDisplay2;
  89698. }(Component$1);
  89699. MouseTimeDisplay.prototype.options_ = {
  89700. children: ["timeTooltip"]
  89701. };
  89702. Component$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay);
  89703. var STEP_SECONDS = 5;
  89704. var PAGE_KEY_MULTIPLIER = 12;
  89705. var SeekBar = /* @__PURE__ */ function(_Slider) {
  89706. _inheritsLoose(SeekBar2, _Slider);
  89707. function SeekBar2(player, options2) {
  89708. var _this;
  89709. _this = _Slider.call(this, player, options2) || this;
  89710. _this.setEventHandlers_();
  89711. return _this;
  89712. }
  89713. var _proto = SeekBar2.prototype;
  89714. _proto.setEventHandlers_ = function setEventHandlers_() {
  89715. var _this2 = this;
  89716. this.update_ = bind(this, this.update);
  89717. this.update = throttle(this.update_, UPDATE_REFRESH_INTERVAL);
  89718. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89719. if (this.player_.liveTracker) {
  89720. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  89721. }
  89722. this.updateInterval = null;
  89723. this.enableIntervalHandler_ = function(e) {
  89724. return _this2.enableInterval_(e);
  89725. };
  89726. this.disableIntervalHandler_ = function(e) {
  89727. return _this2.disableInterval_(e);
  89728. };
  89729. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  89730. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89731. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89732. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  89733. }
  89734. };
  89735. _proto.toggleVisibility_ = function toggleVisibility_(e) {
  89736. if (document_1.visibilityState === "hidden") {
  89737. this.cancelNamedAnimationFrame("SeekBar#update");
  89738. this.cancelNamedAnimationFrame("Slider#update");
  89739. this.disableInterval_(e);
  89740. } else {
  89741. if (!this.player_.ended() && !this.player_.paused()) {
  89742. this.enableInterval_();
  89743. }
  89744. this.update();
  89745. }
  89746. };
  89747. _proto.enableInterval_ = function enableInterval_() {
  89748. if (this.updateInterval) {
  89749. return;
  89750. }
  89751. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL);
  89752. };
  89753. _proto.disableInterval_ = function disableInterval_(e) {
  89754. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  89755. return;
  89756. }
  89757. if (!this.updateInterval) {
  89758. return;
  89759. }
  89760. this.clearInterval(this.updateInterval);
  89761. this.updateInterval = null;
  89762. };
  89763. _proto.createEl = function createEl2() {
  89764. return _Slider.prototype.createEl.call(this, "div", {
  89765. className: "vjs-progress-holder"
  89766. }, {
  89767. "aria-label": this.localize("Progress Bar")
  89768. });
  89769. };
  89770. _proto.update = function update(event2) {
  89771. var _this3 = this;
  89772. if (document_1.visibilityState === "hidden") {
  89773. return;
  89774. }
  89775. var percent = _Slider.prototype.update.call(this);
  89776. this.requestNamedAnimationFrame("SeekBar#update", function() {
  89777. var currentTime = _this3.player_.ended() ? _this3.player_.duration() : _this3.getCurrentTime_();
  89778. var liveTracker = _this3.player_.liveTracker;
  89779. var duration5 = _this3.player_.duration();
  89780. if (liveTracker && liveTracker.isLive()) {
  89781. duration5 = _this3.player_.liveTracker.liveCurrentTime();
  89782. }
  89783. if (_this3.percent_ !== percent) {
  89784. _this3.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  89785. _this3.percent_ = percent;
  89786. }
  89787. if (_this3.currentTime_ !== currentTime || _this3.duration_ !== duration5) {
  89788. _this3.el_.setAttribute("aria-valuetext", _this3.localize("progress bar timing: currentTime={1} duration={2}", [formatTime(currentTime, duration5), formatTime(duration5, duration5)], "{1} of {2}"));
  89789. _this3.currentTime_ = currentTime;
  89790. _this3.duration_ = duration5;
  89791. }
  89792. if (_this3.bar) {
  89793. _this3.bar.update(getBoundingClientRect(_this3.el()), _this3.getProgress());
  89794. }
  89795. });
  89796. return percent;
  89797. };
  89798. _proto.userSeek_ = function userSeek_(ct2) {
  89799. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  89800. this.player_.liveTracker.nextSeekedFromUser();
  89801. }
  89802. this.player_.currentTime(ct2);
  89803. };
  89804. _proto.getCurrentTime_ = function getCurrentTime_() {
  89805. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89806. };
  89807. _proto.getPercent = function getPercent() {
  89808. var currentTime = this.getCurrentTime_();
  89809. var percent;
  89810. var liveTracker = this.player_.liveTracker;
  89811. if (liveTracker && liveTracker.isLive()) {
  89812. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  89813. if (liveTracker.atLiveEdge()) {
  89814. percent = 1;
  89815. }
  89816. } else {
  89817. percent = currentTime / this.player_.duration();
  89818. }
  89819. return percent;
  89820. };
  89821. _proto.handleMouseDown = function handleMouseDown(event2) {
  89822. if (!isSingleLeftClick(event2)) {
  89823. return;
  89824. }
  89825. event2.stopPropagation();
  89826. this.videoWasPlaying = !this.player_.paused();
  89827. this.player_.pause();
  89828. _Slider.prototype.handleMouseDown.call(this, event2);
  89829. };
  89830. _proto.handleMouseMove = function handleMouseMove(event2, mouseDown) {
  89831. if (mouseDown === void 0) {
  89832. mouseDown = false;
  89833. }
  89834. if (!isSingleLeftClick(event2)) {
  89835. return;
  89836. }
  89837. if (!mouseDown && !this.player_.scrubbing()) {
  89838. this.player_.scrubbing(true);
  89839. }
  89840. var newTime;
  89841. var distance2 = this.calculateDistance(event2);
  89842. var liveTracker = this.player_.liveTracker;
  89843. if (!liveTracker || !liveTracker.isLive()) {
  89844. newTime = distance2 * this.player_.duration();
  89845. if (newTime === this.player_.duration()) {
  89846. newTime = newTime - 0.1;
  89847. }
  89848. } else {
  89849. if (distance2 >= 0.99) {
  89850. liveTracker.seekToLiveEdge();
  89851. return;
  89852. }
  89853. var seekableStart = liveTracker.seekableStart();
  89854. var seekableEnd = liveTracker.liveCurrentTime();
  89855. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  89856. if (newTime >= seekableEnd) {
  89857. newTime = seekableEnd;
  89858. }
  89859. if (newTime <= seekableStart) {
  89860. newTime = seekableStart + 0.1;
  89861. }
  89862. if (newTime === Infinity) {
  89863. return;
  89864. }
  89865. }
  89866. this.userSeek_(newTime);
  89867. };
  89868. _proto.enable = function enable() {
  89869. _Slider.prototype.enable.call(this);
  89870. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89871. if (!mouseTimeDisplay) {
  89872. return;
  89873. }
  89874. mouseTimeDisplay.show();
  89875. };
  89876. _proto.disable = function disable() {
  89877. _Slider.prototype.disable.call(this);
  89878. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89879. if (!mouseTimeDisplay) {
  89880. return;
  89881. }
  89882. mouseTimeDisplay.hide();
  89883. };
  89884. _proto.handleMouseUp = function handleMouseUp(event2) {
  89885. _Slider.prototype.handleMouseUp.call(this, event2);
  89886. if (event2) {
  89887. event2.stopPropagation();
  89888. }
  89889. this.player_.scrubbing(false);
  89890. this.player_.trigger({
  89891. type: "timeupdate",
  89892. target: this,
  89893. manuallyTriggered: true
  89894. });
  89895. if (this.videoWasPlaying) {
  89896. silencePromise(this.player_.play());
  89897. } else {
  89898. this.update_();
  89899. }
  89900. };
  89901. _proto.stepForward = function stepForward() {
  89902. this.userSeek_(this.player_.currentTime() + STEP_SECONDS);
  89903. };
  89904. _proto.stepBack = function stepBack() {
  89905. this.userSeek_(this.player_.currentTime() - STEP_SECONDS);
  89906. };
  89907. _proto.handleAction = function handleAction(event2) {
  89908. if (this.player_.paused()) {
  89909. this.player_.play();
  89910. } else {
  89911. this.player_.pause();
  89912. }
  89913. };
  89914. _proto.handleKeyDown = function handleKeyDown(event2) {
  89915. var liveTracker = this.player_.liveTracker;
  89916. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  89917. event2.preventDefault();
  89918. event2.stopPropagation();
  89919. this.handleAction(event2);
  89920. } else if (keycode.isEventKey(event2, "Home")) {
  89921. event2.preventDefault();
  89922. event2.stopPropagation();
  89923. this.userSeek_(0);
  89924. } else if (keycode.isEventKey(event2, "End")) {
  89925. event2.preventDefault();
  89926. event2.stopPropagation();
  89927. if (liveTracker && liveTracker.isLive()) {
  89928. this.userSeek_(liveTracker.liveCurrentTime());
  89929. } else {
  89930. this.userSeek_(this.player_.duration());
  89931. }
  89932. } else if (/^[0-9]$/.test(keycode(event2))) {
  89933. event2.preventDefault();
  89934. event2.stopPropagation();
  89935. var gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  89936. if (liveTracker && liveTracker.isLive()) {
  89937. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  89938. } else {
  89939. this.userSeek_(this.player_.duration() * gotoFraction);
  89940. }
  89941. } else if (keycode.isEventKey(event2, "PgDn")) {
  89942. event2.preventDefault();
  89943. event2.stopPropagation();
  89944. this.userSeek_(this.player_.currentTime() - STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89945. } else if (keycode.isEventKey(event2, "PgUp")) {
  89946. event2.preventDefault();
  89947. event2.stopPropagation();
  89948. this.userSeek_(this.player_.currentTime() + STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89949. } else {
  89950. _Slider.prototype.handleKeyDown.call(this, event2);
  89951. }
  89952. };
  89953. _proto.dispose = function dispose() {
  89954. this.disableInterval_();
  89955. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89956. if (this.player_.liveTracker) {
  89957. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  89958. }
  89959. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  89960. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89961. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89962. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  89963. }
  89964. _Slider.prototype.dispose.call(this);
  89965. };
  89966. return SeekBar2;
  89967. }(Slider);
  89968. SeekBar.prototype.options_ = {
  89969. children: ["loadProgressBar", "playProgressBar"],
  89970. barName: "playProgressBar"
  89971. };
  89972. if (!IS_IOS && !IS_ANDROID) {
  89973. SeekBar.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  89974. }
  89975. Component$1.registerComponent("SeekBar", SeekBar);
  89976. var ProgressControl = /* @__PURE__ */ function(_Component) {
  89977. _inheritsLoose(ProgressControl2, _Component);
  89978. function ProgressControl2(player, options2) {
  89979. var _this;
  89980. _this = _Component.call(this, player, options2) || this;
  89981. _this.handleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  89982. _this.throttledHandleMouseSeek = throttle(bind(_assertThisInitialized(_this), _this.handleMouseSeek), UPDATE_REFRESH_INTERVAL);
  89983. _this.handleMouseUpHandler_ = function(e) {
  89984. return _this.handleMouseUp(e);
  89985. };
  89986. _this.handleMouseDownHandler_ = function(e) {
  89987. return _this.handleMouseDown(e);
  89988. };
  89989. _this.enable();
  89990. return _this;
  89991. }
  89992. var _proto = ProgressControl2.prototype;
  89993. _proto.createEl = function createEl2() {
  89994. return _Component.prototype.createEl.call(this, "div", {
  89995. className: "vjs-progress-control vjs-control"
  89996. });
  89997. };
  89998. _proto.handleMouseMove = function handleMouseMove(event2) {
  89999. var seekBar = this.getChild("seekBar");
  90000. if (!seekBar) {
  90001. return;
  90002. }
  90003. var playProgressBar = seekBar.getChild("playProgressBar");
  90004. var mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  90005. if (!playProgressBar && !mouseTimeDisplay) {
  90006. return;
  90007. }
  90008. var seekBarEl = seekBar.el();
  90009. var seekBarRect = findPosition(seekBarEl);
  90010. var seekBarPoint = getPointerPosition(seekBarEl, event2).x;
  90011. seekBarPoint = clamp(seekBarPoint, 0, 1);
  90012. if (mouseTimeDisplay) {
  90013. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  90014. }
  90015. if (playProgressBar) {
  90016. playProgressBar.update(seekBarRect, seekBar.getProgress());
  90017. }
  90018. };
  90019. _proto.handleMouseSeek = function handleMouseSeek(event2) {
  90020. var seekBar = this.getChild("seekBar");
  90021. if (seekBar) {
  90022. seekBar.handleMouseMove(event2);
  90023. }
  90024. };
  90025. _proto.enabled = function enabled() {
  90026. return this.enabled_;
  90027. };
  90028. _proto.disable = function disable() {
  90029. this.children().forEach(function(child) {
  90030. return child.disable && child.disable();
  90031. });
  90032. if (!this.enabled()) {
  90033. return;
  90034. }
  90035. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  90036. this.off(this.el_, "mousemove", this.handleMouseMove);
  90037. this.removeListenersAddedOnMousedownAndTouchstart();
  90038. this.addClass("disabled");
  90039. this.enabled_ = false;
  90040. if (this.player_.scrubbing()) {
  90041. var seekBar = this.getChild("seekBar");
  90042. this.player_.scrubbing(false);
  90043. if (seekBar.videoWasPlaying) {
  90044. silencePromise(this.player_.play());
  90045. }
  90046. }
  90047. };
  90048. _proto.enable = function enable() {
  90049. this.children().forEach(function(child) {
  90050. return child.enable && child.enable();
  90051. });
  90052. if (this.enabled()) {
  90053. return;
  90054. }
  90055. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  90056. this.on(this.el_, "mousemove", this.handleMouseMove);
  90057. this.removeClass("disabled");
  90058. this.enabled_ = true;
  90059. };
  90060. _proto.removeListenersAddedOnMousedownAndTouchstart = function removeListenersAddedOnMousedownAndTouchstart() {
  90061. var doc = this.el_.ownerDocument;
  90062. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  90063. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  90064. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  90065. this.off(doc, "touchend", this.handleMouseUpHandler_);
  90066. };
  90067. _proto.handleMouseDown = function handleMouseDown(event2) {
  90068. var doc = this.el_.ownerDocument;
  90069. var seekBar = this.getChild("seekBar");
  90070. if (seekBar) {
  90071. seekBar.handleMouseDown(event2);
  90072. }
  90073. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  90074. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  90075. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  90076. this.on(doc, "touchend", this.handleMouseUpHandler_);
  90077. };
  90078. _proto.handleMouseUp = function handleMouseUp(event2) {
  90079. var seekBar = this.getChild("seekBar");
  90080. if (seekBar) {
  90081. seekBar.handleMouseUp(event2);
  90082. }
  90083. this.removeListenersAddedOnMousedownAndTouchstart();
  90084. };
  90085. return ProgressControl2;
  90086. }(Component$1);
  90087. ProgressControl.prototype.options_ = {
  90088. children: ["seekBar"]
  90089. };
  90090. Component$1.registerComponent("ProgressControl", ProgressControl);
  90091. var PictureInPictureToggle = /* @__PURE__ */ function(_Button) {
  90092. _inheritsLoose(PictureInPictureToggle2, _Button);
  90093. function PictureInPictureToggle2(player, options2) {
  90094. var _this;
  90095. _this = _Button.call(this, player, options2) || this;
  90096. _this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], function(e) {
  90097. return _this.handlePictureInPictureChange(e);
  90098. });
  90099. _this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], function(e) {
  90100. return _this.handlePictureInPictureEnabledChange(e);
  90101. });
  90102. _this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], function() {
  90103. var isSourceAudio = player.currentType().substring(0, 5) === "audio";
  90104. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  90105. if (player.isInPictureInPicture()) {
  90106. player.exitPictureInPicture();
  90107. }
  90108. _this.hide();
  90109. } else {
  90110. _this.show();
  90111. }
  90112. });
  90113. _this.disable();
  90114. return _this;
  90115. }
  90116. var _proto = PictureInPictureToggle2.prototype;
  90117. _proto.buildCSSClass = function buildCSSClass() {
  90118. return "vjs-picture-in-picture-control " + _Button.prototype.buildCSSClass.call(this);
  90119. };
  90120. _proto.handlePictureInPictureEnabledChange = function handlePictureInPictureEnabledChange() {
  90121. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false) {
  90122. this.enable();
  90123. } else {
  90124. this.disable();
  90125. }
  90126. };
  90127. _proto.handlePictureInPictureChange = function handlePictureInPictureChange(event2) {
  90128. if (this.player_.isInPictureInPicture()) {
  90129. this.controlText("Exit Picture-in-Picture");
  90130. } else {
  90131. this.controlText("Picture-in-Picture");
  90132. }
  90133. this.handlePictureInPictureEnabledChange();
  90134. };
  90135. _proto.handleClick = function handleClick(event2) {
  90136. if (!this.player_.isInPictureInPicture()) {
  90137. this.player_.requestPictureInPicture();
  90138. } else {
  90139. this.player_.exitPictureInPicture();
  90140. }
  90141. };
  90142. return PictureInPictureToggle2;
  90143. }(Button);
  90144. PictureInPictureToggle.prototype.controlText_ = "Picture-in-Picture";
  90145. Component$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle);
  90146. var FullscreenToggle = /* @__PURE__ */ function(_Button) {
  90147. _inheritsLoose(FullscreenToggle2, _Button);
  90148. function FullscreenToggle2(player, options2) {
  90149. var _this;
  90150. _this = _Button.call(this, player, options2) || this;
  90151. _this.on(player, "fullscreenchange", function(e) {
  90152. return _this.handleFullscreenChange(e);
  90153. });
  90154. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  90155. _this.disable();
  90156. }
  90157. return _this;
  90158. }
  90159. var _proto = FullscreenToggle2.prototype;
  90160. _proto.buildCSSClass = function buildCSSClass() {
  90161. return "vjs-fullscreen-control " + _Button.prototype.buildCSSClass.call(this);
  90162. };
  90163. _proto.handleFullscreenChange = function handleFullscreenChange(event2) {
  90164. if (this.player_.isFullscreen()) {
  90165. this.controlText("Non-Fullscreen");
  90166. } else {
  90167. this.controlText("Fullscreen");
  90168. }
  90169. };
  90170. _proto.handleClick = function handleClick(event2) {
  90171. if (!this.player_.isFullscreen()) {
  90172. this.player_.requestFullscreen();
  90173. } else {
  90174. this.player_.exitFullscreen();
  90175. }
  90176. };
  90177. return FullscreenToggle2;
  90178. }(Button);
  90179. FullscreenToggle.prototype.controlText_ = "Fullscreen";
  90180. Component$1.registerComponent("FullscreenToggle", FullscreenToggle);
  90181. var checkVolumeSupport = function checkVolumeSupport2(self2, player) {
  90182. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  90183. self2.addClass("vjs-hidden");
  90184. }
  90185. self2.on(player, "loadstart", function() {
  90186. if (!player.tech_.featuresVolumeControl) {
  90187. self2.addClass("vjs-hidden");
  90188. } else {
  90189. self2.removeClass("vjs-hidden");
  90190. }
  90191. });
  90192. };
  90193. var VolumeLevel = /* @__PURE__ */ function(_Component) {
  90194. _inheritsLoose(VolumeLevel2, _Component);
  90195. function VolumeLevel2() {
  90196. return _Component.apply(this, arguments) || this;
  90197. }
  90198. var _proto = VolumeLevel2.prototype;
  90199. _proto.createEl = function createEl2() {
  90200. var el = _Component.prototype.createEl.call(this, "div", {
  90201. className: "vjs-volume-level"
  90202. });
  90203. el.appendChild(_Component.prototype.createEl.call(this, "span", {
  90204. className: "vjs-control-text"
  90205. }));
  90206. return el;
  90207. };
  90208. return VolumeLevel2;
  90209. }(Component$1);
  90210. Component$1.registerComponent("VolumeLevel", VolumeLevel);
  90211. var VolumeLevelTooltip = /* @__PURE__ */ function(_Component) {
  90212. _inheritsLoose(VolumeLevelTooltip2, _Component);
  90213. function VolumeLevelTooltip2(player, options2) {
  90214. var _this;
  90215. _this = _Component.call(this, player, options2) || this;
  90216. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90217. return _this;
  90218. }
  90219. var _proto = VolumeLevelTooltip2.prototype;
  90220. _proto.createEl = function createEl2() {
  90221. return _Component.prototype.createEl.call(this, "div", {
  90222. className: "vjs-volume-tooltip"
  90223. }, {
  90224. "aria-hidden": "true"
  90225. });
  90226. };
  90227. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical, content) {
  90228. if (!vertical) {
  90229. var tooltipRect = getBoundingClientRect(this.el_);
  90230. var playerRect = getBoundingClientRect(this.player_.el());
  90231. var volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  90232. if (!playerRect || !tooltipRect) {
  90233. return;
  90234. }
  90235. var spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  90236. var spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  90237. var pullTooltipBy = tooltipRect.width / 2;
  90238. if (spaceLeftOfPoint < pullTooltipBy) {
  90239. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  90240. } else if (spaceRightOfPoint < pullTooltipBy) {
  90241. pullTooltipBy = spaceRightOfPoint;
  90242. }
  90243. if (pullTooltipBy < 0) {
  90244. pullTooltipBy = 0;
  90245. } else if (pullTooltipBy > tooltipRect.width) {
  90246. pullTooltipBy = tooltipRect.width;
  90247. }
  90248. this.el_.style.right = "-" + pullTooltipBy + "px";
  90249. }
  90250. this.write(content + "%");
  90251. };
  90252. _proto.write = function write(content) {
  90253. textContent(this.el_, content);
  90254. };
  90255. _proto.updateVolume = function updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  90256. var _this2 = this;
  90257. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", function() {
  90258. _this2.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  90259. if (cb) {
  90260. cb();
  90261. }
  90262. });
  90263. };
  90264. return VolumeLevelTooltip2;
  90265. }(Component$1);
  90266. Component$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip);
  90267. var MouseVolumeLevelDisplay = /* @__PURE__ */ function(_Component) {
  90268. _inheritsLoose(MouseVolumeLevelDisplay2, _Component);
  90269. function MouseVolumeLevelDisplay2(player, options2) {
  90270. var _this;
  90271. _this = _Component.call(this, player, options2) || this;
  90272. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90273. return _this;
  90274. }
  90275. var _proto = MouseVolumeLevelDisplay2.prototype;
  90276. _proto.createEl = function createEl2() {
  90277. return _Component.prototype.createEl.call(this, "div", {
  90278. className: "vjs-mouse-display"
  90279. });
  90280. };
  90281. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical) {
  90282. var _this2 = this;
  90283. var volume = 100 * rangeBarPoint;
  90284. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, function() {
  90285. if (vertical) {
  90286. _this2.el_.style.bottom = rangeBarRect.height * rangeBarPoint + "px";
  90287. } else {
  90288. _this2.el_.style.left = rangeBarRect.width * rangeBarPoint + "px";
  90289. }
  90290. });
  90291. };
  90292. return MouseVolumeLevelDisplay2;
  90293. }(Component$1);
  90294. MouseVolumeLevelDisplay.prototype.options_ = {
  90295. children: ["volumeLevelTooltip"]
  90296. };
  90297. Component$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay);
  90298. var VolumeBar = /* @__PURE__ */ function(_Slider) {
  90299. _inheritsLoose(VolumeBar2, _Slider);
  90300. function VolumeBar2(player, options2) {
  90301. var _this;
  90302. _this = _Slider.call(this, player, options2) || this;
  90303. _this.on("slideractive", function(e) {
  90304. return _this.updateLastVolume_(e);
  90305. });
  90306. _this.on(player, "volumechange", function(e) {
  90307. return _this.updateARIAAttributes(e);
  90308. });
  90309. player.ready(function() {
  90310. return _this.updateARIAAttributes();
  90311. });
  90312. return _this;
  90313. }
  90314. var _proto = VolumeBar2.prototype;
  90315. _proto.createEl = function createEl2() {
  90316. return _Slider.prototype.createEl.call(this, "div", {
  90317. className: "vjs-volume-bar vjs-slider-bar"
  90318. }, {
  90319. "aria-label": this.localize("Volume Level"),
  90320. "aria-live": "polite"
  90321. });
  90322. };
  90323. _proto.handleMouseDown = function handleMouseDown(event2) {
  90324. if (!isSingleLeftClick(event2)) {
  90325. return;
  90326. }
  90327. _Slider.prototype.handleMouseDown.call(this, event2);
  90328. };
  90329. _proto.handleMouseMove = function handleMouseMove(event2) {
  90330. var mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  90331. if (mouseVolumeLevelDisplay) {
  90332. var volumeBarEl = this.el();
  90333. var volumeBarRect = getBoundingClientRect(volumeBarEl);
  90334. var vertical = this.vertical();
  90335. var volumeBarPoint = getPointerPosition(volumeBarEl, event2);
  90336. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  90337. volumeBarPoint = clamp(volumeBarPoint, 0, 1);
  90338. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  90339. }
  90340. if (!isSingleLeftClick(event2)) {
  90341. return;
  90342. }
  90343. this.checkMuted();
  90344. this.player_.volume(this.calculateDistance(event2));
  90345. };
  90346. _proto.checkMuted = function checkMuted() {
  90347. if (this.player_.muted()) {
  90348. this.player_.muted(false);
  90349. }
  90350. };
  90351. _proto.getPercent = function getPercent() {
  90352. if (this.player_.muted()) {
  90353. return 0;
  90354. }
  90355. return this.player_.volume();
  90356. };
  90357. _proto.stepForward = function stepForward() {
  90358. this.checkMuted();
  90359. this.player_.volume(this.player_.volume() + 0.1);
  90360. };
  90361. _proto.stepBack = function stepBack() {
  90362. this.checkMuted();
  90363. this.player_.volume(this.player_.volume() - 0.1);
  90364. };
  90365. _proto.updateARIAAttributes = function updateARIAAttributes(event2) {
  90366. var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  90367. this.el_.setAttribute("aria-valuenow", ariaValue);
  90368. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  90369. };
  90370. _proto.volumeAsPercentage_ = function volumeAsPercentage_() {
  90371. return Math.round(this.player_.volume() * 100);
  90372. };
  90373. _proto.updateLastVolume_ = function updateLastVolume_() {
  90374. var _this2 = this;
  90375. var volumeBeforeDrag = this.player_.volume();
  90376. this.one("sliderinactive", function() {
  90377. if (_this2.player_.volume() === 0) {
  90378. _this2.player_.lastVolume_(volumeBeforeDrag);
  90379. }
  90380. });
  90381. };
  90382. return VolumeBar2;
  90383. }(Slider);
  90384. VolumeBar.prototype.options_ = {
  90385. children: ["volumeLevel"],
  90386. barName: "volumeLevel"
  90387. };
  90388. if (!IS_IOS && !IS_ANDROID) {
  90389. VolumeBar.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  90390. }
  90391. VolumeBar.prototype.playerEvent = "volumechange";
  90392. Component$1.registerComponent("VolumeBar", VolumeBar);
  90393. var VolumeControl = /* @__PURE__ */ function(_Component) {
  90394. _inheritsLoose(VolumeControl2, _Component);
  90395. function VolumeControl2(player, options2) {
  90396. var _this;
  90397. if (options2 === void 0) {
  90398. options2 = {};
  90399. }
  90400. options2.vertical = options2.vertical || false;
  90401. if (typeof options2.volumeBar === "undefined" || isPlain(options2.volumeBar)) {
  90402. options2.volumeBar = options2.volumeBar || {};
  90403. options2.volumeBar.vertical = options2.vertical;
  90404. }
  90405. _this = _Component.call(this, player, options2) || this;
  90406. checkVolumeSupport(_assertThisInitialized(_this), player);
  90407. _this.throttledHandleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  90408. _this.handleMouseUpHandler_ = function(e) {
  90409. return _this.handleMouseUp(e);
  90410. };
  90411. _this.on("mousedown", function(e) {
  90412. return _this.handleMouseDown(e);
  90413. });
  90414. _this.on("touchstart", function(e) {
  90415. return _this.handleMouseDown(e);
  90416. });
  90417. _this.on("mousemove", function(e) {
  90418. return _this.handleMouseMove(e);
  90419. });
  90420. _this.on(_this.volumeBar, ["focus", "slideractive"], function() {
  90421. _this.volumeBar.addClass("vjs-slider-active");
  90422. _this.addClass("vjs-slider-active");
  90423. _this.trigger("slideractive");
  90424. });
  90425. _this.on(_this.volumeBar, ["blur", "sliderinactive"], function() {
  90426. _this.volumeBar.removeClass("vjs-slider-active");
  90427. _this.removeClass("vjs-slider-active");
  90428. _this.trigger("sliderinactive");
  90429. });
  90430. return _this;
  90431. }
  90432. var _proto = VolumeControl2.prototype;
  90433. _proto.createEl = function createEl2() {
  90434. var orientationClass = "vjs-volume-horizontal";
  90435. if (this.options_.vertical) {
  90436. orientationClass = "vjs-volume-vertical";
  90437. }
  90438. return _Component.prototype.createEl.call(this, "div", {
  90439. className: "vjs-volume-control vjs-control " + orientationClass
  90440. });
  90441. };
  90442. _proto.handleMouseDown = function handleMouseDown(event2) {
  90443. var doc = this.el_.ownerDocument;
  90444. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  90445. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  90446. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  90447. this.on(doc, "touchend", this.handleMouseUpHandler_);
  90448. };
  90449. _proto.handleMouseUp = function handleMouseUp(event2) {
  90450. var doc = this.el_.ownerDocument;
  90451. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  90452. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  90453. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  90454. this.off(doc, "touchend", this.handleMouseUpHandler_);
  90455. };
  90456. _proto.handleMouseMove = function handleMouseMove(event2) {
  90457. this.volumeBar.handleMouseMove(event2);
  90458. };
  90459. return VolumeControl2;
  90460. }(Component$1);
  90461. VolumeControl.prototype.options_ = {
  90462. children: ["volumeBar"]
  90463. };
  90464. Component$1.registerComponent("VolumeControl", VolumeControl);
  90465. var checkMuteSupport = function checkMuteSupport2(self2, player) {
  90466. if (player.tech_ && !player.tech_.featuresMuteControl) {
  90467. self2.addClass("vjs-hidden");
  90468. }
  90469. self2.on(player, "loadstart", function() {
  90470. if (!player.tech_.featuresMuteControl) {
  90471. self2.addClass("vjs-hidden");
  90472. } else {
  90473. self2.removeClass("vjs-hidden");
  90474. }
  90475. });
  90476. };
  90477. var MuteToggle = /* @__PURE__ */ function(_Button) {
  90478. _inheritsLoose(MuteToggle2, _Button);
  90479. function MuteToggle2(player, options2) {
  90480. var _this;
  90481. _this = _Button.call(this, player, options2) || this;
  90482. checkMuteSupport(_assertThisInitialized(_this), player);
  90483. _this.on(player, ["loadstart", "volumechange"], function(e) {
  90484. return _this.update(e);
  90485. });
  90486. return _this;
  90487. }
  90488. var _proto = MuteToggle2.prototype;
  90489. _proto.buildCSSClass = function buildCSSClass() {
  90490. return "vjs-mute-control " + _Button.prototype.buildCSSClass.call(this);
  90491. };
  90492. _proto.handleClick = function handleClick(event2) {
  90493. var vol = this.player_.volume();
  90494. var lastVolume = this.player_.lastVolume_();
  90495. if (vol === 0) {
  90496. var volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  90497. this.player_.volume(volumeToSet);
  90498. this.player_.muted(false);
  90499. } else {
  90500. this.player_.muted(this.player_.muted() ? false : true);
  90501. }
  90502. };
  90503. _proto.update = function update(event2) {
  90504. this.updateIcon_();
  90505. this.updateControlText_();
  90506. };
  90507. _proto.updateIcon_ = function updateIcon_() {
  90508. var vol = this.player_.volume();
  90509. var level = 3;
  90510. if (IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {
  90511. this.player_.muted(this.player_.tech_.el_.muted);
  90512. }
  90513. if (vol === 0 || this.player_.muted()) {
  90514. level = 0;
  90515. } else if (vol < 0.33) {
  90516. level = 1;
  90517. } else if (vol < 0.67) {
  90518. level = 2;
  90519. }
  90520. for (var i2 = 0; i2 < 4; i2++) {
  90521. removeClass(this.el_, "vjs-vol-" + i2);
  90522. }
  90523. addClass(this.el_, "vjs-vol-" + level);
  90524. };
  90525. _proto.updateControlText_ = function updateControlText_() {
  90526. var soundOff = this.player_.muted() || this.player_.volume() === 0;
  90527. var text = soundOff ? "Unmute" : "Mute";
  90528. if (this.controlText() !== text) {
  90529. this.controlText(text);
  90530. }
  90531. };
  90532. return MuteToggle2;
  90533. }(Button);
  90534. MuteToggle.prototype.controlText_ = "Mute";
  90535. Component$1.registerComponent("MuteToggle", MuteToggle);
  90536. var VolumePanel = /* @__PURE__ */ function(_Component) {
  90537. _inheritsLoose(VolumePanel2, _Component);
  90538. function VolumePanel2(player, options2) {
  90539. var _this;
  90540. if (options2 === void 0) {
  90541. options2 = {};
  90542. }
  90543. if (typeof options2.inline !== "undefined") {
  90544. options2.inline = options2.inline;
  90545. } else {
  90546. options2.inline = true;
  90547. }
  90548. if (typeof options2.volumeControl === "undefined" || isPlain(options2.volumeControl)) {
  90549. options2.volumeControl = options2.volumeControl || {};
  90550. options2.volumeControl.vertical = !options2.inline;
  90551. }
  90552. _this = _Component.call(this, player, options2) || this;
  90553. _this.handleKeyPressHandler_ = function(e) {
  90554. return _this.handleKeyPress(e);
  90555. };
  90556. _this.on(player, ["loadstart"], function(e) {
  90557. return _this.volumePanelState_(e);
  90558. });
  90559. _this.on(_this.muteToggle, "keyup", function(e) {
  90560. return _this.handleKeyPress(e);
  90561. });
  90562. _this.on(_this.volumeControl, "keyup", function(e) {
  90563. return _this.handleVolumeControlKeyUp(e);
  90564. });
  90565. _this.on("keydown", function(e) {
  90566. return _this.handleKeyPress(e);
  90567. });
  90568. _this.on("mouseover", function(e) {
  90569. return _this.handleMouseOver(e);
  90570. });
  90571. _this.on("mouseout", function(e) {
  90572. return _this.handleMouseOut(e);
  90573. });
  90574. _this.on(_this.volumeControl, ["slideractive"], _this.sliderActive_);
  90575. _this.on(_this.volumeControl, ["sliderinactive"], _this.sliderInactive_);
  90576. return _this;
  90577. }
  90578. var _proto = VolumePanel2.prototype;
  90579. _proto.sliderActive_ = function sliderActive_() {
  90580. this.addClass("vjs-slider-active");
  90581. };
  90582. _proto.sliderInactive_ = function sliderInactive_() {
  90583. this.removeClass("vjs-slider-active");
  90584. };
  90585. _proto.volumePanelState_ = function volumePanelState_() {
  90586. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  90587. this.addClass("vjs-hidden");
  90588. }
  90589. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  90590. this.addClass("vjs-mute-toggle-only");
  90591. }
  90592. };
  90593. _proto.createEl = function createEl2() {
  90594. var orientationClass = "vjs-volume-panel-horizontal";
  90595. if (!this.options_.inline) {
  90596. orientationClass = "vjs-volume-panel-vertical";
  90597. }
  90598. return _Component.prototype.createEl.call(this, "div", {
  90599. className: "vjs-volume-panel vjs-control " + orientationClass
  90600. });
  90601. };
  90602. _proto.dispose = function dispose() {
  90603. this.handleMouseOut();
  90604. _Component.prototype.dispose.call(this);
  90605. };
  90606. _proto.handleVolumeControlKeyUp = function handleVolumeControlKeyUp(event2) {
  90607. if (keycode.isEventKey(event2, "Esc")) {
  90608. this.muteToggle.focus();
  90609. }
  90610. };
  90611. _proto.handleMouseOver = function handleMouseOver(event2) {
  90612. this.addClass("vjs-hover");
  90613. on(document_1, "keyup", this.handleKeyPressHandler_);
  90614. };
  90615. _proto.handleMouseOut = function handleMouseOut(event2) {
  90616. this.removeClass("vjs-hover");
  90617. off(document_1, "keyup", this.handleKeyPressHandler_);
  90618. };
  90619. _proto.handleKeyPress = function handleKeyPress(event2) {
  90620. if (keycode.isEventKey(event2, "Esc")) {
  90621. this.handleMouseOut();
  90622. }
  90623. };
  90624. return VolumePanel2;
  90625. }(Component$1);
  90626. VolumePanel.prototype.options_ = {
  90627. children: ["muteToggle", "volumeControl"]
  90628. };
  90629. Component$1.registerComponent("VolumePanel", VolumePanel);
  90630. var Menu = /* @__PURE__ */ function(_Component) {
  90631. _inheritsLoose(Menu2, _Component);
  90632. function Menu2(player, options2) {
  90633. var _this;
  90634. _this = _Component.call(this, player, options2) || this;
  90635. if (options2) {
  90636. _this.menuButton_ = options2.menuButton;
  90637. }
  90638. _this.focusedChild_ = -1;
  90639. _this.on("keydown", function(e) {
  90640. return _this.handleKeyDown(e);
  90641. });
  90642. _this.boundHandleBlur_ = function(e) {
  90643. return _this.handleBlur(e);
  90644. };
  90645. _this.boundHandleTapClick_ = function(e) {
  90646. return _this.handleTapClick(e);
  90647. };
  90648. return _this;
  90649. }
  90650. var _proto = Menu2.prototype;
  90651. _proto.addEventListenerForItem = function addEventListenerForItem(component) {
  90652. if (!(component instanceof Component$1)) {
  90653. return;
  90654. }
  90655. this.on(component, "blur", this.boundHandleBlur_);
  90656. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  90657. };
  90658. _proto.removeEventListenerForItem = function removeEventListenerForItem(component) {
  90659. if (!(component instanceof Component$1)) {
  90660. return;
  90661. }
  90662. this.off(component, "blur", this.boundHandleBlur_);
  90663. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  90664. };
  90665. _proto.removeChild = function removeChild(component) {
  90666. if (typeof component === "string") {
  90667. component = this.getChild(component);
  90668. }
  90669. this.removeEventListenerForItem(component);
  90670. _Component.prototype.removeChild.call(this, component);
  90671. };
  90672. _proto.addItem = function addItem(component) {
  90673. var childComponent = this.addChild(component);
  90674. if (childComponent) {
  90675. this.addEventListenerForItem(childComponent);
  90676. }
  90677. };
  90678. _proto.createEl = function createEl$12() {
  90679. var contentElType = this.options_.contentElType || "ul";
  90680. this.contentEl_ = createEl(contentElType, {
  90681. className: "vjs-menu-content"
  90682. });
  90683. this.contentEl_.setAttribute("role", "menu");
  90684. var el = _Component.prototype.createEl.call(this, "div", {
  90685. append: this.contentEl_,
  90686. className: "vjs-menu"
  90687. });
  90688. el.appendChild(this.contentEl_);
  90689. on(el, "click", function(event2) {
  90690. event2.preventDefault();
  90691. event2.stopImmediatePropagation();
  90692. });
  90693. return el;
  90694. };
  90695. _proto.dispose = function dispose() {
  90696. this.contentEl_ = null;
  90697. this.boundHandleBlur_ = null;
  90698. this.boundHandleTapClick_ = null;
  90699. _Component.prototype.dispose.call(this);
  90700. };
  90701. _proto.handleBlur = function handleBlur(event2) {
  90702. var relatedTarget = event2.relatedTarget || document_1.activeElement;
  90703. if (!this.children().some(function(element) {
  90704. return element.el() === relatedTarget;
  90705. })) {
  90706. var btn = this.menuButton_;
  90707. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  90708. btn.unpressButton();
  90709. }
  90710. }
  90711. };
  90712. _proto.handleTapClick = function handleTapClick(event2) {
  90713. if (this.menuButton_) {
  90714. this.menuButton_.unpressButton();
  90715. var childComponents = this.children();
  90716. if (!Array.isArray(childComponents)) {
  90717. return;
  90718. }
  90719. var foundComponent = childComponents.filter(function(component) {
  90720. return component.el() === event2.target;
  90721. })[0];
  90722. if (!foundComponent) {
  90723. return;
  90724. }
  90725. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  90726. this.menuButton_.focus();
  90727. }
  90728. }
  90729. };
  90730. _proto.handleKeyDown = function handleKeyDown(event2) {
  90731. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  90732. event2.preventDefault();
  90733. event2.stopPropagation();
  90734. this.stepForward();
  90735. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  90736. event2.preventDefault();
  90737. event2.stopPropagation();
  90738. this.stepBack();
  90739. }
  90740. };
  90741. _proto.stepForward = function stepForward() {
  90742. var stepChild = 0;
  90743. if (this.focusedChild_ !== void 0) {
  90744. stepChild = this.focusedChild_ + 1;
  90745. }
  90746. this.focus(stepChild);
  90747. };
  90748. _proto.stepBack = function stepBack() {
  90749. var stepChild = 0;
  90750. if (this.focusedChild_ !== void 0) {
  90751. stepChild = this.focusedChild_ - 1;
  90752. }
  90753. this.focus(stepChild);
  90754. };
  90755. _proto.focus = function focus(item) {
  90756. if (item === void 0) {
  90757. item = 0;
  90758. }
  90759. var children = this.children().slice();
  90760. var haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  90761. if (haveTitle) {
  90762. children.shift();
  90763. }
  90764. if (children.length > 0) {
  90765. if (item < 0) {
  90766. item = 0;
  90767. } else if (item >= children.length) {
  90768. item = children.length - 1;
  90769. }
  90770. this.focusedChild_ = item;
  90771. children[item].el_.focus();
  90772. }
  90773. };
  90774. return Menu2;
  90775. }(Component$1);
  90776. Component$1.registerComponent("Menu", Menu);
  90777. var MenuButton = /* @__PURE__ */ function(_Component) {
  90778. _inheritsLoose(MenuButton2, _Component);
  90779. function MenuButton2(player, options2) {
  90780. var _this;
  90781. if (options2 === void 0) {
  90782. options2 = {};
  90783. }
  90784. _this = _Component.call(this, player, options2) || this;
  90785. _this.menuButton_ = new Button(player, options2);
  90786. _this.menuButton_.controlText(_this.controlText_);
  90787. _this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  90788. var buttonClass = Button.prototype.buildCSSClass();
  90789. _this.menuButton_.el_.className = _this.buildCSSClass() + " " + buttonClass;
  90790. _this.menuButton_.removeClass("vjs-control");
  90791. _this.addChild(_this.menuButton_);
  90792. _this.update();
  90793. _this.enabled_ = true;
  90794. var handleClick = function handleClick2(e) {
  90795. return _this.handleClick(e);
  90796. };
  90797. _this.handleMenuKeyUp_ = function(e) {
  90798. return _this.handleMenuKeyUp(e);
  90799. };
  90800. _this.on(_this.menuButton_, "tap", handleClick);
  90801. _this.on(_this.menuButton_, "click", handleClick);
  90802. _this.on(_this.menuButton_, "keydown", function(e) {
  90803. return _this.handleKeyDown(e);
  90804. });
  90805. _this.on(_this.menuButton_, "mouseenter", function() {
  90806. _this.addClass("vjs-hover");
  90807. _this.menu.show();
  90808. on(document_1, "keyup", _this.handleMenuKeyUp_);
  90809. });
  90810. _this.on("mouseleave", function(e) {
  90811. return _this.handleMouseLeave(e);
  90812. });
  90813. _this.on("keydown", function(e) {
  90814. return _this.handleSubmenuKeyDown(e);
  90815. });
  90816. return _this;
  90817. }
  90818. var _proto = MenuButton2.prototype;
  90819. _proto.update = function update() {
  90820. var menu = this.createMenu();
  90821. if (this.menu) {
  90822. this.menu.dispose();
  90823. this.removeChild(this.menu);
  90824. }
  90825. this.menu = menu;
  90826. this.addChild(menu);
  90827. this.buttonPressed_ = false;
  90828. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90829. if (this.items && this.items.length <= this.hideThreshold_) {
  90830. this.hide();
  90831. this.menu.contentEl_.removeAttribute("role");
  90832. } else {
  90833. this.show();
  90834. this.menu.contentEl_.setAttribute("role", "menu");
  90835. }
  90836. };
  90837. _proto.createMenu = function createMenu() {
  90838. var menu = new Menu(this.player_, {
  90839. menuButton: this
  90840. });
  90841. this.hideThreshold_ = 0;
  90842. if (this.options_.title) {
  90843. var titleEl = createEl("li", {
  90844. className: "vjs-menu-title",
  90845. textContent: toTitleCase$1(this.options_.title),
  90846. tabIndex: -1
  90847. });
  90848. var titleComponent = new Component$1(this.player_, {
  90849. el: titleEl
  90850. });
  90851. menu.addItem(titleComponent);
  90852. }
  90853. this.items = this.createItems();
  90854. if (this.items) {
  90855. for (var i2 = 0; i2 < this.items.length; i2++) {
  90856. menu.addItem(this.items[i2]);
  90857. }
  90858. }
  90859. return menu;
  90860. };
  90861. _proto.createItems = function createItems() {
  90862. };
  90863. _proto.createEl = function createEl2() {
  90864. return _Component.prototype.createEl.call(this, "div", {
  90865. className: this.buildWrapperCSSClass()
  90866. }, {});
  90867. };
  90868. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  90869. var menuButtonClass = "vjs-menu-button";
  90870. if (this.options_.inline === true) {
  90871. menuButtonClass += "-inline";
  90872. } else {
  90873. menuButtonClass += "-popup";
  90874. }
  90875. var buttonClass = Button.prototype.buildCSSClass();
  90876. return "vjs-menu-button " + menuButtonClass + " " + buttonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90877. };
  90878. _proto.buildCSSClass = function buildCSSClass() {
  90879. var menuButtonClass = "vjs-menu-button";
  90880. if (this.options_.inline === true) {
  90881. menuButtonClass += "-inline";
  90882. } else {
  90883. menuButtonClass += "-popup";
  90884. }
  90885. return "vjs-menu-button " + menuButtonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90886. };
  90887. _proto.controlText = function controlText(text, el) {
  90888. if (el === void 0) {
  90889. el = this.menuButton_.el();
  90890. }
  90891. return this.menuButton_.controlText(text, el);
  90892. };
  90893. _proto.dispose = function dispose() {
  90894. this.handleMouseLeave();
  90895. _Component.prototype.dispose.call(this);
  90896. };
  90897. _proto.handleClick = function handleClick(event2) {
  90898. if (this.buttonPressed_) {
  90899. this.unpressButton();
  90900. } else {
  90901. this.pressButton();
  90902. }
  90903. };
  90904. _proto.handleMouseLeave = function handleMouseLeave(event2) {
  90905. this.removeClass("vjs-hover");
  90906. off(document_1, "keyup", this.handleMenuKeyUp_);
  90907. };
  90908. _proto.focus = function focus() {
  90909. this.menuButton_.focus();
  90910. };
  90911. _proto.blur = function blur() {
  90912. this.menuButton_.blur();
  90913. };
  90914. _proto.handleKeyDown = function handleKeyDown(event2) {
  90915. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90916. if (this.buttonPressed_) {
  90917. this.unpressButton();
  90918. }
  90919. if (!keycode.isEventKey(event2, "Tab")) {
  90920. event2.preventDefault();
  90921. this.menuButton_.focus();
  90922. }
  90923. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  90924. if (!this.buttonPressed_) {
  90925. event2.preventDefault();
  90926. this.pressButton();
  90927. }
  90928. }
  90929. };
  90930. _proto.handleMenuKeyUp = function handleMenuKeyUp(event2) {
  90931. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90932. this.removeClass("vjs-hover");
  90933. }
  90934. };
  90935. _proto.handleSubmenuKeyPress = function handleSubmenuKeyPress(event2) {
  90936. this.handleSubmenuKeyDown(event2);
  90937. };
  90938. _proto.handleSubmenuKeyDown = function handleSubmenuKeyDown(event2) {
  90939. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90940. if (this.buttonPressed_) {
  90941. this.unpressButton();
  90942. }
  90943. if (!keycode.isEventKey(event2, "Tab")) {
  90944. event2.preventDefault();
  90945. this.menuButton_.focus();
  90946. }
  90947. }
  90948. };
  90949. _proto.pressButton = function pressButton() {
  90950. if (this.enabled_) {
  90951. this.buttonPressed_ = true;
  90952. this.menu.show();
  90953. this.menu.lockShowing();
  90954. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  90955. if (IS_IOS && isInFrame()) {
  90956. return;
  90957. }
  90958. this.menu.focus();
  90959. }
  90960. };
  90961. _proto.unpressButton = function unpressButton() {
  90962. if (this.enabled_) {
  90963. this.buttonPressed_ = false;
  90964. this.menu.unlockShowing();
  90965. this.menu.hide();
  90966. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90967. }
  90968. };
  90969. _proto.disable = function disable() {
  90970. this.unpressButton();
  90971. this.enabled_ = false;
  90972. this.addClass("vjs-disabled");
  90973. this.menuButton_.disable();
  90974. };
  90975. _proto.enable = function enable() {
  90976. this.enabled_ = true;
  90977. this.removeClass("vjs-disabled");
  90978. this.menuButton_.enable();
  90979. };
  90980. return MenuButton2;
  90981. }(Component$1);
  90982. Component$1.registerComponent("MenuButton", MenuButton);
  90983. var TrackButton = /* @__PURE__ */ function(_MenuButton) {
  90984. _inheritsLoose(TrackButton2, _MenuButton);
  90985. function TrackButton2(player, options2) {
  90986. var _this;
  90987. var tracks = options2.tracks;
  90988. _this = _MenuButton.call(this, player, options2) || this;
  90989. if (_this.items.length <= 1) {
  90990. _this.hide();
  90991. }
  90992. if (!tracks) {
  90993. return _assertThisInitialized(_this);
  90994. }
  90995. var updateHandler = bind(_assertThisInitialized(_this), _this.update);
  90996. tracks.addEventListener("removetrack", updateHandler);
  90997. tracks.addEventListener("addtrack", updateHandler);
  90998. tracks.addEventListener("labelchange", updateHandler);
  90999. _this.player_.on("ready", updateHandler);
  91000. _this.player_.on("dispose", function() {
  91001. tracks.removeEventListener("removetrack", updateHandler);
  91002. tracks.removeEventListener("addtrack", updateHandler);
  91003. tracks.removeEventListener("labelchange", updateHandler);
  91004. });
  91005. return _this;
  91006. }
  91007. return TrackButton2;
  91008. }(MenuButton);
  91009. Component$1.registerComponent("TrackButton", TrackButton);
  91010. var MenuKeys = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  91011. var MenuItem = /* @__PURE__ */ function(_ClickableComponent) {
  91012. _inheritsLoose(MenuItem2, _ClickableComponent);
  91013. function MenuItem2(player, options2) {
  91014. var _this;
  91015. _this = _ClickableComponent.call(this, player, options2) || this;
  91016. _this.selectable = options2.selectable;
  91017. _this.isSelected_ = options2.selected || false;
  91018. _this.multiSelectable = options2.multiSelectable;
  91019. _this.selected(_this.isSelected_);
  91020. if (_this.selectable) {
  91021. if (_this.multiSelectable) {
  91022. _this.el_.setAttribute("role", "menuitemcheckbox");
  91023. } else {
  91024. _this.el_.setAttribute("role", "menuitemradio");
  91025. }
  91026. } else {
  91027. _this.el_.setAttribute("role", "menuitem");
  91028. }
  91029. return _this;
  91030. }
  91031. var _proto = MenuItem2.prototype;
  91032. _proto.createEl = function createEl$12(type2, props, attrs) {
  91033. this.nonIconControl = true;
  91034. var el = _ClickableComponent.prototype.createEl.call(this, "li", assign({
  91035. className: "vjs-menu-item",
  91036. tabIndex: -1
  91037. }, props), attrs);
  91038. el.replaceChild(createEl("span", {
  91039. className: "vjs-menu-item-text",
  91040. textContent: this.localize(this.options_.label)
  91041. }), el.querySelector(".vjs-icon-placeholder"));
  91042. return el;
  91043. };
  91044. _proto.handleKeyDown = function handleKeyDown(event2) {
  91045. if (!MenuKeys.some(function(key) {
  91046. return keycode.isEventKey(event2, key);
  91047. })) {
  91048. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  91049. }
  91050. };
  91051. _proto.handleClick = function handleClick(event2) {
  91052. this.selected(true);
  91053. };
  91054. _proto.selected = function selected(_selected) {
  91055. if (this.selectable) {
  91056. if (_selected) {
  91057. this.addClass("vjs-selected");
  91058. this.el_.setAttribute("aria-checked", "true");
  91059. this.controlText(", selected");
  91060. this.isSelected_ = true;
  91061. } else {
  91062. this.removeClass("vjs-selected");
  91063. this.el_.setAttribute("aria-checked", "false");
  91064. this.controlText("");
  91065. this.isSelected_ = false;
  91066. }
  91067. }
  91068. };
  91069. return MenuItem2;
  91070. }(ClickableComponent);
  91071. Component$1.registerComponent("MenuItem", MenuItem);
  91072. var TextTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91073. _inheritsLoose(TextTrackMenuItem2, _MenuItem);
  91074. function TextTrackMenuItem2(player, options2) {
  91075. var _this;
  91076. var track = options2.track;
  91077. var tracks = player.textTracks();
  91078. options2.label = track.label || track.language || "Unknown";
  91079. options2.selected = track.mode === "showing";
  91080. _this = _MenuItem.call(this, player, options2) || this;
  91081. _this.track = track;
  91082. _this.kinds = (options2.kinds || [options2.kind || _this.track.kind]).filter(Boolean);
  91083. var changeHandler = function changeHandler2() {
  91084. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  91085. args[_key] = arguments[_key];
  91086. }
  91087. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  91088. };
  91089. var selectedLanguageChangeHandler = function selectedLanguageChangeHandler2() {
  91090. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  91091. args[_key2] = arguments[_key2];
  91092. }
  91093. _this.handleSelectedLanguageChange.apply(_assertThisInitialized(_this), args);
  91094. };
  91095. player.on(["loadstart", "texttrackchange"], changeHandler);
  91096. tracks.addEventListener("change", changeHandler);
  91097. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91098. _this.on("dispose", function() {
  91099. player.off(["loadstart", "texttrackchange"], changeHandler);
  91100. tracks.removeEventListener("change", changeHandler);
  91101. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91102. });
  91103. if (tracks.onchange === void 0) {
  91104. var event2;
  91105. _this.on(["tap", "click"], function() {
  91106. if (typeof window_1.Event !== "object") {
  91107. try {
  91108. event2 = new window_1.Event("change");
  91109. } catch (err) {
  91110. }
  91111. }
  91112. if (!event2) {
  91113. event2 = document_1.createEvent("Event");
  91114. event2.initEvent("change", true, true);
  91115. }
  91116. tracks.dispatchEvent(event2);
  91117. });
  91118. }
  91119. _this.handleTracksChange();
  91120. return _this;
  91121. }
  91122. var _proto = TextTrackMenuItem2.prototype;
  91123. _proto.handleClick = function handleClick(event2) {
  91124. var referenceTrack = this.track;
  91125. var tracks = this.player_.textTracks();
  91126. _MenuItem.prototype.handleClick.call(this, event2);
  91127. if (!tracks) {
  91128. return;
  91129. }
  91130. for (var i2 = 0; i2 < tracks.length; i2++) {
  91131. var track = tracks[i2];
  91132. if (this.kinds.indexOf(track.kind) === -1) {
  91133. continue;
  91134. }
  91135. if (track === referenceTrack) {
  91136. if (track.mode !== "showing") {
  91137. track.mode = "showing";
  91138. }
  91139. } else if (track.mode !== "disabled") {
  91140. track.mode = "disabled";
  91141. }
  91142. }
  91143. };
  91144. _proto.handleTracksChange = function handleTracksChange(event2) {
  91145. var shouldBeSelected = this.track.mode === "showing";
  91146. if (shouldBeSelected !== this.isSelected_) {
  91147. this.selected(shouldBeSelected);
  91148. }
  91149. };
  91150. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91151. if (this.track.mode === "showing") {
  91152. var selectedLanguage = this.player_.cache_.selectedLanguage;
  91153. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  91154. return;
  91155. }
  91156. this.player_.cache_.selectedLanguage = {
  91157. enabled: true,
  91158. language: this.track.language,
  91159. kind: this.track.kind
  91160. };
  91161. }
  91162. };
  91163. _proto.dispose = function dispose() {
  91164. this.track = null;
  91165. _MenuItem.prototype.dispose.call(this);
  91166. };
  91167. return TextTrackMenuItem2;
  91168. }(MenuItem);
  91169. Component$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem);
  91170. var OffTextTrackMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91171. _inheritsLoose(OffTextTrackMenuItem2, _TextTrackMenuItem);
  91172. function OffTextTrackMenuItem2(player, options2) {
  91173. options2.track = {
  91174. player,
  91175. kind: options2.kind,
  91176. kinds: options2.kinds,
  91177. "default": false,
  91178. mode: "disabled"
  91179. };
  91180. if (!options2.kinds) {
  91181. options2.kinds = [options2.kind];
  91182. }
  91183. if (options2.label) {
  91184. options2.track.label = options2.label;
  91185. } else {
  91186. options2.track.label = options2.kinds.join(" and ") + " off";
  91187. }
  91188. options2.selectable = true;
  91189. options2.multiSelectable = false;
  91190. return _TextTrackMenuItem.call(this, player, options2) || this;
  91191. }
  91192. var _proto = OffTextTrackMenuItem2.prototype;
  91193. _proto.handleTracksChange = function handleTracksChange(event2) {
  91194. var tracks = this.player().textTracks();
  91195. var shouldBeSelected = true;
  91196. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91197. var track = tracks[i2];
  91198. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  91199. shouldBeSelected = false;
  91200. break;
  91201. }
  91202. }
  91203. if (shouldBeSelected !== this.isSelected_) {
  91204. this.selected(shouldBeSelected);
  91205. }
  91206. };
  91207. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91208. var tracks = this.player().textTracks();
  91209. var allHidden = true;
  91210. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91211. var track = tracks[i2];
  91212. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  91213. allHidden = false;
  91214. break;
  91215. }
  91216. }
  91217. if (allHidden) {
  91218. this.player_.cache_.selectedLanguage = {
  91219. enabled: false
  91220. };
  91221. }
  91222. };
  91223. return OffTextTrackMenuItem2;
  91224. }(TextTrackMenuItem);
  91225. Component$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem);
  91226. var TextTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91227. _inheritsLoose(TextTrackButton2, _TrackButton);
  91228. function TextTrackButton2(player, options2) {
  91229. if (options2 === void 0) {
  91230. options2 = {};
  91231. }
  91232. options2.tracks = player.textTracks();
  91233. return _TrackButton.call(this, player, options2) || this;
  91234. }
  91235. var _proto = TextTrackButton2.prototype;
  91236. _proto.createItems = function createItems(items, TrackMenuItem) {
  91237. if (items === void 0) {
  91238. items = [];
  91239. }
  91240. if (TrackMenuItem === void 0) {
  91241. TrackMenuItem = TextTrackMenuItem;
  91242. }
  91243. var label2;
  91244. if (this.label_) {
  91245. label2 = this.label_ + " off";
  91246. }
  91247. items.push(new OffTextTrackMenuItem(this.player_, {
  91248. kinds: this.kinds_,
  91249. kind: this.kind_,
  91250. label: label2
  91251. }));
  91252. this.hideThreshold_ += 1;
  91253. var tracks = this.player_.textTracks();
  91254. if (!Array.isArray(this.kinds_)) {
  91255. this.kinds_ = [this.kind_];
  91256. }
  91257. for (var i2 = 0; i2 < tracks.length; i2++) {
  91258. var track = tracks[i2];
  91259. if (this.kinds_.indexOf(track.kind) > -1) {
  91260. var item = new TrackMenuItem(this.player_, {
  91261. track,
  91262. kinds: this.kinds_,
  91263. kind: this.kind_,
  91264. selectable: true,
  91265. multiSelectable: false
  91266. });
  91267. item.addClass("vjs-" + track.kind + "-menu-item");
  91268. items.push(item);
  91269. }
  91270. }
  91271. return items;
  91272. };
  91273. return TextTrackButton2;
  91274. }(TrackButton);
  91275. Component$1.registerComponent("TextTrackButton", TextTrackButton);
  91276. var ChaptersTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91277. _inheritsLoose(ChaptersTrackMenuItem2, _MenuItem);
  91278. function ChaptersTrackMenuItem2(player, options2) {
  91279. var _this;
  91280. var track = options2.track;
  91281. var cue = options2.cue;
  91282. var currentTime = player.currentTime();
  91283. options2.selectable = true;
  91284. options2.multiSelectable = false;
  91285. options2.label = cue.text;
  91286. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  91287. _this = _MenuItem.call(this, player, options2) || this;
  91288. _this.track = track;
  91289. _this.cue = cue;
  91290. return _this;
  91291. }
  91292. var _proto = ChaptersTrackMenuItem2.prototype;
  91293. _proto.handleClick = function handleClick(event2) {
  91294. _MenuItem.prototype.handleClick.call(this);
  91295. this.player_.currentTime(this.cue.startTime);
  91296. };
  91297. return ChaptersTrackMenuItem2;
  91298. }(MenuItem);
  91299. Component$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem);
  91300. var ChaptersButton = /* @__PURE__ */ function(_TextTrackButton) {
  91301. _inheritsLoose(ChaptersButton2, _TextTrackButton);
  91302. function ChaptersButton2(player, options2, ready) {
  91303. var _this;
  91304. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91305. _this.selectCurrentItem_ = function() {
  91306. _this.items.forEach(function(item) {
  91307. item.selected(_this.track_.activeCues[0] === item.cue);
  91308. });
  91309. };
  91310. return _this;
  91311. }
  91312. var _proto = ChaptersButton2.prototype;
  91313. _proto.buildCSSClass = function buildCSSClass() {
  91314. return "vjs-chapters-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91315. };
  91316. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91317. return "vjs-chapters-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91318. };
  91319. _proto.update = function update(event2) {
  91320. if (event2 && event2.track && event2.track.kind !== "chapters") {
  91321. return;
  91322. }
  91323. var track = this.findChaptersTrack();
  91324. if (track !== this.track_) {
  91325. this.setTrack(track);
  91326. _TextTrackButton.prototype.update.call(this);
  91327. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  91328. _TextTrackButton.prototype.update.call(this);
  91329. }
  91330. };
  91331. _proto.setTrack = function setTrack(track) {
  91332. if (this.track_ === track) {
  91333. return;
  91334. }
  91335. if (!this.updateHandler_) {
  91336. this.updateHandler_ = this.update.bind(this);
  91337. }
  91338. if (this.track_) {
  91339. var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91340. if (remoteTextTrackEl) {
  91341. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  91342. }
  91343. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  91344. this.track_ = null;
  91345. }
  91346. this.track_ = track;
  91347. if (this.track_) {
  91348. this.track_.mode = "hidden";
  91349. var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91350. if (_remoteTextTrackEl) {
  91351. _remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  91352. }
  91353. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  91354. }
  91355. };
  91356. _proto.findChaptersTrack = function findChaptersTrack() {
  91357. var tracks = this.player_.textTracks() || [];
  91358. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  91359. var track = tracks[i2];
  91360. if (track.kind === this.kind_) {
  91361. return track;
  91362. }
  91363. }
  91364. };
  91365. _proto.getMenuCaption = function getMenuCaption() {
  91366. if (this.track_ && this.track_.label) {
  91367. return this.track_.label;
  91368. }
  91369. return this.localize(toTitleCase$1(this.kind_));
  91370. };
  91371. _proto.createMenu = function createMenu() {
  91372. this.options_.title = this.getMenuCaption();
  91373. return _TextTrackButton.prototype.createMenu.call(this);
  91374. };
  91375. _proto.createItems = function createItems() {
  91376. var items = [];
  91377. if (!this.track_) {
  91378. return items;
  91379. }
  91380. var cues = this.track_.cues;
  91381. if (!cues) {
  91382. return items;
  91383. }
  91384. for (var i2 = 0, l = cues.length; i2 < l; i2++) {
  91385. var cue = cues[i2];
  91386. var mi = new ChaptersTrackMenuItem(this.player_, {
  91387. track: this.track_,
  91388. cue
  91389. });
  91390. items.push(mi);
  91391. }
  91392. return items;
  91393. };
  91394. return ChaptersButton2;
  91395. }(TextTrackButton);
  91396. ChaptersButton.prototype.kind_ = "chapters";
  91397. ChaptersButton.prototype.controlText_ = "Chapters";
  91398. Component$1.registerComponent("ChaptersButton", ChaptersButton);
  91399. var DescriptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91400. _inheritsLoose(DescriptionsButton2, _TextTrackButton);
  91401. function DescriptionsButton2(player, options2, ready) {
  91402. var _this;
  91403. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91404. var tracks = player.textTracks();
  91405. var changeHandler = bind(_assertThisInitialized(_this), _this.handleTracksChange);
  91406. tracks.addEventListener("change", changeHandler);
  91407. _this.on("dispose", function() {
  91408. tracks.removeEventListener("change", changeHandler);
  91409. });
  91410. return _this;
  91411. }
  91412. var _proto = DescriptionsButton2.prototype;
  91413. _proto.handleTracksChange = function handleTracksChange(event2) {
  91414. var tracks = this.player().textTracks();
  91415. var disabled = false;
  91416. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91417. var track = tracks[i2];
  91418. if (track.kind !== this.kind_ && track.mode === "showing") {
  91419. disabled = true;
  91420. break;
  91421. }
  91422. }
  91423. if (disabled) {
  91424. this.disable();
  91425. } else {
  91426. this.enable();
  91427. }
  91428. };
  91429. _proto.buildCSSClass = function buildCSSClass() {
  91430. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91431. };
  91432. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91433. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91434. };
  91435. return DescriptionsButton2;
  91436. }(TextTrackButton);
  91437. DescriptionsButton.prototype.kind_ = "descriptions";
  91438. DescriptionsButton.prototype.controlText_ = "Descriptions";
  91439. Component$1.registerComponent("DescriptionsButton", DescriptionsButton);
  91440. var SubtitlesButton = /* @__PURE__ */ function(_TextTrackButton) {
  91441. _inheritsLoose(SubtitlesButton2, _TextTrackButton);
  91442. function SubtitlesButton2(player, options2, ready) {
  91443. return _TextTrackButton.call(this, player, options2, ready) || this;
  91444. }
  91445. var _proto = SubtitlesButton2.prototype;
  91446. _proto.buildCSSClass = function buildCSSClass() {
  91447. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91448. };
  91449. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91450. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91451. };
  91452. return SubtitlesButton2;
  91453. }(TextTrackButton);
  91454. SubtitlesButton.prototype.kind_ = "subtitles";
  91455. SubtitlesButton.prototype.controlText_ = "Subtitles";
  91456. Component$1.registerComponent("SubtitlesButton", SubtitlesButton);
  91457. var CaptionSettingsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91458. _inheritsLoose(CaptionSettingsMenuItem2, _TextTrackMenuItem);
  91459. function CaptionSettingsMenuItem2(player, options2) {
  91460. var _this;
  91461. options2.track = {
  91462. player,
  91463. kind: options2.kind,
  91464. label: options2.kind + " settings",
  91465. selectable: false,
  91466. "default": false,
  91467. mode: "disabled"
  91468. };
  91469. options2.selectable = false;
  91470. options2.name = "CaptionSettingsMenuItem";
  91471. _this = _TextTrackMenuItem.call(this, player, options2) || this;
  91472. _this.addClass("vjs-texttrack-settings");
  91473. _this.controlText(", opens " + options2.kind + " settings dialog");
  91474. return _this;
  91475. }
  91476. var _proto = CaptionSettingsMenuItem2.prototype;
  91477. _proto.handleClick = function handleClick(event2) {
  91478. this.player().getChild("textTrackSettings").open();
  91479. };
  91480. return CaptionSettingsMenuItem2;
  91481. }(TextTrackMenuItem);
  91482. Component$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem);
  91483. var CaptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91484. _inheritsLoose(CaptionsButton2, _TextTrackButton);
  91485. function CaptionsButton2(player, options2, ready) {
  91486. return _TextTrackButton.call(this, player, options2, ready) || this;
  91487. }
  91488. var _proto = CaptionsButton2.prototype;
  91489. _proto.buildCSSClass = function buildCSSClass() {
  91490. return "vjs-captions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91491. };
  91492. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91493. return "vjs-captions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91494. };
  91495. _proto.createItems = function createItems() {
  91496. var items = [];
  91497. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91498. items.push(new CaptionSettingsMenuItem(this.player_, {
  91499. kind: this.kind_
  91500. }));
  91501. this.hideThreshold_ += 1;
  91502. }
  91503. return _TextTrackButton.prototype.createItems.call(this, items);
  91504. };
  91505. return CaptionsButton2;
  91506. }(TextTrackButton);
  91507. CaptionsButton.prototype.kind_ = "captions";
  91508. CaptionsButton.prototype.controlText_ = "Captions";
  91509. Component$1.registerComponent("CaptionsButton", CaptionsButton);
  91510. var SubsCapsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91511. _inheritsLoose(SubsCapsMenuItem2, _TextTrackMenuItem);
  91512. function SubsCapsMenuItem2() {
  91513. return _TextTrackMenuItem.apply(this, arguments) || this;
  91514. }
  91515. var _proto = SubsCapsMenuItem2.prototype;
  91516. _proto.createEl = function createEl$12(type2, props, attrs) {
  91517. var el = _TextTrackMenuItem.prototype.createEl.call(this, type2, props, attrs);
  91518. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91519. if (this.options_.track.kind === "captions") {
  91520. parentSpan.appendChild(createEl("span", {
  91521. className: "vjs-icon-placeholder"
  91522. }, {
  91523. "aria-hidden": true
  91524. }));
  91525. parentSpan.appendChild(createEl("span", {
  91526. className: "vjs-control-text",
  91527. textContent: " " + this.localize("Captions")
  91528. }));
  91529. }
  91530. return el;
  91531. };
  91532. return SubsCapsMenuItem2;
  91533. }(TextTrackMenuItem);
  91534. Component$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem);
  91535. var SubsCapsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91536. _inheritsLoose(SubsCapsButton2, _TextTrackButton);
  91537. function SubsCapsButton2(player, options2) {
  91538. var _this;
  91539. if (options2 === void 0) {
  91540. options2 = {};
  91541. }
  91542. _this = _TextTrackButton.call(this, player, options2) || this;
  91543. _this.label_ = "subtitles";
  91544. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(_this.player_.language_) > -1) {
  91545. _this.label_ = "captions";
  91546. }
  91547. _this.menuButton_.controlText(toTitleCase$1(_this.label_));
  91548. return _this;
  91549. }
  91550. var _proto = SubsCapsButton2.prototype;
  91551. _proto.buildCSSClass = function buildCSSClass() {
  91552. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91553. };
  91554. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91555. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91556. };
  91557. _proto.createItems = function createItems() {
  91558. var items = [];
  91559. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91560. items.push(new CaptionSettingsMenuItem(this.player_, {
  91561. kind: this.label_
  91562. }));
  91563. this.hideThreshold_ += 1;
  91564. }
  91565. items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem);
  91566. return items;
  91567. };
  91568. return SubsCapsButton2;
  91569. }(TextTrackButton);
  91570. SubsCapsButton.prototype.kinds_ = ["captions", "subtitles"];
  91571. SubsCapsButton.prototype.controlText_ = "Subtitles";
  91572. Component$1.registerComponent("SubsCapsButton", SubsCapsButton);
  91573. var AudioTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91574. _inheritsLoose(AudioTrackMenuItem2, _MenuItem);
  91575. function AudioTrackMenuItem2(player, options2) {
  91576. var _this;
  91577. var track = options2.track;
  91578. var tracks = player.audioTracks();
  91579. options2.label = track.label || track.language || "Unknown";
  91580. options2.selected = track.enabled;
  91581. _this = _MenuItem.call(this, player, options2) || this;
  91582. _this.track = track;
  91583. _this.addClass("vjs-" + track.kind + "-menu-item");
  91584. var changeHandler = function changeHandler2() {
  91585. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  91586. args[_key] = arguments[_key];
  91587. }
  91588. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  91589. };
  91590. tracks.addEventListener("change", changeHandler);
  91591. _this.on("dispose", function() {
  91592. tracks.removeEventListener("change", changeHandler);
  91593. });
  91594. return _this;
  91595. }
  91596. var _proto = AudioTrackMenuItem2.prototype;
  91597. _proto.createEl = function createEl$12(type2, props, attrs) {
  91598. var el = _MenuItem.prototype.createEl.call(this, type2, props, attrs);
  91599. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91600. if (this.options_.track.kind === "main-desc") {
  91601. parentSpan.appendChild(createEl("span", {
  91602. className: "vjs-icon-placeholder"
  91603. }, {
  91604. "aria-hidden": true
  91605. }));
  91606. parentSpan.appendChild(createEl("span", {
  91607. className: "vjs-control-text",
  91608. textContent: " " + this.localize("Descriptions")
  91609. }));
  91610. }
  91611. return el;
  91612. };
  91613. _proto.handleClick = function handleClick(event2) {
  91614. _MenuItem.prototype.handleClick.call(this, event2);
  91615. this.track.enabled = true;
  91616. if (this.player_.tech_.featuresNativeAudioTracks) {
  91617. var tracks = this.player_.audioTracks();
  91618. for (var i2 = 0; i2 < tracks.length; i2++) {
  91619. var track = tracks[i2];
  91620. if (track === this.track) {
  91621. continue;
  91622. }
  91623. track.enabled = track === this.track;
  91624. }
  91625. }
  91626. };
  91627. _proto.handleTracksChange = function handleTracksChange(event2) {
  91628. this.selected(this.track.enabled);
  91629. };
  91630. return AudioTrackMenuItem2;
  91631. }(MenuItem);
  91632. Component$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem);
  91633. var AudioTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91634. _inheritsLoose(AudioTrackButton2, _TrackButton);
  91635. function AudioTrackButton2(player, options2) {
  91636. if (options2 === void 0) {
  91637. options2 = {};
  91638. }
  91639. options2.tracks = player.audioTracks();
  91640. return _TrackButton.call(this, player, options2) || this;
  91641. }
  91642. var _proto = AudioTrackButton2.prototype;
  91643. _proto.buildCSSClass = function buildCSSClass() {
  91644. return "vjs-audio-button " + _TrackButton.prototype.buildCSSClass.call(this);
  91645. };
  91646. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91647. return "vjs-audio-button " + _TrackButton.prototype.buildWrapperCSSClass.call(this);
  91648. };
  91649. _proto.createItems = function createItems(items) {
  91650. if (items === void 0) {
  91651. items = [];
  91652. }
  91653. this.hideThreshold_ = 1;
  91654. var tracks = this.player_.audioTracks();
  91655. for (var i2 = 0; i2 < tracks.length; i2++) {
  91656. var track = tracks[i2];
  91657. items.push(new AudioTrackMenuItem(this.player_, {
  91658. track,
  91659. selectable: true,
  91660. multiSelectable: false
  91661. }));
  91662. }
  91663. return items;
  91664. };
  91665. return AudioTrackButton2;
  91666. }(TrackButton);
  91667. AudioTrackButton.prototype.controlText_ = "Audio Track";
  91668. Component$1.registerComponent("AudioTrackButton", AudioTrackButton);
  91669. var PlaybackRateMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91670. _inheritsLoose(PlaybackRateMenuItem2, _MenuItem);
  91671. function PlaybackRateMenuItem2(player, options2) {
  91672. var _this;
  91673. var label2 = options2.rate;
  91674. var rate = parseFloat(label2, 10);
  91675. options2.label = label2;
  91676. options2.selected = rate === player.playbackRate();
  91677. options2.selectable = true;
  91678. options2.multiSelectable = false;
  91679. _this = _MenuItem.call(this, player, options2) || this;
  91680. _this.label = label2;
  91681. _this.rate = rate;
  91682. _this.on(player, "ratechange", function(e) {
  91683. return _this.update(e);
  91684. });
  91685. return _this;
  91686. }
  91687. var _proto = PlaybackRateMenuItem2.prototype;
  91688. _proto.handleClick = function handleClick(event2) {
  91689. _MenuItem.prototype.handleClick.call(this);
  91690. this.player().playbackRate(this.rate);
  91691. };
  91692. _proto.update = function update(event2) {
  91693. this.selected(this.player().playbackRate() === this.rate);
  91694. };
  91695. return PlaybackRateMenuItem2;
  91696. }(MenuItem);
  91697. PlaybackRateMenuItem.prototype.contentElType = "button";
  91698. Component$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem);
  91699. var PlaybackRateMenuButton = /* @__PURE__ */ function(_MenuButton) {
  91700. _inheritsLoose(PlaybackRateMenuButton2, _MenuButton);
  91701. function PlaybackRateMenuButton2(player, options2) {
  91702. var _this;
  91703. _this = _MenuButton.call(this, player, options2) || this;
  91704. _this.menuButton_.el_.setAttribute("aria-describedby", _this.labelElId_);
  91705. _this.updateVisibility();
  91706. _this.updateLabel();
  91707. _this.on(player, "loadstart", function(e) {
  91708. return _this.updateVisibility(e);
  91709. });
  91710. _this.on(player, "ratechange", function(e) {
  91711. return _this.updateLabel(e);
  91712. });
  91713. _this.on(player, "playbackrateschange", function(e) {
  91714. return _this.handlePlaybackRateschange(e);
  91715. });
  91716. return _this;
  91717. }
  91718. var _proto = PlaybackRateMenuButton2.prototype;
  91719. _proto.createEl = function createEl$12() {
  91720. var el = _MenuButton.prototype.createEl.call(this);
  91721. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  91722. this.labelEl_ = createEl("div", {
  91723. className: "vjs-playback-rate-value",
  91724. id: this.labelElId_,
  91725. textContent: "1x"
  91726. });
  91727. el.appendChild(this.labelEl_);
  91728. return el;
  91729. };
  91730. _proto.dispose = function dispose() {
  91731. this.labelEl_ = null;
  91732. _MenuButton.prototype.dispose.call(this);
  91733. };
  91734. _proto.buildCSSClass = function buildCSSClass() {
  91735. return "vjs-playback-rate " + _MenuButton.prototype.buildCSSClass.call(this);
  91736. };
  91737. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91738. return "vjs-playback-rate " + _MenuButton.prototype.buildWrapperCSSClass.call(this);
  91739. };
  91740. _proto.createItems = function createItems() {
  91741. var rates = this.playbackRates();
  91742. var items = [];
  91743. for (var i2 = rates.length - 1; i2 >= 0; i2--) {
  91744. items.push(new PlaybackRateMenuItem(this.player(), {
  91745. rate: rates[i2] + "x"
  91746. }));
  91747. }
  91748. return items;
  91749. };
  91750. _proto.updateARIAAttributes = function updateARIAAttributes() {
  91751. this.el().setAttribute("aria-valuenow", this.player().playbackRate());
  91752. };
  91753. _proto.handleClick = function handleClick(event2) {
  91754. var currentRate = this.player().playbackRate();
  91755. var rates = this.playbackRates();
  91756. var currentIndex = rates.indexOf(currentRate);
  91757. var newIndex = (currentIndex + 1) % rates.length;
  91758. this.player().playbackRate(rates[newIndex]);
  91759. };
  91760. _proto.handlePlaybackRateschange = function handlePlaybackRateschange(event2) {
  91761. this.update();
  91762. };
  91763. _proto.playbackRates = function playbackRates() {
  91764. var player = this.player();
  91765. return player.playbackRates && player.playbackRates() || [];
  91766. };
  91767. _proto.playbackRateSupported = function playbackRateSupported() {
  91768. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  91769. };
  91770. _proto.updateVisibility = function updateVisibility(event2) {
  91771. if (this.playbackRateSupported()) {
  91772. this.removeClass("vjs-hidden");
  91773. } else {
  91774. this.addClass("vjs-hidden");
  91775. }
  91776. };
  91777. _proto.updateLabel = function updateLabel(event2) {
  91778. if (this.playbackRateSupported()) {
  91779. this.labelEl_.textContent = this.player().playbackRate() + "x";
  91780. }
  91781. };
  91782. return PlaybackRateMenuButton2;
  91783. }(MenuButton);
  91784. PlaybackRateMenuButton.prototype.controlText_ = "Playback Rate";
  91785. Component$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton);
  91786. var Spacer = /* @__PURE__ */ function(_Component) {
  91787. _inheritsLoose(Spacer2, _Component);
  91788. function Spacer2() {
  91789. return _Component.apply(this, arguments) || this;
  91790. }
  91791. var _proto = Spacer2.prototype;
  91792. _proto.buildCSSClass = function buildCSSClass() {
  91793. return "vjs-spacer " + _Component.prototype.buildCSSClass.call(this);
  91794. };
  91795. _proto.createEl = function createEl2(tag, props, attributes) {
  91796. if (tag === void 0) {
  91797. tag = "div";
  91798. }
  91799. if (props === void 0) {
  91800. props = {};
  91801. }
  91802. if (attributes === void 0) {
  91803. attributes = {};
  91804. }
  91805. if (!props.className) {
  91806. props.className = this.buildCSSClass();
  91807. }
  91808. return _Component.prototype.createEl.call(this, tag, props, attributes);
  91809. };
  91810. return Spacer2;
  91811. }(Component$1);
  91812. Component$1.registerComponent("Spacer", Spacer);
  91813. var CustomControlSpacer = /* @__PURE__ */ function(_Spacer) {
  91814. _inheritsLoose(CustomControlSpacer2, _Spacer);
  91815. function CustomControlSpacer2() {
  91816. return _Spacer.apply(this, arguments) || this;
  91817. }
  91818. var _proto = CustomControlSpacer2.prototype;
  91819. _proto.buildCSSClass = function buildCSSClass() {
  91820. return "vjs-custom-control-spacer " + _Spacer.prototype.buildCSSClass.call(this);
  91821. };
  91822. _proto.createEl = function createEl2() {
  91823. return _Spacer.prototype.createEl.call(this, "div", {
  91824. className: this.buildCSSClass(),
  91825. textContent: "\xA0"
  91826. });
  91827. };
  91828. return CustomControlSpacer2;
  91829. }(Spacer);
  91830. Component$1.registerComponent("CustomControlSpacer", CustomControlSpacer);
  91831. var ControlBar = /* @__PURE__ */ function(_Component) {
  91832. _inheritsLoose(ControlBar2, _Component);
  91833. function ControlBar2() {
  91834. return _Component.apply(this, arguments) || this;
  91835. }
  91836. var _proto = ControlBar2.prototype;
  91837. _proto.createEl = function createEl2() {
  91838. return _Component.prototype.createEl.call(this, "div", {
  91839. className: "vjs-control-bar",
  91840. dir: "ltr"
  91841. });
  91842. };
  91843. return ControlBar2;
  91844. }(Component$1);
  91845. ControlBar.prototype.options_ = {
  91846. children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  91847. };
  91848. if ("exitPictureInPicture" in document_1) {
  91849. ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  91850. }
  91851. Component$1.registerComponent("ControlBar", ControlBar);
  91852. var ErrorDisplay = /* @__PURE__ */ function(_ModalDialog) {
  91853. _inheritsLoose(ErrorDisplay2, _ModalDialog);
  91854. function ErrorDisplay2(player, options2) {
  91855. var _this;
  91856. _this = _ModalDialog.call(this, player, options2) || this;
  91857. _this.on(player, "error", function(e) {
  91858. return _this.open(e);
  91859. });
  91860. return _this;
  91861. }
  91862. var _proto = ErrorDisplay2.prototype;
  91863. _proto.buildCSSClass = function buildCSSClass() {
  91864. return "vjs-error-display " + _ModalDialog.prototype.buildCSSClass.call(this);
  91865. };
  91866. _proto.content = function content() {
  91867. var error = this.player().error();
  91868. return error ? this.localize(error.message) : "";
  91869. };
  91870. return ErrorDisplay2;
  91871. }(ModalDialog);
  91872. ErrorDisplay.prototype.options_ = _extends$2({}, ModalDialog.prototype.options_, {
  91873. pauseOnOpen: false,
  91874. fillAlways: true,
  91875. temporary: false,
  91876. uncloseable: true
  91877. });
  91878. Component$1.registerComponent("ErrorDisplay", ErrorDisplay);
  91879. var LOCAL_STORAGE_KEY$1 = "vjs-text-track-settings";
  91880. var COLOR_BLACK = ["#000", "Black"];
  91881. var COLOR_BLUE = ["#00F", "Blue"];
  91882. var COLOR_CYAN = ["#0FF", "Cyan"];
  91883. var COLOR_GREEN = ["#0F0", "Green"];
  91884. var COLOR_MAGENTA = ["#F0F", "Magenta"];
  91885. var COLOR_RED = ["#F00", "Red"];
  91886. var COLOR_WHITE = ["#FFF", "White"];
  91887. var COLOR_YELLOW = ["#FF0", "Yellow"];
  91888. var OPACITY_OPAQUE = ["1", "Opaque"];
  91889. var OPACITY_SEMI = ["0.5", "Semi-Transparent"];
  91890. var OPACITY_TRANS = ["0", "Transparent"];
  91891. var selectConfigs = {
  91892. backgroundColor: {
  91893. selector: ".vjs-bg-color > select",
  91894. id: "captions-background-color-%s",
  91895. label: "Color",
  91896. options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91897. },
  91898. backgroundOpacity: {
  91899. selector: ".vjs-bg-opacity > select",
  91900. id: "captions-background-opacity-%s",
  91901. label: "Transparency",
  91902. options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS]
  91903. },
  91904. color: {
  91905. selector: ".vjs-fg-color > select",
  91906. id: "captions-foreground-color-%s",
  91907. label: "Color",
  91908. options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91909. },
  91910. edgeStyle: {
  91911. selector: ".vjs-edge-style > select",
  91912. id: "%s",
  91913. label: "Text Edge Style",
  91914. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  91915. },
  91916. fontFamily: {
  91917. selector: ".vjs-font-family > select",
  91918. id: "captions-font-family-%s",
  91919. label: "Font Family",
  91920. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  91921. },
  91922. fontPercent: {
  91923. selector: ".vjs-font-percent > select",
  91924. id: "captions-font-size-%s",
  91925. label: "Font Size",
  91926. 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%"]],
  91927. "default": 2,
  91928. parser: function parser(v) {
  91929. return v === "1.00" ? null : Number(v);
  91930. }
  91931. },
  91932. textOpacity: {
  91933. selector: ".vjs-text-opacity > select",
  91934. id: "captions-foreground-opacity-%s",
  91935. label: "Transparency",
  91936. options: [OPACITY_OPAQUE, OPACITY_SEMI]
  91937. },
  91938. windowColor: {
  91939. selector: ".vjs-window-color > select",
  91940. id: "captions-window-color-%s",
  91941. label: "Color"
  91942. },
  91943. windowOpacity: {
  91944. selector: ".vjs-window-opacity > select",
  91945. id: "captions-window-opacity-%s",
  91946. label: "Transparency",
  91947. options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE]
  91948. }
  91949. };
  91950. selectConfigs.windowColor.options = selectConfigs.backgroundColor.options;
  91951. function parseOptionValue(value, parser2) {
  91952. if (parser2) {
  91953. value = parser2(value);
  91954. }
  91955. if (value && value !== "none") {
  91956. return value;
  91957. }
  91958. }
  91959. function getSelectedOptionValue(el, parser2) {
  91960. var value = el.options[el.options.selectedIndex].value;
  91961. return parseOptionValue(value, parser2);
  91962. }
  91963. function setSelectedOption(el, value, parser2) {
  91964. if (!value) {
  91965. return;
  91966. }
  91967. for (var i2 = 0; i2 < el.options.length; i2++) {
  91968. if (parseOptionValue(el.options[i2].value, parser2) === value) {
  91969. el.selectedIndex = i2;
  91970. break;
  91971. }
  91972. }
  91973. }
  91974. var TextTrackSettings = /* @__PURE__ */ function(_ModalDialog) {
  91975. _inheritsLoose(TextTrackSettings2, _ModalDialog);
  91976. function TextTrackSettings2(player, options2) {
  91977. var _this;
  91978. options2.temporary = false;
  91979. _this = _ModalDialog.call(this, player, options2) || this;
  91980. _this.updateDisplay = _this.updateDisplay.bind(_assertThisInitialized(_this));
  91981. _this.fill();
  91982. _this.hasBeenOpened_ = _this.hasBeenFilled_ = true;
  91983. _this.endDialog = createEl("p", {
  91984. className: "vjs-control-text",
  91985. textContent: _this.localize("End of dialog window.")
  91986. });
  91987. _this.el().appendChild(_this.endDialog);
  91988. _this.setDefaults();
  91989. if (options2.persistTextTrackSettings === void 0) {
  91990. _this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings;
  91991. }
  91992. _this.on(_this.$(".vjs-done-button"), "click", function() {
  91993. _this.saveSettings();
  91994. _this.close();
  91995. });
  91996. _this.on(_this.$(".vjs-default-button"), "click", function() {
  91997. _this.setDefaults();
  91998. _this.updateDisplay();
  91999. });
  92000. each(selectConfigs, function(config) {
  92001. _this.on(_this.$(config.selector), "change", _this.updateDisplay);
  92002. });
  92003. if (_this.options_.persistTextTrackSettings) {
  92004. _this.restoreSettings();
  92005. }
  92006. return _this;
  92007. }
  92008. var _proto = TextTrackSettings2.prototype;
  92009. _proto.dispose = function dispose() {
  92010. this.endDialog = null;
  92011. _ModalDialog.prototype.dispose.call(this);
  92012. };
  92013. _proto.createElSelect_ = function createElSelect_(key, legendId, type2) {
  92014. var _this2 = this;
  92015. if (legendId === void 0) {
  92016. legendId = "";
  92017. }
  92018. if (type2 === void 0) {
  92019. type2 = "label";
  92020. }
  92021. var config = selectConfigs[key];
  92022. var id = config.id.replace("%s", this.id_);
  92023. var selectLabelledbyIds = [legendId, id].join(" ").trim();
  92024. return ["<" + type2 + ' id="' + id + '" class="' + (type2 === "label" ? "vjs-label" : "") + '">', this.localize(config.label), "</" + type2 + ">", '<select aria-labelledby="' + selectLabelledbyIds + '">'].concat(config.options.map(function(o) {
  92025. var optionId = id + "-" + o[1].replace(/\W+/g, "");
  92026. return ['<option id="' + optionId + '" value="' + o[0] + '" ', 'aria-labelledby="' + selectLabelledbyIds + " " + optionId + '">', _this2.localize(o[1]), "</option>"].join("");
  92027. })).concat("</select>").join("");
  92028. };
  92029. _proto.createElFgColor_ = function createElFgColor_() {
  92030. var legendId = "captions-text-legend-" + this.id_;
  92031. 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("");
  92032. };
  92033. _proto.createElBgColor_ = function createElBgColor_() {
  92034. var legendId = "captions-background-" + this.id_;
  92035. 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("");
  92036. };
  92037. _proto.createElWinColor_ = function createElWinColor_() {
  92038. var legendId = "captions-window-" + this.id_;
  92039. 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("");
  92040. };
  92041. _proto.createElColors_ = function createElColors_() {
  92042. return createEl("div", {
  92043. className: "vjs-track-settings-colors",
  92044. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  92045. });
  92046. };
  92047. _proto.createElFont_ = function createElFont_() {
  92048. return createEl("div", {
  92049. className: "vjs-track-settings-font",
  92050. 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("")
  92051. });
  92052. };
  92053. _proto.createElControls_ = function createElControls_() {
  92054. var defaultsDescription = this.localize("restore all settings to the default values");
  92055. return createEl("div", {
  92056. className: "vjs-track-settings-controls",
  92057. 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("")
  92058. });
  92059. };
  92060. _proto.content = function content() {
  92061. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  92062. };
  92063. _proto.label = function label2() {
  92064. return this.localize("Caption Settings Dialog");
  92065. };
  92066. _proto.description = function description() {
  92067. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  92068. };
  92069. _proto.buildCSSClass = function buildCSSClass() {
  92070. return _ModalDialog.prototype.buildCSSClass.call(this) + " vjs-text-track-settings";
  92071. };
  92072. _proto.getValues = function getValues() {
  92073. var _this3 = this;
  92074. return reduce(selectConfigs, function(accum, config, key) {
  92075. var value = getSelectedOptionValue(_this3.$(config.selector), config.parser);
  92076. if (value !== void 0) {
  92077. accum[key] = value;
  92078. }
  92079. return accum;
  92080. }, {});
  92081. };
  92082. _proto.setValues = function setValues(values3) {
  92083. var _this4 = this;
  92084. each(selectConfigs, function(config, key) {
  92085. setSelectedOption(_this4.$(config.selector), values3[key], config.parser);
  92086. });
  92087. };
  92088. _proto.setDefaults = function setDefaults() {
  92089. var _this5 = this;
  92090. each(selectConfigs, function(config) {
  92091. var index2 = config.hasOwnProperty("default") ? config["default"] : 0;
  92092. _this5.$(config.selector).selectedIndex = index2;
  92093. });
  92094. };
  92095. _proto.restoreSettings = function restoreSettings() {
  92096. var values3;
  92097. try {
  92098. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1));
  92099. } catch (err) {
  92100. log$1.warn(err);
  92101. }
  92102. if (values3) {
  92103. this.setValues(values3);
  92104. }
  92105. };
  92106. _proto.saveSettings = function saveSettings() {
  92107. if (!this.options_.persistTextTrackSettings) {
  92108. return;
  92109. }
  92110. var values3 = this.getValues();
  92111. try {
  92112. if (Object.keys(values3).length) {
  92113. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1, JSON.stringify(values3));
  92114. } else {
  92115. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1);
  92116. }
  92117. } catch (err) {
  92118. log$1.warn(err);
  92119. }
  92120. };
  92121. _proto.updateDisplay = function updateDisplay() {
  92122. var ttDisplay = this.player_.getChild("textTrackDisplay");
  92123. if (ttDisplay) {
  92124. ttDisplay.updateDisplay();
  92125. }
  92126. };
  92127. _proto.conditionalBlur_ = function conditionalBlur_() {
  92128. this.previouslyActiveEl_ = null;
  92129. var cb = this.player_.controlBar;
  92130. var subsCapsBtn = cb && cb.subsCapsButton;
  92131. var ccBtn = cb && cb.captionsButton;
  92132. if (subsCapsBtn) {
  92133. subsCapsBtn.focus();
  92134. } else if (ccBtn) {
  92135. ccBtn.focus();
  92136. }
  92137. };
  92138. return TextTrackSettings2;
  92139. }(ModalDialog);
  92140. Component$1.registerComponent("TextTrackSettings", TextTrackSettings);
  92141. var ResizeManager = /* @__PURE__ */ function(_Component) {
  92142. _inheritsLoose(ResizeManager2, _Component);
  92143. function ResizeManager2(player, options2) {
  92144. var _this;
  92145. var RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  92146. if (options2.ResizeObserver === null) {
  92147. RESIZE_OBSERVER_AVAILABLE = false;
  92148. }
  92149. var options_ = mergeOptions$3({
  92150. createEl: !RESIZE_OBSERVER_AVAILABLE,
  92151. reportTouchActivity: false
  92152. }, options2);
  92153. _this = _Component.call(this, player, options_) || this;
  92154. _this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  92155. _this.loadListener_ = null;
  92156. _this.resizeObserver_ = null;
  92157. _this.debouncedHandler_ = debounce(function() {
  92158. _this.resizeHandler();
  92159. }, 100, false, _assertThisInitialized(_this));
  92160. if (RESIZE_OBSERVER_AVAILABLE) {
  92161. _this.resizeObserver_ = new _this.ResizeObserver(_this.debouncedHandler_);
  92162. _this.resizeObserver_.observe(player.el());
  92163. } else {
  92164. _this.loadListener_ = function() {
  92165. if (!_this.el_ || !_this.el_.contentWindow) {
  92166. return;
  92167. }
  92168. var debouncedHandler_ = _this.debouncedHandler_;
  92169. var unloadListener_ = _this.unloadListener_ = function() {
  92170. off(this, "resize", debouncedHandler_);
  92171. off(this, "unload", unloadListener_);
  92172. unloadListener_ = null;
  92173. };
  92174. on(_this.el_.contentWindow, "unload", unloadListener_);
  92175. on(_this.el_.contentWindow, "resize", debouncedHandler_);
  92176. };
  92177. _this.one("load", _this.loadListener_);
  92178. }
  92179. return _this;
  92180. }
  92181. var _proto = ResizeManager2.prototype;
  92182. _proto.createEl = function createEl2() {
  92183. return _Component.prototype.createEl.call(this, "iframe", {
  92184. className: "vjs-resize-manager",
  92185. tabIndex: -1,
  92186. title: this.localize("No content")
  92187. }, {
  92188. "aria-hidden": "true"
  92189. });
  92190. };
  92191. _proto.resizeHandler = function resizeHandler() {
  92192. if (!this.player_ || !this.player_.trigger) {
  92193. return;
  92194. }
  92195. this.player_.trigger("playerresize");
  92196. };
  92197. _proto.dispose = function dispose() {
  92198. if (this.debouncedHandler_) {
  92199. this.debouncedHandler_.cancel();
  92200. }
  92201. if (this.resizeObserver_) {
  92202. if (this.player_.el()) {
  92203. this.resizeObserver_.unobserve(this.player_.el());
  92204. }
  92205. this.resizeObserver_.disconnect();
  92206. }
  92207. if (this.loadListener_) {
  92208. this.off("load", this.loadListener_);
  92209. }
  92210. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  92211. this.unloadListener_.call(this.el_.contentWindow);
  92212. }
  92213. this.ResizeObserver = null;
  92214. this.resizeObserver = null;
  92215. this.debouncedHandler_ = null;
  92216. this.loadListener_ = null;
  92217. _Component.prototype.dispose.call(this);
  92218. };
  92219. return ResizeManager2;
  92220. }(Component$1);
  92221. Component$1.registerComponent("ResizeManager", ResizeManager);
  92222. var defaults$1 = {
  92223. trackingThreshold: 20,
  92224. liveTolerance: 15
  92225. };
  92226. var LiveTracker = /* @__PURE__ */ function(_Component) {
  92227. _inheritsLoose(LiveTracker2, _Component);
  92228. function LiveTracker2(player, options2) {
  92229. var _this;
  92230. var options_ = mergeOptions$3(defaults$1, options2, {
  92231. createEl: false
  92232. });
  92233. _this = _Component.call(this, player, options_) || this;
  92234. _this.handleVisibilityChange_ = function(e) {
  92235. return _this.handleVisibilityChange(e);
  92236. };
  92237. _this.trackLiveHandler_ = function() {
  92238. return _this.trackLive_();
  92239. };
  92240. _this.handlePlay_ = function(e) {
  92241. return _this.handlePlay(e);
  92242. };
  92243. _this.handleFirstTimeupdate_ = function(e) {
  92244. return _this.handleFirstTimeupdate(e);
  92245. };
  92246. _this.handleSeeked_ = function(e) {
  92247. return _this.handleSeeked(e);
  92248. };
  92249. _this.seekToLiveEdge_ = function(e) {
  92250. return _this.seekToLiveEdge(e);
  92251. };
  92252. _this.reset_();
  92253. _this.on(_this.player_, "durationchange", function(e) {
  92254. return _this.handleDurationchange(e);
  92255. });
  92256. _this.on(_this.player_, "canplay", function() {
  92257. return _this.toggleTracking();
  92258. });
  92259. if (IE_VERSION && "hidden" in document_1 && "visibilityState" in document_1) {
  92260. _this.on(document_1, "visibilitychange", _this.handleVisibilityChange_);
  92261. }
  92262. return _this;
  92263. }
  92264. var _proto = LiveTracker2.prototype;
  92265. _proto.handleVisibilityChange = function handleVisibilityChange() {
  92266. if (this.player_.duration() !== Infinity) {
  92267. return;
  92268. }
  92269. if (document_1.hidden) {
  92270. this.stopTracking();
  92271. } else {
  92272. this.startTracking();
  92273. }
  92274. };
  92275. _proto.trackLive_ = function trackLive_() {
  92276. var seekable3 = this.player_.seekable();
  92277. if (!seekable3 || !seekable3.length) {
  92278. return;
  92279. }
  92280. var newTime = Number(window_1.performance.now().toFixed(4));
  92281. var deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  92282. this.lastTime_ = newTime;
  92283. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  92284. var liveCurrentTime = this.liveCurrentTime();
  92285. var currentTime = this.player_.currentTime();
  92286. var isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  92287. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  92288. isBehind = false;
  92289. }
  92290. if (isBehind !== this.behindLiveEdge_) {
  92291. this.behindLiveEdge_ = isBehind;
  92292. this.trigger("liveedgechange");
  92293. }
  92294. };
  92295. _proto.handleDurationchange = function handleDurationchange() {
  92296. this.toggleTracking();
  92297. };
  92298. _proto.toggleTracking = function toggleTracking() {
  92299. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  92300. if (this.player_.options_.liveui) {
  92301. this.player_.addClass("vjs-liveui");
  92302. }
  92303. this.startTracking();
  92304. } else {
  92305. this.player_.removeClass("vjs-liveui");
  92306. this.stopTracking();
  92307. }
  92308. };
  92309. _proto.startTracking = function startTracking() {
  92310. if (this.isTracking()) {
  92311. return;
  92312. }
  92313. if (!this.timeupdateSeen_) {
  92314. this.timeupdateSeen_ = this.player_.hasStarted();
  92315. }
  92316. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL);
  92317. this.trackLive_();
  92318. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92319. if (!this.timeupdateSeen_) {
  92320. this.one(this.player_, "play", this.handlePlay_);
  92321. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92322. } else {
  92323. this.on(this.player_, "seeked", this.handleSeeked_);
  92324. }
  92325. };
  92326. _proto.handleFirstTimeupdate = function handleFirstTimeupdate() {
  92327. this.timeupdateSeen_ = true;
  92328. this.on(this.player_, "seeked", this.handleSeeked_);
  92329. };
  92330. _proto.handleSeeked = function handleSeeked() {
  92331. var timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  92332. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  92333. this.nextSeekedFromUser_ = false;
  92334. this.trackLive_();
  92335. };
  92336. _proto.handlePlay = function handlePlay() {
  92337. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  92338. };
  92339. _proto.reset_ = function reset_() {
  92340. this.lastTime_ = -1;
  92341. this.pastSeekEnd_ = 0;
  92342. this.lastSeekEnd_ = -1;
  92343. this.behindLiveEdge_ = true;
  92344. this.timeupdateSeen_ = false;
  92345. this.seekedBehindLive_ = false;
  92346. this.nextSeekedFromUser_ = false;
  92347. this.clearInterval(this.trackingInterval_);
  92348. this.trackingInterval_ = null;
  92349. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92350. this.off(this.player_, "seeked", this.handleSeeked_);
  92351. this.off(this.player_, "play", this.handlePlay_);
  92352. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92353. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  92354. };
  92355. _proto.nextSeekedFromUser = function nextSeekedFromUser() {
  92356. this.nextSeekedFromUser_ = true;
  92357. };
  92358. _proto.stopTracking = function stopTracking() {
  92359. if (!this.isTracking()) {
  92360. return;
  92361. }
  92362. this.reset_();
  92363. this.trigger("liveedgechange");
  92364. };
  92365. _proto.seekableEnd = function seekableEnd() {
  92366. var seekable3 = this.player_.seekable();
  92367. var seekableEnds = [];
  92368. var i2 = seekable3 ? seekable3.length : 0;
  92369. while (i2--) {
  92370. seekableEnds.push(seekable3.end(i2));
  92371. }
  92372. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  92373. };
  92374. _proto.seekableStart = function seekableStart() {
  92375. var seekable3 = this.player_.seekable();
  92376. var seekableStarts = [];
  92377. var i2 = seekable3 ? seekable3.length : 0;
  92378. while (i2--) {
  92379. seekableStarts.push(seekable3.start(i2));
  92380. }
  92381. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  92382. };
  92383. _proto.liveWindow = function liveWindow() {
  92384. var liveCurrentTime = this.liveCurrentTime();
  92385. if (liveCurrentTime === Infinity) {
  92386. return 0;
  92387. }
  92388. return liveCurrentTime - this.seekableStart();
  92389. };
  92390. _proto.isLive = function isLive() {
  92391. return this.isTracking();
  92392. };
  92393. _proto.atLiveEdge = function atLiveEdge() {
  92394. return !this.behindLiveEdge();
  92395. };
  92396. _proto.liveCurrentTime = function liveCurrentTime() {
  92397. return this.pastSeekEnd() + this.seekableEnd();
  92398. };
  92399. _proto.pastSeekEnd = function pastSeekEnd() {
  92400. var seekableEnd = this.seekableEnd();
  92401. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  92402. this.pastSeekEnd_ = 0;
  92403. }
  92404. this.lastSeekEnd_ = seekableEnd;
  92405. return this.pastSeekEnd_;
  92406. };
  92407. _proto.behindLiveEdge = function behindLiveEdge() {
  92408. return this.behindLiveEdge_;
  92409. };
  92410. _proto.isTracking = function isTracking() {
  92411. return typeof this.trackingInterval_ === "number";
  92412. };
  92413. _proto.seekToLiveEdge = function seekToLiveEdge() {
  92414. this.seekedBehindLive_ = false;
  92415. if (this.atLiveEdge()) {
  92416. return;
  92417. }
  92418. this.nextSeekedFromUser_ = false;
  92419. this.player_.currentTime(this.liveCurrentTime());
  92420. };
  92421. _proto.dispose = function dispose() {
  92422. this.off(document_1, "visibilitychange", this.handleVisibilityChange_);
  92423. this.stopTracking();
  92424. _Component.prototype.dispose.call(this);
  92425. };
  92426. return LiveTracker2;
  92427. }(Component$1);
  92428. Component$1.registerComponent("LiveTracker", LiveTracker);
  92429. var sourcesetLoad = function sourcesetLoad2(tech) {
  92430. var el = tech.el();
  92431. if (el.hasAttribute("src")) {
  92432. tech.triggerSourceset(el.src);
  92433. return true;
  92434. }
  92435. var sources = tech.$$("source");
  92436. var srcUrls = [];
  92437. var src = "";
  92438. if (!sources.length) {
  92439. return false;
  92440. }
  92441. for (var i2 = 0; i2 < sources.length; i2++) {
  92442. var url = sources[i2].src;
  92443. if (url && srcUrls.indexOf(url) === -1) {
  92444. srcUrls.push(url);
  92445. }
  92446. }
  92447. if (!srcUrls.length) {
  92448. return false;
  92449. }
  92450. if (srcUrls.length === 1) {
  92451. src = srcUrls[0];
  92452. }
  92453. tech.triggerSourceset(src);
  92454. return true;
  92455. };
  92456. var innerHTMLDescriptorPolyfill = Object.defineProperty({}, "innerHTML", {
  92457. get: function get2() {
  92458. return this.cloneNode(true).innerHTML;
  92459. },
  92460. set: function set2(v) {
  92461. var dummy = document_1.createElement(this.nodeName.toLowerCase());
  92462. dummy.innerHTML = v;
  92463. var docFrag = document_1.createDocumentFragment();
  92464. while (dummy.childNodes.length) {
  92465. docFrag.appendChild(dummy.childNodes[0]);
  92466. }
  92467. this.innerText = "";
  92468. window_1.Element.prototype.appendChild.call(this, docFrag);
  92469. return this.innerHTML;
  92470. }
  92471. });
  92472. var getDescriptor = function getDescriptor2(priority, prop) {
  92473. var descriptor = {};
  92474. for (var i2 = 0; i2 < priority.length; i2++) {
  92475. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  92476. if (descriptor && descriptor.set && descriptor.get) {
  92477. break;
  92478. }
  92479. }
  92480. descriptor.enumerable = true;
  92481. descriptor.configurable = true;
  92482. return descriptor;
  92483. };
  92484. var getInnerHTMLDescriptor = function getInnerHTMLDescriptor2(tech) {
  92485. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill], "innerHTML");
  92486. };
  92487. var firstSourceWatch = function firstSourceWatch2(tech) {
  92488. var el = tech.el();
  92489. if (el.resetSourceWatch_) {
  92490. return;
  92491. }
  92492. var old = {};
  92493. var innerDescriptor = getInnerHTMLDescriptor(tech);
  92494. var appendWrapper = function appendWrapper2(appendFn) {
  92495. return function() {
  92496. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  92497. args[_key] = arguments[_key];
  92498. }
  92499. var retval = appendFn.apply(el, args);
  92500. sourcesetLoad(tech);
  92501. return retval;
  92502. };
  92503. };
  92504. ["append", "appendChild", "insertAdjacentHTML"].forEach(function(k) {
  92505. if (!el[k]) {
  92506. return;
  92507. }
  92508. old[k] = el[k];
  92509. el[k] = appendWrapper(old[k]);
  92510. });
  92511. Object.defineProperty(el, "innerHTML", mergeOptions$3(innerDescriptor, {
  92512. set: appendWrapper(innerDescriptor.set)
  92513. }));
  92514. el.resetSourceWatch_ = function() {
  92515. el.resetSourceWatch_ = null;
  92516. Object.keys(old).forEach(function(k) {
  92517. el[k] = old[k];
  92518. });
  92519. Object.defineProperty(el, "innerHTML", innerDescriptor);
  92520. };
  92521. tech.one("sourceset", el.resetSourceWatch_);
  92522. };
  92523. var srcDescriptorPolyfill = Object.defineProperty({}, "src", {
  92524. get: function get3() {
  92525. if (this.hasAttribute("src")) {
  92526. return getAbsoluteURL(window_1.Element.prototype.getAttribute.call(this, "src"));
  92527. }
  92528. return "";
  92529. },
  92530. set: function set3(v) {
  92531. window_1.Element.prototype.setAttribute.call(this, "src", v);
  92532. return v;
  92533. }
  92534. });
  92535. var getSrcDescriptor = function getSrcDescriptor2(tech) {
  92536. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill], "src");
  92537. };
  92538. var setupSourceset = function setupSourceset2(tech) {
  92539. if (!tech.featuresSourceset) {
  92540. return;
  92541. }
  92542. var el = tech.el();
  92543. if (el.resetSourceset_) {
  92544. return;
  92545. }
  92546. var srcDescriptor = getSrcDescriptor(tech);
  92547. var oldSetAttribute = el.setAttribute;
  92548. var oldLoad = el.load;
  92549. Object.defineProperty(el, "src", mergeOptions$3(srcDescriptor, {
  92550. set: function set4(v) {
  92551. var retval = srcDescriptor.set.call(el, v);
  92552. tech.triggerSourceset(el.src);
  92553. return retval;
  92554. }
  92555. }));
  92556. el.setAttribute = function(n, v) {
  92557. var retval = oldSetAttribute.call(el, n, v);
  92558. if (/src/i.test(n)) {
  92559. tech.triggerSourceset(el.src);
  92560. }
  92561. return retval;
  92562. };
  92563. el.load = function() {
  92564. var retval = oldLoad.call(el);
  92565. if (!sourcesetLoad(tech)) {
  92566. tech.triggerSourceset("");
  92567. firstSourceWatch(tech);
  92568. }
  92569. return retval;
  92570. };
  92571. if (el.currentSrc) {
  92572. tech.triggerSourceset(el.currentSrc);
  92573. } else if (!sourcesetLoad(tech)) {
  92574. firstSourceWatch(tech);
  92575. }
  92576. el.resetSourceset_ = function() {
  92577. el.resetSourceset_ = null;
  92578. el.load = oldLoad;
  92579. el.setAttribute = oldSetAttribute;
  92580. Object.defineProperty(el, "src", srcDescriptor);
  92581. if (el.resetSourceWatch_) {
  92582. el.resetSourceWatch_();
  92583. }
  92584. };
  92585. };
  92586. var defineLazyProperty = function defineLazyProperty2(obj, key, getValue2, setter) {
  92587. if (setter === void 0) {
  92588. setter = true;
  92589. }
  92590. var set4 = function set5(value) {
  92591. return Object.defineProperty(obj, key, {
  92592. value,
  92593. enumerable: true,
  92594. writable: true
  92595. });
  92596. };
  92597. var options2 = {
  92598. configurable: true,
  92599. enumerable: true,
  92600. get: function get7() {
  92601. var value = getValue2();
  92602. set4(value);
  92603. return value;
  92604. }
  92605. };
  92606. if (setter) {
  92607. options2.set = set4;
  92608. }
  92609. return Object.defineProperty(obj, key, options2);
  92610. };
  92611. var Html5$1 = /* @__PURE__ */ function(_Tech) {
  92612. _inheritsLoose(Html52, _Tech);
  92613. function Html52(options2, ready) {
  92614. var _this;
  92615. _this = _Tech.call(this, options2, ready) || this;
  92616. var source = options2.source;
  92617. var crossoriginTracks = false;
  92618. _this.featuresVideoFrameCallback = _this.featuresVideoFrameCallback && _this.el_.tagName === "VIDEO";
  92619. if (source && (_this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  92620. _this.setSource(source);
  92621. } else {
  92622. _this.handleLateInit_(_this.el_);
  92623. }
  92624. if (options2.enableSourceset) {
  92625. _this.setupSourcesetHandling_();
  92626. }
  92627. _this.isScrubbing_ = false;
  92628. if (_this.el_.hasChildNodes()) {
  92629. var nodes = _this.el_.childNodes;
  92630. var nodesLength = nodes.length;
  92631. var removeNodes = [];
  92632. while (nodesLength--) {
  92633. var node = nodes[nodesLength];
  92634. var nodeName = node.nodeName.toLowerCase();
  92635. if (nodeName === "track") {
  92636. if (!_this.featuresNativeTextTracks) {
  92637. removeNodes.push(node);
  92638. } else {
  92639. _this.remoteTextTrackEls().addTrackElement_(node);
  92640. _this.remoteTextTracks().addTrack(node.track);
  92641. _this.textTracks().addTrack(node.track);
  92642. if (!crossoriginTracks && !_this.el_.hasAttribute("crossorigin") && isCrossOrigin(node.src)) {
  92643. crossoriginTracks = true;
  92644. }
  92645. }
  92646. }
  92647. }
  92648. for (var i2 = 0; i2 < removeNodes.length; i2++) {
  92649. _this.el_.removeChild(removeNodes[i2]);
  92650. }
  92651. }
  92652. _this.proxyNativeTracks_();
  92653. if (_this.featuresNativeTextTracks && crossoriginTracks) {
  92654. 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.");
  92655. }
  92656. _this.restoreMetadataTracksInIOSNativePlayer_();
  92657. if ((TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && options2.nativeControlsForTouch === true) {
  92658. _this.setControls(true);
  92659. }
  92660. _this.proxyWebkitFullscreen_();
  92661. _this.triggerReady();
  92662. return _this;
  92663. }
  92664. var _proto = Html52.prototype;
  92665. _proto.dispose = function dispose() {
  92666. if (this.el_ && this.el_.resetSourceset_) {
  92667. this.el_.resetSourceset_();
  92668. }
  92669. Html52.disposeMediaElement(this.el_);
  92670. this.options_ = null;
  92671. _Tech.prototype.dispose.call(this);
  92672. };
  92673. _proto.setupSourcesetHandling_ = function setupSourcesetHandling_() {
  92674. setupSourceset(this);
  92675. };
  92676. _proto.restoreMetadataTracksInIOSNativePlayer_ = function restoreMetadataTracksInIOSNativePlayer_() {
  92677. var textTracks = this.textTracks();
  92678. var metadataTracksPreFullscreenState;
  92679. var takeMetadataTrackSnapshot = function takeMetadataTrackSnapshot2() {
  92680. metadataTracksPreFullscreenState = [];
  92681. for (var i2 = 0; i2 < textTracks.length; i2++) {
  92682. var track = textTracks[i2];
  92683. if (track.kind === "metadata") {
  92684. metadataTracksPreFullscreenState.push({
  92685. track,
  92686. storedMode: track.mode
  92687. });
  92688. }
  92689. }
  92690. };
  92691. takeMetadataTrackSnapshot();
  92692. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92693. this.on("dispose", function() {
  92694. return textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92695. });
  92696. var restoreTrackMode = function restoreTrackMode2() {
  92697. for (var i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  92698. var storedTrack = metadataTracksPreFullscreenState[i2];
  92699. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  92700. storedTrack.track.mode = storedTrack.storedMode;
  92701. }
  92702. }
  92703. textTracks.removeEventListener("change", restoreTrackMode2);
  92704. };
  92705. this.on("webkitbeginfullscreen", function() {
  92706. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92707. textTracks.removeEventListener("change", restoreTrackMode);
  92708. textTracks.addEventListener("change", restoreTrackMode);
  92709. });
  92710. this.on("webkitendfullscreen", function() {
  92711. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92712. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92713. textTracks.removeEventListener("change", restoreTrackMode);
  92714. });
  92715. };
  92716. _proto.overrideNative_ = function overrideNative_(type2, override) {
  92717. var _this2 = this;
  92718. if (override !== this["featuresNative" + type2 + "Tracks"]) {
  92719. return;
  92720. }
  92721. var lowerCaseType = type2.toLowerCase();
  92722. if (this[lowerCaseType + "TracksListeners_"]) {
  92723. Object.keys(this[lowerCaseType + "TracksListeners_"]).forEach(function(eventName) {
  92724. var elTracks = _this2.el()[lowerCaseType + "Tracks"];
  92725. elTracks.removeEventListener(eventName, _this2[lowerCaseType + "TracksListeners_"][eventName]);
  92726. });
  92727. }
  92728. this["featuresNative" + type2 + "Tracks"] = !override;
  92729. this[lowerCaseType + "TracksListeners_"] = null;
  92730. this.proxyNativeTracksForType_(lowerCaseType);
  92731. };
  92732. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks(override) {
  92733. this.overrideNative_("Audio", override);
  92734. };
  92735. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks(override) {
  92736. this.overrideNative_("Video", override);
  92737. };
  92738. _proto.proxyNativeTracksForType_ = function proxyNativeTracksForType_(name) {
  92739. var _this3 = this;
  92740. var props = NORMAL[name];
  92741. var elTracks = this.el()[props.getterName];
  92742. var techTracks = this[props.getterName]();
  92743. if (!this["featuresNative" + props.capitalName + "Tracks"] || !elTracks || !elTracks.addEventListener) {
  92744. return;
  92745. }
  92746. var listeners = {
  92747. change: function change(e) {
  92748. var event2 = {
  92749. type: "change",
  92750. target: techTracks,
  92751. currentTarget: techTracks,
  92752. srcElement: techTracks
  92753. };
  92754. techTracks.trigger(event2);
  92755. if (name === "text") {
  92756. _this3[REMOTE.remoteText.getterName]().trigger(event2);
  92757. }
  92758. },
  92759. addtrack: function addtrack(e) {
  92760. techTracks.addTrack(e.track);
  92761. },
  92762. removetrack: function removetrack(e) {
  92763. techTracks.removeTrack(e.track);
  92764. }
  92765. };
  92766. var removeOldTracks = function removeOldTracks2() {
  92767. var removeTracks = [];
  92768. for (var i2 = 0; i2 < techTracks.length; i2++) {
  92769. var found = false;
  92770. for (var j = 0; j < elTracks.length; j++) {
  92771. if (elTracks[j] === techTracks[i2]) {
  92772. found = true;
  92773. break;
  92774. }
  92775. }
  92776. if (!found) {
  92777. removeTracks.push(techTracks[i2]);
  92778. }
  92779. }
  92780. while (removeTracks.length) {
  92781. techTracks.removeTrack(removeTracks.shift());
  92782. }
  92783. };
  92784. this[props.getterName + "Listeners_"] = listeners;
  92785. Object.keys(listeners).forEach(function(eventName) {
  92786. var listener = listeners[eventName];
  92787. elTracks.addEventListener(eventName, listener);
  92788. _this3.on("dispose", function(e) {
  92789. return elTracks.removeEventListener(eventName, listener);
  92790. });
  92791. });
  92792. this.on("loadstart", removeOldTracks);
  92793. this.on("dispose", function(e) {
  92794. return _this3.off("loadstart", removeOldTracks);
  92795. });
  92796. };
  92797. _proto.proxyNativeTracks_ = function proxyNativeTracks_() {
  92798. var _this4 = this;
  92799. NORMAL.names.forEach(function(name) {
  92800. _this4.proxyNativeTracksForType_(name);
  92801. });
  92802. };
  92803. _proto.createEl = function createEl2() {
  92804. var el = this.options_.tag;
  92805. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  92806. if (el) {
  92807. var clone = el.cloneNode(true);
  92808. if (el.parentNode) {
  92809. el.parentNode.insertBefore(clone, el);
  92810. }
  92811. Html52.disposeMediaElement(el);
  92812. el = clone;
  92813. } else {
  92814. el = document_1.createElement("video");
  92815. var tagAttributes = this.options_.tag && getAttributes(this.options_.tag);
  92816. var attributes = mergeOptions$3({}, tagAttributes);
  92817. if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {
  92818. delete attributes.controls;
  92819. }
  92820. setAttributes(el, assign(attributes, {
  92821. id: this.options_.techId,
  92822. "class": "vjs-tech"
  92823. }));
  92824. }
  92825. el.playerId = this.options_.playerId;
  92826. }
  92827. if (typeof this.options_.preload !== "undefined") {
  92828. setAttribute(el, "preload", this.options_.preload);
  92829. }
  92830. if (this.options_.disablePictureInPicture !== void 0) {
  92831. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  92832. }
  92833. var settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  92834. for (var i2 = 0; i2 < settingsAttrs.length; i2++) {
  92835. var attr = settingsAttrs[i2];
  92836. var value = this.options_[attr];
  92837. if (typeof value !== "undefined") {
  92838. if (value) {
  92839. setAttribute(el, attr, attr);
  92840. } else {
  92841. removeAttribute(el, attr);
  92842. }
  92843. el[attr] = value;
  92844. }
  92845. }
  92846. return el;
  92847. };
  92848. _proto.handleLateInit_ = function handleLateInit_(el) {
  92849. if (el.networkState === 0 || el.networkState === 3) {
  92850. return;
  92851. }
  92852. if (el.readyState === 0) {
  92853. var loadstartFired = false;
  92854. var setLoadstartFired = function setLoadstartFired2() {
  92855. loadstartFired = true;
  92856. };
  92857. this.on("loadstart", setLoadstartFired);
  92858. var triggerLoadstart = function triggerLoadstart2() {
  92859. if (!loadstartFired) {
  92860. this.trigger("loadstart");
  92861. }
  92862. };
  92863. this.on("loadedmetadata", triggerLoadstart);
  92864. this.ready(function() {
  92865. this.off("loadstart", setLoadstartFired);
  92866. this.off("loadedmetadata", triggerLoadstart);
  92867. if (!loadstartFired) {
  92868. this.trigger("loadstart");
  92869. }
  92870. });
  92871. return;
  92872. }
  92873. var eventsToTrigger = ["loadstart"];
  92874. eventsToTrigger.push("loadedmetadata");
  92875. if (el.readyState >= 2) {
  92876. eventsToTrigger.push("loadeddata");
  92877. }
  92878. if (el.readyState >= 3) {
  92879. eventsToTrigger.push("canplay");
  92880. }
  92881. if (el.readyState >= 4) {
  92882. eventsToTrigger.push("canplaythrough");
  92883. }
  92884. this.ready(function() {
  92885. eventsToTrigger.forEach(function(type2) {
  92886. this.trigger(type2);
  92887. }, this);
  92888. });
  92889. };
  92890. _proto.setScrubbing = function setScrubbing(isScrubbing) {
  92891. this.isScrubbing_ = isScrubbing;
  92892. };
  92893. _proto.scrubbing = function scrubbing() {
  92894. return this.isScrubbing_;
  92895. };
  92896. _proto.setCurrentTime = function setCurrentTime(seconds) {
  92897. try {
  92898. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI) {
  92899. this.el_.fastSeek(seconds);
  92900. } else {
  92901. this.el_.currentTime = seconds;
  92902. }
  92903. } catch (e) {
  92904. log$1(e, "Video is not ready. (Video.js)");
  92905. }
  92906. };
  92907. _proto.duration = function duration5() {
  92908. var _this5 = this;
  92909. if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME && this.el_.currentTime === 0) {
  92910. var checkProgress = function checkProgress2() {
  92911. if (_this5.el_.currentTime > 0) {
  92912. if (_this5.el_.duration === Infinity) {
  92913. _this5.trigger("durationchange");
  92914. }
  92915. _this5.off("timeupdate", checkProgress2);
  92916. }
  92917. };
  92918. this.on("timeupdate", checkProgress);
  92919. return NaN;
  92920. }
  92921. return this.el_.duration || NaN;
  92922. };
  92923. _proto.width = function width2() {
  92924. return this.el_.offsetWidth;
  92925. };
  92926. _proto.height = function height2() {
  92927. return this.el_.offsetHeight;
  92928. };
  92929. _proto.proxyWebkitFullscreen_ = function proxyWebkitFullscreen_() {
  92930. var _this6 = this;
  92931. if (!("webkitDisplayingFullscreen" in this.el_)) {
  92932. return;
  92933. }
  92934. var endFn = function endFn2() {
  92935. this.trigger("fullscreenchange", {
  92936. isFullscreen: false
  92937. });
  92938. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  92939. this.el_.controls = false;
  92940. }
  92941. };
  92942. var beginFn = function beginFn2() {
  92943. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  92944. this.one("webkitendfullscreen", endFn);
  92945. this.trigger("fullscreenchange", {
  92946. isFullscreen: true,
  92947. nativeIOSFullscreen: true
  92948. });
  92949. }
  92950. };
  92951. this.on("webkitbeginfullscreen", beginFn);
  92952. this.on("dispose", function() {
  92953. _this6.off("webkitbeginfullscreen", beginFn);
  92954. _this6.off("webkitendfullscreen", endFn);
  92955. });
  92956. };
  92957. _proto.supportsFullScreen = function supportsFullScreen() {
  92958. if (typeof this.el_.webkitEnterFullScreen === "function") {
  92959. var userAgent = window_1.navigator && window_1.navigator.userAgent || "";
  92960. if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) {
  92961. return true;
  92962. }
  92963. }
  92964. return false;
  92965. };
  92966. _proto.enterFullScreen = function enterFullScreen() {
  92967. var video = this.el_;
  92968. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  92969. silencePromise(this.el_.play());
  92970. this.setTimeout(function() {
  92971. video.pause();
  92972. try {
  92973. video.webkitEnterFullScreen();
  92974. } catch (e) {
  92975. this.trigger("fullscreenerror", e);
  92976. }
  92977. }, 0);
  92978. } else {
  92979. try {
  92980. video.webkitEnterFullScreen();
  92981. } catch (e) {
  92982. this.trigger("fullscreenerror", e);
  92983. }
  92984. }
  92985. };
  92986. _proto.exitFullScreen = function exitFullScreen() {
  92987. if (!this.el_.webkitDisplayingFullscreen) {
  92988. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  92989. return;
  92990. }
  92991. this.el_.webkitExitFullScreen();
  92992. };
  92993. _proto.requestPictureInPicture = function requestPictureInPicture() {
  92994. return this.el_.requestPictureInPicture();
  92995. };
  92996. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  92997. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  92998. return this.el_.requestVideoFrameCallback(cb);
  92999. }
  93000. return _Tech.prototype.requestVideoFrameCallback.call(this, cb);
  93001. };
  93002. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  93003. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  93004. this.el_.cancelVideoFrameCallback(id);
  93005. } else {
  93006. _Tech.prototype.cancelVideoFrameCallback.call(this, id);
  93007. }
  93008. };
  93009. _proto.src = function src(_src) {
  93010. if (_src === void 0) {
  93011. return this.el_.src;
  93012. }
  93013. this.setSrc(_src);
  93014. };
  93015. _proto.reset = function reset3() {
  93016. Html52.resetMediaElement(this.el_);
  93017. };
  93018. _proto.currentSrc = function currentSrc() {
  93019. if (this.currentSource_) {
  93020. return this.currentSource_.src;
  93021. }
  93022. return this.el_.currentSrc;
  93023. };
  93024. _proto.setControls = function setControls(val) {
  93025. this.el_.controls = !!val;
  93026. };
  93027. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  93028. if (!this.featuresNativeTextTracks) {
  93029. return _Tech.prototype.addTextTrack.call(this, kind, label2, language);
  93030. }
  93031. return this.el_.addTextTrack(kind, label2, language);
  93032. };
  93033. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  93034. if (!this.featuresNativeTextTracks) {
  93035. return _Tech.prototype.createRemoteTextTrack.call(this, options2);
  93036. }
  93037. var htmlTrackElement = document_1.createElement("track");
  93038. if (options2.kind) {
  93039. htmlTrackElement.kind = options2.kind;
  93040. }
  93041. if (options2.label) {
  93042. htmlTrackElement.label = options2.label;
  93043. }
  93044. if (options2.language || options2.srclang) {
  93045. htmlTrackElement.srclang = options2.language || options2.srclang;
  93046. }
  93047. if (options2["default"]) {
  93048. htmlTrackElement["default"] = options2["default"];
  93049. }
  93050. if (options2.id) {
  93051. htmlTrackElement.id = options2.id;
  93052. }
  93053. if (options2.src) {
  93054. htmlTrackElement.src = options2.src;
  93055. }
  93056. return htmlTrackElement;
  93057. };
  93058. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  93059. var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options2, manualCleanup);
  93060. if (this.featuresNativeTextTracks) {
  93061. this.el().appendChild(htmlTrackElement);
  93062. }
  93063. return htmlTrackElement;
  93064. };
  93065. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  93066. _Tech.prototype.removeRemoteTextTrack.call(this, track);
  93067. if (this.featuresNativeTextTracks) {
  93068. var tracks = this.$$("track");
  93069. var i2 = tracks.length;
  93070. while (i2--) {
  93071. if (track === tracks[i2] || track === tracks[i2].track) {
  93072. this.el().removeChild(tracks[i2]);
  93073. }
  93074. }
  93075. }
  93076. };
  93077. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  93078. if (typeof this.el().getVideoPlaybackQuality === "function") {
  93079. return this.el().getVideoPlaybackQuality();
  93080. }
  93081. var videoPlaybackQuality = {};
  93082. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  93083. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  93084. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  93085. }
  93086. if (window_1.performance && typeof window_1.performance.now === "function") {
  93087. videoPlaybackQuality.creationTime = window_1.performance.now();
  93088. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  93089. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  93090. }
  93091. return videoPlaybackQuality;
  93092. };
  93093. return Html52;
  93094. }(Tech$1);
  93095. defineLazyProperty(Html5$1, "TEST_VID", function() {
  93096. if (!isReal()) {
  93097. return;
  93098. }
  93099. var video = document_1.createElement("video");
  93100. var track = document_1.createElement("track");
  93101. track.kind = "captions";
  93102. track.srclang = "en";
  93103. track.label = "English";
  93104. video.appendChild(track);
  93105. return video;
  93106. });
  93107. Html5$1.isSupported = function() {
  93108. try {
  93109. Html5$1.TEST_VID.volume = 0.5;
  93110. } catch (e) {
  93111. return false;
  93112. }
  93113. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.canPlayType);
  93114. };
  93115. Html5$1.canPlayType = function(type2) {
  93116. return Html5$1.TEST_VID.canPlayType(type2);
  93117. };
  93118. Html5$1.canPlaySource = function(srcObj, options2) {
  93119. return Html5$1.canPlayType(srcObj.type);
  93120. };
  93121. Html5$1.canControlVolume = function() {
  93122. try {
  93123. var volume = Html5$1.TEST_VID.volume;
  93124. Html5$1.TEST_VID.volume = volume / 2 + 0.1;
  93125. var canControl = volume !== Html5$1.TEST_VID.volume;
  93126. if (canControl && IS_IOS) {
  93127. window_1.setTimeout(function() {
  93128. if (Html5$1 && Html5$1.prototype) {
  93129. Html5$1.prototype.featuresVolumeControl = volume !== Html5$1.TEST_VID.volume;
  93130. }
  93131. });
  93132. return false;
  93133. }
  93134. return canControl;
  93135. } catch (e) {
  93136. return false;
  93137. }
  93138. };
  93139. Html5$1.canMuteVolume = function() {
  93140. try {
  93141. var muted = Html5$1.TEST_VID.muted;
  93142. Html5$1.TEST_VID.muted = !muted;
  93143. if (Html5$1.TEST_VID.muted) {
  93144. setAttribute(Html5$1.TEST_VID, "muted", "muted");
  93145. } else {
  93146. removeAttribute(Html5$1.TEST_VID, "muted", "muted");
  93147. }
  93148. return muted !== Html5$1.TEST_VID.muted;
  93149. } catch (e) {
  93150. return false;
  93151. }
  93152. };
  93153. Html5$1.canControlPlaybackRate = function() {
  93154. if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) {
  93155. return false;
  93156. }
  93157. try {
  93158. var playbackRate = Html5$1.TEST_VID.playbackRate;
  93159. Html5$1.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  93160. return playbackRate !== Html5$1.TEST_VID.playbackRate;
  93161. } catch (e) {
  93162. return false;
  93163. }
  93164. };
  93165. Html5$1.canOverrideAttributes = function() {
  93166. try {
  93167. var noop2 = function noop3() {
  93168. };
  93169. Object.defineProperty(document_1.createElement("video"), "src", {
  93170. get: noop2,
  93171. set: noop2
  93172. });
  93173. Object.defineProperty(document_1.createElement("audio"), "src", {
  93174. get: noop2,
  93175. set: noop2
  93176. });
  93177. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  93178. get: noop2,
  93179. set: noop2
  93180. });
  93181. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  93182. get: noop2,
  93183. set: noop2
  93184. });
  93185. } catch (e) {
  93186. return false;
  93187. }
  93188. return true;
  93189. };
  93190. Html5$1.supportsNativeTextTracks = function() {
  93191. return IS_ANY_SAFARI || IS_IOS && IS_CHROME;
  93192. };
  93193. Html5$1.supportsNativeVideoTracks = function() {
  93194. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.videoTracks);
  93195. };
  93196. Html5$1.supportsNativeAudioTracks = function() {
  93197. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.audioTracks);
  93198. };
  93199. 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"];
  93200. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function(_ref) {
  93201. var key = _ref[0], fn2 = _ref[1];
  93202. defineLazyProperty(Html5$1.prototype, key, function() {
  93203. return Html5$1[fn2]();
  93204. }, true);
  93205. });
  93206. Html5$1.prototype.featuresVolumeControl = Html5$1.canControlVolume();
  93207. Html5$1.prototype.movingMediaElementInDOM = !IS_IOS;
  93208. Html5$1.prototype.featuresFullscreenResize = true;
  93209. Html5$1.prototype.featuresProgressEvents = true;
  93210. Html5$1.prototype.featuresTimeupdateEvents = true;
  93211. Html5$1.prototype.featuresVideoFrameCallback = !!(Html5$1.TEST_VID && Html5$1.TEST_VID.requestVideoFrameCallback);
  93212. var canPlayType;
  93213. Html5$1.patchCanPlayType = function() {
  93214. if (ANDROID_VERSION >= 4 && !IS_FIREFOX && !IS_CHROME) {
  93215. canPlayType = Html5$1.TEST_VID && Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93216. Html5$1.TEST_VID.constructor.prototype.canPlayType = function(type2) {
  93217. var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
  93218. if (type2 && mpegurlRE.test(type2)) {
  93219. return "maybe";
  93220. }
  93221. return canPlayType.call(this, type2);
  93222. };
  93223. }
  93224. };
  93225. Html5$1.unpatchCanPlayType = function() {
  93226. var r2 = Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93227. if (canPlayType) {
  93228. Html5$1.TEST_VID.constructor.prototype.canPlayType = canPlayType;
  93229. }
  93230. return r2;
  93231. };
  93232. Html5$1.patchCanPlayType();
  93233. Html5$1.disposeMediaElement = function(el) {
  93234. if (!el) {
  93235. return;
  93236. }
  93237. if (el.parentNode) {
  93238. el.parentNode.removeChild(el);
  93239. }
  93240. while (el.hasChildNodes()) {
  93241. el.removeChild(el.firstChild);
  93242. }
  93243. el.removeAttribute("src");
  93244. if (typeof el.load === "function") {
  93245. (function() {
  93246. try {
  93247. el.load();
  93248. } catch (e) {
  93249. }
  93250. })();
  93251. }
  93252. };
  93253. Html5$1.resetMediaElement = function(el) {
  93254. if (!el) {
  93255. return;
  93256. }
  93257. var sources = el.querySelectorAll("source");
  93258. var i2 = sources.length;
  93259. while (i2--) {
  93260. el.removeChild(sources[i2]);
  93261. }
  93262. el.removeAttribute("src");
  93263. if (typeof el.load === "function") {
  93264. (function() {
  93265. try {
  93266. el.load();
  93267. } catch (e) {
  93268. }
  93269. })();
  93270. }
  93271. };
  93272. [
  93273. "muted",
  93274. "defaultMuted",
  93275. "autoplay",
  93276. "controls",
  93277. "loop",
  93278. "playsinline"
  93279. ].forEach(function(prop) {
  93280. Html5$1.prototype[prop] = function() {
  93281. return this.el_[prop] || this.el_.hasAttribute(prop);
  93282. };
  93283. });
  93284. [
  93285. "muted",
  93286. "defaultMuted",
  93287. "autoplay",
  93288. "loop",
  93289. "playsinline"
  93290. ].forEach(function(prop) {
  93291. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93292. this.el_[prop] = v;
  93293. if (v) {
  93294. this.el_.setAttribute(prop, prop);
  93295. } else {
  93296. this.el_.removeAttribute(prop);
  93297. }
  93298. };
  93299. });
  93300. [
  93301. "paused",
  93302. "currentTime",
  93303. "buffered",
  93304. "volume",
  93305. "poster",
  93306. "preload",
  93307. "error",
  93308. "seeking",
  93309. "seekable",
  93310. "ended",
  93311. "playbackRate",
  93312. "defaultPlaybackRate",
  93313. "disablePictureInPicture",
  93314. "played",
  93315. "networkState",
  93316. "readyState",
  93317. "videoWidth",
  93318. "videoHeight",
  93319. "crossOrigin"
  93320. ].forEach(function(prop) {
  93321. Html5$1.prototype[prop] = function() {
  93322. return this.el_[prop];
  93323. };
  93324. });
  93325. [
  93326. "volume",
  93327. "src",
  93328. "poster",
  93329. "preload",
  93330. "playbackRate",
  93331. "defaultPlaybackRate",
  93332. "disablePictureInPicture",
  93333. "crossOrigin"
  93334. ].forEach(function(prop) {
  93335. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93336. this.el_[prop] = v;
  93337. };
  93338. });
  93339. [
  93340. "pause",
  93341. "load",
  93342. "play"
  93343. ].forEach(function(prop) {
  93344. Html5$1.prototype[prop] = function() {
  93345. return this.el_[prop]();
  93346. };
  93347. });
  93348. Tech$1.withSourceHandlers(Html5$1);
  93349. Html5$1.nativeSourceHandler = {};
  93350. Html5$1.nativeSourceHandler.canPlayType = function(type2) {
  93351. try {
  93352. return Html5$1.TEST_VID.canPlayType(type2);
  93353. } catch (e) {
  93354. return "";
  93355. }
  93356. };
  93357. Html5$1.nativeSourceHandler.canHandleSource = function(source, options2) {
  93358. if (source.type) {
  93359. return Html5$1.nativeSourceHandler.canPlayType(source.type);
  93360. } else if (source.src) {
  93361. var ext = getFileExtension(source.src);
  93362. return Html5$1.nativeSourceHandler.canPlayType("video/" + ext);
  93363. }
  93364. return "";
  93365. };
  93366. Html5$1.nativeSourceHandler.handleSource = function(source, tech, options2) {
  93367. tech.setSrc(source.src);
  93368. };
  93369. Html5$1.nativeSourceHandler.dispose = function() {
  93370. };
  93371. Html5$1.registerSourceHandler(Html5$1.nativeSourceHandler);
  93372. Tech$1.registerTech("Html5", Html5$1);
  93373. var TECH_EVENTS_RETRIGGER = [
  93374. "progress",
  93375. "abort",
  93376. "suspend",
  93377. "emptied",
  93378. "stalled",
  93379. "loadedmetadata",
  93380. "loadeddata",
  93381. "timeupdate",
  93382. "resize",
  93383. "volumechange",
  93384. "texttrackchange"
  93385. ];
  93386. var TECH_EVENTS_QUEUE = {
  93387. canplay: "CanPlay",
  93388. canplaythrough: "CanPlayThrough",
  93389. playing: "Playing",
  93390. seeked: "Seeked"
  93391. };
  93392. var BREAKPOINT_ORDER = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  93393. var BREAKPOINT_CLASSES = {};
  93394. BREAKPOINT_ORDER.forEach(function(k) {
  93395. var v = k.charAt(0) === "x" ? "x-" + k.substring(1) : k;
  93396. BREAKPOINT_CLASSES[k] = "vjs-layout-" + v;
  93397. });
  93398. var DEFAULT_BREAKPOINTS = {
  93399. tiny: 210,
  93400. xsmall: 320,
  93401. small: 425,
  93402. medium: 768,
  93403. large: 1440,
  93404. xlarge: 2560,
  93405. huge: Infinity
  93406. };
  93407. var Player = /* @__PURE__ */ function(_Component) {
  93408. _inheritsLoose(Player2, _Component);
  93409. function Player2(tag, options2, ready) {
  93410. var _this;
  93411. tag.id = tag.id || options2.id || "vjs_video_" + newGUID();
  93412. options2 = assign(Player2.getTagSettings(tag), options2);
  93413. options2.initChildren = false;
  93414. options2.createEl = false;
  93415. options2.evented = false;
  93416. options2.reportTouchActivity = false;
  93417. if (!options2.language) {
  93418. if (typeof tag.closest === "function") {
  93419. var closest = tag.closest("[lang]");
  93420. if (closest && closest.getAttribute) {
  93421. options2.language = closest.getAttribute("lang");
  93422. }
  93423. } else {
  93424. var element = tag;
  93425. while (element && element.nodeType === 1) {
  93426. if (getAttributes(element).hasOwnProperty("lang")) {
  93427. options2.language = element.getAttribute("lang");
  93428. break;
  93429. }
  93430. element = element.parentNode;
  93431. }
  93432. }
  93433. }
  93434. _this = _Component.call(this, null, options2, ready) || this;
  93435. _this.boundDocumentFullscreenChange_ = function(e) {
  93436. return _this.documentFullscreenChange_(e);
  93437. };
  93438. _this.boundFullWindowOnEscKey_ = function(e) {
  93439. return _this.fullWindowOnEscKey(e);
  93440. };
  93441. _this.boundUpdateStyleEl_ = function(e) {
  93442. return _this.updateStyleEl_(e);
  93443. };
  93444. _this.boundApplyInitTime_ = function(e) {
  93445. return _this.applyInitTime_(e);
  93446. };
  93447. _this.boundUpdateCurrentBreakpoint_ = function(e) {
  93448. return _this.updateCurrentBreakpoint_(e);
  93449. };
  93450. _this.boundHandleTechClick_ = function(e) {
  93451. return _this.handleTechClick_(e);
  93452. };
  93453. _this.boundHandleTechDoubleClick_ = function(e) {
  93454. return _this.handleTechDoubleClick_(e);
  93455. };
  93456. _this.boundHandleTechTouchStart_ = function(e) {
  93457. return _this.handleTechTouchStart_(e);
  93458. };
  93459. _this.boundHandleTechTouchMove_ = function(e) {
  93460. return _this.handleTechTouchMove_(e);
  93461. };
  93462. _this.boundHandleTechTouchEnd_ = function(e) {
  93463. return _this.handleTechTouchEnd_(e);
  93464. };
  93465. _this.boundHandleTechTap_ = function(e) {
  93466. return _this.handleTechTap_(e);
  93467. };
  93468. _this.isFullscreen_ = false;
  93469. _this.log = createLogger(_this.id_);
  93470. _this.fsApi_ = FullscreenApi;
  93471. _this.isPosterFromTech_ = false;
  93472. _this.queuedCallbacks_ = [];
  93473. _this.isReady_ = false;
  93474. _this.hasStarted_ = false;
  93475. _this.userActive_ = false;
  93476. _this.debugEnabled_ = false;
  93477. _this.audioOnlyMode_ = false;
  93478. _this.audioPosterMode_ = false;
  93479. _this.audioOnlyCache_ = {
  93480. playerHeight: null,
  93481. hiddenChildren: []
  93482. };
  93483. if (!_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) {
  93484. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  93485. }
  93486. _this.tag = tag;
  93487. _this.tagAttributes = tag && getAttributes(tag);
  93488. _this.language(_this.options_.language);
  93489. if (options2.languages) {
  93490. var languagesToLower = {};
  93491. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  93492. languagesToLower[name.toLowerCase()] = options2.languages[name];
  93493. });
  93494. _this.languages_ = languagesToLower;
  93495. } else {
  93496. _this.languages_ = Player2.prototype.options_.languages;
  93497. }
  93498. _this.resetCache_();
  93499. _this.poster_ = options2.poster || "";
  93500. _this.controls_ = !!options2.controls;
  93501. tag.controls = false;
  93502. tag.removeAttribute("controls");
  93503. _this.changingSrc_ = false;
  93504. _this.playCallbacks_ = [];
  93505. _this.playTerminatedQueue_ = [];
  93506. if (tag.hasAttribute("autoplay")) {
  93507. _this.autoplay(true);
  93508. } else {
  93509. _this.autoplay(_this.options_.autoplay);
  93510. }
  93511. if (options2.plugins) {
  93512. Object.keys(options2.plugins).forEach(function(name) {
  93513. if (typeof _this[name] !== "function") {
  93514. throw new Error('plugin "' + name + '" does not exist');
  93515. }
  93516. });
  93517. }
  93518. _this.scrubbing_ = false;
  93519. _this.el_ = _this.createEl();
  93520. evented(_assertThisInitialized(_this), {
  93521. eventBusKey: "el_"
  93522. });
  93523. if (_this.fsApi_.requestFullscreen) {
  93524. on(document_1, _this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93525. _this.on(_this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93526. }
  93527. if (_this.fluid_) {
  93528. _this.on(["playerreset", "resize"], _this.boundUpdateStyleEl_);
  93529. }
  93530. var playerOptionsCopy = mergeOptions$3(_this.options_);
  93531. if (options2.plugins) {
  93532. Object.keys(options2.plugins).forEach(function(name) {
  93533. _this[name](options2.plugins[name]);
  93534. });
  93535. }
  93536. if (options2.debug) {
  93537. _this.debug(true);
  93538. }
  93539. _this.options_.playerOptions = playerOptionsCopy;
  93540. _this.middleware_ = [];
  93541. _this.playbackRates(options2.playbackRates);
  93542. _this.initChildren();
  93543. _this.isAudio(tag.nodeName.toLowerCase() === "audio");
  93544. if (_this.controls()) {
  93545. _this.addClass("vjs-controls-enabled");
  93546. } else {
  93547. _this.addClass("vjs-controls-disabled");
  93548. }
  93549. _this.el_.setAttribute("role", "region");
  93550. if (_this.isAudio()) {
  93551. _this.el_.setAttribute("aria-label", _this.localize("Audio Player"));
  93552. } else {
  93553. _this.el_.setAttribute("aria-label", _this.localize("Video Player"));
  93554. }
  93555. if (_this.isAudio()) {
  93556. _this.addClass("vjs-audio");
  93557. }
  93558. if (_this.flexNotSupported_()) {
  93559. _this.addClass("vjs-no-flex");
  93560. }
  93561. if (TOUCH_ENABLED) {
  93562. _this.addClass("vjs-touch-enabled");
  93563. }
  93564. if (!IS_IOS) {
  93565. _this.addClass("vjs-workinghover");
  93566. }
  93567. Player2.players[_this.id_] = _assertThisInitialized(_this);
  93568. var majorVersion = version$5.split(".")[0];
  93569. _this.addClass("vjs-v" + majorVersion);
  93570. _this.userActive(true);
  93571. _this.reportUserActivity();
  93572. _this.one("play", function(e) {
  93573. return _this.listenForUserActivity_(e);
  93574. });
  93575. _this.on("stageclick", function(e) {
  93576. return _this.handleStageClick_(e);
  93577. });
  93578. _this.on("keydown", function(e) {
  93579. return _this.handleKeyDown(e);
  93580. });
  93581. _this.on("languagechange", function(e) {
  93582. return _this.handleLanguagechange(e);
  93583. });
  93584. _this.breakpoints(_this.options_.breakpoints);
  93585. _this.responsive(_this.options_.responsive);
  93586. _this.on("ready", function() {
  93587. _this.audioPosterMode(_this.options_.audioPosterMode);
  93588. _this.audioOnlyMode(_this.options_.audioOnlyMode);
  93589. });
  93590. return _this;
  93591. }
  93592. var _proto = Player2.prototype;
  93593. _proto.dispose = function dispose() {
  93594. var _this2 = this;
  93595. this.trigger("dispose");
  93596. this.off("dispose");
  93597. off(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  93598. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  93599. if (this.styleEl_ && this.styleEl_.parentNode) {
  93600. this.styleEl_.parentNode.removeChild(this.styleEl_);
  93601. this.styleEl_ = null;
  93602. }
  93603. Player2.players[this.id_] = null;
  93604. if (this.tag && this.tag.player) {
  93605. this.tag.player = null;
  93606. }
  93607. if (this.el_ && this.el_.player) {
  93608. this.el_.player = null;
  93609. }
  93610. if (this.tech_) {
  93611. this.tech_.dispose();
  93612. this.isPosterFromTech_ = false;
  93613. this.poster_ = "";
  93614. }
  93615. if (this.playerElIngest_) {
  93616. this.playerElIngest_ = null;
  93617. }
  93618. if (this.tag) {
  93619. this.tag = null;
  93620. }
  93621. clearCacheForPlayer(this);
  93622. ALL.names.forEach(function(name) {
  93623. var props = ALL[name];
  93624. var list = _this2[props.getterName]();
  93625. if (list && list.off) {
  93626. list.off();
  93627. }
  93628. });
  93629. _Component.prototype.dispose.call(this, {
  93630. restoreEl: this.options_.restoreEl
  93631. });
  93632. };
  93633. _proto.createEl = function createEl2() {
  93634. var tag = this.tag;
  93635. var el;
  93636. var playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  93637. var divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  93638. if (playerElIngest) {
  93639. el = this.el_ = tag.parentNode;
  93640. } else if (!divEmbed) {
  93641. el = this.el_ = _Component.prototype.createEl.call(this, "div");
  93642. }
  93643. var attrs = getAttributes(tag);
  93644. if (divEmbed) {
  93645. el = this.el_ = tag;
  93646. tag = this.tag = document_1.createElement("video");
  93647. while (el.children.length) {
  93648. tag.appendChild(el.firstChild);
  93649. }
  93650. if (!hasClass(el, "video-js")) {
  93651. addClass(el, "video-js");
  93652. }
  93653. el.appendChild(tag);
  93654. playerElIngest = this.playerElIngest_ = el;
  93655. Object.keys(el).forEach(function(k) {
  93656. try {
  93657. tag[k] = el[k];
  93658. } catch (e) {
  93659. }
  93660. });
  93661. }
  93662. tag.setAttribute("tabindex", "-1");
  93663. attrs.tabindex = "-1";
  93664. if (IE_VERSION || IS_CHROME && IS_WINDOWS) {
  93665. tag.setAttribute("role", "application");
  93666. attrs.role = "application";
  93667. }
  93668. tag.removeAttribute("width");
  93669. tag.removeAttribute("height");
  93670. if ("width" in attrs) {
  93671. delete attrs.width;
  93672. }
  93673. if ("height" in attrs) {
  93674. delete attrs.height;
  93675. }
  93676. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  93677. if (!(divEmbed && attr === "class")) {
  93678. el.setAttribute(attr, attrs[attr]);
  93679. }
  93680. if (divEmbed) {
  93681. tag.setAttribute(attr, attrs[attr]);
  93682. }
  93683. });
  93684. tag.playerId = tag.id;
  93685. tag.id += "_html5_api";
  93686. tag.className = "vjs-tech";
  93687. tag.player = el.player = this;
  93688. this.addClass("vjs-paused");
  93689. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  93690. this.styleEl_ = createStyleElement("vjs-styles-dimensions");
  93691. var defaultsStyleEl = $(".vjs-styles-defaults");
  93692. var head = $("head");
  93693. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  93694. }
  93695. this.fill_ = false;
  93696. this.fluid_ = false;
  93697. this.width(this.options_.width);
  93698. this.height(this.options_.height);
  93699. this.fill(this.options_.fill);
  93700. this.fluid(this.options_.fluid);
  93701. this.aspectRatio(this.options_.aspectRatio);
  93702. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  93703. var links = tag.getElementsByTagName("a");
  93704. for (var i2 = 0; i2 < links.length; i2++) {
  93705. var linkEl = links.item(i2);
  93706. addClass(linkEl, "vjs-hidden");
  93707. linkEl.setAttribute("hidden", "hidden");
  93708. }
  93709. tag.initNetworkState_ = tag.networkState;
  93710. if (tag.parentNode && !playerElIngest) {
  93711. tag.parentNode.insertBefore(el, tag);
  93712. }
  93713. prependTo(tag, el);
  93714. this.children_.unshift(tag);
  93715. this.el_.setAttribute("lang", this.language_);
  93716. this.el_.setAttribute("translate", "no");
  93717. this.el_ = el;
  93718. return el;
  93719. };
  93720. _proto.crossOrigin = function crossOrigin(value) {
  93721. if (!value) {
  93722. return this.techGet_("crossOrigin");
  93723. }
  93724. if (value !== "anonymous" && value !== "use-credentials") {
  93725. log$1.warn('crossOrigin must be "anonymous" or "use-credentials", given "' + value + '"');
  93726. return;
  93727. }
  93728. this.techCall_("setCrossOrigin", value);
  93729. return;
  93730. };
  93731. _proto.width = function width2(value) {
  93732. return this.dimension("width", value);
  93733. };
  93734. _proto.height = function height2(value) {
  93735. return this.dimension("height", value);
  93736. };
  93737. _proto.dimension = function dimension(_dimension, value) {
  93738. var privDimension = _dimension + "_";
  93739. if (value === void 0) {
  93740. return this[privDimension] || 0;
  93741. }
  93742. if (value === "" || value === "auto") {
  93743. this[privDimension] = void 0;
  93744. this.updateStyleEl_();
  93745. return;
  93746. }
  93747. var parsedVal = parseFloat(value);
  93748. if (isNaN(parsedVal)) {
  93749. log$1.error('Improper value "' + value + '" supplied for for ' + _dimension);
  93750. return;
  93751. }
  93752. this[privDimension] = parsedVal;
  93753. this.updateStyleEl_();
  93754. };
  93755. _proto.fluid = function fluid(bool) {
  93756. var _this3 = this;
  93757. if (bool === void 0) {
  93758. return !!this.fluid_;
  93759. }
  93760. this.fluid_ = !!bool;
  93761. if (isEvented(this)) {
  93762. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  93763. }
  93764. if (bool) {
  93765. this.addClass("vjs-fluid");
  93766. this.fill(false);
  93767. addEventedCallback(this, function() {
  93768. _this3.on(["playerreset", "resize"], _this3.boundUpdateStyleEl_);
  93769. });
  93770. } else {
  93771. this.removeClass("vjs-fluid");
  93772. }
  93773. this.updateStyleEl_();
  93774. };
  93775. _proto.fill = function fill(bool) {
  93776. if (bool === void 0) {
  93777. return !!this.fill_;
  93778. }
  93779. this.fill_ = !!bool;
  93780. if (bool) {
  93781. this.addClass("vjs-fill");
  93782. this.fluid(false);
  93783. } else {
  93784. this.removeClass("vjs-fill");
  93785. }
  93786. };
  93787. _proto.aspectRatio = function aspectRatio(ratio) {
  93788. if (ratio === void 0) {
  93789. return this.aspectRatio_;
  93790. }
  93791. if (!/^\d+\:\d+$/.test(ratio)) {
  93792. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  93793. }
  93794. this.aspectRatio_ = ratio;
  93795. this.fluid(true);
  93796. this.updateStyleEl_();
  93797. };
  93798. _proto.updateStyleEl_ = function updateStyleEl_() {
  93799. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  93800. var _width = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  93801. var _height = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  93802. var techEl = this.tech_ && this.tech_.el();
  93803. if (techEl) {
  93804. if (_width >= 0) {
  93805. techEl.width = _width;
  93806. }
  93807. if (_height >= 0) {
  93808. techEl.height = _height;
  93809. }
  93810. }
  93811. return;
  93812. }
  93813. var width2;
  93814. var height2;
  93815. var aspectRatio;
  93816. var idClass;
  93817. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  93818. aspectRatio = this.aspectRatio_;
  93819. } else if (this.videoWidth() > 0) {
  93820. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  93821. } else {
  93822. aspectRatio = "16:9";
  93823. }
  93824. var ratioParts = aspectRatio.split(":");
  93825. var ratioMultiplier = ratioParts[1] / ratioParts[0];
  93826. if (this.width_ !== void 0) {
  93827. width2 = this.width_;
  93828. } else if (this.height_ !== void 0) {
  93829. width2 = this.height_ / ratioMultiplier;
  93830. } else {
  93831. width2 = this.videoWidth() || 300;
  93832. }
  93833. if (this.height_ !== void 0) {
  93834. height2 = this.height_;
  93835. } else {
  93836. height2 = width2 * ratioMultiplier;
  93837. }
  93838. if (/^[^a-zA-Z]/.test(this.id())) {
  93839. idClass = "dimensions-" + this.id();
  93840. } else {
  93841. idClass = this.id() + "-dimensions";
  93842. }
  93843. this.addClass(idClass);
  93844. 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 ");
  93845. };
  93846. _proto.loadTech_ = function loadTech_(techName, source) {
  93847. var _this4 = this;
  93848. if (this.tech_) {
  93849. this.unloadTech_();
  93850. }
  93851. var titleTechName = toTitleCase$1(techName);
  93852. var camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  93853. if (titleTechName !== "Html5" && this.tag) {
  93854. Tech$1.getTech("Html5").disposeMediaElement(this.tag);
  93855. this.tag.player = null;
  93856. this.tag = null;
  93857. }
  93858. this.techName_ = titleTechName;
  93859. this.isReady_ = false;
  93860. var autoplay = this.autoplay();
  93861. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  93862. autoplay = false;
  93863. }
  93864. var techOptions = {
  93865. source,
  93866. autoplay,
  93867. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  93868. "playerId": this.id(),
  93869. "techId": this.id() + "_" + camelTechName + "_api",
  93870. "playsinline": this.options_.playsinline,
  93871. "preload": this.options_.preload,
  93872. "loop": this.options_.loop,
  93873. "disablePictureInPicture": this.options_.disablePictureInPicture,
  93874. "muted": this.options_.muted,
  93875. "poster": this.poster(),
  93876. "language": this.language(),
  93877. "playerElIngest": this.playerElIngest_ || false,
  93878. "vtt.js": this.options_["vtt.js"],
  93879. "canOverridePoster": !!this.options_.techCanOverridePoster,
  93880. "enableSourceset": this.options_.enableSourceset,
  93881. "Promise": this.options_.Promise
  93882. };
  93883. ALL.names.forEach(function(name) {
  93884. var props = ALL[name];
  93885. techOptions[props.getterName] = _this4[props.privateName];
  93886. });
  93887. assign(techOptions, this.options_[titleTechName]);
  93888. assign(techOptions, this.options_[camelTechName]);
  93889. assign(techOptions, this.options_[techName.toLowerCase()]);
  93890. if (this.tag) {
  93891. techOptions.tag = this.tag;
  93892. }
  93893. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  93894. techOptions.startTime = this.cache_.currentTime;
  93895. }
  93896. var TechClass = Tech$1.getTech(techName);
  93897. if (!TechClass) {
  93898. throw new Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'");
  93899. }
  93900. this.tech_ = new TechClass(techOptions);
  93901. this.tech_.ready(bind(this, this.handleTechReady_), true);
  93902. textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  93903. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  93904. _this4.on(_this4.tech_, event2, function(e) {
  93905. return _this4["handleTech" + toTitleCase$1(event2) + "_"](e);
  93906. });
  93907. });
  93908. Object.keys(TECH_EVENTS_QUEUE).forEach(function(event2) {
  93909. _this4.on(_this4.tech_, event2, function(eventObj) {
  93910. if (_this4.tech_.playbackRate() === 0 && _this4.tech_.seeking()) {
  93911. _this4.queuedCallbacks_.push({
  93912. callback: _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"].bind(_this4),
  93913. event: eventObj
  93914. });
  93915. return;
  93916. }
  93917. _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"](eventObj);
  93918. });
  93919. });
  93920. this.on(this.tech_, "loadstart", function(e) {
  93921. return _this4.handleTechLoadStart_(e);
  93922. });
  93923. this.on(this.tech_, "sourceset", function(e) {
  93924. return _this4.handleTechSourceset_(e);
  93925. });
  93926. this.on(this.tech_, "waiting", function(e) {
  93927. return _this4.handleTechWaiting_(e);
  93928. });
  93929. this.on(this.tech_, "ended", function(e) {
  93930. return _this4.handleTechEnded_(e);
  93931. });
  93932. this.on(this.tech_, "seeking", function(e) {
  93933. return _this4.handleTechSeeking_(e);
  93934. });
  93935. this.on(this.tech_, "play", function(e) {
  93936. return _this4.handleTechPlay_(e);
  93937. });
  93938. this.on(this.tech_, "firstplay", function(e) {
  93939. return _this4.handleTechFirstPlay_(e);
  93940. });
  93941. this.on(this.tech_, "pause", function(e) {
  93942. return _this4.handleTechPause_(e);
  93943. });
  93944. this.on(this.tech_, "durationchange", function(e) {
  93945. return _this4.handleTechDurationChange_(e);
  93946. });
  93947. this.on(this.tech_, "fullscreenchange", function(e, data) {
  93948. return _this4.handleTechFullscreenChange_(e, data);
  93949. });
  93950. this.on(this.tech_, "fullscreenerror", function(e, err) {
  93951. return _this4.handleTechFullscreenError_(e, err);
  93952. });
  93953. this.on(this.tech_, "enterpictureinpicture", function(e) {
  93954. return _this4.handleTechEnterPictureInPicture_(e);
  93955. });
  93956. this.on(this.tech_, "leavepictureinpicture", function(e) {
  93957. return _this4.handleTechLeavePictureInPicture_(e);
  93958. });
  93959. this.on(this.tech_, "error", function(e) {
  93960. return _this4.handleTechError_(e);
  93961. });
  93962. this.on(this.tech_, "posterchange", function(e) {
  93963. return _this4.handleTechPosterChange_(e);
  93964. });
  93965. this.on(this.tech_, "textdata", function(e) {
  93966. return _this4.handleTechTextData_(e);
  93967. });
  93968. this.on(this.tech_, "ratechange", function(e) {
  93969. return _this4.handleTechRateChange_(e);
  93970. });
  93971. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  93972. this.usingNativeControls(this.techGet_("controls"));
  93973. if (this.controls() && !this.usingNativeControls()) {
  93974. this.addTechControlsListeners_();
  93975. }
  93976. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  93977. prependTo(this.tech_.el(), this.el());
  93978. }
  93979. if (this.tag) {
  93980. this.tag.player = null;
  93981. this.tag = null;
  93982. }
  93983. };
  93984. _proto.unloadTech_ = function unloadTech_() {
  93985. var _this5 = this;
  93986. ALL.names.forEach(function(name) {
  93987. var props = ALL[name];
  93988. _this5[props.privateName] = _this5[props.getterName]();
  93989. });
  93990. this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_);
  93991. this.isReady_ = false;
  93992. this.tech_.dispose();
  93993. this.tech_ = false;
  93994. if (this.isPosterFromTech_) {
  93995. this.poster_ = "";
  93996. this.trigger("posterchange");
  93997. }
  93998. this.isPosterFromTech_ = false;
  93999. };
  94000. _proto.tech = function tech(safety) {
  94001. if (safety === void 0) {
  94002. 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");
  94003. }
  94004. return this.tech_;
  94005. };
  94006. _proto.addTechControlsListeners_ = function addTechControlsListeners_() {
  94007. this.removeTechControlsListeners_();
  94008. this.on(this.tech_, "click", this.boundHandleTechClick_);
  94009. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  94010. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  94011. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  94012. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  94013. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  94014. };
  94015. _proto.removeTechControlsListeners_ = function removeTechControlsListeners_() {
  94016. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  94017. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  94018. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  94019. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  94020. this.off(this.tech_, "click", this.boundHandleTechClick_);
  94021. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  94022. };
  94023. _proto.handleTechReady_ = function handleTechReady_() {
  94024. this.triggerReady();
  94025. if (this.cache_.volume) {
  94026. this.techCall_("setVolume", this.cache_.volume);
  94027. }
  94028. this.handleTechPosterChange_();
  94029. this.handleTechDurationChange_();
  94030. };
  94031. _proto.handleTechLoadStart_ = function handleTechLoadStart_() {
  94032. this.removeClass("vjs-ended");
  94033. this.removeClass("vjs-seeking");
  94034. this.error(null);
  94035. this.handleTechDurationChange_();
  94036. if (!this.paused()) {
  94037. this.trigger("loadstart");
  94038. this.trigger("firstplay");
  94039. } else {
  94040. this.hasStarted(false);
  94041. this.trigger("loadstart");
  94042. }
  94043. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  94044. };
  94045. _proto.manualAutoplay_ = function manualAutoplay_(type2) {
  94046. var _this6 = this;
  94047. if (!this.tech_ || typeof type2 !== "string") {
  94048. return;
  94049. }
  94050. var resolveMuted = function resolveMuted2() {
  94051. var previouslyMuted = _this6.muted();
  94052. _this6.muted(true);
  94053. var restoreMuted = function restoreMuted2() {
  94054. _this6.muted(previouslyMuted);
  94055. };
  94056. _this6.playTerminatedQueue_.push(restoreMuted);
  94057. var mutedPromise = _this6.play();
  94058. if (!isPromise(mutedPromise)) {
  94059. return;
  94060. }
  94061. return mutedPromise["catch"](function(err) {
  94062. restoreMuted();
  94063. throw new Error("Rejection at manualAutoplay. Restoring muted value. " + (err ? err : ""));
  94064. });
  94065. };
  94066. var promise;
  94067. if (type2 === "any" && !this.muted()) {
  94068. promise = this.play();
  94069. if (isPromise(promise)) {
  94070. promise = promise["catch"](resolveMuted);
  94071. }
  94072. } else if (type2 === "muted" && !this.muted()) {
  94073. promise = resolveMuted();
  94074. } else {
  94075. promise = this.play();
  94076. }
  94077. if (!isPromise(promise)) {
  94078. return;
  94079. }
  94080. return promise.then(function() {
  94081. _this6.trigger({
  94082. type: "autoplay-success",
  94083. autoplay: type2
  94084. });
  94085. })["catch"](function() {
  94086. _this6.trigger({
  94087. type: "autoplay-failure",
  94088. autoplay: type2
  94089. });
  94090. });
  94091. };
  94092. _proto.updateSourceCaches_ = function updateSourceCaches_(srcObj) {
  94093. if (srcObj === void 0) {
  94094. srcObj = "";
  94095. }
  94096. var src = srcObj;
  94097. var type2 = "";
  94098. if (typeof src !== "string") {
  94099. src = srcObj.src;
  94100. type2 = srcObj.type;
  94101. }
  94102. this.cache_.source = this.cache_.source || {};
  94103. this.cache_.sources = this.cache_.sources || [];
  94104. if (src && !type2) {
  94105. type2 = findMimetype(this, src);
  94106. }
  94107. this.cache_.source = mergeOptions$3({}, srcObj, {
  94108. src,
  94109. type: type2
  94110. });
  94111. var matchingSources = this.cache_.sources.filter(function(s) {
  94112. return s.src && s.src === src;
  94113. });
  94114. var sourceElSources = [];
  94115. var sourceEls = this.$$("source");
  94116. var matchingSourceEls = [];
  94117. for (var i2 = 0; i2 < sourceEls.length; i2++) {
  94118. var sourceObj = getAttributes(sourceEls[i2]);
  94119. sourceElSources.push(sourceObj);
  94120. if (sourceObj.src && sourceObj.src === src) {
  94121. matchingSourceEls.push(sourceObj.src);
  94122. }
  94123. }
  94124. if (matchingSourceEls.length && !matchingSources.length) {
  94125. this.cache_.sources = sourceElSources;
  94126. } else if (!matchingSources.length) {
  94127. this.cache_.sources = [this.cache_.source];
  94128. }
  94129. this.cache_.src = src;
  94130. };
  94131. _proto.handleTechSourceset_ = function handleTechSourceset_(event2) {
  94132. var _this7 = this;
  94133. if (!this.changingSrc_) {
  94134. var updateSourceCaches = function updateSourceCaches2(src) {
  94135. return _this7.updateSourceCaches_(src);
  94136. };
  94137. var playerSrc = this.currentSource().src;
  94138. var eventSrc = event2.src;
  94139. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  94140. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  94141. updateSourceCaches = function updateSourceCaches2() {
  94142. };
  94143. }
  94144. }
  94145. updateSourceCaches(eventSrc);
  94146. if (!event2.src) {
  94147. this.tech_.any(["sourceset", "loadstart"], function(e) {
  94148. if (e.type === "sourceset") {
  94149. return;
  94150. }
  94151. var techSrc = _this7.techGet("currentSrc");
  94152. _this7.lastSource_.tech = techSrc;
  94153. _this7.updateSourceCaches_(techSrc);
  94154. });
  94155. }
  94156. }
  94157. this.lastSource_ = {
  94158. player: this.currentSource().src,
  94159. tech: event2.src
  94160. };
  94161. this.trigger({
  94162. src: event2.src,
  94163. type: "sourceset"
  94164. });
  94165. };
  94166. _proto.hasStarted = function hasStarted(request) {
  94167. if (request === void 0) {
  94168. return this.hasStarted_;
  94169. }
  94170. if (request === this.hasStarted_) {
  94171. return;
  94172. }
  94173. this.hasStarted_ = request;
  94174. if (this.hasStarted_) {
  94175. this.addClass("vjs-has-started");
  94176. this.trigger("firstplay");
  94177. } else {
  94178. this.removeClass("vjs-has-started");
  94179. }
  94180. };
  94181. _proto.handleTechPlay_ = function handleTechPlay_() {
  94182. this.removeClass("vjs-ended");
  94183. this.removeClass("vjs-paused");
  94184. this.addClass("vjs-playing");
  94185. this.hasStarted(true);
  94186. this.trigger("play");
  94187. };
  94188. _proto.handleTechRateChange_ = function handleTechRateChange_() {
  94189. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  94190. this.queuedCallbacks_.forEach(function(queued) {
  94191. return queued.callback(queued.event);
  94192. });
  94193. this.queuedCallbacks_ = [];
  94194. }
  94195. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  94196. this.trigger("ratechange");
  94197. };
  94198. _proto.handleTechWaiting_ = function handleTechWaiting_() {
  94199. var _this8 = this;
  94200. this.addClass("vjs-waiting");
  94201. this.trigger("waiting");
  94202. var timeWhenWaiting = this.currentTime();
  94203. var timeUpdateListener = function timeUpdateListener2() {
  94204. if (timeWhenWaiting !== _this8.currentTime()) {
  94205. _this8.removeClass("vjs-waiting");
  94206. _this8.off("timeupdate", timeUpdateListener2);
  94207. }
  94208. };
  94209. this.on("timeupdate", timeUpdateListener);
  94210. };
  94211. _proto.handleTechCanPlay_ = function handleTechCanPlay_() {
  94212. this.removeClass("vjs-waiting");
  94213. this.trigger("canplay");
  94214. };
  94215. _proto.handleTechCanPlayThrough_ = function handleTechCanPlayThrough_() {
  94216. this.removeClass("vjs-waiting");
  94217. this.trigger("canplaythrough");
  94218. };
  94219. _proto.handleTechPlaying_ = function handleTechPlaying_() {
  94220. this.removeClass("vjs-waiting");
  94221. this.trigger("playing");
  94222. };
  94223. _proto.handleTechSeeking_ = function handleTechSeeking_() {
  94224. this.addClass("vjs-seeking");
  94225. this.trigger("seeking");
  94226. };
  94227. _proto.handleTechSeeked_ = function handleTechSeeked_() {
  94228. this.removeClass("vjs-seeking");
  94229. this.removeClass("vjs-ended");
  94230. this.trigger("seeked");
  94231. };
  94232. _proto.handleTechFirstPlay_ = function handleTechFirstPlay_() {
  94233. if (this.options_.starttime) {
  94234. log$1.warn("Passing the `starttime` option to the player will be deprecated in 6.0");
  94235. this.currentTime(this.options_.starttime);
  94236. }
  94237. this.addClass("vjs-has-started");
  94238. this.trigger("firstplay");
  94239. };
  94240. _proto.handleTechPause_ = function handleTechPause_() {
  94241. this.removeClass("vjs-playing");
  94242. this.addClass("vjs-paused");
  94243. this.trigger("pause");
  94244. };
  94245. _proto.handleTechEnded_ = function handleTechEnded_() {
  94246. this.addClass("vjs-ended");
  94247. this.removeClass("vjs-waiting");
  94248. if (this.options_.loop) {
  94249. this.currentTime(0);
  94250. this.play();
  94251. } else if (!this.paused()) {
  94252. this.pause();
  94253. }
  94254. this.trigger("ended");
  94255. };
  94256. _proto.handleTechDurationChange_ = function handleTechDurationChange_() {
  94257. this.duration(this.techGet_("duration"));
  94258. };
  94259. _proto.handleTechClick_ = function handleTechClick_(event2) {
  94260. if (!this.controls_) {
  94261. return;
  94262. }
  94263. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  94264. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  94265. this.options_.userActions.click.call(this, event2);
  94266. } else if (this.paused()) {
  94267. silencePromise(this.play());
  94268. } else {
  94269. this.pause();
  94270. }
  94271. }
  94272. };
  94273. _proto.handleTechDoubleClick_ = function handleTechDoubleClick_(event2) {
  94274. if (!this.controls_) {
  94275. return;
  94276. }
  94277. var inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(el) {
  94278. return el.contains(event2.target);
  94279. });
  94280. if (!inAllowedEls) {
  94281. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  94282. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  94283. this.options_.userActions.doubleClick.call(this, event2);
  94284. } else if (this.isFullscreen()) {
  94285. this.exitFullscreen();
  94286. } else {
  94287. this.requestFullscreen();
  94288. }
  94289. }
  94290. }
  94291. };
  94292. _proto.handleTechTap_ = function handleTechTap_() {
  94293. this.userActive(!this.userActive());
  94294. };
  94295. _proto.handleTechTouchStart_ = function handleTechTouchStart_() {
  94296. this.userWasActive = this.userActive();
  94297. };
  94298. _proto.handleTechTouchMove_ = function handleTechTouchMove_() {
  94299. if (this.userWasActive) {
  94300. this.reportUserActivity();
  94301. }
  94302. };
  94303. _proto.handleTechTouchEnd_ = function handleTechTouchEnd_(event2) {
  94304. if (event2.cancelable) {
  94305. event2.preventDefault();
  94306. }
  94307. };
  94308. _proto.handleStageClick_ = function handleStageClick_() {
  94309. this.reportUserActivity();
  94310. };
  94311. _proto.toggleFullscreenClass_ = function toggleFullscreenClass_() {
  94312. if (this.isFullscreen()) {
  94313. this.addClass("vjs-fullscreen");
  94314. } else {
  94315. this.removeClass("vjs-fullscreen");
  94316. }
  94317. };
  94318. _proto.documentFullscreenChange_ = function documentFullscreenChange_(e) {
  94319. var targetPlayer = e.target.player;
  94320. if (targetPlayer && targetPlayer !== this) {
  94321. return;
  94322. }
  94323. var el = this.el();
  94324. var isFs = document_1[this.fsApi_.fullscreenElement] === el;
  94325. if (!isFs && el.matches) {
  94326. isFs = el.matches(":" + this.fsApi_.fullscreen);
  94327. } else if (!isFs && el.msMatchesSelector) {
  94328. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  94329. }
  94330. this.isFullscreen(isFs);
  94331. };
  94332. _proto.handleTechFullscreenChange_ = function handleTechFullscreenChange_(event2, data) {
  94333. var _this9 = this;
  94334. if (data) {
  94335. if (data.nativeIOSFullscreen) {
  94336. this.addClass("vjs-ios-native-fs");
  94337. this.tech_.one("webkitendfullscreen", function() {
  94338. _this9.removeClass("vjs-ios-native-fs");
  94339. });
  94340. }
  94341. this.isFullscreen(data.isFullscreen);
  94342. }
  94343. };
  94344. _proto.handleTechFullscreenError_ = function handleTechFullscreenError_(event2, err) {
  94345. this.trigger("fullscreenerror", err);
  94346. };
  94347. _proto.togglePictureInPictureClass_ = function togglePictureInPictureClass_() {
  94348. if (this.isInPictureInPicture()) {
  94349. this.addClass("vjs-picture-in-picture");
  94350. } else {
  94351. this.removeClass("vjs-picture-in-picture");
  94352. }
  94353. };
  94354. _proto.handleTechEnterPictureInPicture_ = function handleTechEnterPictureInPicture_(event2) {
  94355. this.isInPictureInPicture(true);
  94356. };
  94357. _proto.handleTechLeavePictureInPicture_ = function handleTechLeavePictureInPicture_(event2) {
  94358. this.isInPictureInPicture(false);
  94359. };
  94360. _proto.handleTechError_ = function handleTechError_() {
  94361. var error = this.tech_.error();
  94362. this.error(error);
  94363. };
  94364. _proto.handleTechTextData_ = function handleTechTextData_() {
  94365. var data = null;
  94366. if (arguments.length > 1) {
  94367. data = arguments[1];
  94368. }
  94369. this.trigger("textdata", data);
  94370. };
  94371. _proto.getCache = function getCache() {
  94372. return this.cache_;
  94373. };
  94374. _proto.resetCache_ = function resetCache_() {
  94375. this.cache_ = {
  94376. currentTime: 0,
  94377. initTime: 0,
  94378. inactivityTimeout: this.options_.inactivityTimeout,
  94379. duration: NaN,
  94380. lastVolume: 1,
  94381. lastPlaybackRate: this.defaultPlaybackRate(),
  94382. media: null,
  94383. src: "",
  94384. source: {},
  94385. sources: [],
  94386. playbackRates: [],
  94387. volume: 1
  94388. };
  94389. };
  94390. _proto.techCall_ = function techCall_(method, arg) {
  94391. this.ready(function() {
  94392. if (method in allowedSetters) {
  94393. return set(this.middleware_, this.tech_, method, arg);
  94394. } else if (method in allowedMediators) {
  94395. return mediate(this.middleware_, this.tech_, method, arg);
  94396. }
  94397. try {
  94398. if (this.tech_) {
  94399. this.tech_[method](arg);
  94400. }
  94401. } catch (e) {
  94402. log$1(e);
  94403. throw e;
  94404. }
  94405. }, true);
  94406. };
  94407. _proto.techGet_ = function techGet_(method) {
  94408. if (!this.tech_ || !this.tech_.isReady_) {
  94409. return;
  94410. }
  94411. if (method in allowedGetters) {
  94412. return get(this.middleware_, this.tech_, method);
  94413. } else if (method in allowedMediators) {
  94414. return mediate(this.middleware_, this.tech_, method);
  94415. }
  94416. try {
  94417. return this.tech_[method]();
  94418. } catch (e) {
  94419. if (this.tech_[method] === void 0) {
  94420. log$1("Video.js: " + method + " method not defined for " + this.techName_ + " playback technology.", e);
  94421. throw e;
  94422. }
  94423. if (e.name === "TypeError") {
  94424. log$1("Video.js: " + method + " unavailable on " + this.techName_ + " playback technology element.", e);
  94425. this.tech_.isReady_ = false;
  94426. throw e;
  94427. }
  94428. log$1(e);
  94429. throw e;
  94430. }
  94431. };
  94432. _proto.play = function play() {
  94433. var _this10 = this;
  94434. var PromiseClass = this.options_.Promise || window_1.Promise;
  94435. if (PromiseClass) {
  94436. return new PromiseClass(function(resolve2) {
  94437. _this10.play_(resolve2);
  94438. });
  94439. }
  94440. return this.play_();
  94441. };
  94442. _proto.play_ = function play_(callback2) {
  94443. var _this11 = this;
  94444. if (callback2 === void 0) {
  94445. callback2 = silencePromise;
  94446. }
  94447. this.playCallbacks_.push(callback2);
  94448. var isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  94449. var isSafariOrIOS = Boolean(IS_ANY_SAFARI || IS_IOS);
  94450. if (this.waitToPlay_) {
  94451. this.off(["ready", "loadstart"], this.waitToPlay_);
  94452. this.waitToPlay_ = null;
  94453. }
  94454. if (!this.isReady_ || !isSrcReady) {
  94455. this.waitToPlay_ = function(e) {
  94456. _this11.play_();
  94457. };
  94458. this.one(["ready", "loadstart"], this.waitToPlay_);
  94459. if (!isSrcReady && isSafariOrIOS) {
  94460. this.load();
  94461. }
  94462. return;
  94463. }
  94464. var val = this.techGet_("play");
  94465. var isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  94466. if (isNativeReplay) {
  94467. this.resetProgressBar_();
  94468. }
  94469. if (val === null) {
  94470. this.runPlayTerminatedQueue_();
  94471. } else {
  94472. this.runPlayCallbacks_(val);
  94473. }
  94474. };
  94475. _proto.runPlayTerminatedQueue_ = function runPlayTerminatedQueue_() {
  94476. var queue = this.playTerminatedQueue_.slice(0);
  94477. this.playTerminatedQueue_ = [];
  94478. queue.forEach(function(q2) {
  94479. q2();
  94480. });
  94481. };
  94482. _proto.runPlayCallbacks_ = function runPlayCallbacks_(val) {
  94483. var callbacks = this.playCallbacks_.slice(0);
  94484. this.playCallbacks_ = [];
  94485. this.playTerminatedQueue_ = [];
  94486. callbacks.forEach(function(cb) {
  94487. cb(val);
  94488. });
  94489. };
  94490. _proto.pause = function pause() {
  94491. this.techCall_("pause");
  94492. };
  94493. _proto.paused = function paused() {
  94494. return this.techGet_("paused") === false ? false : true;
  94495. };
  94496. _proto.played = function played() {
  94497. return this.techGet_("played") || createTimeRanges(0, 0);
  94498. };
  94499. _proto.scrubbing = function scrubbing(isScrubbing) {
  94500. if (typeof isScrubbing === "undefined") {
  94501. return this.scrubbing_;
  94502. }
  94503. this.scrubbing_ = !!isScrubbing;
  94504. this.techCall_("setScrubbing", this.scrubbing_);
  94505. if (isScrubbing) {
  94506. this.addClass("vjs-scrubbing");
  94507. } else {
  94508. this.removeClass("vjs-scrubbing");
  94509. }
  94510. };
  94511. _proto.currentTime = function currentTime(seconds) {
  94512. if (typeof seconds !== "undefined") {
  94513. if (seconds < 0) {
  94514. seconds = 0;
  94515. }
  94516. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  94517. this.cache_.initTime = seconds;
  94518. this.off("canplay", this.boundApplyInitTime_);
  94519. this.one("canplay", this.boundApplyInitTime_);
  94520. return;
  94521. }
  94522. this.techCall_("setCurrentTime", seconds);
  94523. this.cache_.initTime = 0;
  94524. return;
  94525. }
  94526. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  94527. return this.cache_.currentTime;
  94528. };
  94529. _proto.applyInitTime_ = function applyInitTime_() {
  94530. this.currentTime(this.cache_.initTime);
  94531. };
  94532. _proto.duration = function duration5(seconds) {
  94533. if (seconds === void 0) {
  94534. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  94535. }
  94536. seconds = parseFloat(seconds);
  94537. if (seconds < 0) {
  94538. seconds = Infinity;
  94539. }
  94540. if (seconds !== this.cache_.duration) {
  94541. this.cache_.duration = seconds;
  94542. if (seconds === Infinity) {
  94543. this.addClass("vjs-live");
  94544. } else {
  94545. this.removeClass("vjs-live");
  94546. }
  94547. if (!isNaN(seconds)) {
  94548. this.trigger("durationchange");
  94549. }
  94550. }
  94551. };
  94552. _proto.remainingTime = function remainingTime() {
  94553. return this.duration() - this.currentTime();
  94554. };
  94555. _proto.remainingTimeDisplay = function remainingTimeDisplay() {
  94556. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  94557. };
  94558. _proto.buffered = function buffered() {
  94559. var buffered2 = this.techGet_("buffered");
  94560. if (!buffered2 || !buffered2.length) {
  94561. buffered2 = createTimeRanges(0, 0);
  94562. }
  94563. return buffered2;
  94564. };
  94565. _proto.bufferedPercent = function bufferedPercent$12() {
  94566. return bufferedPercent(this.buffered(), this.duration());
  94567. };
  94568. _proto.bufferedEnd = function bufferedEnd() {
  94569. var buffered = this.buffered();
  94570. var duration5 = this.duration();
  94571. var end = buffered.end(buffered.length - 1);
  94572. if (end > duration5) {
  94573. end = duration5;
  94574. }
  94575. return end;
  94576. };
  94577. _proto.volume = function volume(percentAsDecimal) {
  94578. var vol;
  94579. if (percentAsDecimal !== void 0) {
  94580. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  94581. this.cache_.volume = vol;
  94582. this.techCall_("setVolume", vol);
  94583. if (vol > 0) {
  94584. this.lastVolume_(vol);
  94585. }
  94586. return;
  94587. }
  94588. vol = parseFloat(this.techGet_("volume"));
  94589. return isNaN(vol) ? 1 : vol;
  94590. };
  94591. _proto.muted = function muted(_muted) {
  94592. if (_muted !== void 0) {
  94593. this.techCall_("setMuted", _muted);
  94594. return;
  94595. }
  94596. return this.techGet_("muted") || false;
  94597. };
  94598. _proto.defaultMuted = function defaultMuted(_defaultMuted) {
  94599. if (_defaultMuted !== void 0) {
  94600. return this.techCall_("setDefaultMuted", _defaultMuted);
  94601. }
  94602. return this.techGet_("defaultMuted") || false;
  94603. };
  94604. _proto.lastVolume_ = function lastVolume_(percentAsDecimal) {
  94605. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  94606. this.cache_.lastVolume = percentAsDecimal;
  94607. return;
  94608. }
  94609. return this.cache_.lastVolume;
  94610. };
  94611. _proto.supportsFullScreen = function supportsFullScreen() {
  94612. return this.techGet_("supportsFullScreen") || false;
  94613. };
  94614. _proto.isFullscreen = function isFullscreen(isFS) {
  94615. if (isFS !== void 0) {
  94616. var oldValue = this.isFullscreen_;
  94617. this.isFullscreen_ = Boolean(isFS);
  94618. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  94619. this.trigger("fullscreenchange");
  94620. }
  94621. this.toggleFullscreenClass_();
  94622. return;
  94623. }
  94624. return this.isFullscreen_;
  94625. };
  94626. _proto.requestFullscreen = function requestFullscreen(fullscreenOptions) {
  94627. var PromiseClass = this.options_.Promise || window_1.Promise;
  94628. if (PromiseClass) {
  94629. var self2 = this;
  94630. return new PromiseClass(function(resolve2, reject2) {
  94631. function offHandler() {
  94632. self2.off("fullscreenerror", errorHandler);
  94633. self2.off("fullscreenchange", changeHandler);
  94634. }
  94635. function changeHandler() {
  94636. offHandler();
  94637. resolve2();
  94638. }
  94639. function errorHandler(e, err) {
  94640. offHandler();
  94641. reject2(err);
  94642. }
  94643. self2.one("fullscreenchange", changeHandler);
  94644. self2.one("fullscreenerror", errorHandler);
  94645. var promise = self2.requestFullscreenHelper_(fullscreenOptions);
  94646. if (promise) {
  94647. promise.then(offHandler, offHandler);
  94648. promise.then(resolve2, reject2);
  94649. }
  94650. });
  94651. }
  94652. return this.requestFullscreenHelper_();
  94653. };
  94654. _proto.requestFullscreenHelper_ = function requestFullscreenHelper_(fullscreenOptions) {
  94655. var _this12 = this;
  94656. var fsOptions;
  94657. if (!this.fsApi_.prefixed) {
  94658. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  94659. if (fullscreenOptions !== void 0) {
  94660. fsOptions = fullscreenOptions;
  94661. }
  94662. }
  94663. if (this.fsApi_.requestFullscreen) {
  94664. var promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  94665. if (promise) {
  94666. promise.then(function() {
  94667. return _this12.isFullscreen(true);
  94668. }, function() {
  94669. return _this12.isFullscreen(false);
  94670. });
  94671. }
  94672. return promise;
  94673. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94674. this.techCall_("enterFullScreen");
  94675. } else {
  94676. this.enterFullWindow();
  94677. }
  94678. };
  94679. _proto.exitFullscreen = function exitFullscreen() {
  94680. var PromiseClass = this.options_.Promise || window_1.Promise;
  94681. if (PromiseClass) {
  94682. var self2 = this;
  94683. return new PromiseClass(function(resolve2, reject2) {
  94684. function offHandler() {
  94685. self2.off("fullscreenerror", errorHandler);
  94686. self2.off("fullscreenchange", changeHandler);
  94687. }
  94688. function changeHandler() {
  94689. offHandler();
  94690. resolve2();
  94691. }
  94692. function errorHandler(e, err) {
  94693. offHandler();
  94694. reject2(err);
  94695. }
  94696. self2.one("fullscreenchange", changeHandler);
  94697. self2.one("fullscreenerror", errorHandler);
  94698. var promise = self2.exitFullscreenHelper_();
  94699. if (promise) {
  94700. promise.then(offHandler, offHandler);
  94701. promise.then(resolve2, reject2);
  94702. }
  94703. });
  94704. }
  94705. return this.exitFullscreenHelper_();
  94706. };
  94707. _proto.exitFullscreenHelper_ = function exitFullscreenHelper_() {
  94708. var _this13 = this;
  94709. if (this.fsApi_.requestFullscreen) {
  94710. var promise = document_1[this.fsApi_.exitFullscreen]();
  94711. if (promise) {
  94712. silencePromise(promise.then(function() {
  94713. return _this13.isFullscreen(false);
  94714. }));
  94715. }
  94716. return promise;
  94717. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94718. this.techCall_("exitFullScreen");
  94719. } else {
  94720. this.exitFullWindow();
  94721. }
  94722. };
  94723. _proto.enterFullWindow = function enterFullWindow() {
  94724. this.isFullscreen(true);
  94725. this.isFullWindow = true;
  94726. this.docOrigOverflow = document_1.documentElement.style.overflow;
  94727. on(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94728. document_1.documentElement.style.overflow = "hidden";
  94729. addClass(document_1.body, "vjs-full-window");
  94730. this.trigger("enterFullWindow");
  94731. };
  94732. _proto.fullWindowOnEscKey = function fullWindowOnEscKey(event2) {
  94733. if (keycode.isEventKey(event2, "Esc")) {
  94734. if (this.isFullscreen() === true) {
  94735. if (!this.isFullWindow) {
  94736. this.exitFullscreen();
  94737. } else {
  94738. this.exitFullWindow();
  94739. }
  94740. }
  94741. }
  94742. };
  94743. _proto.exitFullWindow = function exitFullWindow() {
  94744. this.isFullscreen(false);
  94745. this.isFullWindow = false;
  94746. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94747. document_1.documentElement.style.overflow = this.docOrigOverflow;
  94748. removeClass(document_1.body, "vjs-full-window");
  94749. this.trigger("exitFullWindow");
  94750. };
  94751. _proto.disablePictureInPicture = function disablePictureInPicture(value) {
  94752. if (value === void 0) {
  94753. return this.techGet_("disablePictureInPicture");
  94754. }
  94755. this.techCall_("setDisablePictureInPicture", value);
  94756. this.options_.disablePictureInPicture = value;
  94757. this.trigger("disablepictureinpicturechanged");
  94758. };
  94759. _proto.isInPictureInPicture = function isInPictureInPicture(isPiP) {
  94760. if (isPiP !== void 0) {
  94761. this.isInPictureInPicture_ = !!isPiP;
  94762. this.togglePictureInPictureClass_();
  94763. return;
  94764. }
  94765. return !!this.isInPictureInPicture_;
  94766. };
  94767. _proto.requestPictureInPicture = function requestPictureInPicture() {
  94768. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  94769. return this.techGet_("requestPictureInPicture");
  94770. }
  94771. };
  94772. _proto.exitPictureInPicture = function exitPictureInPicture() {
  94773. if ("pictureInPictureEnabled" in document_1) {
  94774. return document_1.exitPictureInPicture();
  94775. }
  94776. };
  94777. _proto.handleKeyDown = function handleKeyDown(event2) {
  94778. var userActions = this.options_.userActions;
  94779. if (!userActions || !userActions.hotkeys) {
  94780. return;
  94781. }
  94782. var excludeElement = function excludeElement2(el) {
  94783. var tagName = el.tagName.toLowerCase();
  94784. if (el.isContentEditable) {
  94785. return true;
  94786. }
  94787. var allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  94788. if (tagName === "input") {
  94789. return allowedInputTypes.indexOf(el.type) === -1;
  94790. }
  94791. var excludedTags = ["textarea"];
  94792. return excludedTags.indexOf(tagName) !== -1;
  94793. };
  94794. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  94795. return;
  94796. }
  94797. if (typeof userActions.hotkeys === "function") {
  94798. userActions.hotkeys.call(this, event2);
  94799. } else {
  94800. this.handleHotkeys(event2);
  94801. }
  94802. };
  94803. _proto.handleHotkeys = function handleHotkeys(event2) {
  94804. var hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  94805. var _hotkeys$fullscreenKe = hotkeys.fullscreenKey, fullscreenKey = _hotkeys$fullscreenKe === void 0 ? function(keydownEvent) {
  94806. return keycode.isEventKey(keydownEvent, "f");
  94807. } : _hotkeys$fullscreenKe, _hotkeys$muteKey = hotkeys.muteKey, muteKey = _hotkeys$muteKey === void 0 ? function(keydownEvent) {
  94808. return keycode.isEventKey(keydownEvent, "m");
  94809. } : _hotkeys$muteKey, _hotkeys$playPauseKey = hotkeys.playPauseKey, playPauseKey = _hotkeys$playPauseKey === void 0 ? function(keydownEvent) {
  94810. return keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space");
  94811. } : _hotkeys$playPauseKey;
  94812. if (fullscreenKey.call(this, event2)) {
  94813. event2.preventDefault();
  94814. event2.stopPropagation();
  94815. var FSToggle = Component$1.getComponent("FullscreenToggle");
  94816. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  94817. FSToggle.prototype.handleClick.call(this, event2);
  94818. }
  94819. } else if (muteKey.call(this, event2)) {
  94820. event2.preventDefault();
  94821. event2.stopPropagation();
  94822. var MuteToggle2 = Component$1.getComponent("MuteToggle");
  94823. MuteToggle2.prototype.handleClick.call(this, event2);
  94824. } else if (playPauseKey.call(this, event2)) {
  94825. event2.preventDefault();
  94826. event2.stopPropagation();
  94827. var PlayToggle2 = Component$1.getComponent("PlayToggle");
  94828. PlayToggle2.prototype.handleClick.call(this, event2);
  94829. }
  94830. };
  94831. _proto.canPlayType = function canPlayType3(type2) {
  94832. var can;
  94833. for (var i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  94834. var techName = j[i2];
  94835. var tech = Tech$1.getTech(techName);
  94836. if (!tech) {
  94837. tech = Component$1.getComponent(techName);
  94838. }
  94839. if (!tech) {
  94840. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94841. continue;
  94842. }
  94843. if (tech.isSupported()) {
  94844. can = tech.canPlayType(type2);
  94845. if (can) {
  94846. return can;
  94847. }
  94848. }
  94849. }
  94850. return "";
  94851. };
  94852. _proto.selectSource = function selectSource(sources) {
  94853. var _this14 = this;
  94854. var techs = this.options_.techOrder.map(function(techName) {
  94855. return [techName, Tech$1.getTech(techName)];
  94856. }).filter(function(_ref) {
  94857. var techName = _ref[0], tech = _ref[1];
  94858. if (tech) {
  94859. return tech.isSupported();
  94860. }
  94861. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94862. return false;
  94863. });
  94864. var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair2(outerArray, innerArray, tester) {
  94865. var found;
  94866. outerArray.some(function(outerChoice) {
  94867. return innerArray.some(function(innerChoice) {
  94868. found = tester(outerChoice, innerChoice);
  94869. if (found) {
  94870. return true;
  94871. }
  94872. });
  94873. });
  94874. return found;
  94875. };
  94876. var foundSourceAndTech;
  94877. var flip = function flip2(fn2) {
  94878. return function(a, b) {
  94879. return fn2(b, a);
  94880. };
  94881. };
  94882. var finder = function finder2(_ref2, source) {
  94883. var techName = _ref2[0], tech = _ref2[1];
  94884. if (tech.canPlaySource(source, _this14.options_[techName.toLowerCase()])) {
  94885. return {
  94886. source,
  94887. tech: techName
  94888. };
  94889. }
  94890. };
  94891. if (this.options_.sourceOrder) {
  94892. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  94893. } else {
  94894. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  94895. }
  94896. return foundSourceAndTech || false;
  94897. };
  94898. _proto.handleSrc_ = function handleSrc_(source, isRetry) {
  94899. var _this15 = this;
  94900. if (typeof source === "undefined") {
  94901. return this.cache_.src || "";
  94902. }
  94903. if (this.resetRetryOnError_) {
  94904. this.resetRetryOnError_();
  94905. }
  94906. var sources = filterSource(source);
  94907. if (!sources.length) {
  94908. this.setTimeout(function() {
  94909. this.error({
  94910. code: 4,
  94911. message: this.options_.notSupportedMessage
  94912. });
  94913. }, 0);
  94914. return;
  94915. }
  94916. this.changingSrc_ = true;
  94917. if (!isRetry) {
  94918. this.cache_.sources = sources;
  94919. }
  94920. this.updateSourceCaches_(sources[0]);
  94921. setSource(this, sources[0], function(middlewareSource, mws) {
  94922. _this15.middleware_ = mws;
  94923. if (!isRetry) {
  94924. _this15.cache_.sources = sources;
  94925. }
  94926. _this15.updateSourceCaches_(middlewareSource);
  94927. var err = _this15.src_(middlewareSource);
  94928. if (err) {
  94929. if (sources.length > 1) {
  94930. return _this15.handleSrc_(sources.slice(1));
  94931. }
  94932. _this15.changingSrc_ = false;
  94933. _this15.setTimeout(function() {
  94934. this.error({
  94935. code: 4,
  94936. message: this.options_.notSupportedMessage
  94937. });
  94938. }, 0);
  94939. _this15.triggerReady();
  94940. return;
  94941. }
  94942. setTech(mws, _this15.tech_);
  94943. });
  94944. if (this.options_.retryOnError && sources.length > 1) {
  94945. var retry = function retry2() {
  94946. _this15.error(null);
  94947. _this15.handleSrc_(sources.slice(1), true);
  94948. };
  94949. var stopListeningForErrors = function stopListeningForErrors2() {
  94950. _this15.off("error", retry);
  94951. };
  94952. this.one("error", retry);
  94953. this.one("playing", stopListeningForErrors);
  94954. this.resetRetryOnError_ = function() {
  94955. _this15.off("error", retry);
  94956. _this15.off("playing", stopListeningForErrors);
  94957. };
  94958. }
  94959. };
  94960. _proto.src = function src(source) {
  94961. return this.handleSrc_(source, false);
  94962. };
  94963. _proto.src_ = function src_(source) {
  94964. var _this16 = this;
  94965. var sourceTech = this.selectSource([source]);
  94966. if (!sourceTech) {
  94967. return true;
  94968. }
  94969. if (!titleCaseEquals(sourceTech.tech, this.techName_)) {
  94970. this.changingSrc_ = true;
  94971. this.loadTech_(sourceTech.tech, sourceTech.source);
  94972. this.tech_.ready(function() {
  94973. _this16.changingSrc_ = false;
  94974. });
  94975. return false;
  94976. }
  94977. this.ready(function() {
  94978. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  94979. this.techCall_("setSource", source);
  94980. } else {
  94981. this.techCall_("src", source.src);
  94982. }
  94983. this.changingSrc_ = false;
  94984. }, true);
  94985. return false;
  94986. };
  94987. _proto.load = function load() {
  94988. this.techCall_("load");
  94989. };
  94990. _proto.reset = function reset3() {
  94991. var _this17 = this;
  94992. var PromiseClass = this.options_.Promise || window_1.Promise;
  94993. if (this.paused() || !PromiseClass) {
  94994. this.doReset_();
  94995. } else {
  94996. var playPromise = this.play();
  94997. silencePromise(playPromise.then(function() {
  94998. return _this17.doReset_();
  94999. }));
  95000. }
  95001. };
  95002. _proto.doReset_ = function doReset_() {
  95003. if (this.tech_) {
  95004. this.tech_.clearTracks("text");
  95005. }
  95006. this.resetCache_();
  95007. this.poster("");
  95008. this.loadTech_(this.options_.techOrder[0], null);
  95009. this.techCall_("reset");
  95010. this.resetControlBarUI_();
  95011. if (isEvented(this)) {
  95012. this.trigger("playerreset");
  95013. }
  95014. };
  95015. _proto.resetControlBarUI_ = function resetControlBarUI_() {
  95016. this.resetProgressBar_();
  95017. this.resetPlaybackRate_();
  95018. this.resetVolumeBar_();
  95019. };
  95020. _proto.resetProgressBar_ = function resetProgressBar_() {
  95021. this.currentTime(0);
  95022. var _ref3 = this.controlBar || {}, durationDisplay = _ref3.durationDisplay, remainingTimeDisplay = _ref3.remainingTimeDisplay;
  95023. if (durationDisplay) {
  95024. durationDisplay.updateContent();
  95025. }
  95026. if (remainingTimeDisplay) {
  95027. remainingTimeDisplay.updateContent();
  95028. }
  95029. };
  95030. _proto.resetPlaybackRate_ = function resetPlaybackRate_() {
  95031. this.playbackRate(this.defaultPlaybackRate());
  95032. this.handleTechRateChange_();
  95033. };
  95034. _proto.resetVolumeBar_ = function resetVolumeBar_() {
  95035. this.volume(1);
  95036. this.trigger("volumechange");
  95037. };
  95038. _proto.currentSources = function currentSources() {
  95039. var source = this.currentSource();
  95040. var sources = [];
  95041. if (Object.keys(source).length !== 0) {
  95042. sources.push(source);
  95043. }
  95044. return this.cache_.sources || sources;
  95045. };
  95046. _proto.currentSource = function currentSource() {
  95047. return this.cache_.source || {};
  95048. };
  95049. _proto.currentSrc = function currentSrc() {
  95050. return this.currentSource() && this.currentSource().src || "";
  95051. };
  95052. _proto.currentType = function currentType() {
  95053. return this.currentSource() && this.currentSource().type || "";
  95054. };
  95055. _proto.preload = function preload(value) {
  95056. if (value !== void 0) {
  95057. this.techCall_("setPreload", value);
  95058. this.options_.preload = value;
  95059. return;
  95060. }
  95061. return this.techGet_("preload");
  95062. };
  95063. _proto.autoplay = function autoplay(value) {
  95064. if (value === void 0) {
  95065. return this.options_.autoplay || false;
  95066. }
  95067. var techAutoplay;
  95068. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  95069. this.options_.autoplay = value;
  95070. this.manualAutoplay_(typeof value === "string" ? value : "play");
  95071. techAutoplay = false;
  95072. } else if (!value) {
  95073. this.options_.autoplay = false;
  95074. } else {
  95075. this.options_.autoplay = true;
  95076. }
  95077. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  95078. if (this.tech_) {
  95079. this.techCall_("setAutoplay", techAutoplay);
  95080. }
  95081. };
  95082. _proto.playsinline = function playsinline(value) {
  95083. if (value !== void 0) {
  95084. this.techCall_("setPlaysinline", value);
  95085. this.options_.playsinline = value;
  95086. return this;
  95087. }
  95088. return this.techGet_("playsinline");
  95089. };
  95090. _proto.loop = function loop(value) {
  95091. if (value !== void 0) {
  95092. this.techCall_("setLoop", value);
  95093. this.options_.loop = value;
  95094. return;
  95095. }
  95096. return this.techGet_("loop");
  95097. };
  95098. _proto.poster = function poster(src) {
  95099. if (src === void 0) {
  95100. return this.poster_;
  95101. }
  95102. if (!src) {
  95103. src = "";
  95104. }
  95105. if (src === this.poster_) {
  95106. return;
  95107. }
  95108. this.poster_ = src;
  95109. this.techCall_("setPoster", src);
  95110. this.isPosterFromTech_ = false;
  95111. this.trigger("posterchange");
  95112. };
  95113. _proto.handleTechPosterChange_ = function handleTechPosterChange_() {
  95114. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  95115. var newPoster = this.tech_.poster() || "";
  95116. if (newPoster !== this.poster_) {
  95117. this.poster_ = newPoster;
  95118. this.isPosterFromTech_ = true;
  95119. this.trigger("posterchange");
  95120. }
  95121. }
  95122. };
  95123. _proto.controls = function controls(bool) {
  95124. if (bool === void 0) {
  95125. return !!this.controls_;
  95126. }
  95127. bool = !!bool;
  95128. if (this.controls_ === bool) {
  95129. return;
  95130. }
  95131. this.controls_ = bool;
  95132. if (this.usingNativeControls()) {
  95133. this.techCall_("setControls", bool);
  95134. }
  95135. if (this.controls_) {
  95136. this.removeClass("vjs-controls-disabled");
  95137. this.addClass("vjs-controls-enabled");
  95138. this.trigger("controlsenabled");
  95139. if (!this.usingNativeControls()) {
  95140. this.addTechControlsListeners_();
  95141. }
  95142. } else {
  95143. this.removeClass("vjs-controls-enabled");
  95144. this.addClass("vjs-controls-disabled");
  95145. this.trigger("controlsdisabled");
  95146. if (!this.usingNativeControls()) {
  95147. this.removeTechControlsListeners_();
  95148. }
  95149. }
  95150. };
  95151. _proto.usingNativeControls = function usingNativeControls(bool) {
  95152. if (bool === void 0) {
  95153. return !!this.usingNativeControls_;
  95154. }
  95155. bool = !!bool;
  95156. if (this.usingNativeControls_ === bool) {
  95157. return;
  95158. }
  95159. this.usingNativeControls_ = bool;
  95160. if (this.usingNativeControls_) {
  95161. this.addClass("vjs-using-native-controls");
  95162. this.trigger("usingnativecontrols");
  95163. } else {
  95164. this.removeClass("vjs-using-native-controls");
  95165. this.trigger("usingcustomcontrols");
  95166. }
  95167. };
  95168. _proto.error = function error(err) {
  95169. var _this18 = this;
  95170. if (err === void 0) {
  95171. return this.error_ || null;
  95172. }
  95173. hooks("beforeerror").forEach(function(hookFunction) {
  95174. var newErr = hookFunction(_this18, err);
  95175. if (!(isObject2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  95176. _this18.log.error("please return a value that MediaError expects in beforeerror hooks");
  95177. return;
  95178. }
  95179. err = newErr;
  95180. });
  95181. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  95182. var triggerSuppressedError = function triggerSuppressedError2() {
  95183. this.error(err);
  95184. };
  95185. this.options_.suppressNotSupportedError = false;
  95186. this.any(["click", "touchstart"], triggerSuppressedError);
  95187. this.one("loadstart", function() {
  95188. this.off(["click", "touchstart"], triggerSuppressedError);
  95189. });
  95190. return;
  95191. }
  95192. if (err === null) {
  95193. this.error_ = err;
  95194. this.removeClass("vjs-error");
  95195. if (this.errorDisplay) {
  95196. this.errorDisplay.close();
  95197. }
  95198. return;
  95199. }
  95200. this.error_ = new MediaError(err);
  95201. this.addClass("vjs-error");
  95202. log$1.error("(CODE:" + this.error_.code + " " + MediaError.errorTypes[this.error_.code] + ")", this.error_.message, this.error_);
  95203. this.trigger("error");
  95204. hooks("error").forEach(function(hookFunction) {
  95205. return hookFunction(_this18, _this18.error_);
  95206. });
  95207. return;
  95208. };
  95209. _proto.reportUserActivity = function reportUserActivity(event2) {
  95210. this.userActivity_ = true;
  95211. };
  95212. _proto.userActive = function userActive(bool) {
  95213. if (bool === void 0) {
  95214. return this.userActive_;
  95215. }
  95216. bool = !!bool;
  95217. if (bool === this.userActive_) {
  95218. return;
  95219. }
  95220. this.userActive_ = bool;
  95221. if (this.userActive_) {
  95222. this.userActivity_ = true;
  95223. this.removeClass("vjs-user-inactive");
  95224. this.addClass("vjs-user-active");
  95225. this.trigger("useractive");
  95226. return;
  95227. }
  95228. if (this.tech_) {
  95229. this.tech_.one("mousemove", function(e) {
  95230. e.stopPropagation();
  95231. e.preventDefault();
  95232. });
  95233. }
  95234. this.userActivity_ = false;
  95235. this.removeClass("vjs-user-active");
  95236. this.addClass("vjs-user-inactive");
  95237. this.trigger("userinactive");
  95238. };
  95239. _proto.listenForUserActivity_ = function listenForUserActivity_() {
  95240. var mouseInProgress;
  95241. var lastMoveX;
  95242. var lastMoveY;
  95243. var handleActivity = bind(this, this.reportUserActivity);
  95244. var handleMouseMove = function handleMouseMove2(e) {
  95245. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  95246. lastMoveX = e.screenX;
  95247. lastMoveY = e.screenY;
  95248. handleActivity();
  95249. }
  95250. };
  95251. var handleMouseDown = function handleMouseDown2() {
  95252. handleActivity();
  95253. this.clearInterval(mouseInProgress);
  95254. mouseInProgress = this.setInterval(handleActivity, 250);
  95255. };
  95256. var handleMouseUpAndMouseLeave = function handleMouseUpAndMouseLeave2(event2) {
  95257. handleActivity();
  95258. this.clearInterval(mouseInProgress);
  95259. };
  95260. this.on("mousedown", handleMouseDown);
  95261. this.on("mousemove", handleMouseMove);
  95262. this.on("mouseup", handleMouseUpAndMouseLeave);
  95263. this.on("mouseleave", handleMouseUpAndMouseLeave);
  95264. var controlBar = this.getChild("controlBar");
  95265. if (controlBar && !IS_IOS && !IS_ANDROID) {
  95266. controlBar.on("mouseenter", function(event2) {
  95267. if (this.player().options_.inactivityTimeout !== 0) {
  95268. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  95269. }
  95270. this.player().options_.inactivityTimeout = 0;
  95271. });
  95272. controlBar.on("mouseleave", function(event2) {
  95273. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  95274. });
  95275. }
  95276. this.on("keydown", handleActivity);
  95277. this.on("keyup", handleActivity);
  95278. var inactivityTimeout;
  95279. this.setInterval(function() {
  95280. if (!this.userActivity_) {
  95281. return;
  95282. }
  95283. this.userActivity_ = false;
  95284. this.userActive(true);
  95285. this.clearTimeout(inactivityTimeout);
  95286. var timeout = this.options_.inactivityTimeout;
  95287. if (timeout <= 0) {
  95288. return;
  95289. }
  95290. inactivityTimeout = this.setTimeout(function() {
  95291. if (!this.userActivity_) {
  95292. this.userActive(false);
  95293. }
  95294. }, timeout);
  95295. }, 250);
  95296. };
  95297. _proto.playbackRate = function playbackRate(rate) {
  95298. if (rate !== void 0) {
  95299. this.techCall_("setPlaybackRate", rate);
  95300. return;
  95301. }
  95302. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95303. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  95304. }
  95305. return 1;
  95306. };
  95307. _proto.defaultPlaybackRate = function defaultPlaybackRate(rate) {
  95308. if (rate !== void 0) {
  95309. return this.techCall_("setDefaultPlaybackRate", rate);
  95310. }
  95311. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95312. return this.techGet_("defaultPlaybackRate");
  95313. }
  95314. return 1;
  95315. };
  95316. _proto.isAudio = function isAudio(bool) {
  95317. if (bool !== void 0) {
  95318. this.isAudio_ = !!bool;
  95319. return;
  95320. }
  95321. return !!this.isAudio_;
  95322. };
  95323. _proto.enableAudioOnlyUI_ = function enableAudioOnlyUI_() {
  95324. var _this19 = this;
  95325. this.addClass("vjs-audio-only-mode");
  95326. var playerChildren = this.children();
  95327. var controlBar = this.getChild("ControlBar");
  95328. var controlBarHeight = controlBar && controlBar.currentHeight();
  95329. playerChildren.forEach(function(child) {
  95330. if (child === controlBar) {
  95331. return;
  95332. }
  95333. if (child.el_ && !child.hasClass("vjs-hidden")) {
  95334. child.hide();
  95335. _this19.audioOnlyCache_.hiddenChildren.push(child);
  95336. }
  95337. });
  95338. this.audioOnlyCache_.playerHeight = this.currentHeight();
  95339. this.height(controlBarHeight);
  95340. this.trigger("audioonlymodechange");
  95341. };
  95342. _proto.disableAudioOnlyUI_ = function disableAudioOnlyUI_() {
  95343. this.removeClass("vjs-audio-only-mode");
  95344. this.audioOnlyCache_.hiddenChildren.forEach(function(child) {
  95345. return child.show();
  95346. });
  95347. this.height(this.audioOnlyCache_.playerHeight);
  95348. this.trigger("audioonlymodechange");
  95349. };
  95350. _proto.audioOnlyMode = function audioOnlyMode(value) {
  95351. var _this20 = this;
  95352. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  95353. return this.audioOnlyMode_;
  95354. }
  95355. this.audioOnlyMode_ = value;
  95356. var PromiseClass = this.options_.Promise || window_1.Promise;
  95357. if (PromiseClass) {
  95358. if (value) {
  95359. var exitPromises = [];
  95360. if (this.isInPictureInPicture()) {
  95361. exitPromises.push(this.exitPictureInPicture());
  95362. }
  95363. if (this.isFullscreen()) {
  95364. exitPromises.push(this.exitFullscreen());
  95365. }
  95366. if (this.audioPosterMode()) {
  95367. exitPromises.push(this.audioPosterMode(false));
  95368. }
  95369. return PromiseClass.all(exitPromises).then(function() {
  95370. return _this20.enableAudioOnlyUI_();
  95371. });
  95372. }
  95373. return PromiseClass.resolve().then(function() {
  95374. return _this20.disableAudioOnlyUI_();
  95375. });
  95376. }
  95377. if (value) {
  95378. if (this.isInPictureInPicture()) {
  95379. this.exitPictureInPicture();
  95380. }
  95381. if (this.isFullscreen()) {
  95382. this.exitFullscreen();
  95383. }
  95384. this.enableAudioOnlyUI_();
  95385. } else {
  95386. this.disableAudioOnlyUI_();
  95387. }
  95388. };
  95389. _proto.enablePosterModeUI_ = function enablePosterModeUI_() {
  95390. var tech = this.tech_ && this.tech_;
  95391. tech.hide();
  95392. this.addClass("vjs-audio-poster-mode");
  95393. this.trigger("audiopostermodechange");
  95394. };
  95395. _proto.disablePosterModeUI_ = function disablePosterModeUI_() {
  95396. var tech = this.tech_ && this.tech_;
  95397. tech.show();
  95398. this.removeClass("vjs-audio-poster-mode");
  95399. this.trigger("audiopostermodechange");
  95400. };
  95401. _proto.audioPosterMode = function audioPosterMode(value) {
  95402. var _this21 = this;
  95403. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  95404. return this.audioPosterMode_;
  95405. }
  95406. this.audioPosterMode_ = value;
  95407. var PromiseClass = this.options_.Promise || window_1.Promise;
  95408. if (PromiseClass) {
  95409. if (value) {
  95410. if (this.audioOnlyMode()) {
  95411. var audioOnlyModePromise = this.audioOnlyMode(false);
  95412. return audioOnlyModePromise.then(function() {
  95413. _this21.enablePosterModeUI_();
  95414. });
  95415. }
  95416. return PromiseClass.resolve().then(function() {
  95417. _this21.enablePosterModeUI_();
  95418. });
  95419. }
  95420. return PromiseClass.resolve().then(function() {
  95421. _this21.disablePosterModeUI_();
  95422. });
  95423. }
  95424. if (value) {
  95425. if (this.audioOnlyMode()) {
  95426. this.audioOnlyMode(false);
  95427. }
  95428. this.enablePosterModeUI_();
  95429. return;
  95430. }
  95431. this.disablePosterModeUI_();
  95432. };
  95433. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  95434. if (this.tech_) {
  95435. return this.tech_.addTextTrack(kind, label2, language);
  95436. }
  95437. };
  95438. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  95439. if (this.tech_) {
  95440. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  95441. }
  95442. };
  95443. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(obj) {
  95444. if (obj === void 0) {
  95445. obj = {};
  95446. }
  95447. var _obj = obj, track = _obj.track;
  95448. if (!track) {
  95449. track = obj;
  95450. }
  95451. if (this.tech_) {
  95452. return this.tech_.removeRemoteTextTrack(track);
  95453. }
  95454. };
  95455. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  95456. return this.techGet_("getVideoPlaybackQuality");
  95457. };
  95458. _proto.videoWidth = function videoWidth() {
  95459. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  95460. };
  95461. _proto.videoHeight = function videoHeight() {
  95462. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  95463. };
  95464. _proto.language = function language(code) {
  95465. if (code === void 0) {
  95466. return this.language_;
  95467. }
  95468. if (this.language_ !== String(code).toLowerCase()) {
  95469. this.language_ = String(code).toLowerCase();
  95470. if (isEvented(this)) {
  95471. this.trigger("languagechange");
  95472. }
  95473. }
  95474. };
  95475. _proto.languages = function languages() {
  95476. return mergeOptions$3(Player2.prototype.options_.languages, this.languages_);
  95477. };
  95478. _proto.toJSON = function toJSON() {
  95479. var options2 = mergeOptions$3(this.options_);
  95480. var tracks = options2.tracks;
  95481. options2.tracks = [];
  95482. for (var i2 = 0; i2 < tracks.length; i2++) {
  95483. var track = tracks[i2];
  95484. track = mergeOptions$3(track);
  95485. track.player = void 0;
  95486. options2.tracks[i2] = track;
  95487. }
  95488. return options2;
  95489. };
  95490. _proto.createModal = function createModal(content, options2) {
  95491. var _this22 = this;
  95492. options2 = options2 || {};
  95493. options2.content = content || "";
  95494. var modal = new ModalDialog(this, options2);
  95495. this.addChild(modal);
  95496. modal.on("dispose", function() {
  95497. _this22.removeChild(modal);
  95498. });
  95499. modal.open();
  95500. return modal;
  95501. };
  95502. _proto.updateCurrentBreakpoint_ = function updateCurrentBreakpoint_() {
  95503. if (!this.responsive()) {
  95504. return;
  95505. }
  95506. var currentBreakpoint = this.currentBreakpoint();
  95507. var currentWidth = this.currentWidth();
  95508. for (var i2 = 0; i2 < BREAKPOINT_ORDER.length; i2++) {
  95509. var candidateBreakpoint = BREAKPOINT_ORDER[i2];
  95510. var maxWidth = this.breakpoints_[candidateBreakpoint];
  95511. if (currentWidth <= maxWidth) {
  95512. if (currentBreakpoint === candidateBreakpoint) {
  95513. return;
  95514. }
  95515. if (currentBreakpoint) {
  95516. this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);
  95517. }
  95518. this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);
  95519. this.breakpoint_ = candidateBreakpoint;
  95520. break;
  95521. }
  95522. }
  95523. };
  95524. _proto.removeCurrentBreakpoint_ = function removeCurrentBreakpoint_() {
  95525. var className = this.currentBreakpointClass();
  95526. this.breakpoint_ = "";
  95527. if (className) {
  95528. this.removeClass(className);
  95529. }
  95530. };
  95531. _proto.breakpoints = function breakpoints(_breakpoints) {
  95532. if (_breakpoints === void 0) {
  95533. return assign(this.breakpoints_);
  95534. }
  95535. this.breakpoint_ = "";
  95536. this.breakpoints_ = assign({}, DEFAULT_BREAKPOINTS, _breakpoints);
  95537. this.updateCurrentBreakpoint_();
  95538. return assign(this.breakpoints_);
  95539. };
  95540. _proto.responsive = function responsive(value) {
  95541. if (value === void 0) {
  95542. return this.responsive_;
  95543. }
  95544. value = Boolean(value);
  95545. var current = this.responsive_;
  95546. if (value === current) {
  95547. return;
  95548. }
  95549. this.responsive_ = value;
  95550. if (value) {
  95551. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  95552. this.updateCurrentBreakpoint_();
  95553. } else {
  95554. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  95555. this.removeCurrentBreakpoint_();
  95556. }
  95557. return value;
  95558. };
  95559. _proto.currentBreakpoint = function currentBreakpoint() {
  95560. return this.breakpoint_;
  95561. };
  95562. _proto.currentBreakpointClass = function currentBreakpointClass() {
  95563. return BREAKPOINT_CLASSES[this.breakpoint_] || "";
  95564. };
  95565. _proto.loadMedia = function loadMedia(media, ready) {
  95566. var _this23 = this;
  95567. if (!media || typeof media !== "object") {
  95568. return;
  95569. }
  95570. this.reset();
  95571. this.cache_.media = mergeOptions$3(media);
  95572. 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;
  95573. if (!artwork && poster) {
  95574. this.cache_.media.artwork = [{
  95575. src: poster,
  95576. type: getMimetype(poster)
  95577. }];
  95578. }
  95579. if (src) {
  95580. this.src(src);
  95581. }
  95582. if (poster) {
  95583. this.poster(poster);
  95584. }
  95585. if (Array.isArray(textTracks)) {
  95586. textTracks.forEach(function(tt2) {
  95587. return _this23.addRemoteTextTrack(tt2, false);
  95588. });
  95589. }
  95590. this.ready(ready);
  95591. };
  95592. _proto.getMedia = function getMedia() {
  95593. if (!this.cache_.media) {
  95594. var poster = this.poster();
  95595. var src = this.currentSources();
  95596. var textTracks = Array.prototype.map.call(this.remoteTextTracks(), function(tt2) {
  95597. return {
  95598. kind: tt2.kind,
  95599. label: tt2.label,
  95600. language: tt2.language,
  95601. src: tt2.src
  95602. };
  95603. });
  95604. var media = {
  95605. src,
  95606. textTracks
  95607. };
  95608. if (poster) {
  95609. media.poster = poster;
  95610. media.artwork = [{
  95611. src: media.poster,
  95612. type: getMimetype(media.poster)
  95613. }];
  95614. }
  95615. return media;
  95616. }
  95617. return mergeOptions$3(this.cache_.media);
  95618. };
  95619. Player2.getTagSettings = function getTagSettings(tag) {
  95620. var baseOptions = {
  95621. sources: [],
  95622. tracks: []
  95623. };
  95624. var tagOptions = getAttributes(tag);
  95625. var dataSetup = tagOptions["data-setup"];
  95626. if (hasClass(tag, "vjs-fill")) {
  95627. tagOptions.fill = true;
  95628. }
  95629. if (hasClass(tag, "vjs-fluid")) {
  95630. tagOptions.fluid = true;
  95631. }
  95632. if (dataSetup !== null) {
  95633. var _safeParseTuple = tuple(dataSetup || "{}"), err = _safeParseTuple[0], data = _safeParseTuple[1];
  95634. if (err) {
  95635. log$1.error(err);
  95636. }
  95637. assign(tagOptions, data);
  95638. }
  95639. assign(baseOptions, tagOptions);
  95640. if (tag.hasChildNodes()) {
  95641. var children = tag.childNodes;
  95642. for (var i2 = 0, j = children.length; i2 < j; i2++) {
  95643. var child = children[i2];
  95644. var childName = child.nodeName.toLowerCase();
  95645. if (childName === "source") {
  95646. baseOptions.sources.push(getAttributes(child));
  95647. } else if (childName === "track") {
  95648. baseOptions.tracks.push(getAttributes(child));
  95649. }
  95650. }
  95651. }
  95652. return baseOptions;
  95653. };
  95654. _proto.flexNotSupported_ = function flexNotSupported_() {
  95655. var elem = document_1.createElement("i");
  95656. return !("flexBasis" in elem.style || "webkitFlexBasis" in elem.style || "mozFlexBasis" in elem.style || "msFlexBasis" in elem.style || "msFlexOrder" in elem.style);
  95657. };
  95658. _proto.debug = function debug(enabled) {
  95659. if (enabled === void 0) {
  95660. return this.debugEnabled_;
  95661. }
  95662. if (enabled) {
  95663. this.trigger("debugon");
  95664. this.previousLogLevel_ = this.log.level;
  95665. this.log.level("debug");
  95666. this.debugEnabled_ = true;
  95667. } else {
  95668. this.trigger("debugoff");
  95669. this.log.level(this.previousLogLevel_);
  95670. this.previousLogLevel_ = void 0;
  95671. this.debugEnabled_ = false;
  95672. }
  95673. };
  95674. _proto.playbackRates = function playbackRates(newRates) {
  95675. if (newRates === void 0) {
  95676. return this.cache_.playbackRates;
  95677. }
  95678. if (!Array.isArray(newRates)) {
  95679. return;
  95680. }
  95681. if (!newRates.every(function(rate) {
  95682. return typeof rate === "number";
  95683. })) {
  95684. return;
  95685. }
  95686. this.cache_.playbackRates = newRates;
  95687. this.trigger("playbackrateschange");
  95688. };
  95689. return Player2;
  95690. }(Component$1);
  95691. ALL.names.forEach(function(name) {
  95692. var props = ALL[name];
  95693. Player.prototype[props.getterName] = function() {
  95694. if (this.tech_) {
  95695. return this.tech_[props.getterName]();
  95696. }
  95697. this[props.privateName] = this[props.privateName] || new props.ListClass();
  95698. return this[props.privateName];
  95699. };
  95700. });
  95701. Player.prototype.crossorigin = Player.prototype.crossOrigin;
  95702. Player.players = {};
  95703. var navigator$2 = window_1.navigator;
  95704. Player.prototype.options_ = {
  95705. techOrder: Tech$1.defaultTechOrder_,
  95706. html5: {},
  95707. inactivityTimeout: 2e3,
  95708. playbackRates: [],
  95709. liveui: false,
  95710. children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  95711. language: navigator$2 && (navigator$2.languages && navigator$2.languages[0] || navigator$2.userLanguage || navigator$2.language) || "en",
  95712. languages: {},
  95713. notSupportedMessage: "No compatible source was found for this media.",
  95714. normalizeAutoplay: false,
  95715. fullscreen: {
  95716. options: {
  95717. navigationUI: "hide"
  95718. }
  95719. },
  95720. breakpoints: {},
  95721. responsive: false,
  95722. audioOnlyMode: false,
  95723. audioPosterMode: false
  95724. };
  95725. [
  95726. "ended",
  95727. "seeking",
  95728. "seekable",
  95729. "networkState",
  95730. "readyState"
  95731. ].forEach(function(fn2) {
  95732. Player.prototype[fn2] = function() {
  95733. return this.techGet_(fn2);
  95734. };
  95735. });
  95736. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  95737. Player.prototype["handleTech" + toTitleCase$1(event2) + "_"] = function() {
  95738. return this.trigger(event2);
  95739. };
  95740. });
  95741. Component$1.registerComponent("Player", Player);
  95742. var BASE_PLUGIN_NAME = "plugin";
  95743. var PLUGIN_CACHE_KEY = "activePlugins_";
  95744. var pluginStorage = {};
  95745. var pluginExists = function pluginExists2(name) {
  95746. return pluginStorage.hasOwnProperty(name);
  95747. };
  95748. var getPlugin = function getPlugin2(name) {
  95749. return pluginExists(name) ? pluginStorage[name] : void 0;
  95750. };
  95751. var markPluginAsActive = function markPluginAsActive2(player, name) {
  95752. player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {};
  95753. player[PLUGIN_CACHE_KEY][name] = true;
  95754. };
  95755. var triggerSetupEvent = function triggerSetupEvent2(player, hash, before) {
  95756. var eventName = (before ? "before" : "") + "pluginsetup";
  95757. player.trigger(eventName, hash);
  95758. player.trigger(eventName + ":" + hash.name, hash);
  95759. };
  95760. var createBasicPlugin = function createBasicPlugin2(name, plugin) {
  95761. var basicPluginWrapper = function basicPluginWrapper2() {
  95762. triggerSetupEvent(this, {
  95763. name,
  95764. plugin,
  95765. instance: null
  95766. }, true);
  95767. var instance = plugin.apply(this, arguments);
  95768. markPluginAsActive(this, name);
  95769. triggerSetupEvent(this, {
  95770. name,
  95771. plugin,
  95772. instance
  95773. });
  95774. return instance;
  95775. };
  95776. Object.keys(plugin).forEach(function(prop) {
  95777. basicPluginWrapper[prop] = plugin[prop];
  95778. });
  95779. return basicPluginWrapper;
  95780. };
  95781. var createPluginFactory = function createPluginFactory2(name, PluginSubClass) {
  95782. PluginSubClass.prototype.name = name;
  95783. return function() {
  95784. triggerSetupEvent(this, {
  95785. name,
  95786. plugin: PluginSubClass,
  95787. instance: null
  95788. }, true);
  95789. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  95790. args[_key] = arguments[_key];
  95791. }
  95792. var instance = _construct(PluginSubClass, [this].concat(args));
  95793. this[name] = function() {
  95794. return instance;
  95795. };
  95796. triggerSetupEvent(this, instance.getEventHash());
  95797. return instance;
  95798. };
  95799. };
  95800. var Plugin = /* @__PURE__ */ function() {
  95801. function Plugin2(player) {
  95802. if (this.constructor === Plugin2) {
  95803. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  95804. }
  95805. this.player = player;
  95806. if (!this.log) {
  95807. this.log = this.player.log.createLogger(this.name);
  95808. }
  95809. evented(this);
  95810. delete this.trigger;
  95811. stateful(this, this.constructor.defaultState);
  95812. markPluginAsActive(player, this.name);
  95813. this.dispose = this.dispose.bind(this);
  95814. player.on("dispose", this.dispose);
  95815. }
  95816. var _proto = Plugin2.prototype;
  95817. _proto.version = function version2() {
  95818. return this.constructor.VERSION;
  95819. };
  95820. _proto.getEventHash = function getEventHash(hash) {
  95821. if (hash === void 0) {
  95822. hash = {};
  95823. }
  95824. hash.name = this.name;
  95825. hash.plugin = this.constructor;
  95826. hash.instance = this;
  95827. return hash;
  95828. };
  95829. _proto.trigger = function trigger$13(event2, hash) {
  95830. if (hash === void 0) {
  95831. hash = {};
  95832. }
  95833. return trigger(this.eventBusEl_, event2, this.getEventHash(hash));
  95834. };
  95835. _proto.handleStateChanged = function handleStateChanged(e) {
  95836. };
  95837. _proto.dispose = function dispose() {
  95838. var name = this.name, player = this.player;
  95839. this.trigger("dispose");
  95840. this.off();
  95841. player.off("dispose", this.dispose);
  95842. player[PLUGIN_CACHE_KEY][name] = false;
  95843. this.player = this.state = null;
  95844. player[name] = createPluginFactory(name, pluginStorage[name]);
  95845. };
  95846. Plugin2.isBasic = function isBasic(plugin) {
  95847. var p = typeof plugin === "string" ? getPlugin(plugin) : plugin;
  95848. return typeof p === "function" && !Plugin2.prototype.isPrototypeOf(p.prototype);
  95849. };
  95850. Plugin2.registerPlugin = function registerPlugin(name, plugin) {
  95851. if (typeof name !== "string") {
  95852. throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + typeof name + ".");
  95853. }
  95854. if (pluginExists(name)) {
  95855. log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!');
  95856. } else if (Player.prototype.hasOwnProperty(name)) {
  95857. throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!');
  95858. }
  95859. if (typeof plugin !== "function") {
  95860. throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + typeof plugin + ".");
  95861. }
  95862. pluginStorage[name] = plugin;
  95863. if (name !== BASE_PLUGIN_NAME) {
  95864. if (Plugin2.isBasic(plugin)) {
  95865. Player.prototype[name] = createBasicPlugin(name, plugin);
  95866. } else {
  95867. Player.prototype[name] = createPluginFactory(name, plugin);
  95868. }
  95869. }
  95870. return plugin;
  95871. };
  95872. Plugin2.deregisterPlugin = function deregisterPlugin(name) {
  95873. if (name === BASE_PLUGIN_NAME) {
  95874. throw new Error("Cannot de-register base plugin.");
  95875. }
  95876. if (pluginExists(name)) {
  95877. delete pluginStorage[name];
  95878. delete Player.prototype[name];
  95879. }
  95880. };
  95881. Plugin2.getPlugins = function getPlugins(names2) {
  95882. if (names2 === void 0) {
  95883. names2 = Object.keys(pluginStorage);
  95884. }
  95885. var result;
  95886. names2.forEach(function(name) {
  95887. var plugin = getPlugin(name);
  95888. if (plugin) {
  95889. result = result || {};
  95890. result[name] = plugin;
  95891. }
  95892. });
  95893. return result;
  95894. };
  95895. Plugin2.getPluginVersion = function getPluginVersion(name) {
  95896. var plugin = getPlugin(name);
  95897. return plugin && plugin.VERSION || "";
  95898. };
  95899. return Plugin2;
  95900. }();
  95901. Plugin.getPlugin = getPlugin;
  95902. Plugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME;
  95903. Plugin.registerPlugin(BASE_PLUGIN_NAME, Plugin);
  95904. Player.prototype.usingPlugin = function(name) {
  95905. return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true;
  95906. };
  95907. Player.prototype.hasPlugin = function(name) {
  95908. return !!pluginExists(name);
  95909. };
  95910. var hasLogged = false;
  95911. var extend = function extend2(superClass, subClassMethods) {
  95912. if (subClassMethods === void 0) {
  95913. subClassMethods = {};
  95914. }
  95915. if (!hasLogged) {
  95916. log$1.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0");
  95917. hasLogged = true;
  95918. }
  95919. var subClass = function subClass2() {
  95920. superClass.apply(this, arguments);
  95921. };
  95922. var methods = {};
  95923. if (typeof subClassMethods === "object") {
  95924. if (subClassMethods.constructor !== Object.prototype.constructor) {
  95925. subClass = subClassMethods.constructor;
  95926. }
  95927. methods = subClassMethods;
  95928. } else if (typeof subClassMethods === "function") {
  95929. subClass = subClassMethods;
  95930. }
  95931. _inherits(subClass, superClass);
  95932. if (superClass) {
  95933. subClass.super_ = superClass;
  95934. }
  95935. for (var name in methods) {
  95936. if (methods.hasOwnProperty(name)) {
  95937. subClass.prototype[name] = methods[name];
  95938. }
  95939. }
  95940. return subClass;
  95941. };
  95942. var normalizeId = function normalizeId2(id) {
  95943. return id.indexOf("#") === 0 ? id.slice(1) : id;
  95944. };
  95945. function videojs(id, options2, ready) {
  95946. var player = videojs.getPlayer(id);
  95947. if (player) {
  95948. if (options2) {
  95949. log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.');
  95950. }
  95951. if (ready) {
  95952. player.ready(ready);
  95953. }
  95954. return player;
  95955. }
  95956. var el = typeof id === "string" ? $("#" + normalizeId(id)) : id;
  95957. if (!isEl(el)) {
  95958. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  95959. }
  95960. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  95961. log$1.warn("The element supplied is not included in the DOM");
  95962. }
  95963. options2 = options2 || {};
  95964. if (options2.restoreEl === true) {
  95965. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  95966. }
  95967. hooks("beforesetup").forEach(function(hookFunction) {
  95968. var opts = hookFunction(el, mergeOptions$3(options2));
  95969. if (!isObject2(opts) || Array.isArray(opts)) {
  95970. log$1.error("please return an object in beforesetup hooks");
  95971. return;
  95972. }
  95973. options2 = mergeOptions$3(options2, opts);
  95974. });
  95975. var PlayerComponent = Component$1.getComponent("Player");
  95976. player = new PlayerComponent(el, options2, ready);
  95977. hooks("setup").forEach(function(hookFunction) {
  95978. return hookFunction(player);
  95979. });
  95980. return player;
  95981. }
  95982. videojs.hooks_ = hooks_;
  95983. videojs.hooks = hooks;
  95984. videojs.hook = hook;
  95985. videojs.hookOnce = hookOnce;
  95986. videojs.removeHook = removeHook;
  95987. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal()) {
  95988. var style = $(".vjs-styles-defaults");
  95989. if (!style) {
  95990. style = createStyleElement("vjs-styles-defaults");
  95991. var head = $("head");
  95992. if (head) {
  95993. head.insertBefore(style, head.firstChild);
  95994. }
  95995. 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 ");
  95996. }
  95997. }
  95998. autoSetupTimeout(1, videojs);
  95999. videojs.VERSION = version$5;
  96000. videojs.options = Player.prototype.options_;
  96001. videojs.getPlayers = function() {
  96002. return Player.players;
  96003. };
  96004. videojs.getPlayer = function(id) {
  96005. var players = Player.players;
  96006. var tag;
  96007. if (typeof id === "string") {
  96008. var nId = normalizeId(id);
  96009. var player = players[nId];
  96010. if (player) {
  96011. return player;
  96012. }
  96013. tag = $("#" + nId);
  96014. } else {
  96015. tag = id;
  96016. }
  96017. if (isEl(tag)) {
  96018. var _tag = tag, _player = _tag.player, playerId = _tag.playerId;
  96019. if (_player || players[playerId]) {
  96020. return _player || players[playerId];
  96021. }
  96022. }
  96023. };
  96024. videojs.getAllPlayers = function() {
  96025. return Object.keys(Player.players).map(function(k) {
  96026. return Player.players[k];
  96027. }).filter(Boolean);
  96028. };
  96029. videojs.players = Player.players;
  96030. videojs.getComponent = Component$1.getComponent;
  96031. videojs.registerComponent = function(name, comp) {
  96032. if (Tech$1.isTech(comp)) {
  96033. log$1.warn("The " + name + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");
  96034. }
  96035. Component$1.registerComponent.call(Component$1, name, comp);
  96036. };
  96037. videojs.getTech = Tech$1.getTech;
  96038. videojs.registerTech = Tech$1.registerTech;
  96039. videojs.use = use;
  96040. Object.defineProperty(videojs, "middleware", {
  96041. value: {},
  96042. writeable: false,
  96043. enumerable: true
  96044. });
  96045. Object.defineProperty(videojs.middleware, "TERMINATOR", {
  96046. value: TERMINATOR,
  96047. writeable: false,
  96048. enumerable: true
  96049. });
  96050. videojs.browser = browser;
  96051. videojs.TOUCH_ENABLED = TOUCH_ENABLED;
  96052. videojs.extend = extend;
  96053. videojs.mergeOptions = mergeOptions$3;
  96054. videojs.bind = bind;
  96055. videojs.registerPlugin = Plugin.registerPlugin;
  96056. videojs.deregisterPlugin = Plugin.deregisterPlugin;
  96057. videojs.plugin = function(name, plugin) {
  96058. log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  96059. return Plugin.registerPlugin(name, plugin);
  96060. };
  96061. videojs.getPlugins = Plugin.getPlugins;
  96062. videojs.getPlugin = Plugin.getPlugin;
  96063. videojs.getPluginVersion = Plugin.getPluginVersion;
  96064. videojs.addLanguage = function(code, data) {
  96065. var _mergeOptions;
  96066. code = ("" + code).toLowerCase();
  96067. videojs.options.languages = mergeOptions$3(videojs.options.languages, (_mergeOptions = {}, _mergeOptions[code] = data, _mergeOptions));
  96068. return videojs.options.languages[code];
  96069. };
  96070. videojs.log = log$1;
  96071. videojs.createLogger = createLogger;
  96072. videojs.createTimeRange = videojs.createTimeRanges = createTimeRanges;
  96073. videojs.formatTime = formatTime;
  96074. videojs.setFormatTime = setFormatTime;
  96075. videojs.resetFormatTime = resetFormatTime;
  96076. videojs.parseUrl = parseUrl;
  96077. videojs.isCrossOrigin = isCrossOrigin;
  96078. videojs.EventTarget = EventTarget$2;
  96079. videojs.on = on;
  96080. videojs.one = one;
  96081. videojs.off = off;
  96082. videojs.trigger = trigger;
  96083. videojs.xhr = XHR;
  96084. videojs.TextTrack = TextTrack;
  96085. videojs.AudioTrack = AudioTrack;
  96086. videojs.VideoTrack = VideoTrack;
  96087. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach(function(k) {
  96088. videojs[k] = function() {
  96089. log$1.warn("videojs." + k + "() is deprecated; use videojs.dom." + k + "() instead");
  96090. return Dom$1[k].apply(null, arguments);
  96091. };
  96092. });
  96093. videojs.computedStyle = computedStyle;
  96094. videojs.dom = Dom$1;
  96095. videojs.url = Url$1;
  96096. videojs.defineLazyProperty = defineLazyProperty;
  96097. videojs.addLanguage("en", {
  96098. "Non-Fullscreen": "Exit Fullscreen"
  96099. });
  96100. /*! @name @videojs/http-streaming @version 2.16.2 @license Apache-2.0 */
  96101. var resolveUrl4 = resolveUrl$1;
  96102. var resolveManifestRedirect = function resolveManifestRedirect2(handleManifestRedirect, url, req) {
  96103. if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) {
  96104. return req.responseURL;
  96105. }
  96106. return url;
  96107. };
  96108. var logger = function logger2(source) {
  96109. if (videojs.log.debug) {
  96110. return videojs.log.debug.bind(videojs, "VHS:", source + " >");
  96111. }
  96112. return function() {
  96113. };
  96114. };
  96115. var TIME_FUDGE_FACTOR = 1 / 30;
  96116. var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3;
  96117. var filterRanges = function filterRanges2(timeRanges, predicate) {
  96118. var results = [];
  96119. var i2;
  96120. if (timeRanges && timeRanges.length) {
  96121. for (i2 = 0; i2 < timeRanges.length; i2++) {
  96122. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  96123. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  96124. }
  96125. }
  96126. }
  96127. return videojs.createTimeRanges(results);
  96128. };
  96129. var findRange = function findRange2(buffered, time) {
  96130. return filterRanges(buffered, function(start2, end) {
  96131. return start2 - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time;
  96132. });
  96133. };
  96134. var findNextRange = function findNextRange2(timeRanges, time) {
  96135. return filterRanges(timeRanges, function(start2) {
  96136. return start2 - TIME_FUDGE_FACTOR >= time;
  96137. });
  96138. };
  96139. var findGaps = function findGaps2(buffered) {
  96140. if (buffered.length < 2) {
  96141. return videojs.createTimeRanges();
  96142. }
  96143. var ranges = [];
  96144. for (var i2 = 1; i2 < buffered.length; i2++) {
  96145. var start2 = buffered.end(i2 - 1);
  96146. var end = buffered.start(i2);
  96147. ranges.push([start2, end]);
  96148. }
  96149. return videojs.createTimeRanges(ranges);
  96150. };
  96151. var bufferIntersection = function bufferIntersection2(bufferA, bufferB) {
  96152. var start2 = null;
  96153. var end = null;
  96154. var arity = 0;
  96155. var extents = [];
  96156. var ranges = [];
  96157. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  96158. return videojs.createTimeRange();
  96159. }
  96160. var count = bufferA.length;
  96161. while (count--) {
  96162. extents.push({
  96163. time: bufferA.start(count),
  96164. type: "start"
  96165. });
  96166. extents.push({
  96167. time: bufferA.end(count),
  96168. type: "end"
  96169. });
  96170. }
  96171. count = bufferB.length;
  96172. while (count--) {
  96173. extents.push({
  96174. time: bufferB.start(count),
  96175. type: "start"
  96176. });
  96177. extents.push({
  96178. time: bufferB.end(count),
  96179. type: "end"
  96180. });
  96181. }
  96182. extents.sort(function(a, b) {
  96183. return a.time - b.time;
  96184. });
  96185. for (count = 0; count < extents.length; count++) {
  96186. if (extents[count].type === "start") {
  96187. arity++;
  96188. if (arity === 2) {
  96189. start2 = extents[count].time;
  96190. }
  96191. } else if (extents[count].type === "end") {
  96192. arity--;
  96193. if (arity === 1) {
  96194. end = extents[count].time;
  96195. }
  96196. }
  96197. if (start2 !== null && end !== null) {
  96198. ranges.push([start2, end]);
  96199. start2 = null;
  96200. end = null;
  96201. }
  96202. }
  96203. return videojs.createTimeRanges(ranges);
  96204. };
  96205. var printableRange = function printableRange2(range3) {
  96206. var strArr = [];
  96207. if (!range3 || !range3.length) {
  96208. return "";
  96209. }
  96210. for (var i2 = 0; i2 < range3.length; i2++) {
  96211. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  96212. }
  96213. return strArr.join(", ");
  96214. };
  96215. var timeUntilRebuffer = function timeUntilRebuffer2(buffered, currentTime, playbackRate) {
  96216. if (playbackRate === void 0) {
  96217. playbackRate = 1;
  96218. }
  96219. var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  96220. return (bufferedEnd - currentTime) / playbackRate;
  96221. };
  96222. var timeRangesToArray = function timeRangesToArray2(timeRanges) {
  96223. var timeRangesList = [];
  96224. for (var i2 = 0; i2 < timeRanges.length; i2++) {
  96225. timeRangesList.push({
  96226. start: timeRanges.start(i2),
  96227. end: timeRanges.end(i2)
  96228. });
  96229. }
  96230. return timeRangesList;
  96231. };
  96232. var isRangeDifferent = function isRangeDifferent2(a, b) {
  96233. if (a === b) {
  96234. return false;
  96235. }
  96236. if (!a && b || !b && a) {
  96237. return true;
  96238. }
  96239. if (a.length !== b.length) {
  96240. return true;
  96241. }
  96242. for (var i2 = 0; i2 < a.length; i2++) {
  96243. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  96244. return true;
  96245. }
  96246. }
  96247. return false;
  96248. };
  96249. var lastBufferedEnd = function lastBufferedEnd2(a) {
  96250. if (!a || !a.length || !a.end) {
  96251. return;
  96252. }
  96253. return a.end(a.length - 1);
  96254. };
  96255. var timeAheadOf = function timeAheadOf2(range3, startTime) {
  96256. var time = 0;
  96257. if (!range3 || !range3.length) {
  96258. return time;
  96259. }
  96260. for (var i2 = 0; i2 < range3.length; i2++) {
  96261. var start2 = range3.start(i2);
  96262. var end = range3.end(i2);
  96263. if (startTime > end) {
  96264. continue;
  96265. }
  96266. if (startTime > start2 && startTime <= end) {
  96267. time += end - startTime;
  96268. continue;
  96269. }
  96270. time += end - start2;
  96271. }
  96272. return time;
  96273. };
  96274. var createTimeRange$1 = videojs.createTimeRange;
  96275. var segmentDurationWithParts = function segmentDurationWithParts2(playlist, segment) {
  96276. if (!segment.preload) {
  96277. return segment.duration;
  96278. }
  96279. var result = 0;
  96280. (segment.parts || []).forEach(function(p) {
  96281. result += p.duration;
  96282. });
  96283. (segment.preloadHints || []).forEach(function(p) {
  96284. if (p.type === "PART") {
  96285. result += playlist.partTargetDuration;
  96286. }
  96287. });
  96288. return result;
  96289. };
  96290. var getPartsAndSegments = function getPartsAndSegments2(playlist) {
  96291. return (playlist.segments || []).reduce(function(acc, segment, si) {
  96292. if (segment.parts) {
  96293. segment.parts.forEach(function(part, pi) {
  96294. acc.push({
  96295. duration: part.duration,
  96296. segmentIndex: si,
  96297. partIndex: pi,
  96298. part,
  96299. segment
  96300. });
  96301. });
  96302. } else {
  96303. acc.push({
  96304. duration: segment.duration,
  96305. segmentIndex: si,
  96306. partIndex: null,
  96307. segment,
  96308. part: null
  96309. });
  96310. }
  96311. return acc;
  96312. }, []);
  96313. };
  96314. var getLastParts = function getLastParts2(media) {
  96315. var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  96316. return lastSegment && lastSegment.parts || [];
  96317. };
  96318. var getKnownPartCount = function getKnownPartCount2(_ref) {
  96319. var preloadSegment = _ref.preloadSegment;
  96320. if (!preloadSegment) {
  96321. return;
  96322. }
  96323. var parts = preloadSegment.parts, preloadHints = preloadSegment.preloadHints;
  96324. var partCount = (preloadHints || []).reduce(function(count, hint) {
  96325. return count + (hint.type === "PART" ? 1 : 0);
  96326. }, 0);
  96327. partCount += parts && parts.length ? parts.length : 0;
  96328. return partCount;
  96329. };
  96330. var liveEdgeDelay = function liveEdgeDelay2(master, media) {
  96331. if (media.endList) {
  96332. return 0;
  96333. }
  96334. if (master && master.suggestedPresentationDelay) {
  96335. return master.suggestedPresentationDelay;
  96336. }
  96337. var hasParts = getLastParts(media).length > 0;
  96338. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  96339. return media.serverControl.partHoldBack;
  96340. } else if (hasParts && media.partTargetDuration) {
  96341. return media.partTargetDuration * 3;
  96342. } else if (media.serverControl && media.serverControl.holdBack) {
  96343. return media.serverControl.holdBack;
  96344. } else if (media.targetDuration) {
  96345. return media.targetDuration * 3;
  96346. }
  96347. return 0;
  96348. };
  96349. var backwardDuration = function backwardDuration2(playlist, endSequence) {
  96350. var result = 0;
  96351. var i2 = endSequence - playlist.mediaSequence;
  96352. var segment = playlist.segments[i2];
  96353. if (segment) {
  96354. if (typeof segment.start !== "undefined") {
  96355. return {
  96356. result: segment.start,
  96357. precise: true
  96358. };
  96359. }
  96360. if (typeof segment.end !== "undefined") {
  96361. return {
  96362. result: segment.end - segment.duration,
  96363. precise: true
  96364. };
  96365. }
  96366. }
  96367. while (i2--) {
  96368. segment = playlist.segments[i2];
  96369. if (typeof segment.end !== "undefined") {
  96370. return {
  96371. result: result + segment.end,
  96372. precise: true
  96373. };
  96374. }
  96375. result += segmentDurationWithParts(playlist, segment);
  96376. if (typeof segment.start !== "undefined") {
  96377. return {
  96378. result: result + segment.start,
  96379. precise: true
  96380. };
  96381. }
  96382. }
  96383. return {
  96384. result,
  96385. precise: false
  96386. };
  96387. };
  96388. var forwardDuration = function forwardDuration2(playlist, endSequence) {
  96389. var result = 0;
  96390. var segment;
  96391. var i2 = endSequence - playlist.mediaSequence;
  96392. for (; i2 < playlist.segments.length; i2++) {
  96393. segment = playlist.segments[i2];
  96394. if (typeof segment.start !== "undefined") {
  96395. return {
  96396. result: segment.start - result,
  96397. precise: true
  96398. };
  96399. }
  96400. result += segmentDurationWithParts(playlist, segment);
  96401. if (typeof segment.end !== "undefined") {
  96402. return {
  96403. result: segment.end - result,
  96404. precise: true
  96405. };
  96406. }
  96407. }
  96408. return {
  96409. result: -1,
  96410. precise: false
  96411. };
  96412. };
  96413. var intervalDuration = function intervalDuration2(playlist, endSequence, expired) {
  96414. if (typeof endSequence === "undefined") {
  96415. endSequence = playlist.mediaSequence + playlist.segments.length;
  96416. }
  96417. if (endSequence < playlist.mediaSequence) {
  96418. return 0;
  96419. }
  96420. var backward = backwardDuration(playlist, endSequence);
  96421. if (backward.precise) {
  96422. return backward.result;
  96423. }
  96424. var forward = forwardDuration(playlist, endSequence);
  96425. if (forward.precise) {
  96426. return forward.result;
  96427. }
  96428. return backward.result + expired;
  96429. };
  96430. var duration2 = function duration3(playlist, endSequence, expired) {
  96431. if (!playlist) {
  96432. return 0;
  96433. }
  96434. if (typeof expired !== "number") {
  96435. expired = 0;
  96436. }
  96437. if (typeof endSequence === "undefined") {
  96438. if (playlist.totalDuration) {
  96439. return playlist.totalDuration;
  96440. }
  96441. if (!playlist.endList) {
  96442. return window_1.Infinity;
  96443. }
  96444. }
  96445. return intervalDuration(playlist, endSequence, expired);
  96446. };
  96447. var sumDurations = function sumDurations2(_ref2) {
  96448. var defaultDuration = _ref2.defaultDuration, durationList = _ref2.durationList, startIndex = _ref2.startIndex, endIndex = _ref2.endIndex;
  96449. var durations = 0;
  96450. if (startIndex > endIndex) {
  96451. var _ref3 = [endIndex, startIndex];
  96452. startIndex = _ref3[0];
  96453. endIndex = _ref3[1];
  96454. }
  96455. if (startIndex < 0) {
  96456. for (var i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  96457. durations += defaultDuration;
  96458. }
  96459. startIndex = 0;
  96460. }
  96461. for (var _i = startIndex; _i < endIndex; _i++) {
  96462. durations += durationList[_i].duration;
  96463. }
  96464. return durations;
  96465. };
  96466. var playlistEnd = function playlistEnd2(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  96467. if (!playlist || !playlist.segments) {
  96468. return null;
  96469. }
  96470. if (playlist.endList) {
  96471. return duration2(playlist);
  96472. }
  96473. if (expired === null) {
  96474. return null;
  96475. }
  96476. expired = expired || 0;
  96477. var lastSegmentEndTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  96478. if (useSafeLiveEnd) {
  96479. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay(null, playlist);
  96480. lastSegmentEndTime -= liveEdgePadding;
  96481. }
  96482. return Math.max(0, lastSegmentEndTime);
  96483. };
  96484. var seekable = function seekable2(playlist, expired, liveEdgePadding) {
  96485. var useSafeLiveEnd = true;
  96486. var seekableStart = expired || 0;
  96487. var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  96488. if (seekableEnd === null) {
  96489. return createTimeRange$1();
  96490. }
  96491. return createTimeRange$1(seekableStart, seekableEnd);
  96492. };
  96493. var getMediaInfoForTime = function getMediaInfoForTime2(_ref4) {
  96494. var playlist = _ref4.playlist, currentTime = _ref4.currentTime, startingSegmentIndex = _ref4.startingSegmentIndex, startingPartIndex = _ref4.startingPartIndex, startTime = _ref4.startTime, experimentalExactManifestTimings = _ref4.experimentalExactManifestTimings;
  96495. var time = currentTime - startTime;
  96496. var partsAndSegments = getPartsAndSegments(playlist);
  96497. var startIndex = 0;
  96498. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  96499. var partAndSegment = partsAndSegments[i2];
  96500. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  96501. continue;
  96502. }
  96503. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  96504. continue;
  96505. }
  96506. startIndex = i2;
  96507. break;
  96508. }
  96509. if (time < 0) {
  96510. if (startIndex > 0) {
  96511. for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) {
  96512. var _partAndSegment = partsAndSegments[_i2];
  96513. time += _partAndSegment.duration;
  96514. if (experimentalExactManifestTimings) {
  96515. if (time < 0) {
  96516. continue;
  96517. }
  96518. } else if (time + TIME_FUDGE_FACTOR <= 0) {
  96519. continue;
  96520. }
  96521. return {
  96522. partIndex: _partAndSegment.partIndex,
  96523. segmentIndex: _partAndSegment.segmentIndex,
  96524. startTime: startTime - sumDurations({
  96525. defaultDuration: playlist.targetDuration,
  96526. durationList: partsAndSegments,
  96527. startIndex,
  96528. endIndex: _i2
  96529. })
  96530. };
  96531. }
  96532. }
  96533. return {
  96534. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96535. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96536. startTime: currentTime
  96537. };
  96538. }
  96539. if (startIndex < 0) {
  96540. for (var _i3 = startIndex; _i3 < 0; _i3++) {
  96541. time -= playlist.targetDuration;
  96542. if (time < 0) {
  96543. return {
  96544. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96545. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96546. startTime: currentTime
  96547. };
  96548. }
  96549. }
  96550. startIndex = 0;
  96551. }
  96552. for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) {
  96553. var _partAndSegment2 = partsAndSegments[_i4];
  96554. time -= _partAndSegment2.duration;
  96555. if (experimentalExactManifestTimings) {
  96556. if (time > 0) {
  96557. continue;
  96558. }
  96559. } else if (time - TIME_FUDGE_FACTOR >= 0) {
  96560. continue;
  96561. }
  96562. return {
  96563. partIndex: _partAndSegment2.partIndex,
  96564. segmentIndex: _partAndSegment2.segmentIndex,
  96565. startTime: startTime + sumDurations({
  96566. defaultDuration: playlist.targetDuration,
  96567. durationList: partsAndSegments,
  96568. startIndex,
  96569. endIndex: _i4
  96570. })
  96571. };
  96572. }
  96573. return {
  96574. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  96575. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  96576. startTime: currentTime
  96577. };
  96578. };
  96579. var isBlacklisted = function isBlacklisted2(playlist) {
  96580. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  96581. };
  96582. var isIncompatible = function isIncompatible2(playlist) {
  96583. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  96584. };
  96585. var isEnabled = function isEnabled2(playlist) {
  96586. var blacklisted = isBlacklisted(playlist);
  96587. return !playlist.disabled && !blacklisted;
  96588. };
  96589. var isDisabled = function isDisabled2(playlist) {
  96590. return playlist.disabled;
  96591. };
  96592. var isAes = function isAes2(media) {
  96593. for (var i2 = 0; i2 < media.segments.length; i2++) {
  96594. if (media.segments[i2].key) {
  96595. return true;
  96596. }
  96597. }
  96598. return false;
  96599. };
  96600. var hasAttribute = function hasAttribute2(attr, playlist) {
  96601. return playlist.attributes && playlist.attributes[attr];
  96602. };
  96603. var estimateSegmentRequestTime = function estimateSegmentRequestTime2(segmentDuration, bandwidth2, playlist, bytesReceived) {
  96604. if (bytesReceived === void 0) {
  96605. bytesReceived = 0;
  96606. }
  96607. if (!hasAttribute("BANDWIDTH", playlist)) {
  96608. return NaN;
  96609. }
  96610. var size = segmentDuration * playlist.attributes.BANDWIDTH;
  96611. return (size - bytesReceived * 8) / bandwidth2;
  96612. };
  96613. var isLowestEnabledRendition = function isLowestEnabledRendition2(master, media) {
  96614. if (master.playlists.length === 1) {
  96615. return true;
  96616. }
  96617. var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  96618. return master.playlists.filter(function(playlist) {
  96619. if (!isEnabled(playlist)) {
  96620. return false;
  96621. }
  96622. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  96623. }).length === 0;
  96624. };
  96625. var playlistMatch = function playlistMatch2(a, b) {
  96626. if (!a && !b || !a && b || a && !b) {
  96627. return false;
  96628. }
  96629. if (a === b) {
  96630. return true;
  96631. }
  96632. if (a.id && b.id && a.id === b.id) {
  96633. return true;
  96634. }
  96635. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  96636. return true;
  96637. }
  96638. if (a.uri && b.uri && a.uri === b.uri) {
  96639. return true;
  96640. }
  96641. return false;
  96642. };
  96643. var someAudioVariant = function someAudioVariant2(master, callback2) {
  96644. var AUDIO5 = master && master.mediaGroups && master.mediaGroups.AUDIO || {};
  96645. var found = false;
  96646. for (var groupName in AUDIO5) {
  96647. for (var label2 in AUDIO5[groupName]) {
  96648. found = callback2(AUDIO5[groupName][label2]);
  96649. if (found) {
  96650. break;
  96651. }
  96652. }
  96653. if (found) {
  96654. break;
  96655. }
  96656. }
  96657. return !!found;
  96658. };
  96659. var isAudioOnly = function isAudioOnly2(master) {
  96660. if (!master || !master.playlists || !master.playlists.length) {
  96661. var found = someAudioVariant(master, function(variant) {
  96662. return variant.playlists && variant.playlists.length || variant.uri;
  96663. });
  96664. return found;
  96665. }
  96666. var _loop = function _loop2(i3) {
  96667. var playlist = master.playlists[i3];
  96668. var CODECS = playlist.attributes && playlist.attributes.CODECS;
  96669. if (CODECS && CODECS.split(",").every(function(c) {
  96670. return isAudioCodec2(c);
  96671. })) {
  96672. return "continue";
  96673. }
  96674. var found2 = someAudioVariant(master, function(variant) {
  96675. return playlistMatch(playlist, variant);
  96676. });
  96677. if (found2) {
  96678. return "continue";
  96679. }
  96680. return {
  96681. v: false
  96682. };
  96683. };
  96684. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96685. var _ret = _loop(i2);
  96686. if (_ret === "continue")
  96687. continue;
  96688. if (typeof _ret === "object")
  96689. return _ret.v;
  96690. }
  96691. return true;
  96692. };
  96693. var Playlist = {
  96694. liveEdgeDelay,
  96695. duration: duration2,
  96696. seekable,
  96697. getMediaInfoForTime,
  96698. isEnabled,
  96699. isDisabled,
  96700. isBlacklisted,
  96701. isIncompatible,
  96702. playlistEnd,
  96703. isAes,
  96704. hasAttribute,
  96705. estimateSegmentRequestTime,
  96706. isLowestEnabledRendition,
  96707. isAudioOnly,
  96708. playlistMatch,
  96709. segmentDurationWithParts
  96710. };
  96711. var log = videojs.log;
  96712. var createPlaylistID = function createPlaylistID2(index2, uri) {
  96713. return index2 + "-" + uri;
  96714. };
  96715. var groupID = function groupID2(type2, group, label2) {
  96716. return "placeholder-uri-" + type2 + "-" + group + "-" + label2;
  96717. };
  96718. var parseManifest = function parseManifest2(_ref) {
  96719. 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;
  96720. var parser2 = new Parser();
  96721. if (onwarn) {
  96722. parser2.on("warn", onwarn);
  96723. }
  96724. if (oninfo) {
  96725. parser2.on("info", oninfo);
  96726. }
  96727. customTagParsers.forEach(function(customParser) {
  96728. return parser2.addParser(customParser);
  96729. });
  96730. customTagMappers.forEach(function(mapper) {
  96731. return parser2.addTagMapper(mapper);
  96732. });
  96733. parser2.push(manifestString);
  96734. parser2.end();
  96735. var manifest = parser2.manifest;
  96736. if (!experimentalLLHLS) {
  96737. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  96738. if (manifest.hasOwnProperty(k)) {
  96739. delete manifest[k];
  96740. }
  96741. });
  96742. if (manifest.segments) {
  96743. manifest.segments.forEach(function(segment) {
  96744. ["parts", "preloadHints"].forEach(function(k) {
  96745. if (segment.hasOwnProperty(k)) {
  96746. delete segment[k];
  96747. }
  96748. });
  96749. });
  96750. }
  96751. }
  96752. if (!manifest.targetDuration) {
  96753. var targetDuration = 10;
  96754. if (manifest.segments && manifest.segments.length) {
  96755. targetDuration = manifest.segments.reduce(function(acc, s) {
  96756. return Math.max(acc, s.duration);
  96757. }, 0);
  96758. }
  96759. if (onwarn) {
  96760. onwarn("manifest has no targetDuration defaulting to " + targetDuration);
  96761. }
  96762. manifest.targetDuration = targetDuration;
  96763. }
  96764. var parts = getLastParts(manifest);
  96765. if (parts.length && !manifest.partTargetDuration) {
  96766. var partTargetDuration = parts.reduce(function(acc, p) {
  96767. return Math.max(acc, p.duration);
  96768. }, 0);
  96769. if (onwarn) {
  96770. onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration);
  96771. 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.");
  96772. }
  96773. manifest.partTargetDuration = partTargetDuration;
  96774. }
  96775. return manifest;
  96776. };
  96777. var forEachMediaGroup3 = function forEachMediaGroup4(master, callback2) {
  96778. if (!master.mediaGroups) {
  96779. return;
  96780. }
  96781. ["AUDIO", "SUBTITLES"].forEach(function(mediaType) {
  96782. if (!master.mediaGroups[mediaType]) {
  96783. return;
  96784. }
  96785. for (var groupKey in master.mediaGroups[mediaType]) {
  96786. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  96787. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  96788. callback2(mediaProperties, mediaType, groupKey, labelKey);
  96789. }
  96790. }
  96791. });
  96792. };
  96793. var setupMediaPlaylist = function setupMediaPlaylist2(_ref2) {
  96794. var playlist = _ref2.playlist, uri = _ref2.uri, id = _ref2.id;
  96795. playlist.id = id;
  96796. playlist.playlistErrors_ = 0;
  96797. if (uri) {
  96798. playlist.uri = uri;
  96799. }
  96800. playlist.attributes = playlist.attributes || {};
  96801. };
  96802. var setupMediaPlaylists = function setupMediaPlaylists2(master) {
  96803. var i2 = master.playlists.length;
  96804. while (i2--) {
  96805. var playlist = master.playlists[i2];
  96806. setupMediaPlaylist({
  96807. playlist,
  96808. id: createPlaylistID(i2, playlist.uri)
  96809. });
  96810. playlist.resolvedUri = resolveUrl4(master.uri, playlist.uri);
  96811. master.playlists[playlist.id] = playlist;
  96812. master.playlists[playlist.uri] = playlist;
  96813. if (!playlist.attributes.BANDWIDTH) {
  96814. log.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  96815. }
  96816. }
  96817. };
  96818. var resolveMediaGroupUris = function resolveMediaGroupUris2(master) {
  96819. forEachMediaGroup3(master, function(properties) {
  96820. if (properties.uri) {
  96821. properties.resolvedUri = resolveUrl4(master.uri, properties.uri);
  96822. }
  96823. });
  96824. };
  96825. var masterForMedia = function masterForMedia2(media, uri) {
  96826. var id = createPlaylistID(0, uri);
  96827. var master = {
  96828. mediaGroups: {
  96829. "AUDIO": {},
  96830. "VIDEO": {},
  96831. "CLOSED-CAPTIONS": {},
  96832. "SUBTITLES": {}
  96833. },
  96834. uri: window_1.location.href,
  96835. resolvedUri: window_1.location.href,
  96836. playlists: [{
  96837. uri,
  96838. id,
  96839. resolvedUri: uri,
  96840. attributes: {}
  96841. }]
  96842. };
  96843. master.playlists[id] = master.playlists[0];
  96844. master.playlists[uri] = master.playlists[0];
  96845. return master;
  96846. };
  96847. var addPropertiesToMaster = function addPropertiesToMaster2(master, uri, createGroupID) {
  96848. if (createGroupID === void 0) {
  96849. createGroupID = groupID;
  96850. }
  96851. master.uri = uri;
  96852. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96853. if (!master.playlists[i2].uri) {
  96854. var phonyUri = "placeholder-uri-" + i2;
  96855. master.playlists[i2].uri = phonyUri;
  96856. }
  96857. }
  96858. var audioOnlyMaster = isAudioOnly(master);
  96859. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  96860. if (!properties.playlists || !properties.playlists.length) {
  96861. if (audioOnlyMaster && mediaType === "AUDIO" && !properties.uri) {
  96862. for (var _i = 0; _i < master.playlists.length; _i++) {
  96863. var p = master.playlists[_i];
  96864. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  96865. return;
  96866. }
  96867. }
  96868. }
  96869. properties.playlists = [_extends$2({}, properties)];
  96870. }
  96871. properties.playlists.forEach(function(p2, i3) {
  96872. var groupId = createGroupID(mediaType, groupKey, labelKey, p2);
  96873. var id = createPlaylistID(i3, groupId);
  96874. if (p2.uri) {
  96875. p2.resolvedUri = p2.resolvedUri || resolveUrl4(master.uri, p2.uri);
  96876. } else {
  96877. p2.uri = i3 === 0 ? groupId : id;
  96878. p2.resolvedUri = p2.uri;
  96879. }
  96880. p2.id = p2.id || id;
  96881. p2.attributes = p2.attributes || {};
  96882. master.playlists[p2.id] = p2;
  96883. master.playlists[p2.uri] = p2;
  96884. });
  96885. });
  96886. setupMediaPlaylists(master);
  96887. resolveMediaGroupUris(master);
  96888. };
  96889. var mergeOptions$2 = videojs.mergeOptions, EventTarget$1 = videojs.EventTarget;
  96890. var addLLHLSQueryDirectives = function addLLHLSQueryDirectives2(uri, media) {
  96891. if (media.endList || !media.serverControl) {
  96892. return uri;
  96893. }
  96894. var parameters = {};
  96895. if (media.serverControl.canBlockReload) {
  96896. var preloadSegment = media.preloadSegment;
  96897. var nextMSN = media.mediaSequence + media.segments.length;
  96898. if (preloadSegment) {
  96899. var parts = preloadSegment.parts || [];
  96900. var nextPart = getKnownPartCount(media) - 1;
  96901. if (nextPart > -1 && nextPart !== parts.length - 1) {
  96902. parameters._HLS_part = nextPart;
  96903. }
  96904. if (nextPart > -1 || parts.length) {
  96905. nextMSN--;
  96906. }
  96907. }
  96908. parameters._HLS_msn = nextMSN;
  96909. }
  96910. if (media.serverControl && media.serverControl.canSkipUntil) {
  96911. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  96912. }
  96913. if (Object.keys(parameters).length) {
  96914. var parsedUri = new window_1.URL(uri);
  96915. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  96916. if (!parameters.hasOwnProperty(name)) {
  96917. return;
  96918. }
  96919. parsedUri.searchParams.set(name, parameters[name]);
  96920. });
  96921. uri = parsedUri.toString();
  96922. }
  96923. return uri;
  96924. };
  96925. var updateSegment = function updateSegment2(a, b) {
  96926. if (!a) {
  96927. return b;
  96928. }
  96929. var result = mergeOptions$2(a, b);
  96930. if (a.preloadHints && !b.preloadHints) {
  96931. delete result.preloadHints;
  96932. }
  96933. if (a.parts && !b.parts) {
  96934. delete result.parts;
  96935. } else if (a.parts && b.parts) {
  96936. for (var i2 = 0; i2 < b.parts.length; i2++) {
  96937. if (a.parts && a.parts[i2]) {
  96938. result.parts[i2] = mergeOptions$2(a.parts[i2], b.parts[i2]);
  96939. }
  96940. }
  96941. }
  96942. if (!a.skipped && b.skipped) {
  96943. result.skipped = false;
  96944. }
  96945. if (a.preload && !b.preload) {
  96946. result.preload = false;
  96947. }
  96948. return result;
  96949. };
  96950. var updateSegments = function updateSegments2(original, update, offset) {
  96951. var oldSegments = original.slice();
  96952. var newSegments = update.slice();
  96953. offset = offset || 0;
  96954. var result = [];
  96955. var currentMap;
  96956. for (var newIndex = 0; newIndex < newSegments.length; newIndex++) {
  96957. var oldSegment = oldSegments[newIndex + offset];
  96958. var newSegment = newSegments[newIndex];
  96959. if (oldSegment) {
  96960. currentMap = oldSegment.map || currentMap;
  96961. result.push(updateSegment(oldSegment, newSegment));
  96962. } else {
  96963. if (currentMap && !newSegment.map) {
  96964. newSegment.map = currentMap;
  96965. }
  96966. result.push(newSegment);
  96967. }
  96968. }
  96969. return result;
  96970. };
  96971. var resolveSegmentUris = function resolveSegmentUris2(segment, baseUri) {
  96972. if (!segment.resolvedUri && segment.uri) {
  96973. segment.resolvedUri = resolveUrl4(baseUri, segment.uri);
  96974. }
  96975. if (segment.key && !segment.key.resolvedUri) {
  96976. segment.key.resolvedUri = resolveUrl4(baseUri, segment.key.uri);
  96977. }
  96978. if (segment.map && !segment.map.resolvedUri) {
  96979. segment.map.resolvedUri = resolveUrl4(baseUri, segment.map.uri);
  96980. }
  96981. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  96982. segment.map.key.resolvedUri = resolveUrl4(baseUri, segment.map.key.uri);
  96983. }
  96984. if (segment.parts && segment.parts.length) {
  96985. segment.parts.forEach(function(p) {
  96986. if (p.resolvedUri) {
  96987. return;
  96988. }
  96989. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  96990. });
  96991. }
  96992. if (segment.preloadHints && segment.preloadHints.length) {
  96993. segment.preloadHints.forEach(function(p) {
  96994. if (p.resolvedUri) {
  96995. return;
  96996. }
  96997. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  96998. });
  96999. }
  97000. };
  97001. var getAllSegments = function getAllSegments2(media) {
  97002. var segments = media.segments || [];
  97003. var preloadSegment = media.preloadSegment;
  97004. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  97005. if (preloadSegment.preloadHints) {
  97006. for (var i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  97007. if (preloadSegment.preloadHints[i2].type === "MAP") {
  97008. return segments;
  97009. }
  97010. }
  97011. }
  97012. preloadSegment.duration = media.targetDuration;
  97013. preloadSegment.preload = true;
  97014. segments.push(preloadSegment);
  97015. }
  97016. return segments;
  97017. };
  97018. var isPlaylistUnchanged = function isPlaylistUnchanged2(a, b) {
  97019. 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;
  97020. };
  97021. var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) {
  97022. if (unchangedCheck === void 0) {
  97023. unchangedCheck = isPlaylistUnchanged;
  97024. }
  97025. var result = mergeOptions$2(master, {});
  97026. var oldMedia = result.playlists[newMedia.id];
  97027. if (!oldMedia) {
  97028. return null;
  97029. }
  97030. if (unchangedCheck(oldMedia, newMedia)) {
  97031. return null;
  97032. }
  97033. newMedia.segments = getAllSegments(newMedia);
  97034. var mergedPlaylist = mergeOptions$2(oldMedia, newMedia);
  97035. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  97036. delete mergedPlaylist.preloadSegment;
  97037. }
  97038. if (oldMedia.segments) {
  97039. if (newMedia.skip) {
  97040. newMedia.segments = newMedia.segments || [];
  97041. for (var i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  97042. newMedia.segments.unshift({
  97043. skipped: true
  97044. });
  97045. }
  97046. }
  97047. mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  97048. }
  97049. mergedPlaylist.segments.forEach(function(segment) {
  97050. resolveSegmentUris(segment, mergedPlaylist.resolvedUri);
  97051. });
  97052. for (var _i = 0; _i < result.playlists.length; _i++) {
  97053. if (result.playlists[_i].id === newMedia.id) {
  97054. result.playlists[_i] = mergedPlaylist;
  97055. }
  97056. }
  97057. result.playlists[newMedia.id] = mergedPlaylist;
  97058. result.playlists[newMedia.uri] = mergedPlaylist;
  97059. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  97060. if (!properties.playlists) {
  97061. return;
  97062. }
  97063. for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) {
  97064. if (newMedia.id === properties.playlists[_i2].id) {
  97065. properties.playlists[_i2] = mergedPlaylist;
  97066. }
  97067. }
  97068. });
  97069. return result;
  97070. };
  97071. var refreshDelay = function refreshDelay2(media, update) {
  97072. var segments = media.segments || [];
  97073. var lastSegment = segments[segments.length - 1];
  97074. var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  97075. var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  97076. if (update && lastDuration) {
  97077. return lastDuration * 1e3;
  97078. }
  97079. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  97080. };
  97081. var PlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  97082. _inheritsLoose(PlaylistLoader2, _EventTarget);
  97083. function PlaylistLoader2(src, vhs, options2) {
  97084. var _this;
  97085. if (options2 === void 0) {
  97086. options2 = {};
  97087. }
  97088. _this = _EventTarget.call(this) || this;
  97089. if (!src) {
  97090. throw new Error("A non-empty playlist URL or object is required");
  97091. }
  97092. _this.logger_ = logger("PlaylistLoader");
  97093. 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;
  97094. _this.src = src;
  97095. _this.vhs_ = vhs;
  97096. _this.withCredentials = withCredentials;
  97097. _this.handleManifestRedirects = handleManifestRedirects;
  97098. var vhsOptions = vhs.options_;
  97099. _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  97100. _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  97101. _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false;
  97102. if (videojs.browser.IE_VERSION) {
  97103. _this.experimentalLLHLS = false;
  97104. }
  97105. _this.state = "HAVE_NOTHING";
  97106. _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(_assertThisInitialized(_this));
  97107. _this.on("mediaupdatetimeout", _this.handleMediaupdatetimeout_);
  97108. return _this;
  97109. }
  97110. var _proto = PlaylistLoader2.prototype;
  97111. _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() {
  97112. var _this2 = this;
  97113. if (this.state !== "HAVE_METADATA") {
  97114. return;
  97115. }
  97116. var media = this.media();
  97117. var uri = resolveUrl4(this.master.uri, media.uri);
  97118. if (this.experimentalLLHLS) {
  97119. uri = addLLHLSQueryDirectives(uri, media);
  97120. }
  97121. this.state = "HAVE_CURRENT_METADATA";
  97122. this.request = this.vhs_.xhr({
  97123. uri,
  97124. withCredentials: this.withCredentials
  97125. }, function(error, req) {
  97126. if (!_this2.request) {
  97127. return;
  97128. }
  97129. if (error) {
  97130. return _this2.playlistRequestError(_this2.request, _this2.media(), "HAVE_METADATA");
  97131. }
  97132. _this2.haveMetadata({
  97133. playlistString: _this2.request.responseText,
  97134. url: _this2.media().uri,
  97135. id: _this2.media().id
  97136. });
  97137. });
  97138. };
  97139. _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) {
  97140. var uri = playlist.uri, id = playlist.id;
  97141. this.request = null;
  97142. if (startingState) {
  97143. this.state = startingState;
  97144. }
  97145. this.error = {
  97146. playlist: this.master.playlists[id],
  97147. status: xhr.status,
  97148. message: "HLS playlist request error at URL: " + uri + ".",
  97149. responseText: xhr.responseText,
  97150. code: xhr.status >= 500 ? 4 : 2
  97151. };
  97152. this.trigger("error");
  97153. };
  97154. _proto.parseManifest_ = function parseManifest_(_ref) {
  97155. var _this3 = this;
  97156. var url = _ref.url, manifestString = _ref.manifestString;
  97157. return parseManifest({
  97158. onwarn: function onwarn(_ref2) {
  97159. var message = _ref2.message;
  97160. return _this3.logger_("m3u8-parser warn for " + url + ": " + message);
  97161. },
  97162. oninfo: function oninfo(_ref3) {
  97163. var message = _ref3.message;
  97164. return _this3.logger_("m3u8-parser info for " + url + ": " + message);
  97165. },
  97166. manifestString,
  97167. customTagParsers: this.customTagParsers,
  97168. customTagMappers: this.customTagMappers,
  97169. experimentalLLHLS: this.experimentalLLHLS
  97170. });
  97171. };
  97172. _proto.haveMetadata = function haveMetadata(_ref4) {
  97173. var playlistString = _ref4.playlistString, playlistObject = _ref4.playlistObject, url = _ref4.url, id = _ref4.id;
  97174. this.request = null;
  97175. this.state = "HAVE_METADATA";
  97176. var playlist = playlistObject || this.parseManifest_({
  97177. url,
  97178. manifestString: playlistString
  97179. });
  97180. playlist.lastRequest = Date.now();
  97181. setupMediaPlaylist({
  97182. playlist,
  97183. uri: url,
  97184. id
  97185. });
  97186. var update = updateMaster$1(this.master, playlist);
  97187. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  97188. this.pendingMedia_ = null;
  97189. if (update) {
  97190. this.master = update;
  97191. this.media_ = this.master.playlists[id];
  97192. } else {
  97193. this.trigger("playlistunchanged");
  97194. }
  97195. this.updateMediaUpdateTimeout_(refreshDelay(this.media(), !!update));
  97196. this.trigger("loadedplaylist");
  97197. };
  97198. _proto.dispose = function dispose() {
  97199. this.trigger("dispose");
  97200. this.stopRequest();
  97201. window_1.clearTimeout(this.mediaUpdateTimeout);
  97202. window_1.clearTimeout(this.finalRenditionTimeout);
  97203. this.off();
  97204. };
  97205. _proto.stopRequest = function stopRequest() {
  97206. if (this.request) {
  97207. var oldRequest = this.request;
  97208. this.request = null;
  97209. oldRequest.onreadystatechange = null;
  97210. oldRequest.abort();
  97211. }
  97212. };
  97213. _proto.media = function media(playlist, shouldDelay) {
  97214. var _this4 = this;
  97215. if (!playlist) {
  97216. return this.media_;
  97217. }
  97218. if (this.state === "HAVE_NOTHING") {
  97219. throw new Error("Cannot switch media playlist from " + this.state);
  97220. }
  97221. if (typeof playlist === "string") {
  97222. if (!this.master.playlists[playlist]) {
  97223. throw new Error("Unknown playlist URI: " + playlist);
  97224. }
  97225. playlist = this.master.playlists[playlist];
  97226. }
  97227. window_1.clearTimeout(this.finalRenditionTimeout);
  97228. if (shouldDelay) {
  97229. var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  97230. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  97231. return;
  97232. }
  97233. var startingState = this.state;
  97234. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  97235. var masterPlaylistRef = this.master.playlists[playlist.id];
  97236. if (masterPlaylistRef && masterPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  97237. if (this.request) {
  97238. this.request.onreadystatechange = null;
  97239. this.request.abort();
  97240. this.request = null;
  97241. }
  97242. this.state = "HAVE_METADATA";
  97243. this.media_ = playlist;
  97244. if (mediaChange) {
  97245. this.trigger("mediachanging");
  97246. if (startingState === "HAVE_MASTER") {
  97247. this.trigger("loadedmetadata");
  97248. } else {
  97249. this.trigger("mediachange");
  97250. }
  97251. }
  97252. return;
  97253. }
  97254. this.updateMediaUpdateTimeout_(refreshDelay(playlist, true));
  97255. if (!mediaChange) {
  97256. return;
  97257. }
  97258. this.state = "SWITCHING_MEDIA";
  97259. if (this.request) {
  97260. if (playlist.resolvedUri === this.request.url) {
  97261. return;
  97262. }
  97263. this.request.onreadystatechange = null;
  97264. this.request.abort();
  97265. this.request = null;
  97266. }
  97267. if (this.media_) {
  97268. this.trigger("mediachanging");
  97269. }
  97270. this.pendingMedia_ = playlist;
  97271. this.request = this.vhs_.xhr({
  97272. uri: playlist.resolvedUri,
  97273. withCredentials: this.withCredentials
  97274. }, function(error, req) {
  97275. if (!_this4.request) {
  97276. return;
  97277. }
  97278. playlist.lastRequest = Date.now();
  97279. playlist.resolvedUri = resolveManifestRedirect(_this4.handleManifestRedirects, playlist.resolvedUri, req);
  97280. if (error) {
  97281. return _this4.playlistRequestError(_this4.request, playlist, startingState);
  97282. }
  97283. _this4.haveMetadata({
  97284. playlistString: req.responseText,
  97285. url: playlist.uri,
  97286. id: playlist.id
  97287. });
  97288. if (startingState === "HAVE_MASTER") {
  97289. _this4.trigger("loadedmetadata");
  97290. } else {
  97291. _this4.trigger("mediachange");
  97292. }
  97293. });
  97294. };
  97295. _proto.pause = function pause() {
  97296. if (this.mediaUpdateTimeout) {
  97297. window_1.clearTimeout(this.mediaUpdateTimeout);
  97298. this.mediaUpdateTimeout = null;
  97299. }
  97300. this.stopRequest();
  97301. if (this.state === "HAVE_NOTHING") {
  97302. this.started = false;
  97303. }
  97304. if (this.state === "SWITCHING_MEDIA") {
  97305. if (this.media_) {
  97306. this.state = "HAVE_METADATA";
  97307. } else {
  97308. this.state = "HAVE_MASTER";
  97309. }
  97310. } else if (this.state === "HAVE_CURRENT_METADATA") {
  97311. this.state = "HAVE_METADATA";
  97312. }
  97313. };
  97314. _proto.load = function load(shouldDelay) {
  97315. var _this5 = this;
  97316. if (this.mediaUpdateTimeout) {
  97317. window_1.clearTimeout(this.mediaUpdateTimeout);
  97318. this.mediaUpdateTimeout = null;
  97319. }
  97320. var media = this.media();
  97321. if (shouldDelay) {
  97322. var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  97323. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97324. _this5.mediaUpdateTimeout = null;
  97325. _this5.load();
  97326. }, delay);
  97327. return;
  97328. }
  97329. if (!this.started) {
  97330. this.start();
  97331. return;
  97332. }
  97333. if (media && !media.endList) {
  97334. this.trigger("mediaupdatetimeout");
  97335. } else {
  97336. this.trigger("loadedplaylist");
  97337. }
  97338. };
  97339. _proto.updateMediaUpdateTimeout_ = function updateMediaUpdateTimeout_(delay) {
  97340. var _this6 = this;
  97341. if (this.mediaUpdateTimeout) {
  97342. window_1.clearTimeout(this.mediaUpdateTimeout);
  97343. this.mediaUpdateTimeout = null;
  97344. }
  97345. if (!this.media() || this.media().endList) {
  97346. return;
  97347. }
  97348. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97349. _this6.mediaUpdateTimeout = null;
  97350. _this6.trigger("mediaupdatetimeout");
  97351. _this6.updateMediaUpdateTimeout_(delay);
  97352. }, delay);
  97353. };
  97354. _proto.start = function start2() {
  97355. var _this7 = this;
  97356. this.started = true;
  97357. if (typeof this.src === "object") {
  97358. if (!this.src.uri) {
  97359. this.src.uri = window_1.location.href;
  97360. }
  97361. this.src.resolvedUri = this.src.uri;
  97362. setTimeout(function() {
  97363. _this7.setupInitialPlaylist(_this7.src);
  97364. }, 0);
  97365. return;
  97366. }
  97367. this.request = this.vhs_.xhr({
  97368. uri: this.src,
  97369. withCredentials: this.withCredentials
  97370. }, function(error, req) {
  97371. if (!_this7.request) {
  97372. return;
  97373. }
  97374. _this7.request = null;
  97375. if (error) {
  97376. _this7.error = {
  97377. status: req.status,
  97378. message: "HLS playlist request error at URL: " + _this7.src + ".",
  97379. responseText: req.responseText,
  97380. code: 2
  97381. };
  97382. if (_this7.state === "HAVE_NOTHING") {
  97383. _this7.started = false;
  97384. }
  97385. return _this7.trigger("error");
  97386. }
  97387. _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req);
  97388. var manifest = _this7.parseManifest_({
  97389. manifestString: req.responseText,
  97390. url: _this7.src
  97391. });
  97392. _this7.setupInitialPlaylist(manifest);
  97393. });
  97394. };
  97395. _proto.srcUri = function srcUri() {
  97396. return typeof this.src === "string" ? this.src : this.src.uri;
  97397. };
  97398. _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) {
  97399. this.state = "HAVE_MASTER";
  97400. if (manifest.playlists) {
  97401. this.master = manifest;
  97402. addPropertiesToMaster(this.master, this.srcUri());
  97403. manifest.playlists.forEach(function(playlist) {
  97404. playlist.segments = getAllSegments(playlist);
  97405. playlist.segments.forEach(function(segment) {
  97406. resolveSegmentUris(segment, playlist.resolvedUri);
  97407. });
  97408. });
  97409. this.trigger("loadedplaylist");
  97410. if (!this.request) {
  97411. this.media(this.master.playlists[0]);
  97412. }
  97413. return;
  97414. }
  97415. var uri = this.srcUri() || window_1.location.href;
  97416. this.master = masterForMedia(manifest, uri);
  97417. this.haveMetadata({
  97418. playlistObject: manifest,
  97419. url: uri,
  97420. id: this.master.playlists[0].id
  97421. });
  97422. this.trigger("loadedmetadata");
  97423. };
  97424. return PlaylistLoader2;
  97425. }(EventTarget$1);
  97426. var videojsXHR = videojs.xhr, mergeOptions$1$1 = videojs.mergeOptions;
  97427. var callbackWrapper = function callbackWrapper2(request, error, response, callback2) {
  97428. var reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  97429. if (!error && reqResponse) {
  97430. request.responseTime = Date.now();
  97431. request.roundTripTime = request.responseTime - request.requestTime;
  97432. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  97433. if (!request.bandwidth) {
  97434. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  97435. }
  97436. }
  97437. if (response.headers) {
  97438. request.responseHeaders = response.headers;
  97439. }
  97440. if (error && error.code === "ETIMEDOUT") {
  97441. request.timedout = true;
  97442. }
  97443. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  97444. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  97445. }
  97446. callback2(error, request);
  97447. };
  97448. var xhrFactory = function xhrFactory2() {
  97449. var xhr = function XhrFunction(options2, callback2) {
  97450. options2 = mergeOptions$1$1({
  97451. timeout: 45e3
  97452. }, options2);
  97453. var beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest;
  97454. if (beforeRequest && typeof beforeRequest === "function") {
  97455. var newOptions = beforeRequest(options2);
  97456. if (newOptions) {
  97457. options2 = newOptions;
  97458. }
  97459. }
  97460. var xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr;
  97461. var request = xhrMethod(options2, function(error, response) {
  97462. return callbackWrapper(request, error, response, callback2);
  97463. });
  97464. var originalAbort = request.abort;
  97465. request.abort = function() {
  97466. request.aborted = true;
  97467. return originalAbort.apply(request, arguments);
  97468. };
  97469. request.uri = options2.uri;
  97470. request.requestTime = Date.now();
  97471. return request;
  97472. };
  97473. xhr.original = true;
  97474. return xhr;
  97475. };
  97476. var byterangeStr = function byterangeStr2(byterange) {
  97477. var byterangeEnd;
  97478. var byterangeStart = byterange.offset;
  97479. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  97480. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  97481. } else {
  97482. byterangeEnd = byterange.offset + byterange.length - 1;
  97483. }
  97484. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  97485. };
  97486. var segmentXhrHeaders = function segmentXhrHeaders2(segment) {
  97487. var headers = {};
  97488. if (segment.byterange) {
  97489. headers.Range = byterangeStr(segment.byterange);
  97490. }
  97491. return headers;
  97492. };
  97493. var textRange = function textRange2(range3, i2) {
  97494. return range3.start(i2) + "-" + range3.end(i2);
  97495. };
  97496. var formatHexString = function formatHexString2(e, i2) {
  97497. var value = e.toString(16);
  97498. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  97499. };
  97500. var formatAsciiString = function formatAsciiString2(e) {
  97501. if (e >= 32 && e < 126) {
  97502. return String.fromCharCode(e);
  97503. }
  97504. return ".";
  97505. };
  97506. var createTransferableMessage = function createTransferableMessage2(message) {
  97507. var transferable = {};
  97508. Object.keys(message).forEach(function(key) {
  97509. var value = message[key];
  97510. if (isArrayBufferView2(value)) {
  97511. transferable[key] = {
  97512. bytes: value.buffer,
  97513. byteOffset: value.byteOffset,
  97514. byteLength: value.byteLength
  97515. };
  97516. } else {
  97517. transferable[key] = value;
  97518. }
  97519. });
  97520. return transferable;
  97521. };
  97522. var initSegmentId = function initSegmentId2(initSegment) {
  97523. var byterange = initSegment.byterange || {
  97524. length: Infinity,
  97525. offset: 0
  97526. };
  97527. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  97528. };
  97529. var segmentKeyId = function segmentKeyId2(key) {
  97530. return key.resolvedUri;
  97531. };
  97532. var hexDump = function hexDump2(data) {
  97533. var bytes = Array.prototype.slice.call(data);
  97534. var step = 16;
  97535. var result = "";
  97536. var hex;
  97537. var ascii;
  97538. for (var j = 0; j < bytes.length / step; j++) {
  97539. hex = bytes.slice(j * step, j * step + step).map(formatHexString).join("");
  97540. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join("");
  97541. result += hex + " " + ascii + "\n";
  97542. }
  97543. return result;
  97544. };
  97545. var tagDump = function tagDump2(_ref) {
  97546. var bytes = _ref.bytes;
  97547. return hexDump(bytes);
  97548. };
  97549. var textRanges = function textRanges2(ranges) {
  97550. var result = "";
  97551. var i2;
  97552. for (i2 = 0; i2 < ranges.length; i2++) {
  97553. result += textRange(ranges, i2) + " ";
  97554. }
  97555. return result;
  97556. };
  97557. var utils = /* @__PURE__ */ Object.freeze({
  97558. __proto__: null,
  97559. createTransferableMessage,
  97560. initSegmentId,
  97561. segmentKeyId,
  97562. hexDump,
  97563. tagDump,
  97564. textRanges
  97565. });
  97566. var SEGMENT_END_FUDGE_PERCENT = 0.25;
  97567. var playerTimeToProgramTime = function playerTimeToProgramTime2(playerTime, segment) {
  97568. if (!segment.dateTimeObject) {
  97569. return null;
  97570. }
  97571. var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  97572. var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  97573. var startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  97574. var offsetFromSegmentStart = playerTime - startOfSegment;
  97575. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  97576. };
  97577. var originalSegmentVideoDuration = function originalSegmentVideoDuration2(videoTimingInfo) {
  97578. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  97579. };
  97580. var findSegmentForProgramTime = function findSegmentForProgramTime2(programTime, playlist) {
  97581. var dateTimeObject;
  97582. try {
  97583. dateTimeObject = new Date(programTime);
  97584. } catch (e) {
  97585. return null;
  97586. }
  97587. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97588. return null;
  97589. }
  97590. var segment = playlist.segments[0];
  97591. if (dateTimeObject < segment.dateTimeObject) {
  97592. return null;
  97593. }
  97594. for (var i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  97595. segment = playlist.segments[i2];
  97596. var nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  97597. if (dateTimeObject < nextSegmentStart) {
  97598. break;
  97599. }
  97600. }
  97601. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97602. var lastSegmentStart = lastSegment.dateTimeObject;
  97603. var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT;
  97604. var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  97605. if (dateTimeObject > lastSegmentEnd) {
  97606. return null;
  97607. }
  97608. if (dateTimeObject > lastSegmentStart) {
  97609. segment = lastSegment;
  97610. }
  97611. return {
  97612. segment,
  97613. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  97614. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97615. };
  97616. };
  97617. var findSegmentForPlayerTime = function findSegmentForPlayerTime2(time, playlist) {
  97618. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97619. return null;
  97620. }
  97621. var segmentEnd = 0;
  97622. var segment;
  97623. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97624. segment = playlist.segments[i2];
  97625. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  97626. if (time <= segmentEnd) {
  97627. break;
  97628. }
  97629. }
  97630. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97631. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  97632. return null;
  97633. }
  97634. if (time > segmentEnd) {
  97635. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) {
  97636. return null;
  97637. }
  97638. segment = lastSegment;
  97639. }
  97640. return {
  97641. segment,
  97642. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  97643. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97644. };
  97645. };
  97646. var getOffsetFromTimestamp = function getOffsetFromTimestamp2(comparisonTimeStamp, programTime) {
  97647. var segmentDateTime;
  97648. var programDateTime;
  97649. try {
  97650. segmentDateTime = new Date(comparisonTimeStamp);
  97651. programDateTime = new Date(programTime);
  97652. } catch (e) {
  97653. }
  97654. var segmentTimeEpoch = segmentDateTime.getTime();
  97655. var programTimeEpoch = programDateTime.getTime();
  97656. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  97657. };
  97658. var verifyProgramDateTimeTags = function verifyProgramDateTimeTags2(playlist) {
  97659. if (!playlist.segments || playlist.segments.length === 0) {
  97660. return false;
  97661. }
  97662. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97663. var segment = playlist.segments[i2];
  97664. if (!segment.dateTimeObject) {
  97665. return false;
  97666. }
  97667. }
  97668. return true;
  97669. };
  97670. var getProgramTime = function getProgramTime2(_ref) {
  97671. var playlist = _ref.playlist, _ref$time = _ref.time, time = _ref$time === void 0 ? void 0 : _ref$time, callback2 = _ref.callback;
  97672. if (!callback2) {
  97673. throw new Error("getProgramTime: callback must be provided");
  97674. }
  97675. if (!playlist || time === void 0) {
  97676. return callback2({
  97677. message: "getProgramTime: playlist and time must be provided"
  97678. });
  97679. }
  97680. var matchedSegment = findSegmentForPlayerTime(time, playlist);
  97681. if (!matchedSegment) {
  97682. return callback2({
  97683. message: "valid programTime was not found"
  97684. });
  97685. }
  97686. if (matchedSegment.type === "estimate") {
  97687. return callback2({
  97688. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  97689. seekTime: matchedSegment.estimatedStart
  97690. });
  97691. }
  97692. var programTimeObject = {
  97693. mediaSeconds: time
  97694. };
  97695. var programTime = playerTimeToProgramTime(time, matchedSegment.segment);
  97696. if (programTime) {
  97697. programTimeObject.programDateTime = programTime.toISOString();
  97698. }
  97699. return callback2(null, programTimeObject);
  97700. };
  97701. var seekToProgramTime = function seekToProgramTime2(_ref2) {
  97702. 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;
  97703. if (!callback2) {
  97704. throw new Error("seekToProgramTime: callback must be provided");
  97705. }
  97706. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  97707. return callback2({
  97708. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  97709. });
  97710. }
  97711. if (!playlist.endList && !tech.hasStarted_) {
  97712. return callback2({
  97713. message: "player must be playing a live stream to start buffering"
  97714. });
  97715. }
  97716. if (!verifyProgramDateTimeTags(playlist)) {
  97717. return callback2({
  97718. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  97719. });
  97720. }
  97721. var matchedSegment = findSegmentForProgramTime(programTime, playlist);
  97722. if (!matchedSegment) {
  97723. return callback2({
  97724. message: programTime + " was not found in the stream"
  97725. });
  97726. }
  97727. var segment = matchedSegment.segment;
  97728. var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime);
  97729. if (matchedSegment.type === "estimate") {
  97730. if (retryCount === 0) {
  97731. return callback2({
  97732. message: programTime + " is not buffered yet. Try again"
  97733. });
  97734. }
  97735. seekTo(matchedSegment.estimatedStart + mediaOffset);
  97736. tech.one("seeked", function() {
  97737. seekToProgramTime2({
  97738. programTime,
  97739. playlist,
  97740. retryCount: retryCount - 1,
  97741. seekTo,
  97742. pauseAfterSeek,
  97743. tech,
  97744. callback: callback2
  97745. });
  97746. });
  97747. return;
  97748. }
  97749. var seekToTime = segment.start + mediaOffset;
  97750. var seekedCallback = function seekedCallback2() {
  97751. return callback2(null, tech.currentTime());
  97752. };
  97753. tech.one("seeked", seekedCallback);
  97754. if (pauseAfterSeek) {
  97755. tech.pause();
  97756. }
  97757. seekTo(seekToTime);
  97758. };
  97759. var callbackOnCompleted = function callbackOnCompleted2(request, cb) {
  97760. if (request.readyState === 4) {
  97761. return cb();
  97762. }
  97763. return;
  97764. };
  97765. var containerRequest = function containerRequest2(uri, xhr, cb) {
  97766. var bytes = [];
  97767. var id3Offset;
  97768. var finished = false;
  97769. var endRequestAndCallback = function endRequestAndCallback2(err, req, type2, _bytes) {
  97770. req.abort();
  97771. finished = true;
  97772. return cb(err, req, type2, _bytes);
  97773. };
  97774. var progressListener = function progressListener2(error, request2) {
  97775. if (finished) {
  97776. return;
  97777. }
  97778. if (error) {
  97779. return endRequestAndCallback(error, request2, "", bytes);
  97780. }
  97781. var newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  97782. bytes = concatTypedArrays2(bytes, stringToBytes2(newPart, true));
  97783. id3Offset = id3Offset || getId3Offset2(bytes);
  97784. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  97785. return callbackOnCompleted(request2, function() {
  97786. return endRequestAndCallback(error, request2, "", bytes);
  97787. });
  97788. }
  97789. var type2 = detectContainerForBytes2(bytes);
  97790. if (type2 === "ts" && bytes.length < 188) {
  97791. return callbackOnCompleted(request2, function() {
  97792. return endRequestAndCallback(error, request2, "", bytes);
  97793. });
  97794. }
  97795. if (!type2 && bytes.length < 376) {
  97796. return callbackOnCompleted(request2, function() {
  97797. return endRequestAndCallback(error, request2, "", bytes);
  97798. });
  97799. }
  97800. return endRequestAndCallback(null, request2, type2, bytes);
  97801. };
  97802. var options2 = {
  97803. uri,
  97804. beforeSend: function beforeSend(request2) {
  97805. request2.overrideMimeType("text/plain; charset=x-user-defined");
  97806. request2.addEventListener("progress", function(_ref) {
  97807. _ref.total;
  97808. _ref.loaded;
  97809. return callbackWrapper(request2, null, {
  97810. statusCode: request2.status
  97811. }, progressListener);
  97812. });
  97813. }
  97814. };
  97815. var request = xhr(options2, function(error, response) {
  97816. return callbackWrapper(request, error, response, progressListener);
  97817. });
  97818. return request;
  97819. };
  97820. var EventTarget2 = videojs.EventTarget, mergeOptions$4 = videojs.mergeOptions;
  97821. var dashPlaylistUnchanged = function dashPlaylistUnchanged2(a, b) {
  97822. if (!isPlaylistUnchanged(a, b)) {
  97823. return false;
  97824. }
  97825. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  97826. return false;
  97827. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  97828. return false;
  97829. }
  97830. if (a.segments && !b.segments || !a.segments && b.segments) {
  97831. return false;
  97832. }
  97833. if (!a.segments && !b.segments) {
  97834. return true;
  97835. }
  97836. for (var i2 = 0; i2 < a.segments.length; i2++) {
  97837. var aSegment = a.segments[i2];
  97838. var bSegment = b.segments[i2];
  97839. if (aSegment.uri !== bSegment.uri) {
  97840. return false;
  97841. }
  97842. if (!aSegment.byterange && !bSegment.byterange) {
  97843. continue;
  97844. }
  97845. var aByterange = aSegment.byterange;
  97846. var bByterange = bSegment.byterange;
  97847. if (aByterange && !bByterange || !aByterange && bByterange) {
  97848. return false;
  97849. }
  97850. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  97851. return false;
  97852. }
  97853. }
  97854. return true;
  97855. };
  97856. var dashGroupId = function dashGroupId2(type2, group, label2, playlist) {
  97857. var playlistId = playlist.attributes.NAME || label2;
  97858. return "placeholder-uri-" + type2 + "-" + group + "-" + playlistId;
  97859. };
  97860. var parseMasterXml = function parseMasterXml2(_ref) {
  97861. var masterXml = _ref.masterXml, srcUrl = _ref.srcUrl, clientOffset = _ref.clientOffset, sidxMapping = _ref.sidxMapping, previousManifest = _ref.previousManifest;
  97862. var manifest = parse(masterXml, {
  97863. manifestUri: srcUrl,
  97864. clientOffset,
  97865. sidxMapping,
  97866. previousManifest
  97867. });
  97868. addPropertiesToMaster(manifest, srcUrl, dashGroupId);
  97869. return manifest;
  97870. };
  97871. var removeOldMediaGroupLabels = function removeOldMediaGroupLabels2(update, newMaster) {
  97872. forEachMediaGroup3(update, function(properties, type2, group, label2) {
  97873. if (!(label2 in newMaster.mediaGroups[type2][group])) {
  97874. delete update.mediaGroups[type2][group][label2];
  97875. }
  97876. });
  97877. };
  97878. var updateMaster2 = function updateMaster3(oldMaster, newMaster, sidxMapping) {
  97879. var noChanges = true;
  97880. var update = mergeOptions$4(oldMaster, {
  97881. duration: newMaster.duration,
  97882. minimumUpdatePeriod: newMaster.minimumUpdatePeriod,
  97883. timelineStarts: newMaster.timelineStarts
  97884. });
  97885. for (var i2 = 0; i2 < newMaster.playlists.length; i2++) {
  97886. var playlist = newMaster.playlists[i2];
  97887. if (playlist.sidx) {
  97888. var sidxKey = generateSidxKey(playlist.sidx);
  97889. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  97890. addSidxSegmentsToPlaylist$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  97891. }
  97892. }
  97893. var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged);
  97894. if (playlistUpdate) {
  97895. update = playlistUpdate;
  97896. noChanges = false;
  97897. }
  97898. }
  97899. forEachMediaGroup3(newMaster, function(properties, type2, group, label2) {
  97900. if (properties.playlists && properties.playlists.length) {
  97901. var id = properties.playlists[0].id;
  97902. var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged);
  97903. if (_playlistUpdate) {
  97904. update = _playlistUpdate;
  97905. if (!(label2 in update.mediaGroups[type2][group])) {
  97906. update.mediaGroups[type2][group][label2] = properties;
  97907. }
  97908. update.mediaGroups[type2][group][label2].playlists[0] = update.playlists[id];
  97909. noChanges = false;
  97910. }
  97911. }
  97912. });
  97913. removeOldMediaGroupLabels(update, newMaster);
  97914. if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  97915. noChanges = false;
  97916. }
  97917. if (noChanges) {
  97918. return null;
  97919. }
  97920. return update;
  97921. };
  97922. var equivalentSidx = function equivalentSidx2(a, b) {
  97923. var neitherMap = Boolean(!a.map && !b.map);
  97924. var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  97925. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  97926. };
  97927. var compareSidxEntry = function compareSidxEntry2(playlists, oldSidxMapping) {
  97928. var newSidxMapping = {};
  97929. for (var id in playlists) {
  97930. var playlist = playlists[id];
  97931. var currentSidxInfo = playlist.sidx;
  97932. if (currentSidxInfo) {
  97933. var key = generateSidxKey(currentSidxInfo);
  97934. if (!oldSidxMapping[key]) {
  97935. break;
  97936. }
  97937. var savedSidxInfo = oldSidxMapping[key].sidxInfo;
  97938. if (equivalentSidx(savedSidxInfo, currentSidxInfo)) {
  97939. newSidxMapping[key] = oldSidxMapping[key];
  97940. }
  97941. }
  97942. }
  97943. return newSidxMapping;
  97944. };
  97945. var filterChangedSidxMappings = function filterChangedSidxMappings2(master, oldSidxMapping) {
  97946. var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping);
  97947. var mediaGroupSidx = videoSidx;
  97948. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  97949. if (properties.playlists && properties.playlists.length) {
  97950. var playlists = properties.playlists;
  97951. mediaGroupSidx = mergeOptions$4(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping));
  97952. }
  97953. });
  97954. return mediaGroupSidx;
  97955. };
  97956. var DashPlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  97957. _inheritsLoose(DashPlaylistLoader2, _EventTarget);
  97958. function DashPlaylistLoader2(srcUrlOrPlaylist, vhs, options2, masterPlaylistLoader) {
  97959. var _this;
  97960. if (options2 === void 0) {
  97961. options2 = {};
  97962. }
  97963. _this = _EventTarget.call(this) || this;
  97964. _this.masterPlaylistLoader_ = masterPlaylistLoader || _assertThisInitialized(_this);
  97965. if (!masterPlaylistLoader) {
  97966. _this.isMaster_ = true;
  97967. }
  97968. 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;
  97969. _this.vhs_ = vhs;
  97970. _this.withCredentials = withCredentials;
  97971. _this.handleManifestRedirects = handleManifestRedirects;
  97972. if (!srcUrlOrPlaylist) {
  97973. throw new Error("A non-empty playlist URL or object is required");
  97974. }
  97975. _this.on("minimumUpdatePeriod", function() {
  97976. _this.refreshXml_();
  97977. });
  97978. _this.on("mediaupdatetimeout", function() {
  97979. _this.refreshMedia_(_this.media().id);
  97980. });
  97981. _this.state = "HAVE_NOTHING";
  97982. _this.loadedPlaylists_ = {};
  97983. _this.logger_ = logger("DashPlaylistLoader");
  97984. if (_this.isMaster_) {
  97985. _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  97986. _this.masterPlaylistLoader_.sidxMapping_ = {};
  97987. } else {
  97988. _this.childPlaylist_ = srcUrlOrPlaylist;
  97989. }
  97990. return _this;
  97991. }
  97992. var _proto = DashPlaylistLoader2.prototype;
  97993. _proto.requestErrored_ = function requestErrored_(err, request, startingState) {
  97994. if (!this.request) {
  97995. return true;
  97996. }
  97997. this.request = null;
  97998. if (err) {
  97999. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  98000. status: request.status,
  98001. message: "DASH request error at URL: " + request.uri,
  98002. response: request.response,
  98003. code: 2
  98004. };
  98005. if (startingState) {
  98006. this.state = startingState;
  98007. }
  98008. this.trigger("error");
  98009. return true;
  98010. }
  98011. };
  98012. _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) {
  98013. var _this2 = this;
  98014. var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx);
  98015. if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) {
  98016. this.mediaRequest_ = window_1.setTimeout(function() {
  98017. return cb(false);
  98018. }, 0);
  98019. return;
  98020. }
  98021. var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri);
  98022. var fin = function fin2(err, request) {
  98023. if (_this2.requestErrored_(err, request, startingState)) {
  98024. return;
  98025. }
  98026. var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_;
  98027. var sidx;
  98028. try {
  98029. sidx = parseSidx_1(toUint82(request.response).subarray(8));
  98030. } catch (e) {
  98031. _this2.requestErrored_(e, request, startingState);
  98032. return;
  98033. }
  98034. sidxMapping[sidxKey] = {
  98035. sidxInfo: playlist.sidx,
  98036. sidx
  98037. };
  98038. addSidxSegmentsToPlaylist$1(playlist, sidx, playlist.sidx.resolvedUri);
  98039. return cb(true);
  98040. };
  98041. this.request = containerRequest(uri, this.vhs_.xhr, function(err, request, container, bytes) {
  98042. if (err) {
  98043. return fin(err, request);
  98044. }
  98045. if (!container || container !== "mp4") {
  98046. return fin({
  98047. status: request.status,
  98048. message: "Unsupported " + (container || "unknown") + " container type for sidx segment at URL: " + uri,
  98049. response: "",
  98050. playlist,
  98051. internal: true,
  98052. blacklistDuration: Infinity,
  98053. code: 2
  98054. }, request);
  98055. }
  98056. var _playlist$sidx$bytera = playlist.sidx.byterange, offset = _playlist$sidx$bytera.offset, length = _playlist$sidx$bytera.length;
  98057. if (bytes.length >= length + offset) {
  98058. return fin(err, {
  98059. response: bytes.subarray(offset, offset + length),
  98060. status: request.status,
  98061. uri: request.uri
  98062. });
  98063. }
  98064. _this2.request = _this2.vhs_.xhr({
  98065. uri,
  98066. responseType: "arraybuffer",
  98067. headers: segmentXhrHeaders({
  98068. byterange: playlist.sidx.byterange
  98069. })
  98070. }, fin);
  98071. });
  98072. };
  98073. _proto.dispose = function dispose() {
  98074. this.trigger("dispose");
  98075. this.stopRequest();
  98076. this.loadedPlaylists_ = {};
  98077. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  98078. window_1.clearTimeout(this.mediaRequest_);
  98079. window_1.clearTimeout(this.mediaUpdateTimeout);
  98080. this.mediaUpdateTimeout = null;
  98081. this.mediaRequest_ = null;
  98082. this.minimumUpdatePeriodTimeout_ = null;
  98083. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  98084. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  98085. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  98086. }
  98087. this.off();
  98088. };
  98089. _proto.hasPendingRequest = function hasPendingRequest() {
  98090. return this.request || this.mediaRequest_;
  98091. };
  98092. _proto.stopRequest = function stopRequest() {
  98093. if (this.request) {
  98094. var oldRequest = this.request;
  98095. this.request = null;
  98096. oldRequest.onreadystatechange = null;
  98097. oldRequest.abort();
  98098. }
  98099. };
  98100. _proto.media = function media(playlist) {
  98101. var _this3 = this;
  98102. if (!playlist) {
  98103. return this.media_;
  98104. }
  98105. if (this.state === "HAVE_NOTHING") {
  98106. throw new Error("Cannot switch media playlist from " + this.state);
  98107. }
  98108. var startingState = this.state;
  98109. if (typeof playlist === "string") {
  98110. if (!this.masterPlaylistLoader_.master.playlists[playlist]) {
  98111. throw new Error("Unknown playlist URI: " + playlist);
  98112. }
  98113. playlist = this.masterPlaylistLoader_.master.playlists[playlist];
  98114. }
  98115. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  98116. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  98117. this.state = "HAVE_METADATA";
  98118. this.media_ = playlist;
  98119. if (mediaChange) {
  98120. this.trigger("mediachanging");
  98121. this.trigger("mediachange");
  98122. }
  98123. return;
  98124. }
  98125. if (!mediaChange) {
  98126. return;
  98127. }
  98128. if (this.media_) {
  98129. this.trigger("mediachanging");
  98130. }
  98131. this.addSidxSegments_(playlist, startingState, function(sidxChanged) {
  98132. _this3.haveMetadata({
  98133. startingState,
  98134. playlist
  98135. });
  98136. });
  98137. };
  98138. _proto.haveMetadata = function haveMetadata(_ref2) {
  98139. var startingState = _ref2.startingState, playlist = _ref2.playlist;
  98140. this.state = "HAVE_METADATA";
  98141. this.loadedPlaylists_[playlist.id] = playlist;
  98142. this.mediaRequest_ = null;
  98143. this.refreshMedia_(playlist.id);
  98144. if (startingState === "HAVE_MASTER") {
  98145. this.trigger("loadedmetadata");
  98146. } else {
  98147. this.trigger("mediachange");
  98148. }
  98149. };
  98150. _proto.pause = function pause() {
  98151. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  98152. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  98153. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  98154. }
  98155. this.stopRequest();
  98156. window_1.clearTimeout(this.mediaUpdateTimeout);
  98157. this.mediaUpdateTimeout = null;
  98158. if (this.isMaster_) {
  98159. window_1.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_);
  98160. this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  98161. }
  98162. if (this.state === "HAVE_NOTHING") {
  98163. this.started = false;
  98164. }
  98165. };
  98166. _proto.load = function load(isFinalRendition) {
  98167. var _this4 = this;
  98168. window_1.clearTimeout(this.mediaUpdateTimeout);
  98169. this.mediaUpdateTimeout = null;
  98170. var media = this.media();
  98171. if (isFinalRendition) {
  98172. var delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  98173. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  98174. return _this4.load();
  98175. }, delay);
  98176. return;
  98177. }
  98178. if (!this.started) {
  98179. this.start();
  98180. return;
  98181. }
  98182. if (media && !media.endList) {
  98183. if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) {
  98184. this.trigger("minimumUpdatePeriod");
  98185. this.updateMinimumUpdatePeriodTimeout_();
  98186. }
  98187. this.trigger("mediaupdatetimeout");
  98188. } else {
  98189. this.trigger("loadedplaylist");
  98190. }
  98191. };
  98192. _proto.start = function start2() {
  98193. var _this5 = this;
  98194. this.started = true;
  98195. if (!this.isMaster_) {
  98196. this.mediaRequest_ = window_1.setTimeout(function() {
  98197. return _this5.haveMaster_();
  98198. }, 0);
  98199. return;
  98200. }
  98201. this.requestMaster_(function(req, masterChanged) {
  98202. _this5.haveMaster_();
  98203. if (!_this5.hasPendingRequest() && !_this5.media_) {
  98204. _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]);
  98205. }
  98206. });
  98207. };
  98208. _proto.requestMaster_ = function requestMaster_(cb) {
  98209. var _this6 = this;
  98210. this.request = this.vhs_.xhr({
  98211. uri: this.masterPlaylistLoader_.srcUrl,
  98212. withCredentials: this.withCredentials
  98213. }, function(error, req) {
  98214. if (_this6.requestErrored_(error, req)) {
  98215. if (_this6.state === "HAVE_NOTHING") {
  98216. _this6.started = false;
  98217. }
  98218. return;
  98219. }
  98220. var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_;
  98221. _this6.masterPlaylistLoader_.masterXml_ = req.responseText;
  98222. if (req.responseHeaders && req.responseHeaders.date) {
  98223. _this6.masterLoaded_ = Date.parse(req.responseHeaders.date);
  98224. } else {
  98225. _this6.masterLoaded_ = Date.now();
  98226. }
  98227. _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req);
  98228. if (masterChanged) {
  98229. _this6.handleMaster_();
  98230. _this6.syncClientServerClock_(function() {
  98231. return cb(req, masterChanged);
  98232. });
  98233. return;
  98234. }
  98235. return cb(req, masterChanged);
  98236. });
  98237. };
  98238. _proto.syncClientServerClock_ = function syncClientServerClock_(done) {
  98239. var _this7 = this;
  98240. var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_);
  98241. if (utcTiming === null) {
  98242. this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now();
  98243. return done();
  98244. }
  98245. if (utcTiming.method === "DIRECT") {
  98246. this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  98247. return done();
  98248. }
  98249. this.request = this.vhs_.xhr({
  98250. uri: resolveUrl4(this.masterPlaylistLoader_.srcUrl, utcTiming.value),
  98251. method: utcTiming.method,
  98252. withCredentials: this.withCredentials
  98253. }, function(error, req) {
  98254. if (!_this7.request) {
  98255. return;
  98256. }
  98257. if (error) {
  98258. _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now();
  98259. return done();
  98260. }
  98261. var serverTime;
  98262. if (utcTiming.method === "HEAD") {
  98263. if (!req.responseHeaders || !req.responseHeaders.date) {
  98264. serverTime = _this7.masterLoaded_;
  98265. } else {
  98266. serverTime = Date.parse(req.responseHeaders.date);
  98267. }
  98268. } else {
  98269. serverTime = Date.parse(req.responseText);
  98270. }
  98271. _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  98272. done();
  98273. });
  98274. };
  98275. _proto.haveMaster_ = function haveMaster_() {
  98276. this.state = "HAVE_MASTER";
  98277. if (this.isMaster_) {
  98278. this.trigger("loadedplaylist");
  98279. } else if (!this.media_) {
  98280. this.media(this.childPlaylist_);
  98281. }
  98282. };
  98283. _proto.handleMaster_ = function handleMaster_() {
  98284. this.mediaRequest_ = null;
  98285. var oldMaster = this.masterPlaylistLoader_.master;
  98286. var newMaster = parseMasterXml({
  98287. masterXml: this.masterPlaylistLoader_.masterXml_,
  98288. srcUrl: this.masterPlaylistLoader_.srcUrl,
  98289. clientOffset: this.masterPlaylistLoader_.clientOffset_,
  98290. sidxMapping: this.masterPlaylistLoader_.sidxMapping_,
  98291. previousManifest: oldMaster
  98292. });
  98293. if (oldMaster) {
  98294. newMaster = updateMaster2(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_);
  98295. }
  98296. this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster;
  98297. var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0];
  98298. if (location && location !== this.masterPlaylistLoader_.srcUrl) {
  98299. this.masterPlaylistLoader_.srcUrl = location;
  98300. }
  98301. if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  98302. this.updateMinimumUpdatePeriodTimeout_();
  98303. }
  98304. return Boolean(newMaster);
  98305. };
  98306. _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() {
  98307. var mpl = this.masterPlaylistLoader_;
  98308. if (mpl.createMupOnMedia_) {
  98309. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  98310. mpl.createMupOnMedia_ = null;
  98311. }
  98312. if (mpl.minimumUpdatePeriodTimeout_) {
  98313. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  98314. mpl.minimumUpdatePeriodTimeout_ = null;
  98315. }
  98316. var mup = mpl.master && mpl.master.minimumUpdatePeriod;
  98317. if (mup === 0) {
  98318. if (mpl.media()) {
  98319. mup = mpl.media().targetDuration * 1e3;
  98320. } else {
  98321. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  98322. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  98323. }
  98324. }
  98325. if (typeof mup !== "number" || mup <= 0) {
  98326. if (mup < 0) {
  98327. this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout");
  98328. }
  98329. return;
  98330. }
  98331. this.createMUPTimeout_(mup);
  98332. };
  98333. _proto.createMUPTimeout_ = function createMUPTimeout_(mup) {
  98334. var mpl = this.masterPlaylistLoader_;
  98335. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(function() {
  98336. mpl.minimumUpdatePeriodTimeout_ = null;
  98337. mpl.trigger("minimumUpdatePeriod");
  98338. mpl.createMUPTimeout_(mup);
  98339. }, mup);
  98340. };
  98341. _proto.refreshXml_ = function refreshXml_() {
  98342. var _this8 = this;
  98343. this.requestMaster_(function(req, masterChanged) {
  98344. if (!masterChanged) {
  98345. return;
  98346. }
  98347. if (_this8.media_) {
  98348. _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id];
  98349. }
  98350. _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_);
  98351. _this8.addSidxSegments_(_this8.media(), _this8.state, function(sidxChanged) {
  98352. _this8.refreshMedia_(_this8.media().id);
  98353. });
  98354. });
  98355. };
  98356. _proto.refreshMedia_ = function refreshMedia_(mediaID) {
  98357. var _this9 = this;
  98358. if (!mediaID) {
  98359. throw new Error("refreshMedia_ must take a media id");
  98360. }
  98361. if (this.media_ && this.isMaster_) {
  98362. this.handleMaster_();
  98363. }
  98364. var playlists = this.masterPlaylistLoader_.master.playlists;
  98365. var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  98366. if (mediaChanged) {
  98367. this.media_ = playlists[mediaID];
  98368. } else {
  98369. this.trigger("playlistunchanged");
  98370. }
  98371. if (!this.mediaUpdateTimeout) {
  98372. var createMediaUpdateTimeout = function createMediaUpdateTimeout2() {
  98373. if (_this9.media().endList) {
  98374. return;
  98375. }
  98376. _this9.mediaUpdateTimeout = window_1.setTimeout(function() {
  98377. _this9.trigger("mediaupdatetimeout");
  98378. createMediaUpdateTimeout2();
  98379. }, refreshDelay(_this9.media(), Boolean(mediaChanged)));
  98380. };
  98381. createMediaUpdateTimeout();
  98382. }
  98383. this.trigger("loadedplaylist");
  98384. };
  98385. return DashPlaylistLoader2;
  98386. }(EventTarget2);
  98387. var Config = {
  98388. GOAL_BUFFER_LENGTH: 30,
  98389. MAX_GOAL_BUFFER_LENGTH: 60,
  98390. BACK_BUFFER_LENGTH: 30,
  98391. GOAL_BUFFER_LENGTH_RATE: 1,
  98392. INITIAL_BANDWIDTH: 4194304,
  98393. BANDWIDTH_VARIANCE: 1.2,
  98394. BUFFER_LOW_WATER_LINE: 0,
  98395. MAX_BUFFER_LOW_WATER_LINE: 30,
  98396. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  98397. BUFFER_LOW_WATER_LINE_RATE: 1,
  98398. BUFFER_HIGH_WATER_LINE: 30
  98399. };
  98400. var stringToArrayBuffer = function stringToArrayBuffer2(string) {
  98401. var view = new Uint8Array(new ArrayBuffer(string.length));
  98402. for (var i2 = 0; i2 < string.length; i2++) {
  98403. view[i2] = string.charCodeAt(i2);
  98404. }
  98405. return view.buffer;
  98406. };
  98407. var browserWorkerPolyFill = function browserWorkerPolyFill2(workerObj) {
  98408. workerObj.on = workerObj.addEventListener;
  98409. workerObj.off = workerObj.removeEventListener;
  98410. return workerObj;
  98411. };
  98412. var createObjectURL = function createObjectURL2(str) {
  98413. try {
  98414. return URL.createObjectURL(new Blob([str], {
  98415. type: "application/javascript"
  98416. }));
  98417. } catch (e) {
  98418. var blob = new BlobBuilder();
  98419. blob.append(str);
  98420. return URL.createObjectURL(blob.getBlob());
  98421. }
  98422. };
  98423. var factory = function factory2(code) {
  98424. return function() {
  98425. var objectUrl = createObjectURL(code);
  98426. var worker = browserWorkerPolyFill(new Worker(objectUrl));
  98427. worker.objURL = objectUrl;
  98428. var terminate = worker.terminate;
  98429. worker.on = worker.addEventListener;
  98430. worker.off = worker.removeEventListener;
  98431. worker.terminate = function() {
  98432. URL.revokeObjectURL(objectUrl);
  98433. return terminate.call(this);
  98434. };
  98435. return worker;
  98436. };
  98437. };
  98438. var transform = function transform2(code) {
  98439. return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\nbrowserWorkerPolyFill(self);\n" + code;
  98440. };
  98441. var getWorkerString = function getWorkerString2(fn2) {
  98442. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  98443. };
  98444. var workerCode$1 = transform(getWorkerString(function() {
  98445. var Stream2 = function Stream3() {
  98446. this.init = function() {
  98447. var listeners = {};
  98448. this.on = function(type3, listener) {
  98449. if (!listeners[type3]) {
  98450. listeners[type3] = [];
  98451. }
  98452. listeners[type3] = listeners[type3].concat(listener);
  98453. };
  98454. this.off = function(type3, listener) {
  98455. var index2;
  98456. if (!listeners[type3]) {
  98457. return false;
  98458. }
  98459. index2 = listeners[type3].indexOf(listener);
  98460. listeners[type3] = listeners[type3].slice();
  98461. listeners[type3].splice(index2, 1);
  98462. return index2 > -1;
  98463. };
  98464. this.trigger = function(type3) {
  98465. var callbacks, i2, length, args;
  98466. callbacks = listeners[type3];
  98467. if (!callbacks) {
  98468. return;
  98469. }
  98470. if (arguments.length === 2) {
  98471. length = callbacks.length;
  98472. for (i2 = 0; i2 < length; ++i2) {
  98473. callbacks[i2].call(this, arguments[1]);
  98474. }
  98475. } else {
  98476. args = [];
  98477. i2 = arguments.length;
  98478. for (i2 = 1; i2 < arguments.length; ++i2) {
  98479. args.push(arguments[i2]);
  98480. }
  98481. length = callbacks.length;
  98482. for (i2 = 0; i2 < length; ++i2) {
  98483. callbacks[i2].apply(this, args);
  98484. }
  98485. }
  98486. };
  98487. this.dispose = function() {
  98488. listeners = {};
  98489. };
  98490. };
  98491. };
  98492. Stream2.prototype.pipe = function(destination2) {
  98493. this.on("data", function(data) {
  98494. destination2.push(data);
  98495. });
  98496. this.on("done", function(flushSource) {
  98497. destination2.flush(flushSource);
  98498. });
  98499. this.on("partialdone", function(flushSource) {
  98500. destination2.partialFlush(flushSource);
  98501. });
  98502. this.on("endedtimeline", function(flushSource) {
  98503. destination2.endTimeline(flushSource);
  98504. });
  98505. this.on("reset", function(flushSource) {
  98506. destination2.reset(flushSource);
  98507. });
  98508. return destination2;
  98509. };
  98510. Stream2.prototype.push = function(data) {
  98511. this.trigger("data", data);
  98512. };
  98513. Stream2.prototype.flush = function(flushSource) {
  98514. this.trigger("done", flushSource);
  98515. };
  98516. Stream2.prototype.partialFlush = function(flushSource) {
  98517. this.trigger("partialdone", flushSource);
  98518. };
  98519. Stream2.prototype.endTimeline = function(flushSource) {
  98520. this.trigger("endedtimeline", flushSource);
  98521. };
  98522. Stream2.prototype.reset = function(flushSource) {
  98523. this.trigger("reset", flushSource);
  98524. };
  98525. var stream = Stream2;
  98526. var MAX_UINT32$12 = Math.pow(2, 32);
  98527. var getUint64$22 = function getUint643(uint8) {
  98528. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  98529. var value;
  98530. if (dv.getBigUint64) {
  98531. value = dv.getBigUint64(0);
  98532. if (value < Number.MAX_SAFE_INTEGER) {
  98533. return Number(value);
  98534. }
  98535. return value;
  98536. }
  98537. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  98538. };
  98539. var numbers2 = {
  98540. getUint64: getUint64$22,
  98541. MAX_UINT32: MAX_UINT32$12
  98542. };
  98543. var MAX_UINT322 = numbers2.MAX_UINT32;
  98544. 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;
  98545. (function() {
  98546. var i2;
  98547. types = {
  98548. avc1: [],
  98549. avcC: [],
  98550. btrt: [],
  98551. dinf: [],
  98552. dref: [],
  98553. esds: [],
  98554. ftyp: [],
  98555. hdlr: [],
  98556. mdat: [],
  98557. mdhd: [],
  98558. mdia: [],
  98559. mfhd: [],
  98560. minf: [],
  98561. moof: [],
  98562. moov: [],
  98563. mp4a: [],
  98564. mvex: [],
  98565. mvhd: [],
  98566. pasp: [],
  98567. sdtp: [],
  98568. smhd: [],
  98569. stbl: [],
  98570. stco: [],
  98571. stsc: [],
  98572. stsd: [],
  98573. stsz: [],
  98574. stts: [],
  98575. styp: [],
  98576. tfdt: [],
  98577. tfhd: [],
  98578. traf: [],
  98579. trak: [],
  98580. trun: [],
  98581. trex: [],
  98582. tkhd: [],
  98583. vmhd: []
  98584. };
  98585. if (typeof Uint8Array === "undefined") {
  98586. return;
  98587. }
  98588. for (i2 in types) {
  98589. if (types.hasOwnProperty(i2)) {
  98590. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  98591. }
  98592. }
  98593. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  98594. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  98595. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  98596. VIDEO_HDLR = new Uint8Array([
  98597. 0,
  98598. 0,
  98599. 0,
  98600. 0,
  98601. 0,
  98602. 0,
  98603. 0,
  98604. 0,
  98605. 118,
  98606. 105,
  98607. 100,
  98608. 101,
  98609. 0,
  98610. 0,
  98611. 0,
  98612. 0,
  98613. 0,
  98614. 0,
  98615. 0,
  98616. 0,
  98617. 0,
  98618. 0,
  98619. 0,
  98620. 0,
  98621. 86,
  98622. 105,
  98623. 100,
  98624. 101,
  98625. 111,
  98626. 72,
  98627. 97,
  98628. 110,
  98629. 100,
  98630. 108,
  98631. 101,
  98632. 114,
  98633. 0
  98634. ]);
  98635. AUDIO_HDLR = new Uint8Array([
  98636. 0,
  98637. 0,
  98638. 0,
  98639. 0,
  98640. 0,
  98641. 0,
  98642. 0,
  98643. 0,
  98644. 115,
  98645. 111,
  98646. 117,
  98647. 110,
  98648. 0,
  98649. 0,
  98650. 0,
  98651. 0,
  98652. 0,
  98653. 0,
  98654. 0,
  98655. 0,
  98656. 0,
  98657. 0,
  98658. 0,
  98659. 0,
  98660. 83,
  98661. 111,
  98662. 117,
  98663. 110,
  98664. 100,
  98665. 72,
  98666. 97,
  98667. 110,
  98668. 100,
  98669. 108,
  98670. 101,
  98671. 114,
  98672. 0
  98673. ]);
  98674. HDLR_TYPES = {
  98675. video: VIDEO_HDLR,
  98676. audio: AUDIO_HDLR
  98677. };
  98678. DREF = new Uint8Array([
  98679. 0,
  98680. 0,
  98681. 0,
  98682. 0,
  98683. 0,
  98684. 0,
  98685. 0,
  98686. 1,
  98687. 0,
  98688. 0,
  98689. 0,
  98690. 12,
  98691. 117,
  98692. 114,
  98693. 108,
  98694. 32,
  98695. 0,
  98696. 0,
  98697. 0,
  98698. 1
  98699. ]);
  98700. SMHD = new Uint8Array([
  98701. 0,
  98702. 0,
  98703. 0,
  98704. 0,
  98705. 0,
  98706. 0,
  98707. 0,
  98708. 0
  98709. ]);
  98710. STCO = new Uint8Array([
  98711. 0,
  98712. 0,
  98713. 0,
  98714. 0,
  98715. 0,
  98716. 0,
  98717. 0,
  98718. 0
  98719. ]);
  98720. STSC = STCO;
  98721. STSZ = new Uint8Array([
  98722. 0,
  98723. 0,
  98724. 0,
  98725. 0,
  98726. 0,
  98727. 0,
  98728. 0,
  98729. 0,
  98730. 0,
  98731. 0,
  98732. 0,
  98733. 0
  98734. ]);
  98735. STTS = STCO;
  98736. VMHD = new Uint8Array([
  98737. 0,
  98738. 0,
  98739. 0,
  98740. 1,
  98741. 0,
  98742. 0,
  98743. 0,
  98744. 0,
  98745. 0,
  98746. 0,
  98747. 0,
  98748. 0
  98749. ]);
  98750. })();
  98751. box = function box2(type3) {
  98752. var payload = [], size = 0, i2, result, view;
  98753. for (i2 = 1; i2 < arguments.length; i2++) {
  98754. payload.push(arguments[i2]);
  98755. }
  98756. i2 = payload.length;
  98757. while (i2--) {
  98758. size += payload[i2].byteLength;
  98759. }
  98760. result = new Uint8Array(size + 8);
  98761. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  98762. view.setUint32(0, result.byteLength);
  98763. result.set(type3, 4);
  98764. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  98765. result.set(payload[i2], size);
  98766. size += payload[i2].byteLength;
  98767. }
  98768. return result;
  98769. };
  98770. dinf = function dinf2() {
  98771. return box(types.dinf, box(types.dref, DREF));
  98772. };
  98773. esds = function esds2(track) {
  98774. return box(types.esds, new Uint8Array([
  98775. 0,
  98776. 0,
  98777. 0,
  98778. 0,
  98779. 3,
  98780. 25,
  98781. 0,
  98782. 0,
  98783. 0,
  98784. 4,
  98785. 17,
  98786. 64,
  98787. 21,
  98788. 0,
  98789. 6,
  98790. 0,
  98791. 0,
  98792. 0,
  98793. 218,
  98794. 192,
  98795. 0,
  98796. 0,
  98797. 218,
  98798. 192,
  98799. 5,
  98800. 2,
  98801. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  98802. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  98803. 6,
  98804. 1,
  98805. 2
  98806. ]));
  98807. };
  98808. ftyp = function ftyp2() {
  98809. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  98810. };
  98811. hdlr = function hdlr2(type3) {
  98812. return box(types.hdlr, HDLR_TYPES[type3]);
  98813. };
  98814. mdat = function mdat2(data) {
  98815. return box(types.mdat, data);
  98816. };
  98817. mdhd = function mdhd2(track) {
  98818. var result = new Uint8Array([
  98819. 0,
  98820. 0,
  98821. 0,
  98822. 0,
  98823. 0,
  98824. 0,
  98825. 0,
  98826. 2,
  98827. 0,
  98828. 0,
  98829. 0,
  98830. 3,
  98831. 0,
  98832. 1,
  98833. 95,
  98834. 144,
  98835. track.duration >>> 24 & 255,
  98836. track.duration >>> 16 & 255,
  98837. track.duration >>> 8 & 255,
  98838. track.duration & 255,
  98839. 85,
  98840. 196,
  98841. 0,
  98842. 0
  98843. ]);
  98844. if (track.samplerate) {
  98845. result[12] = track.samplerate >>> 24 & 255;
  98846. result[13] = track.samplerate >>> 16 & 255;
  98847. result[14] = track.samplerate >>> 8 & 255;
  98848. result[15] = track.samplerate & 255;
  98849. }
  98850. return box(types.mdhd, result);
  98851. };
  98852. mdia = function mdia2(track) {
  98853. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  98854. };
  98855. mfhd = function mfhd2(sequenceNumber) {
  98856. return box(types.mfhd, new Uint8Array([
  98857. 0,
  98858. 0,
  98859. 0,
  98860. 0,
  98861. (sequenceNumber & 4278190080) >> 24,
  98862. (sequenceNumber & 16711680) >> 16,
  98863. (sequenceNumber & 65280) >> 8,
  98864. sequenceNumber & 255
  98865. ]));
  98866. };
  98867. minf = function minf2(track) {
  98868. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  98869. };
  98870. moof = function moof2(sequenceNumber, tracks) {
  98871. var trackFragments = [], i2 = tracks.length;
  98872. while (i2--) {
  98873. trackFragments[i2] = traf(tracks[i2]);
  98874. }
  98875. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  98876. };
  98877. moov = function moov2(tracks) {
  98878. var i2 = tracks.length, boxes = [];
  98879. while (i2--) {
  98880. boxes[i2] = trak(tracks[i2]);
  98881. }
  98882. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  98883. };
  98884. mvex = function mvex2(tracks) {
  98885. var i2 = tracks.length, boxes = [];
  98886. while (i2--) {
  98887. boxes[i2] = trex(tracks[i2]);
  98888. }
  98889. return box.apply(null, [types.mvex].concat(boxes));
  98890. };
  98891. mvhd = function mvhd2(duration5) {
  98892. var bytes = new Uint8Array([
  98893. 0,
  98894. 0,
  98895. 0,
  98896. 0,
  98897. 0,
  98898. 0,
  98899. 0,
  98900. 1,
  98901. 0,
  98902. 0,
  98903. 0,
  98904. 2,
  98905. 0,
  98906. 1,
  98907. 95,
  98908. 144,
  98909. (duration5 & 4278190080) >> 24,
  98910. (duration5 & 16711680) >> 16,
  98911. (duration5 & 65280) >> 8,
  98912. duration5 & 255,
  98913. 0,
  98914. 1,
  98915. 0,
  98916. 0,
  98917. 1,
  98918. 0,
  98919. 0,
  98920. 0,
  98921. 0,
  98922. 0,
  98923. 0,
  98924. 0,
  98925. 0,
  98926. 0,
  98927. 0,
  98928. 0,
  98929. 0,
  98930. 1,
  98931. 0,
  98932. 0,
  98933. 0,
  98934. 0,
  98935. 0,
  98936. 0,
  98937. 0,
  98938. 0,
  98939. 0,
  98940. 0,
  98941. 0,
  98942. 0,
  98943. 0,
  98944. 0,
  98945. 0,
  98946. 1,
  98947. 0,
  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. 64,
  98962. 0,
  98963. 0,
  98964. 0,
  98965. 0,
  98966. 0,
  98967. 0,
  98968. 0,
  98969. 0,
  98970. 0,
  98971. 0,
  98972. 0,
  98973. 0,
  98974. 0,
  98975. 0,
  98976. 0,
  98977. 0,
  98978. 0,
  98979. 0,
  98980. 0,
  98981. 0,
  98982. 0,
  98983. 0,
  98984. 0,
  98985. 0,
  98986. 0,
  98987. 0,
  98988. 0,
  98989. 255,
  98990. 255,
  98991. 255,
  98992. 255
  98993. ]);
  98994. return box(types.mvhd, bytes);
  98995. };
  98996. sdtp = function sdtp2(track) {
  98997. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  98998. for (i2 = 0; i2 < samples.length; i2++) {
  98999. flags = samples[i2].flags;
  99000. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  99001. }
  99002. return box(types.sdtp, bytes);
  99003. };
  99004. stbl = function stbl2(track) {
  99005. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  99006. };
  99007. (function() {
  99008. var videoSample, audioSample;
  99009. stsd = function stsd2(track) {
  99010. return box(types.stsd, new Uint8Array([
  99011. 0,
  99012. 0,
  99013. 0,
  99014. 0,
  99015. 0,
  99016. 0,
  99017. 0,
  99018. 1
  99019. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  99020. };
  99021. videoSample = function videoSample2(track) {
  99022. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  99023. for (i2 = 0; i2 < sps.length; i2++) {
  99024. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  99025. sequenceParameterSets.push(sps[i2].byteLength & 255);
  99026. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  99027. }
  99028. for (i2 = 0; i2 < pps.length; i2++) {
  99029. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  99030. pictureParameterSets.push(pps[i2].byteLength & 255);
  99031. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  99032. }
  99033. avc1Box = [types.avc1, new Uint8Array([
  99034. 0,
  99035. 0,
  99036. 0,
  99037. 0,
  99038. 0,
  99039. 0,
  99040. 0,
  99041. 1,
  99042. 0,
  99043. 0,
  99044. 0,
  99045. 0,
  99046. 0,
  99047. 0,
  99048. 0,
  99049. 0,
  99050. 0,
  99051. 0,
  99052. 0,
  99053. 0,
  99054. 0,
  99055. 0,
  99056. 0,
  99057. 0,
  99058. (track.width & 65280) >> 8,
  99059. track.width & 255,
  99060. (track.height & 65280) >> 8,
  99061. track.height & 255,
  99062. 0,
  99063. 72,
  99064. 0,
  99065. 0,
  99066. 0,
  99067. 72,
  99068. 0,
  99069. 0,
  99070. 0,
  99071. 0,
  99072. 0,
  99073. 0,
  99074. 0,
  99075. 1,
  99076. 19,
  99077. 118,
  99078. 105,
  99079. 100,
  99080. 101,
  99081. 111,
  99082. 106,
  99083. 115,
  99084. 45,
  99085. 99,
  99086. 111,
  99087. 110,
  99088. 116,
  99089. 114,
  99090. 105,
  99091. 98,
  99092. 45,
  99093. 104,
  99094. 108,
  99095. 115,
  99096. 0,
  99097. 0,
  99098. 0,
  99099. 0,
  99100. 0,
  99101. 0,
  99102. 0,
  99103. 0,
  99104. 0,
  99105. 0,
  99106. 0,
  99107. 0,
  99108. 0,
  99109. 24,
  99110. 17,
  99111. 17
  99112. ]), box(types.avcC, new Uint8Array([
  99113. 1,
  99114. track.profileIdc,
  99115. track.profileCompatibility,
  99116. track.levelIdc,
  99117. 255
  99118. ].concat(
  99119. [sps.length],
  99120. sequenceParameterSets,
  99121. [pps.length],
  99122. pictureParameterSets
  99123. ))), box(types.btrt, new Uint8Array([
  99124. 0,
  99125. 28,
  99126. 156,
  99127. 128,
  99128. 0,
  99129. 45,
  99130. 198,
  99131. 192,
  99132. 0,
  99133. 45,
  99134. 198,
  99135. 192
  99136. ]))];
  99137. if (track.sarRatio) {
  99138. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  99139. 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])));
  99140. }
  99141. return box.apply(null, avc1Box);
  99142. };
  99143. audioSample = function audioSample2(track) {
  99144. return box(types.mp4a, new Uint8Array([
  99145. 0,
  99146. 0,
  99147. 0,
  99148. 0,
  99149. 0,
  99150. 0,
  99151. 0,
  99152. 1,
  99153. 0,
  99154. 0,
  99155. 0,
  99156. 0,
  99157. 0,
  99158. 0,
  99159. 0,
  99160. 0,
  99161. (track.channelcount & 65280) >> 8,
  99162. track.channelcount & 255,
  99163. (track.samplesize & 65280) >> 8,
  99164. track.samplesize & 255,
  99165. 0,
  99166. 0,
  99167. 0,
  99168. 0,
  99169. (track.samplerate & 65280) >> 8,
  99170. track.samplerate & 255,
  99171. 0,
  99172. 0
  99173. ]), esds(track));
  99174. };
  99175. })();
  99176. tkhd = function tkhd2(track) {
  99177. var result = new Uint8Array([
  99178. 0,
  99179. 0,
  99180. 0,
  99181. 7,
  99182. 0,
  99183. 0,
  99184. 0,
  99185. 0,
  99186. 0,
  99187. 0,
  99188. 0,
  99189. 0,
  99190. (track.id & 4278190080) >> 24,
  99191. (track.id & 16711680) >> 16,
  99192. (track.id & 65280) >> 8,
  99193. track.id & 255,
  99194. 0,
  99195. 0,
  99196. 0,
  99197. 0,
  99198. (track.duration & 4278190080) >> 24,
  99199. (track.duration & 16711680) >> 16,
  99200. (track.duration & 65280) >> 8,
  99201. track.duration & 255,
  99202. 0,
  99203. 0,
  99204. 0,
  99205. 0,
  99206. 0,
  99207. 0,
  99208. 0,
  99209. 0,
  99210. 0,
  99211. 0,
  99212. 0,
  99213. 0,
  99214. 1,
  99215. 0,
  99216. 0,
  99217. 0,
  99218. 0,
  99219. 1,
  99220. 0,
  99221. 0,
  99222. 0,
  99223. 0,
  99224. 0,
  99225. 0,
  99226. 0,
  99227. 0,
  99228. 0,
  99229. 0,
  99230. 0,
  99231. 0,
  99232. 0,
  99233. 0,
  99234. 0,
  99235. 1,
  99236. 0,
  99237. 0,
  99238. 0,
  99239. 0,
  99240. 0,
  99241. 0,
  99242. 0,
  99243. 0,
  99244. 0,
  99245. 0,
  99246. 0,
  99247. 0,
  99248. 0,
  99249. 0,
  99250. 64,
  99251. 0,
  99252. 0,
  99253. 0,
  99254. (track.width & 65280) >> 8,
  99255. track.width & 255,
  99256. 0,
  99257. 0,
  99258. (track.height & 65280) >> 8,
  99259. track.height & 255,
  99260. 0,
  99261. 0
  99262. ]);
  99263. return box(types.tkhd, result);
  99264. };
  99265. traf = function traf2(track) {
  99266. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  99267. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  99268. 0,
  99269. 0,
  99270. 0,
  99271. 58,
  99272. (track.id & 4278190080) >> 24,
  99273. (track.id & 16711680) >> 16,
  99274. (track.id & 65280) >> 8,
  99275. track.id & 255,
  99276. 0,
  99277. 0,
  99278. 0,
  99279. 1,
  99280. 0,
  99281. 0,
  99282. 0,
  99283. 0,
  99284. 0,
  99285. 0,
  99286. 0,
  99287. 0,
  99288. 0,
  99289. 0,
  99290. 0,
  99291. 0
  99292. ]));
  99293. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  99294. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  99295. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  99296. 1,
  99297. 0,
  99298. 0,
  99299. 0,
  99300. upperWordBaseMediaDecodeTime >>> 24 & 255,
  99301. upperWordBaseMediaDecodeTime >>> 16 & 255,
  99302. upperWordBaseMediaDecodeTime >>> 8 & 255,
  99303. upperWordBaseMediaDecodeTime & 255,
  99304. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  99305. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  99306. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  99307. lowerWordBaseMediaDecodeTime & 255
  99308. ]));
  99309. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  99310. if (track.type === "audio") {
  99311. trackFragmentRun = trun$1(track, dataOffset);
  99312. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  99313. }
  99314. sampleDependencyTable = sdtp(track);
  99315. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  99316. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  99317. };
  99318. trak = function trak2(track) {
  99319. track.duration = track.duration || 4294967295;
  99320. return box(types.trak, tkhd(track), mdia(track));
  99321. };
  99322. trex = function trex2(track) {
  99323. var result = new Uint8Array([
  99324. 0,
  99325. 0,
  99326. 0,
  99327. 0,
  99328. (track.id & 4278190080) >> 24,
  99329. (track.id & 16711680) >> 16,
  99330. (track.id & 65280) >> 8,
  99331. track.id & 255,
  99332. 0,
  99333. 0,
  99334. 0,
  99335. 1,
  99336. 0,
  99337. 0,
  99338. 0,
  99339. 0,
  99340. 0,
  99341. 0,
  99342. 0,
  99343. 0,
  99344. 0,
  99345. 1,
  99346. 0,
  99347. 1
  99348. ]);
  99349. if (track.type !== "video") {
  99350. result[result.length - 1] = 0;
  99351. }
  99352. return box(types.trex, result);
  99353. };
  99354. (function() {
  99355. var audioTrun, videoTrun, trunHeader;
  99356. trunHeader = function trunHeader2(samples, offset) {
  99357. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  99358. if (samples.length) {
  99359. if (samples[0].duration !== void 0) {
  99360. durationPresent = 1;
  99361. }
  99362. if (samples[0].size !== void 0) {
  99363. sizePresent = 2;
  99364. }
  99365. if (samples[0].flags !== void 0) {
  99366. flagsPresent = 4;
  99367. }
  99368. if (samples[0].compositionTimeOffset !== void 0) {
  99369. compositionTimeOffset = 8;
  99370. }
  99371. }
  99372. return [
  99373. 0,
  99374. 0,
  99375. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  99376. 1,
  99377. (samples.length & 4278190080) >>> 24,
  99378. (samples.length & 16711680) >>> 16,
  99379. (samples.length & 65280) >>> 8,
  99380. samples.length & 255,
  99381. (offset & 4278190080) >>> 24,
  99382. (offset & 16711680) >>> 16,
  99383. (offset & 65280) >>> 8,
  99384. offset & 255
  99385. ];
  99386. };
  99387. videoTrun = function videoTrun2(track, offset) {
  99388. var bytesOffest, bytes, header, samples, sample, i2;
  99389. samples = track.samples || [];
  99390. offset += 8 + 12 + 16 * samples.length;
  99391. header = trunHeader(samples, offset);
  99392. bytes = new Uint8Array(header.length + samples.length * 16);
  99393. bytes.set(header);
  99394. bytesOffest = header.length;
  99395. for (i2 = 0; i2 < samples.length; i2++) {
  99396. sample = samples[i2];
  99397. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99398. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99399. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99400. bytes[bytesOffest++] = sample.duration & 255;
  99401. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99402. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99403. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99404. bytes[bytesOffest++] = sample.size & 255;
  99405. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  99406. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  99407. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  99408. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  99409. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  99410. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  99411. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  99412. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  99413. }
  99414. return box(types.trun, bytes);
  99415. };
  99416. audioTrun = function audioTrun2(track, offset) {
  99417. var bytes, bytesOffest, header, samples, sample, i2;
  99418. samples = track.samples || [];
  99419. offset += 8 + 12 + 8 * samples.length;
  99420. header = trunHeader(samples, offset);
  99421. bytes = new Uint8Array(header.length + samples.length * 8);
  99422. bytes.set(header);
  99423. bytesOffest = header.length;
  99424. for (i2 = 0; i2 < samples.length; i2++) {
  99425. sample = samples[i2];
  99426. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99427. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99428. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99429. bytes[bytesOffest++] = sample.duration & 255;
  99430. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99431. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99432. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99433. bytes[bytesOffest++] = sample.size & 255;
  99434. }
  99435. return box(types.trun, bytes);
  99436. };
  99437. trun$1 = function trun2(track, offset) {
  99438. if (track.type === "audio") {
  99439. return audioTrun(track, offset);
  99440. }
  99441. return videoTrun(track, offset);
  99442. };
  99443. })();
  99444. var mp4Generator = {
  99445. ftyp,
  99446. mdat,
  99447. moof,
  99448. moov,
  99449. initSegment: function initSegment(tracks) {
  99450. var fileType = ftyp(), movie = moov(tracks), result;
  99451. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  99452. result.set(fileType);
  99453. result.set(movie, fileType.byteLength);
  99454. return result;
  99455. }
  99456. };
  99457. var groupNalsIntoFrames = function groupNalsIntoFrames2(nalUnits) {
  99458. var i2, currentNal, currentFrame = [], frames = [];
  99459. frames.byteLength = 0;
  99460. frames.nalCount = 0;
  99461. frames.duration = 0;
  99462. currentFrame.byteLength = 0;
  99463. for (i2 = 0; i2 < nalUnits.length; i2++) {
  99464. currentNal = nalUnits[i2];
  99465. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  99466. if (currentFrame.length) {
  99467. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99468. frames.byteLength += currentFrame.byteLength;
  99469. frames.nalCount += currentFrame.length;
  99470. frames.duration += currentFrame.duration;
  99471. frames.push(currentFrame);
  99472. }
  99473. currentFrame = [currentNal];
  99474. currentFrame.byteLength = currentNal.data.byteLength;
  99475. currentFrame.pts = currentNal.pts;
  99476. currentFrame.dts = currentNal.dts;
  99477. } else {
  99478. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  99479. currentFrame.keyFrame = true;
  99480. }
  99481. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99482. currentFrame.byteLength += currentNal.data.byteLength;
  99483. currentFrame.push(currentNal);
  99484. }
  99485. }
  99486. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  99487. currentFrame.duration = frames[frames.length - 1].duration;
  99488. }
  99489. frames.byteLength += currentFrame.byteLength;
  99490. frames.nalCount += currentFrame.length;
  99491. frames.duration += currentFrame.duration;
  99492. frames.push(currentFrame);
  99493. return frames;
  99494. };
  99495. var groupFramesIntoGops = function groupFramesIntoGops2(frames) {
  99496. var i2, currentFrame, currentGop = [], gops = [];
  99497. currentGop.byteLength = 0;
  99498. currentGop.nalCount = 0;
  99499. currentGop.duration = 0;
  99500. currentGop.pts = frames[0].pts;
  99501. currentGop.dts = frames[0].dts;
  99502. gops.byteLength = 0;
  99503. gops.nalCount = 0;
  99504. gops.duration = 0;
  99505. gops.pts = frames[0].pts;
  99506. gops.dts = frames[0].dts;
  99507. for (i2 = 0; i2 < frames.length; i2++) {
  99508. currentFrame = frames[i2];
  99509. if (currentFrame.keyFrame) {
  99510. if (currentGop.length) {
  99511. gops.push(currentGop);
  99512. gops.byteLength += currentGop.byteLength;
  99513. gops.nalCount += currentGop.nalCount;
  99514. gops.duration += currentGop.duration;
  99515. }
  99516. currentGop = [currentFrame];
  99517. currentGop.nalCount = currentFrame.length;
  99518. currentGop.byteLength = currentFrame.byteLength;
  99519. currentGop.pts = currentFrame.pts;
  99520. currentGop.dts = currentFrame.dts;
  99521. currentGop.duration = currentFrame.duration;
  99522. } else {
  99523. currentGop.duration += currentFrame.duration;
  99524. currentGop.nalCount += currentFrame.length;
  99525. currentGop.byteLength += currentFrame.byteLength;
  99526. currentGop.push(currentFrame);
  99527. }
  99528. }
  99529. if (gops.length && currentGop.duration <= 0) {
  99530. currentGop.duration = gops[gops.length - 1].duration;
  99531. }
  99532. gops.byteLength += currentGop.byteLength;
  99533. gops.nalCount += currentGop.nalCount;
  99534. gops.duration += currentGop.duration;
  99535. gops.push(currentGop);
  99536. return gops;
  99537. };
  99538. var extendFirstKeyFrame = function extendFirstKeyFrame2(gops) {
  99539. var currentGop;
  99540. if (!gops[0][0].keyFrame && gops.length > 1) {
  99541. currentGop = gops.shift();
  99542. gops.byteLength -= currentGop.byteLength;
  99543. gops.nalCount -= currentGop.nalCount;
  99544. gops[0][0].dts = currentGop.dts;
  99545. gops[0][0].pts = currentGop.pts;
  99546. gops[0][0].duration += currentGop.duration;
  99547. }
  99548. return gops;
  99549. };
  99550. var createDefaultSample = function createDefaultSample2() {
  99551. return {
  99552. size: 0,
  99553. flags: {
  99554. isLeading: 0,
  99555. dependsOn: 1,
  99556. isDependedOn: 0,
  99557. hasRedundancy: 0,
  99558. degradationPriority: 0,
  99559. isNonSyncSample: 1
  99560. }
  99561. };
  99562. };
  99563. var sampleForFrame = function sampleForFrame2(frame, dataOffset) {
  99564. var sample = createDefaultSample();
  99565. sample.dataOffset = dataOffset;
  99566. sample.compositionTimeOffset = frame.pts - frame.dts;
  99567. sample.duration = frame.duration;
  99568. sample.size = 4 * frame.length;
  99569. sample.size += frame.byteLength;
  99570. if (frame.keyFrame) {
  99571. sample.flags.dependsOn = 2;
  99572. sample.flags.isNonSyncSample = 0;
  99573. }
  99574. return sample;
  99575. };
  99576. var generateSampleTable$1 = function generateSampleTable2(gops, baseDataOffset) {
  99577. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  99578. for (h2 = 0; h2 < gops.length; h2++) {
  99579. currentGop = gops[h2];
  99580. for (i2 = 0; i2 < currentGop.length; i2++) {
  99581. currentFrame = currentGop[i2];
  99582. sample = sampleForFrame(currentFrame, dataOffset);
  99583. dataOffset += sample.size;
  99584. samples.push(sample);
  99585. }
  99586. }
  99587. return samples;
  99588. };
  99589. var concatenateNalData = function concatenateNalData2(gops) {
  99590. 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);
  99591. for (h2 = 0; h2 < gops.length; h2++) {
  99592. currentGop = gops[h2];
  99593. for (i2 = 0; i2 < currentGop.length; i2++) {
  99594. currentFrame = currentGop[i2];
  99595. for (j = 0; j < currentFrame.length; j++) {
  99596. currentNal = currentFrame[j];
  99597. view.setUint32(dataOffset, currentNal.data.byteLength);
  99598. dataOffset += 4;
  99599. data.set(currentNal.data, dataOffset);
  99600. dataOffset += currentNal.data.byteLength;
  99601. }
  99602. }
  99603. }
  99604. return data;
  99605. };
  99606. var generateSampleTableForFrame = function generateSampleTableForFrame2(frame, baseDataOffset) {
  99607. var sample, dataOffset = baseDataOffset || 0, samples = [];
  99608. sample = sampleForFrame(frame, dataOffset);
  99609. samples.push(sample);
  99610. return samples;
  99611. };
  99612. var concatenateNalDataForFrame = function concatenateNalDataForFrame2(frame) {
  99613. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  99614. for (i2 = 0; i2 < frame.length; i2++) {
  99615. currentNal = frame[i2];
  99616. view.setUint32(dataOffset, currentNal.data.byteLength);
  99617. dataOffset += 4;
  99618. data.set(currentNal.data, dataOffset);
  99619. dataOffset += currentNal.data.byteLength;
  99620. }
  99621. return data;
  99622. };
  99623. var frameUtils = {
  99624. groupNalsIntoFrames,
  99625. groupFramesIntoGops,
  99626. extendFirstKeyFrame,
  99627. generateSampleTable: generateSampleTable$1,
  99628. concatenateNalData,
  99629. generateSampleTableForFrame,
  99630. concatenateNalDataForFrame
  99631. };
  99632. var highPrefix = [33, 16, 5, 32, 164, 27];
  99633. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  99634. var zeroFill = function zeroFill2(count) {
  99635. var a = [];
  99636. while (count--) {
  99637. a.push(0);
  99638. }
  99639. return a;
  99640. };
  99641. var makeTable = function makeTable2(metaTable) {
  99642. return Object.keys(metaTable).reduce(function(obj, key) {
  99643. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  99644. return arr.concat(part);
  99645. }, []));
  99646. return obj;
  99647. }, {});
  99648. };
  99649. var silence;
  99650. var silence_1 = function silence_12() {
  99651. if (!silence) {
  99652. var coneOfSilence = {
  99653. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  99654. 88200: [highPrefix, [231], zeroFill(170), [56]],
  99655. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  99656. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  99657. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  99658. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  99659. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  99660. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  99661. 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]],
  99662. 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]],
  99663. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  99664. };
  99665. silence = makeTable(coneOfSilence);
  99666. }
  99667. return silence;
  99668. };
  99669. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  99670. secondsToVideoTs2 = function secondsToVideoTs3(seconds) {
  99671. return seconds * ONE_SECOND_IN_TS$4;
  99672. };
  99673. secondsToAudioTs2 = function secondsToAudioTs3(seconds, sampleRate) {
  99674. return seconds * sampleRate;
  99675. };
  99676. videoTsToSeconds2 = function videoTsToSeconds3(timestamp) {
  99677. return timestamp / ONE_SECOND_IN_TS$4;
  99678. };
  99679. audioTsToSeconds2 = function audioTsToSeconds3(timestamp, sampleRate) {
  99680. return timestamp / sampleRate;
  99681. };
  99682. audioTsToVideoTs2 = function audioTsToVideoTs3(timestamp, sampleRate) {
  99683. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  99684. };
  99685. videoTsToAudioTs2 = function videoTsToAudioTs3(timestamp, sampleRate) {
  99686. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  99687. };
  99688. metadataTsToSeconds2 = function metadataTsToSeconds3(timestamp, timelineStartPts, keepOriginalTimestamps) {
  99689. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  99690. };
  99691. var clock2 = {
  99692. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  99693. secondsToVideoTs: secondsToVideoTs2,
  99694. secondsToAudioTs: secondsToAudioTs2,
  99695. videoTsToSeconds: videoTsToSeconds2,
  99696. audioTsToSeconds: audioTsToSeconds2,
  99697. audioTsToVideoTs: audioTsToVideoTs2,
  99698. videoTsToAudioTs: videoTsToAudioTs2,
  99699. metadataTsToSeconds: metadataTsToSeconds2
  99700. };
  99701. var sumFrameByteLengths = function sumFrameByteLengths2(array) {
  99702. var i2, currentObj, sum = 0;
  99703. for (i2 = 0; i2 < array.length; i2++) {
  99704. currentObj = array[i2];
  99705. sum += currentObj.data.byteLength;
  99706. }
  99707. return sum;
  99708. };
  99709. var prefixWithSilence = function prefixWithSilence2(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  99710. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  99711. if (!frames.length) {
  99712. return;
  99713. }
  99714. baseMediaDecodeTimeTs = clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  99715. frameDuration = Math.ceil(clock2.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  99716. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  99717. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  99718. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  99719. audioFillDuration = audioFillFrameCount * frameDuration;
  99720. }
  99721. if (audioFillFrameCount < 1 || audioFillDuration > clock2.ONE_SECOND_IN_TS / 2) {
  99722. return;
  99723. }
  99724. silentFrame = silence_1()[track.samplerate];
  99725. if (!silentFrame) {
  99726. silentFrame = frames[0].data;
  99727. }
  99728. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  99729. firstFrame = frames[0];
  99730. frames.splice(0, 0, {
  99731. data: silentFrame,
  99732. dts: firstFrame.dts - frameDuration,
  99733. pts: firstFrame.pts - frameDuration
  99734. });
  99735. }
  99736. track.baseMediaDecodeTime -= Math.floor(clock2.videoTsToAudioTs(audioFillDuration, track.samplerate));
  99737. return audioFillDuration;
  99738. };
  99739. var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts2(adtsFrames, track, earliestAllowedDts) {
  99740. if (track.minSegmentDts >= earliestAllowedDts) {
  99741. return adtsFrames;
  99742. }
  99743. track.minSegmentDts = Infinity;
  99744. return adtsFrames.filter(function(currentFrame) {
  99745. if (currentFrame.dts >= earliestAllowedDts) {
  99746. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  99747. track.minSegmentPts = track.minSegmentDts;
  99748. return true;
  99749. }
  99750. return false;
  99751. });
  99752. };
  99753. var generateSampleTable = function generateSampleTable2(frames) {
  99754. var i2, currentFrame, samples = [];
  99755. for (i2 = 0; i2 < frames.length; i2++) {
  99756. currentFrame = frames[i2];
  99757. samples.push({
  99758. size: currentFrame.data.byteLength,
  99759. duration: 1024
  99760. });
  99761. }
  99762. return samples;
  99763. };
  99764. var concatenateFrameData = function concatenateFrameData2(frames) {
  99765. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  99766. for (i2 = 0; i2 < frames.length; i2++) {
  99767. currentFrame = frames[i2];
  99768. data.set(currentFrame.data, dataOffset);
  99769. dataOffset += currentFrame.data.byteLength;
  99770. }
  99771. return data;
  99772. };
  99773. var audioFrameUtils = {
  99774. prefixWithSilence,
  99775. trimAdtsFramesByEarliestDts,
  99776. generateSampleTable,
  99777. concatenateFrameData
  99778. };
  99779. var ONE_SECOND_IN_TS$3 = clock2.ONE_SECOND_IN_TS;
  99780. var collectDtsInfo = function collectDtsInfo2(track, data) {
  99781. if (typeof data.pts === "number") {
  99782. if (track.timelineStartInfo.pts === void 0) {
  99783. track.timelineStartInfo.pts = data.pts;
  99784. }
  99785. if (track.minSegmentPts === void 0) {
  99786. track.minSegmentPts = data.pts;
  99787. } else {
  99788. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  99789. }
  99790. if (track.maxSegmentPts === void 0) {
  99791. track.maxSegmentPts = data.pts;
  99792. } else {
  99793. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  99794. }
  99795. }
  99796. if (typeof data.dts === "number") {
  99797. if (track.timelineStartInfo.dts === void 0) {
  99798. track.timelineStartInfo.dts = data.dts;
  99799. }
  99800. if (track.minSegmentDts === void 0) {
  99801. track.minSegmentDts = data.dts;
  99802. } else {
  99803. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  99804. }
  99805. if (track.maxSegmentDts === void 0) {
  99806. track.maxSegmentDts = data.dts;
  99807. } else {
  99808. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  99809. }
  99810. }
  99811. };
  99812. var clearDtsInfo = function clearDtsInfo2(track) {
  99813. delete track.minSegmentDts;
  99814. delete track.maxSegmentDts;
  99815. delete track.minSegmentPts;
  99816. delete track.maxSegmentPts;
  99817. };
  99818. var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime2(track, keepOriginalTimestamps) {
  99819. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  99820. if (!keepOriginalTimestamps) {
  99821. minSegmentDts -= track.timelineStartInfo.dts;
  99822. }
  99823. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  99824. baseMediaDecodeTime += minSegmentDts;
  99825. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  99826. if (track.type === "audio") {
  99827. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  99828. baseMediaDecodeTime *= scale;
  99829. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  99830. }
  99831. return baseMediaDecodeTime;
  99832. };
  99833. var trackDecodeInfo = {
  99834. clearDtsInfo,
  99835. calculateTrackBaseMediaDecodeTime,
  99836. collectDtsInfo
  99837. };
  99838. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  99839. var parseSei = function parseSei2(bytes) {
  99840. var i2 = 0, result = {
  99841. payloadType: -1,
  99842. payloadSize: 0
  99843. }, payloadType = 0, payloadSize = 0;
  99844. while (i2 < bytes.byteLength) {
  99845. if (bytes[i2] === RBSP_TRAILING_BITS) {
  99846. break;
  99847. }
  99848. while (bytes[i2] === 255) {
  99849. payloadType += 255;
  99850. i2++;
  99851. }
  99852. payloadType += bytes[i2++];
  99853. while (bytes[i2] === 255) {
  99854. payloadSize += 255;
  99855. i2++;
  99856. }
  99857. payloadSize += bytes[i2++];
  99858. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  99859. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  99860. if (userIdentifier === "GA94") {
  99861. result.payloadType = payloadType;
  99862. result.payloadSize = payloadSize;
  99863. result.payload = bytes.subarray(i2, i2 + payloadSize);
  99864. break;
  99865. } else {
  99866. result.payload = void 0;
  99867. }
  99868. }
  99869. i2 += payloadSize;
  99870. payloadType = 0;
  99871. payloadSize = 0;
  99872. }
  99873. return result;
  99874. };
  99875. var parseUserData = function parseUserData2(sei) {
  99876. if (sei.payload[0] !== 181) {
  99877. return null;
  99878. }
  99879. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  99880. return null;
  99881. }
  99882. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  99883. return null;
  99884. }
  99885. if (sei.payload[7] !== 3) {
  99886. return null;
  99887. }
  99888. return sei.payload.subarray(8, sei.payload.length - 1);
  99889. };
  99890. var parseCaptionPackets = function parseCaptionPackets2(pts, userData) {
  99891. var results = [], i2, count, offset, data;
  99892. if (!(userData[0] & 64)) {
  99893. return results;
  99894. }
  99895. count = userData[0] & 31;
  99896. for (i2 = 0; i2 < count; i2++) {
  99897. offset = i2 * 3;
  99898. data = {
  99899. type: userData[offset + 2] & 3,
  99900. pts
  99901. };
  99902. if (userData[offset + 2] & 4) {
  99903. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  99904. results.push(data);
  99905. }
  99906. }
  99907. return results;
  99908. };
  99909. var discardEmulationPreventionBytes$12 = function discardEmulationPreventionBytes5(data) {
  99910. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  99911. while (i2 < length - 2) {
  99912. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  99913. emulationPreventionBytesPositions.push(i2 + 2);
  99914. i2 += 2;
  99915. } else {
  99916. i2++;
  99917. }
  99918. }
  99919. if (emulationPreventionBytesPositions.length === 0) {
  99920. return data;
  99921. }
  99922. newLength = length - emulationPreventionBytesPositions.length;
  99923. newData = new Uint8Array(newLength);
  99924. var sourceIndex = 0;
  99925. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  99926. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  99927. sourceIndex++;
  99928. emulationPreventionBytesPositions.shift();
  99929. }
  99930. newData[i2] = data[sourceIndex];
  99931. }
  99932. return newData;
  99933. };
  99934. var captionPacketParser = {
  99935. parseSei,
  99936. parseUserData,
  99937. parseCaptionPackets,
  99938. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  99939. USER_DATA_REGISTERED_ITU_T_T35
  99940. };
  99941. var CaptionStream$1 = function CaptionStream2(options2) {
  99942. options2 = options2 || {};
  99943. CaptionStream2.prototype.init.call(this);
  99944. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  99945. this.captionPackets_ = [];
  99946. this.ccStreams_ = [
  99947. new Cea608Stream(0, 0),
  99948. new Cea608Stream(0, 1),
  99949. new Cea608Stream(1, 0),
  99950. new Cea608Stream(1, 1)
  99951. ];
  99952. if (this.parse708captions_) {
  99953. this.cc708Stream_ = new Cea708Stream({
  99954. captionServices: options2.captionServices
  99955. });
  99956. }
  99957. this.reset();
  99958. this.ccStreams_.forEach(function(cc) {
  99959. cc.on("data", this.trigger.bind(this, "data"));
  99960. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  99961. cc.on("done", this.trigger.bind(this, "done"));
  99962. }, this);
  99963. if (this.parse708captions_) {
  99964. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  99965. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  99966. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  99967. }
  99968. };
  99969. CaptionStream$1.prototype = new stream();
  99970. CaptionStream$1.prototype.push = function(event2) {
  99971. var sei, userData, newCaptionPackets;
  99972. if (event2.nalUnitType !== "sei_rbsp") {
  99973. return;
  99974. }
  99975. sei = captionPacketParser.parseSei(event2.escapedRBSP);
  99976. if (!sei.payload) {
  99977. return;
  99978. }
  99979. if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) {
  99980. return;
  99981. }
  99982. userData = captionPacketParser.parseUserData(sei);
  99983. if (!userData) {
  99984. return;
  99985. }
  99986. if (event2.dts < this.latestDts_) {
  99987. this.ignoreNextEqualDts_ = true;
  99988. return;
  99989. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  99990. this.numSameDts_--;
  99991. if (!this.numSameDts_) {
  99992. this.ignoreNextEqualDts_ = false;
  99993. }
  99994. return;
  99995. }
  99996. newCaptionPackets = captionPacketParser.parseCaptionPackets(event2.pts, userData);
  99997. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  99998. if (this.latestDts_ !== event2.dts) {
  99999. this.numSameDts_ = 0;
  100000. }
  100001. this.numSameDts_++;
  100002. this.latestDts_ = event2.dts;
  100003. };
  100004. CaptionStream$1.prototype.flushCCStreams = function(flushType) {
  100005. this.ccStreams_.forEach(function(cc) {
  100006. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  100007. }, this);
  100008. };
  100009. CaptionStream$1.prototype.flushStream = function(flushType) {
  100010. if (!this.captionPackets_.length) {
  100011. this.flushCCStreams(flushType);
  100012. return;
  100013. }
  100014. this.captionPackets_.forEach(function(elem, idx) {
  100015. elem.presortIndex = idx;
  100016. });
  100017. this.captionPackets_.sort(function(a, b) {
  100018. if (a.pts === b.pts) {
  100019. return a.presortIndex - b.presortIndex;
  100020. }
  100021. return a.pts - b.pts;
  100022. });
  100023. this.captionPackets_.forEach(function(packet) {
  100024. if (packet.type < 2) {
  100025. this.dispatchCea608Packet(packet);
  100026. } else {
  100027. this.dispatchCea708Packet(packet);
  100028. }
  100029. }, this);
  100030. this.captionPackets_.length = 0;
  100031. this.flushCCStreams(flushType);
  100032. };
  100033. CaptionStream$1.prototype.flush = function() {
  100034. return this.flushStream("flush");
  100035. };
  100036. CaptionStream$1.prototype.partialFlush = function() {
  100037. return this.flushStream("partialFlush");
  100038. };
  100039. CaptionStream$1.prototype.reset = function() {
  100040. this.latestDts_ = null;
  100041. this.ignoreNextEqualDts_ = false;
  100042. this.numSameDts_ = 0;
  100043. this.activeCea608Channel_ = [null, null];
  100044. this.ccStreams_.forEach(function(ccStream) {
  100045. ccStream.reset();
  100046. });
  100047. };
  100048. CaptionStream$1.prototype.dispatchCea608Packet = function(packet) {
  100049. if (this.setsTextOrXDSActive(packet)) {
  100050. this.activeCea608Channel_[packet.type] = null;
  100051. } else if (this.setsChannel1Active(packet)) {
  100052. this.activeCea608Channel_[packet.type] = 0;
  100053. } else if (this.setsChannel2Active(packet)) {
  100054. this.activeCea608Channel_[packet.type] = 1;
  100055. }
  100056. if (this.activeCea608Channel_[packet.type] === null) {
  100057. return;
  100058. }
  100059. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  100060. };
  100061. CaptionStream$1.prototype.setsChannel1Active = function(packet) {
  100062. return (packet.ccData & 30720) === 4096;
  100063. };
  100064. CaptionStream$1.prototype.setsChannel2Active = function(packet) {
  100065. return (packet.ccData & 30720) === 6144;
  100066. };
  100067. CaptionStream$1.prototype.setsTextOrXDSActive = function(packet) {
  100068. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  100069. };
  100070. CaptionStream$1.prototype.dispatchCea708Packet = function(packet) {
  100071. if (this.parse708captions_) {
  100072. this.cc708Stream_.push(packet);
  100073. }
  100074. };
  100075. var CHARACTER_TRANSLATION_708 = {
  100076. 127: 9834,
  100077. 4128: 32,
  100078. 4129: 160,
  100079. 4133: 8230,
  100080. 4138: 352,
  100081. 4140: 338,
  100082. 4144: 9608,
  100083. 4145: 8216,
  100084. 4146: 8217,
  100085. 4147: 8220,
  100086. 4148: 8221,
  100087. 4149: 8226,
  100088. 4153: 8482,
  100089. 4154: 353,
  100090. 4156: 339,
  100091. 4157: 8480,
  100092. 4159: 376,
  100093. 4214: 8539,
  100094. 4215: 8540,
  100095. 4216: 8541,
  100096. 4217: 8542,
  100097. 4218: 9168,
  100098. 4219: 9124,
  100099. 4220: 9123,
  100100. 4221: 9135,
  100101. 4222: 9126,
  100102. 4223: 9121,
  100103. 4256: 12600
  100104. };
  100105. var get708CharFromCode = function get708CharFromCode2(code) {
  100106. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  100107. if (code & 4096 && code === newCode) {
  100108. return "";
  100109. }
  100110. return String.fromCharCode(newCode);
  100111. };
  100112. var within708TextBlock = function within708TextBlock2(b) {
  100113. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  100114. };
  100115. var Cea708Window = function Cea708Window2(windowNum) {
  100116. this.windowNum = windowNum;
  100117. this.reset();
  100118. };
  100119. Cea708Window.prototype.reset = function() {
  100120. this.clearText();
  100121. this.pendingNewLine = false;
  100122. this.winAttr = {};
  100123. this.penAttr = {};
  100124. this.penLoc = {};
  100125. this.penColor = {};
  100126. this.visible = 0;
  100127. this.rowLock = 0;
  100128. this.columnLock = 0;
  100129. this.priority = 0;
  100130. this.relativePositioning = 0;
  100131. this.anchorVertical = 0;
  100132. this.anchorHorizontal = 0;
  100133. this.anchorPoint = 0;
  100134. this.rowCount = 1;
  100135. this.virtualRowCount = this.rowCount + 1;
  100136. this.columnCount = 41;
  100137. this.windowStyle = 0;
  100138. this.penStyle = 0;
  100139. };
  100140. Cea708Window.prototype.getText = function() {
  100141. return this.rows.join("\n");
  100142. };
  100143. Cea708Window.prototype.clearText = function() {
  100144. this.rows = [""];
  100145. this.rowIdx = 0;
  100146. };
  100147. Cea708Window.prototype.newLine = function(pts) {
  100148. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  100149. this.beforeRowOverflow(pts);
  100150. }
  100151. if (this.rows.length > 0) {
  100152. this.rows.push("");
  100153. this.rowIdx++;
  100154. }
  100155. while (this.rows.length > this.virtualRowCount) {
  100156. this.rows.shift();
  100157. this.rowIdx--;
  100158. }
  100159. };
  100160. Cea708Window.prototype.isEmpty = function() {
  100161. if (this.rows.length === 0) {
  100162. return true;
  100163. } else if (this.rows.length === 1) {
  100164. return this.rows[0] === "";
  100165. }
  100166. return false;
  100167. };
  100168. Cea708Window.prototype.addText = function(text) {
  100169. this.rows[this.rowIdx] += text;
  100170. };
  100171. Cea708Window.prototype.backspace = function() {
  100172. if (!this.isEmpty()) {
  100173. var row = this.rows[this.rowIdx];
  100174. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  100175. }
  100176. };
  100177. var Cea708Service = function Cea708Service2(serviceNum, encoding, stream2) {
  100178. this.serviceNum = serviceNum;
  100179. this.text = "";
  100180. this.currentWindow = new Cea708Window(-1);
  100181. this.windows = [];
  100182. this.stream = stream2;
  100183. if (typeof encoding === "string") {
  100184. this.createTextDecoder(encoding);
  100185. }
  100186. };
  100187. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  100188. this.startPts = pts;
  100189. for (var win3 = 0; win3 < 8; win3++) {
  100190. this.windows[win3] = new Cea708Window(win3);
  100191. if (typeof beforeRowOverflow === "function") {
  100192. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  100193. }
  100194. }
  100195. };
  100196. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  100197. this.currentWindow = this.windows[windowNum];
  100198. };
  100199. Cea708Service.prototype.createTextDecoder = function(encoding) {
  100200. if (typeof TextDecoder === "undefined") {
  100201. this.stream.trigger("log", {
  100202. level: "warn",
  100203. message: "The `encoding` option is unsupported without TextDecoder support"
  100204. });
  100205. } else {
  100206. try {
  100207. this.textDecoder_ = new TextDecoder(encoding);
  100208. } catch (error) {
  100209. this.stream.trigger("log", {
  100210. level: "warn",
  100211. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  100212. });
  100213. }
  100214. }
  100215. };
  100216. var Cea708Stream = function Cea708Stream2(options2) {
  100217. options2 = options2 || {};
  100218. Cea708Stream2.prototype.init.call(this);
  100219. var self2 = this;
  100220. var captionServices = options2.captionServices || {};
  100221. var captionServiceEncodings = {};
  100222. var serviceProps;
  100223. Object.keys(captionServices).forEach(function(serviceName) {
  100224. serviceProps = captionServices[serviceName];
  100225. if (/^SERVICE/.test(serviceName)) {
  100226. captionServiceEncodings[serviceName] = serviceProps.encoding;
  100227. }
  100228. });
  100229. this.serviceEncodings = captionServiceEncodings;
  100230. this.current708Packet = null;
  100231. this.services = {};
  100232. this.push = function(packet) {
  100233. if (packet.type === 3) {
  100234. self2.new708Packet();
  100235. self2.add708Bytes(packet);
  100236. } else {
  100237. if (self2.current708Packet === null) {
  100238. self2.new708Packet();
  100239. }
  100240. self2.add708Bytes(packet);
  100241. }
  100242. };
  100243. };
  100244. Cea708Stream.prototype = new stream();
  100245. Cea708Stream.prototype.new708Packet = function() {
  100246. if (this.current708Packet !== null) {
  100247. this.push708Packet();
  100248. }
  100249. this.current708Packet = {
  100250. data: [],
  100251. ptsVals: []
  100252. };
  100253. };
  100254. Cea708Stream.prototype.add708Bytes = function(packet) {
  100255. var data = packet.ccData;
  100256. var byte0 = data >>> 8;
  100257. var byte1 = data & 255;
  100258. this.current708Packet.ptsVals.push(packet.pts);
  100259. this.current708Packet.data.push(byte0);
  100260. this.current708Packet.data.push(byte1);
  100261. };
  100262. Cea708Stream.prototype.push708Packet = function() {
  100263. var packet708 = this.current708Packet;
  100264. var packetData = packet708.data;
  100265. var serviceNum = null;
  100266. var blockSize = null;
  100267. var i2 = 0;
  100268. var b = packetData[i2++];
  100269. packet708.seq = b >> 6;
  100270. packet708.sizeCode = b & 63;
  100271. for (; i2 < packetData.length; i2++) {
  100272. b = packetData[i2++];
  100273. serviceNum = b >> 5;
  100274. blockSize = b & 31;
  100275. if (serviceNum === 7 && blockSize > 0) {
  100276. b = packetData[i2++];
  100277. serviceNum = b;
  100278. }
  100279. this.pushServiceBlock(serviceNum, i2, blockSize);
  100280. if (blockSize > 0) {
  100281. i2 += blockSize - 1;
  100282. }
  100283. }
  100284. };
  100285. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  100286. var b;
  100287. var i2 = start2;
  100288. var packetData = this.current708Packet.data;
  100289. var service = this.services[serviceNum];
  100290. if (!service) {
  100291. service = this.initService(serviceNum, i2);
  100292. }
  100293. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  100294. b = packetData[i2];
  100295. if (within708TextBlock(b)) {
  100296. i2 = this.handleText(i2, service);
  100297. } else if (b === 24) {
  100298. i2 = this.multiByteCharacter(i2, service);
  100299. } else if (b === 16) {
  100300. i2 = this.extendedCommands(i2, service);
  100301. } else if (128 <= b && b <= 135) {
  100302. i2 = this.setCurrentWindow(i2, service);
  100303. } else if (152 <= b && b <= 159) {
  100304. i2 = this.defineWindow(i2, service);
  100305. } else if (b === 136) {
  100306. i2 = this.clearWindows(i2, service);
  100307. } else if (b === 140) {
  100308. i2 = this.deleteWindows(i2, service);
  100309. } else if (b === 137) {
  100310. i2 = this.displayWindows(i2, service);
  100311. } else if (b === 138) {
  100312. i2 = this.hideWindows(i2, service);
  100313. } else if (b === 139) {
  100314. i2 = this.toggleWindows(i2, service);
  100315. } else if (b === 151) {
  100316. i2 = this.setWindowAttributes(i2, service);
  100317. } else if (b === 144) {
  100318. i2 = this.setPenAttributes(i2, service);
  100319. } else if (b === 145) {
  100320. i2 = this.setPenColor(i2, service);
  100321. } else if (b === 146) {
  100322. i2 = this.setPenLocation(i2, service);
  100323. } else if (b === 143) {
  100324. service = this.reset(i2, service);
  100325. } else if (b === 8) {
  100326. service.currentWindow.backspace();
  100327. } else if (b === 12) {
  100328. service.currentWindow.clearText();
  100329. } else if (b === 13) {
  100330. service.currentWindow.pendingNewLine = true;
  100331. } else if (b === 14) {
  100332. service.currentWindow.clearText();
  100333. } else if (b === 141) {
  100334. i2++;
  100335. } else
  100336. ;
  100337. }
  100338. };
  100339. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  100340. var packetData = this.current708Packet.data;
  100341. var b = packetData[++i2];
  100342. if (within708TextBlock(b)) {
  100343. i2 = this.handleText(i2, service, {
  100344. isExtended: true
  100345. });
  100346. }
  100347. return i2;
  100348. };
  100349. Cea708Stream.prototype.getPts = function(byteIndex) {
  100350. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  100351. };
  100352. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  100353. var serviceName = "SERVICE" + serviceNum;
  100354. var self2 = this;
  100355. var serviceName;
  100356. var encoding;
  100357. if (serviceName in this.serviceEncodings) {
  100358. encoding = this.serviceEncodings[serviceName];
  100359. }
  100360. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  100361. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  100362. self2.flushDisplayed(pts, self2.services[serviceNum]);
  100363. });
  100364. return this.services[serviceNum];
  100365. };
  100366. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  100367. var isExtended = options2 && options2.isExtended;
  100368. var isMultiByte = options2 && options2.isMultiByte;
  100369. var packetData = this.current708Packet.data;
  100370. var extended = isExtended ? 4096 : 0;
  100371. var currentByte = packetData[i2];
  100372. var nextByte = packetData[i2 + 1];
  100373. var win3 = service.currentWindow;
  100374. var _char;
  100375. var charCodeArray;
  100376. if (service.textDecoder_ && !isExtended) {
  100377. if (isMultiByte) {
  100378. charCodeArray = [currentByte, nextByte];
  100379. i2++;
  100380. } else {
  100381. charCodeArray = [currentByte];
  100382. }
  100383. _char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  100384. } else {
  100385. _char = get708CharFromCode(extended | currentByte);
  100386. }
  100387. if (win3.pendingNewLine && !win3.isEmpty()) {
  100388. win3.newLine(this.getPts(i2));
  100389. }
  100390. win3.pendingNewLine = false;
  100391. win3.addText(_char);
  100392. return i2;
  100393. };
  100394. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  100395. var packetData = this.current708Packet.data;
  100396. var firstByte = packetData[i2 + 1];
  100397. var secondByte = packetData[i2 + 2];
  100398. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  100399. i2 = this.handleText(++i2, service, {
  100400. isMultiByte: true
  100401. });
  100402. }
  100403. return i2;
  100404. };
  100405. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  100406. var packetData = this.current708Packet.data;
  100407. var b = packetData[i2];
  100408. var windowNum = b & 7;
  100409. service.setCurrentWindow(windowNum);
  100410. return i2;
  100411. };
  100412. Cea708Stream.prototype.defineWindow = function(i2, service) {
  100413. var packetData = this.current708Packet.data;
  100414. var b = packetData[i2];
  100415. var windowNum = b & 7;
  100416. service.setCurrentWindow(windowNum);
  100417. var win3 = service.currentWindow;
  100418. b = packetData[++i2];
  100419. win3.visible = (b & 32) >> 5;
  100420. win3.rowLock = (b & 16) >> 4;
  100421. win3.columnLock = (b & 8) >> 3;
  100422. win3.priority = b & 7;
  100423. b = packetData[++i2];
  100424. win3.relativePositioning = (b & 128) >> 7;
  100425. win3.anchorVertical = b & 127;
  100426. b = packetData[++i2];
  100427. win3.anchorHorizontal = b;
  100428. b = packetData[++i2];
  100429. win3.anchorPoint = (b & 240) >> 4;
  100430. win3.rowCount = b & 15;
  100431. b = packetData[++i2];
  100432. win3.columnCount = b & 63;
  100433. b = packetData[++i2];
  100434. win3.windowStyle = (b & 56) >> 3;
  100435. win3.penStyle = b & 7;
  100436. win3.virtualRowCount = win3.rowCount + 1;
  100437. return i2;
  100438. };
  100439. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  100440. var packetData = this.current708Packet.data;
  100441. var b = packetData[i2];
  100442. var winAttr = service.currentWindow.winAttr;
  100443. b = packetData[++i2];
  100444. winAttr.fillOpacity = (b & 192) >> 6;
  100445. winAttr.fillRed = (b & 48) >> 4;
  100446. winAttr.fillGreen = (b & 12) >> 2;
  100447. winAttr.fillBlue = b & 3;
  100448. b = packetData[++i2];
  100449. winAttr.borderType = (b & 192) >> 6;
  100450. winAttr.borderRed = (b & 48) >> 4;
  100451. winAttr.borderGreen = (b & 12) >> 2;
  100452. winAttr.borderBlue = b & 3;
  100453. b = packetData[++i2];
  100454. winAttr.borderType += (b & 128) >> 5;
  100455. winAttr.wordWrap = (b & 64) >> 6;
  100456. winAttr.printDirection = (b & 48) >> 4;
  100457. winAttr.scrollDirection = (b & 12) >> 2;
  100458. winAttr.justify = b & 3;
  100459. b = packetData[++i2];
  100460. winAttr.effectSpeed = (b & 240) >> 4;
  100461. winAttr.effectDirection = (b & 12) >> 2;
  100462. winAttr.displayEffect = b & 3;
  100463. return i2;
  100464. };
  100465. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  100466. var displayedText = [];
  100467. for (var winId = 0; winId < 8; winId++) {
  100468. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  100469. displayedText.push(service.windows[winId].getText());
  100470. }
  100471. }
  100472. service.endPts = pts;
  100473. service.text = displayedText.join("\n\n");
  100474. this.pushCaption(service);
  100475. service.startPts = pts;
  100476. };
  100477. Cea708Stream.prototype.pushCaption = function(service) {
  100478. if (service.text !== "") {
  100479. this.trigger("data", {
  100480. startPts: service.startPts,
  100481. endPts: service.endPts,
  100482. text: service.text,
  100483. stream: "cc708_" + service.serviceNum
  100484. });
  100485. service.text = "";
  100486. service.startPts = service.endPts;
  100487. }
  100488. };
  100489. Cea708Stream.prototype.displayWindows = function(i2, service) {
  100490. var packetData = this.current708Packet.data;
  100491. var b = packetData[++i2];
  100492. var pts = this.getPts(i2);
  100493. this.flushDisplayed(pts, service);
  100494. for (var winId = 0; winId < 8; winId++) {
  100495. if (b & 1 << winId) {
  100496. service.windows[winId].visible = 1;
  100497. }
  100498. }
  100499. return i2;
  100500. };
  100501. Cea708Stream.prototype.hideWindows = function(i2, service) {
  100502. var packetData = this.current708Packet.data;
  100503. var b = packetData[++i2];
  100504. var pts = this.getPts(i2);
  100505. this.flushDisplayed(pts, service);
  100506. for (var winId = 0; winId < 8; winId++) {
  100507. if (b & 1 << winId) {
  100508. service.windows[winId].visible = 0;
  100509. }
  100510. }
  100511. return i2;
  100512. };
  100513. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  100514. var packetData = this.current708Packet.data;
  100515. var b = packetData[++i2];
  100516. var pts = this.getPts(i2);
  100517. this.flushDisplayed(pts, service);
  100518. for (var winId = 0; winId < 8; winId++) {
  100519. if (b & 1 << winId) {
  100520. service.windows[winId].visible ^= 1;
  100521. }
  100522. }
  100523. return i2;
  100524. };
  100525. Cea708Stream.prototype.clearWindows = function(i2, service) {
  100526. var packetData = this.current708Packet.data;
  100527. var b = packetData[++i2];
  100528. var pts = this.getPts(i2);
  100529. this.flushDisplayed(pts, service);
  100530. for (var winId = 0; winId < 8; winId++) {
  100531. if (b & 1 << winId) {
  100532. service.windows[winId].clearText();
  100533. }
  100534. }
  100535. return i2;
  100536. };
  100537. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  100538. var packetData = this.current708Packet.data;
  100539. var b = packetData[++i2];
  100540. var pts = this.getPts(i2);
  100541. this.flushDisplayed(pts, service);
  100542. for (var winId = 0; winId < 8; winId++) {
  100543. if (b & 1 << winId) {
  100544. service.windows[winId].reset();
  100545. }
  100546. }
  100547. return i2;
  100548. };
  100549. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  100550. var packetData = this.current708Packet.data;
  100551. var b = packetData[i2];
  100552. var penAttr = service.currentWindow.penAttr;
  100553. b = packetData[++i2];
  100554. penAttr.textTag = (b & 240) >> 4;
  100555. penAttr.offset = (b & 12) >> 2;
  100556. penAttr.penSize = b & 3;
  100557. b = packetData[++i2];
  100558. penAttr.italics = (b & 128) >> 7;
  100559. penAttr.underline = (b & 64) >> 6;
  100560. penAttr.edgeType = (b & 56) >> 3;
  100561. penAttr.fontStyle = b & 7;
  100562. return i2;
  100563. };
  100564. Cea708Stream.prototype.setPenColor = function(i2, service) {
  100565. var packetData = this.current708Packet.data;
  100566. var b = packetData[i2];
  100567. var penColor = service.currentWindow.penColor;
  100568. b = packetData[++i2];
  100569. penColor.fgOpacity = (b & 192) >> 6;
  100570. penColor.fgRed = (b & 48) >> 4;
  100571. penColor.fgGreen = (b & 12) >> 2;
  100572. penColor.fgBlue = b & 3;
  100573. b = packetData[++i2];
  100574. penColor.bgOpacity = (b & 192) >> 6;
  100575. penColor.bgRed = (b & 48) >> 4;
  100576. penColor.bgGreen = (b & 12) >> 2;
  100577. penColor.bgBlue = b & 3;
  100578. b = packetData[++i2];
  100579. penColor.edgeRed = (b & 48) >> 4;
  100580. penColor.edgeGreen = (b & 12) >> 2;
  100581. penColor.edgeBlue = b & 3;
  100582. return i2;
  100583. };
  100584. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  100585. var packetData = this.current708Packet.data;
  100586. var b = packetData[i2];
  100587. var penLoc = service.currentWindow.penLoc;
  100588. service.currentWindow.pendingNewLine = true;
  100589. b = packetData[++i2];
  100590. penLoc.row = b & 15;
  100591. b = packetData[++i2];
  100592. penLoc.column = b & 63;
  100593. return i2;
  100594. };
  100595. Cea708Stream.prototype.reset = function(i2, service) {
  100596. var pts = this.getPts(i2);
  100597. this.flushDisplayed(pts, service);
  100598. return this.initService(service.serviceNum, i2);
  100599. };
  100600. var CHARACTER_TRANSLATION = {
  100601. 42: 225,
  100602. 92: 233,
  100603. 94: 237,
  100604. 95: 243,
  100605. 96: 250,
  100606. 123: 231,
  100607. 124: 247,
  100608. 125: 209,
  100609. 126: 241,
  100610. 127: 9608,
  100611. 304: 174,
  100612. 305: 176,
  100613. 306: 189,
  100614. 307: 191,
  100615. 308: 8482,
  100616. 309: 162,
  100617. 310: 163,
  100618. 311: 9834,
  100619. 312: 224,
  100620. 313: 160,
  100621. 314: 232,
  100622. 315: 226,
  100623. 316: 234,
  100624. 317: 238,
  100625. 318: 244,
  100626. 319: 251,
  100627. 544: 193,
  100628. 545: 201,
  100629. 546: 211,
  100630. 547: 218,
  100631. 548: 220,
  100632. 549: 252,
  100633. 550: 8216,
  100634. 551: 161,
  100635. 552: 42,
  100636. 553: 39,
  100637. 554: 8212,
  100638. 555: 169,
  100639. 556: 8480,
  100640. 557: 8226,
  100641. 558: 8220,
  100642. 559: 8221,
  100643. 560: 192,
  100644. 561: 194,
  100645. 562: 199,
  100646. 563: 200,
  100647. 564: 202,
  100648. 565: 203,
  100649. 566: 235,
  100650. 567: 206,
  100651. 568: 207,
  100652. 569: 239,
  100653. 570: 212,
  100654. 571: 217,
  100655. 572: 249,
  100656. 573: 219,
  100657. 574: 171,
  100658. 575: 187,
  100659. 800: 195,
  100660. 801: 227,
  100661. 802: 205,
  100662. 803: 204,
  100663. 804: 236,
  100664. 805: 210,
  100665. 806: 242,
  100666. 807: 213,
  100667. 808: 245,
  100668. 809: 123,
  100669. 810: 125,
  100670. 811: 92,
  100671. 812: 94,
  100672. 813: 95,
  100673. 814: 124,
  100674. 815: 126,
  100675. 816: 196,
  100676. 817: 228,
  100677. 818: 214,
  100678. 819: 246,
  100679. 820: 223,
  100680. 821: 165,
  100681. 822: 164,
  100682. 823: 9474,
  100683. 824: 197,
  100684. 825: 229,
  100685. 826: 216,
  100686. 827: 248,
  100687. 828: 9484,
  100688. 829: 9488,
  100689. 830: 9492,
  100690. 831: 9496
  100691. };
  100692. var getCharFromCode = function getCharFromCode2(code) {
  100693. if (code === null) {
  100694. return "";
  100695. }
  100696. code = CHARACTER_TRANSLATION[code] || code;
  100697. return String.fromCharCode(code);
  100698. };
  100699. var BOTTOM_ROW = 14;
  100700. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  100701. var createDisplayBuffer = function createDisplayBuffer2() {
  100702. var result = [], i2 = BOTTOM_ROW + 1;
  100703. while (i2--) {
  100704. result.push("");
  100705. }
  100706. return result;
  100707. };
  100708. var Cea608Stream = function Cea608Stream2(field, dataChannel) {
  100709. Cea608Stream2.prototype.init.call(this);
  100710. this.field_ = field || 0;
  100711. this.dataChannel_ = dataChannel || 0;
  100712. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  100713. this.setConstants();
  100714. this.reset();
  100715. this.push = function(packet) {
  100716. var data, swap, char0, char1, text;
  100717. data = packet.ccData & 32639;
  100718. if (data === this.lastControlCode_) {
  100719. this.lastControlCode_ = null;
  100720. return;
  100721. }
  100722. if ((data & 61440) === 4096) {
  100723. this.lastControlCode_ = data;
  100724. } else if (data !== this.PADDING_) {
  100725. this.lastControlCode_ = null;
  100726. }
  100727. char0 = data >>> 8;
  100728. char1 = data & 255;
  100729. if (data === this.PADDING_) {
  100730. return;
  100731. } else if (data === this.RESUME_CAPTION_LOADING_) {
  100732. this.mode_ = "popOn";
  100733. } else if (data === this.END_OF_CAPTION_) {
  100734. this.mode_ = "popOn";
  100735. this.clearFormatting(packet.pts);
  100736. this.flushDisplayed(packet.pts);
  100737. swap = this.displayed_;
  100738. this.displayed_ = this.nonDisplayed_;
  100739. this.nonDisplayed_ = swap;
  100740. this.startPts_ = packet.pts;
  100741. } else if (data === this.ROLL_UP_2_ROWS_) {
  100742. this.rollUpRows_ = 2;
  100743. this.setRollUp(packet.pts);
  100744. } else if (data === this.ROLL_UP_3_ROWS_) {
  100745. this.rollUpRows_ = 3;
  100746. this.setRollUp(packet.pts);
  100747. } else if (data === this.ROLL_UP_4_ROWS_) {
  100748. this.rollUpRows_ = 4;
  100749. this.setRollUp(packet.pts);
  100750. } else if (data === this.CARRIAGE_RETURN_) {
  100751. this.clearFormatting(packet.pts);
  100752. this.flushDisplayed(packet.pts);
  100753. this.shiftRowsUp_();
  100754. this.startPts_ = packet.pts;
  100755. } else if (data === this.BACKSPACE_) {
  100756. if (this.mode_ === "popOn") {
  100757. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100758. } else {
  100759. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100760. }
  100761. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  100762. this.flushDisplayed(packet.pts);
  100763. this.displayed_ = createDisplayBuffer();
  100764. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  100765. this.nonDisplayed_ = createDisplayBuffer();
  100766. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  100767. if (this.mode_ !== "paintOn") {
  100768. this.flushDisplayed(packet.pts);
  100769. this.displayed_ = createDisplayBuffer();
  100770. }
  100771. this.mode_ = "paintOn";
  100772. this.startPts_ = packet.pts;
  100773. } else if (this.isSpecialCharacter(char0, char1)) {
  100774. char0 = (char0 & 3) << 8;
  100775. text = getCharFromCode(char0 | char1);
  100776. this[this.mode_](packet.pts, text);
  100777. this.column_++;
  100778. } else if (this.isExtCharacter(char0, char1)) {
  100779. if (this.mode_ === "popOn") {
  100780. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100781. } else {
  100782. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100783. }
  100784. char0 = (char0 & 3) << 8;
  100785. text = getCharFromCode(char0 | char1);
  100786. this[this.mode_](packet.pts, text);
  100787. this.column_++;
  100788. } else if (this.isMidRowCode(char0, char1)) {
  100789. this.clearFormatting(packet.pts);
  100790. this[this.mode_](packet.pts, " ");
  100791. this.column_++;
  100792. if ((char1 & 14) === 14) {
  100793. this.addFormatting(packet.pts, ["i"]);
  100794. }
  100795. if ((char1 & 1) === 1) {
  100796. this.addFormatting(packet.pts, ["u"]);
  100797. }
  100798. } else if (this.isOffsetControlCode(char0, char1)) {
  100799. this.column_ += char1 & 3;
  100800. } else if (this.isPAC(char0, char1)) {
  100801. var row = ROWS.indexOf(data & 7968);
  100802. if (this.mode_ === "rollUp") {
  100803. if (row - this.rollUpRows_ + 1 < 0) {
  100804. row = this.rollUpRows_ - 1;
  100805. }
  100806. this.setRollUp(packet.pts, row);
  100807. }
  100808. if (row !== this.row_) {
  100809. this.clearFormatting(packet.pts);
  100810. this.row_ = row;
  100811. }
  100812. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  100813. this.addFormatting(packet.pts, ["u"]);
  100814. }
  100815. if ((data & 16) === 16) {
  100816. this.column_ = ((data & 14) >> 1) * 4;
  100817. }
  100818. if (this.isColorPAC(char1)) {
  100819. if ((char1 & 14) === 14) {
  100820. this.addFormatting(packet.pts, ["i"]);
  100821. }
  100822. }
  100823. } else if (this.isNormalChar(char0)) {
  100824. if (char1 === 0) {
  100825. char1 = null;
  100826. }
  100827. text = getCharFromCode(char0);
  100828. text += getCharFromCode(char1);
  100829. this[this.mode_](packet.pts, text);
  100830. this.column_ += text.length;
  100831. }
  100832. };
  100833. };
  100834. Cea608Stream.prototype = new stream();
  100835. Cea608Stream.prototype.flushDisplayed = function(pts) {
  100836. var content = this.displayed_.map(function(row, index2) {
  100837. try {
  100838. return row.trim();
  100839. } catch (e) {
  100840. this.trigger("log", {
  100841. level: "warn",
  100842. message: "Skipping a malformed 608 caption at index " + index2 + "."
  100843. });
  100844. return "";
  100845. }
  100846. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  100847. if (content.length) {
  100848. this.trigger("data", {
  100849. startPts: this.startPts_,
  100850. endPts: pts,
  100851. text: content,
  100852. stream: this.name_
  100853. });
  100854. }
  100855. };
  100856. Cea608Stream.prototype.reset = function() {
  100857. this.mode_ = "popOn";
  100858. this.topRow_ = 0;
  100859. this.startPts_ = 0;
  100860. this.displayed_ = createDisplayBuffer();
  100861. this.nonDisplayed_ = createDisplayBuffer();
  100862. this.lastControlCode_ = null;
  100863. this.column_ = 0;
  100864. this.row_ = BOTTOM_ROW;
  100865. this.rollUpRows_ = 2;
  100866. this.formatting_ = [];
  100867. };
  100868. Cea608Stream.prototype.setConstants = function() {
  100869. if (this.dataChannel_ === 0) {
  100870. this.BASE_ = 16;
  100871. this.EXT_ = 17;
  100872. this.CONTROL_ = (20 | this.field_) << 8;
  100873. this.OFFSET_ = 23;
  100874. } else if (this.dataChannel_ === 1) {
  100875. this.BASE_ = 24;
  100876. this.EXT_ = 25;
  100877. this.CONTROL_ = (28 | this.field_) << 8;
  100878. this.OFFSET_ = 31;
  100879. }
  100880. this.PADDING_ = 0;
  100881. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  100882. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  100883. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  100884. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  100885. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  100886. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  100887. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  100888. this.BACKSPACE_ = this.CONTROL_ | 33;
  100889. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  100890. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  100891. };
  100892. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  100893. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  100894. };
  100895. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  100896. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  100897. };
  100898. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  100899. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  100900. };
  100901. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  100902. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  100903. };
  100904. Cea608Stream.prototype.isPAC = function(char0, char1) {
  100905. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  100906. };
  100907. Cea608Stream.prototype.isColorPAC = function(char1) {
  100908. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  100909. };
  100910. Cea608Stream.prototype.isNormalChar = function(_char2) {
  100911. return _char2 >= 32 && _char2 <= 127;
  100912. };
  100913. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  100914. if (this.mode_ !== "rollUp") {
  100915. this.row_ = BOTTOM_ROW;
  100916. this.mode_ = "rollUp";
  100917. this.flushDisplayed(pts);
  100918. this.nonDisplayed_ = createDisplayBuffer();
  100919. this.displayed_ = createDisplayBuffer();
  100920. }
  100921. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  100922. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  100923. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  100924. this.displayed_[this.row_ - i2] = "";
  100925. }
  100926. }
  100927. if (newBaseRow === void 0) {
  100928. newBaseRow = this.row_;
  100929. }
  100930. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  100931. };
  100932. Cea608Stream.prototype.addFormatting = function(pts, format) {
  100933. this.formatting_ = this.formatting_.concat(format);
  100934. var text = format.reduce(function(text2, format2) {
  100935. return text2 + "<" + format2 + ">";
  100936. }, "");
  100937. this[this.mode_](pts, text);
  100938. };
  100939. Cea608Stream.prototype.clearFormatting = function(pts) {
  100940. if (!this.formatting_.length) {
  100941. return;
  100942. }
  100943. var text = this.formatting_.reverse().reduce(function(text2, format) {
  100944. return text2 + "</" + format + ">";
  100945. }, "");
  100946. this.formatting_ = [];
  100947. this[this.mode_](pts, text);
  100948. };
  100949. Cea608Stream.prototype.popOn = function(pts, text) {
  100950. var baseRow = this.nonDisplayed_[this.row_];
  100951. baseRow += text;
  100952. this.nonDisplayed_[this.row_] = baseRow;
  100953. };
  100954. Cea608Stream.prototype.rollUp = function(pts, text) {
  100955. var baseRow = this.displayed_[this.row_];
  100956. baseRow += text;
  100957. this.displayed_[this.row_] = baseRow;
  100958. };
  100959. Cea608Stream.prototype.shiftRowsUp_ = function() {
  100960. var i2;
  100961. for (i2 = 0; i2 < this.topRow_; i2++) {
  100962. this.displayed_[i2] = "";
  100963. }
  100964. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  100965. this.displayed_[i2] = "";
  100966. }
  100967. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  100968. this.displayed_[i2] = this.displayed_[i2 + 1];
  100969. }
  100970. this.displayed_[this.row_] = "";
  100971. };
  100972. Cea608Stream.prototype.paintOn = function(pts, text) {
  100973. var baseRow = this.displayed_[this.row_];
  100974. baseRow += text;
  100975. this.displayed_[this.row_] = baseRow;
  100976. };
  100977. var captionStream = {
  100978. CaptionStream: CaptionStream$1,
  100979. Cea608Stream,
  100980. Cea708Stream
  100981. };
  100982. var streamTypes = {
  100983. H264_STREAM_TYPE: 27,
  100984. ADTS_STREAM_TYPE: 15,
  100985. METADATA_STREAM_TYPE: 21
  100986. };
  100987. var MAX_TS = 8589934592;
  100988. var RO_THRESH = 4294967296;
  100989. var TYPE_SHARED = "shared";
  100990. var handleRollover$1 = function handleRollover2(value, reference) {
  100991. var direction = 1;
  100992. if (value > reference) {
  100993. direction = -1;
  100994. }
  100995. while (Math.abs(reference - value) > RO_THRESH) {
  100996. value += direction * MAX_TS;
  100997. }
  100998. return value;
  100999. };
  101000. var TimestampRolloverStream$1 = function TimestampRolloverStream2(type3) {
  101001. var lastDTS, referenceDTS;
  101002. TimestampRolloverStream2.prototype.init.call(this);
  101003. this.type_ = type3 || TYPE_SHARED;
  101004. this.push = function(data) {
  101005. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  101006. return;
  101007. }
  101008. if (referenceDTS === void 0) {
  101009. referenceDTS = data.dts;
  101010. }
  101011. data.dts = handleRollover$1(data.dts, referenceDTS);
  101012. data.pts = handleRollover$1(data.pts, referenceDTS);
  101013. lastDTS = data.dts;
  101014. this.trigger("data", data);
  101015. };
  101016. this.flush = function() {
  101017. referenceDTS = lastDTS;
  101018. this.trigger("done");
  101019. };
  101020. this.endTimeline = function() {
  101021. this.flush();
  101022. this.trigger("endedtimeline");
  101023. };
  101024. this.discontinuity = function() {
  101025. referenceDTS = void 0;
  101026. lastDTS = void 0;
  101027. };
  101028. this.reset = function() {
  101029. this.discontinuity();
  101030. this.trigger("reset");
  101031. };
  101032. };
  101033. TimestampRolloverStream$1.prototype = new stream();
  101034. var timestampRolloverStream = {
  101035. TimestampRolloverStream: TimestampRolloverStream$1,
  101036. handleRollover: handleRollover$1
  101037. };
  101038. var percentEncode$1 = function percentEncode2(bytes, start2, end) {
  101039. var i2, result = "";
  101040. for (i2 = start2; i2 < end; i2++) {
  101041. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  101042. }
  101043. return result;
  101044. }, parseUtf8 = function parseUtf82(bytes, start2, end) {
  101045. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  101046. }, parseIso88591$1 = function parseIso885912(bytes, start2, end) {
  101047. return unescape(percentEncode$1(bytes, start2, end));
  101048. }, parseSyncSafeInteger$1 = function parseSyncSafeInteger2(data) {
  101049. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  101050. }, tagParsers = {
  101051. TXXX: function TXXX(tag) {
  101052. var i2;
  101053. if (tag.data[0] !== 3) {
  101054. return;
  101055. }
  101056. for (i2 = 1; i2 < tag.data.length; i2++) {
  101057. if (tag.data[i2] === 0) {
  101058. tag.description = parseUtf8(tag.data, 1, i2);
  101059. tag.value = parseUtf8(tag.data, i2 + 1, tag.data.length).replace(/\0*$/, "");
  101060. break;
  101061. }
  101062. }
  101063. tag.data = tag.value;
  101064. },
  101065. WXXX: function WXXX(tag) {
  101066. var i2;
  101067. if (tag.data[0] !== 3) {
  101068. return;
  101069. }
  101070. for (i2 = 1; i2 < tag.data.length; i2++) {
  101071. if (tag.data[i2] === 0) {
  101072. tag.description = parseUtf8(tag.data, 1, i2);
  101073. tag.url = parseUtf8(tag.data, i2 + 1, tag.data.length);
  101074. break;
  101075. }
  101076. }
  101077. },
  101078. PRIV: function PRIV(tag) {
  101079. var i2;
  101080. for (i2 = 0; i2 < tag.data.length; i2++) {
  101081. if (tag.data[i2] === 0) {
  101082. tag.owner = parseIso88591$1(tag.data, 0, i2);
  101083. break;
  101084. }
  101085. }
  101086. tag.privateData = tag.data.subarray(i2 + 1);
  101087. tag.data = tag.privateData;
  101088. }
  101089. }, _MetadataStream;
  101090. _MetadataStream = function MetadataStream(options2) {
  101091. var settings = {
  101092. descriptor: options2 && options2.descriptor
  101093. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  101094. _MetadataStream.prototype.init.call(this);
  101095. this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16);
  101096. if (settings.descriptor) {
  101097. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  101098. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  101099. }
  101100. }
  101101. this.push = function(chunk) {
  101102. var tag, frameStart, frameSize, frame, i3, frameHeader;
  101103. if (chunk.type !== "timed-metadata") {
  101104. return;
  101105. }
  101106. if (chunk.dataAlignmentIndicator) {
  101107. bufferSize = 0;
  101108. buffer.length = 0;
  101109. }
  101110. 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))) {
  101111. this.trigger("log", {
  101112. level: "warn",
  101113. message: "Skipping unrecognized metadata packet"
  101114. });
  101115. return;
  101116. }
  101117. buffer.push(chunk);
  101118. bufferSize += chunk.data.byteLength;
  101119. if (buffer.length === 1) {
  101120. tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10));
  101121. tagSize += 10;
  101122. }
  101123. if (bufferSize < tagSize) {
  101124. return;
  101125. }
  101126. tag = {
  101127. data: new Uint8Array(tagSize),
  101128. frames: [],
  101129. pts: buffer[0].pts,
  101130. dts: buffer[0].dts
  101131. };
  101132. for (i3 = 0; i3 < tagSize; ) {
  101133. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  101134. i3 += buffer[0].data.byteLength;
  101135. bufferSize -= buffer[0].data.byteLength;
  101136. buffer.shift();
  101137. }
  101138. frameStart = 10;
  101139. if (tag.data[5] & 64) {
  101140. frameStart += 4;
  101141. frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14));
  101142. tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20));
  101143. }
  101144. do {
  101145. frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8));
  101146. if (frameSize < 1) {
  101147. this.trigger("log", {
  101148. level: "warn",
  101149. message: "Malformed ID3 frame encountered. Skipping metadata parsing."
  101150. });
  101151. return;
  101152. }
  101153. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  101154. frame = {
  101155. id: frameHeader,
  101156. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  101157. };
  101158. frame.key = frame.id;
  101159. if (tagParsers[frame.id]) {
  101160. tagParsers[frame.id](frame);
  101161. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  101162. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  101163. size *= 4;
  101164. size += d2[7] & 3;
  101165. frame.timeStamp = size;
  101166. if (tag.pts === void 0 && tag.dts === void 0) {
  101167. tag.pts = frame.timeStamp;
  101168. tag.dts = frame.timeStamp;
  101169. }
  101170. this.trigger("timestamp", frame);
  101171. }
  101172. }
  101173. tag.frames.push(frame);
  101174. frameStart += 10;
  101175. frameStart += frameSize;
  101176. } while (frameStart < tagSize);
  101177. this.trigger("data", tag);
  101178. };
  101179. };
  101180. _MetadataStream.prototype = new stream();
  101181. var metadataStream = _MetadataStream;
  101182. var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  101183. var _TransportPacketStream, _TransportParseStream, _ElementaryStream;
  101184. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  101185. _TransportPacketStream = function TransportPacketStream() {
  101186. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  101187. _TransportPacketStream.prototype.init.call(this);
  101188. this.push = function(bytes) {
  101189. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  101190. if (bytesInBuffer) {
  101191. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  101192. everything.set(buffer.subarray(0, bytesInBuffer));
  101193. everything.set(bytes, bytesInBuffer);
  101194. bytesInBuffer = 0;
  101195. } else {
  101196. everything = bytes;
  101197. }
  101198. while (endIndex < everything.byteLength) {
  101199. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  101200. this.trigger("data", everything.subarray(startIndex, endIndex));
  101201. startIndex += MP2T_PACKET_LENGTH$1;
  101202. endIndex += MP2T_PACKET_LENGTH$1;
  101203. continue;
  101204. }
  101205. startIndex++;
  101206. endIndex++;
  101207. }
  101208. if (startIndex < everything.byteLength) {
  101209. buffer.set(everything.subarray(startIndex), 0);
  101210. bytesInBuffer = everything.byteLength - startIndex;
  101211. }
  101212. };
  101213. this.flush = function() {
  101214. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  101215. this.trigger("data", buffer);
  101216. bytesInBuffer = 0;
  101217. }
  101218. this.trigger("done");
  101219. };
  101220. this.endTimeline = function() {
  101221. this.flush();
  101222. this.trigger("endedtimeline");
  101223. };
  101224. this.reset = function() {
  101225. bytesInBuffer = 0;
  101226. this.trigger("reset");
  101227. };
  101228. };
  101229. _TransportPacketStream.prototype = new stream();
  101230. _TransportParseStream = function TransportParseStream() {
  101231. var parsePsi, parsePat2, parsePmt2, self2;
  101232. _TransportParseStream.prototype.init.call(this);
  101233. self2 = this;
  101234. this.packetsWaitingForPmt = [];
  101235. this.programMapTable = void 0;
  101236. parsePsi = function parsePsi2(payload, psi) {
  101237. var offset = 0;
  101238. if (psi.payloadUnitStartIndicator) {
  101239. offset += payload[offset] + 1;
  101240. }
  101241. if (psi.type === "pat") {
  101242. parsePat2(payload.subarray(offset), psi);
  101243. } else {
  101244. parsePmt2(payload.subarray(offset), psi);
  101245. }
  101246. };
  101247. parsePat2 = function parsePat3(payload, pat) {
  101248. pat.section_number = payload[7];
  101249. pat.last_section_number = payload[8];
  101250. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  101251. pat.pmtPid = self2.pmtPid;
  101252. };
  101253. parsePmt2 = function parsePmt3(payload, pmt) {
  101254. var sectionLength, tableEnd, programInfoLength, offset;
  101255. if (!(payload[5] & 1)) {
  101256. return;
  101257. }
  101258. self2.programMapTable = {
  101259. video: null,
  101260. audio: null,
  101261. "timed-metadata": {}
  101262. };
  101263. sectionLength = (payload[1] & 15) << 8 | payload[2];
  101264. tableEnd = 3 + sectionLength - 4;
  101265. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  101266. offset = 12 + programInfoLength;
  101267. while (offset < tableEnd) {
  101268. var streamType = payload[offset];
  101269. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  101270. if (streamType === streamTypes.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  101271. self2.programMapTable.video = pid;
  101272. } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  101273. self2.programMapTable.audio = pid;
  101274. } else if (streamType === streamTypes.METADATA_STREAM_TYPE) {
  101275. self2.programMapTable["timed-metadata"][pid] = streamType;
  101276. }
  101277. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  101278. }
  101279. pmt.programMapTable = self2.programMapTable;
  101280. };
  101281. this.push = function(packet) {
  101282. var result = {}, offset = 4;
  101283. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  101284. result.pid = packet[1] & 31;
  101285. result.pid <<= 8;
  101286. result.pid |= packet[2];
  101287. if ((packet[3] & 48) >>> 4 > 1) {
  101288. offset += packet[offset] + 1;
  101289. }
  101290. if (result.pid === 0) {
  101291. result.type = "pat";
  101292. parsePsi(packet.subarray(offset), result);
  101293. this.trigger("data", result);
  101294. } else if (result.pid === this.pmtPid) {
  101295. result.type = "pmt";
  101296. parsePsi(packet.subarray(offset), result);
  101297. this.trigger("data", result);
  101298. while (this.packetsWaitingForPmt.length) {
  101299. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  101300. }
  101301. } else if (this.programMapTable === void 0) {
  101302. this.packetsWaitingForPmt.push([packet, offset, result]);
  101303. } else {
  101304. this.processPes_(packet, offset, result);
  101305. }
  101306. };
  101307. this.processPes_ = function(packet, offset, result) {
  101308. if (result.pid === this.programMapTable.video) {
  101309. result.streamType = streamTypes.H264_STREAM_TYPE;
  101310. } else if (result.pid === this.programMapTable.audio) {
  101311. result.streamType = streamTypes.ADTS_STREAM_TYPE;
  101312. } else {
  101313. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  101314. }
  101315. result.type = "pes";
  101316. result.data = packet.subarray(offset);
  101317. this.trigger("data", result);
  101318. };
  101319. };
  101320. _TransportParseStream.prototype = new stream();
  101321. _TransportParseStream.STREAM_TYPES = {
  101322. h264: 27,
  101323. adts: 15
  101324. };
  101325. _ElementaryStream = function ElementaryStream() {
  101326. var self2 = this, segmentHadPmt = false, video = {
  101327. data: [],
  101328. size: 0
  101329. }, audio = {
  101330. data: [],
  101331. size: 0
  101332. }, timedMetadata = {
  101333. data: [],
  101334. size: 0
  101335. }, programMapTable, parsePes = function parsePes2(payload, pes) {
  101336. var ptsDtsFlags;
  101337. var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  101338. pes.data = new Uint8Array();
  101339. if (startPrefix !== 1) {
  101340. return;
  101341. }
  101342. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  101343. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  101344. ptsDtsFlags = payload[7];
  101345. if (ptsDtsFlags & 192) {
  101346. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  101347. pes.pts *= 4;
  101348. pes.pts += (payload[13] & 6) >>> 1;
  101349. pes.dts = pes.pts;
  101350. if (ptsDtsFlags & 64) {
  101351. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  101352. pes.dts *= 4;
  101353. pes.dts += (payload[18] & 6) >>> 1;
  101354. }
  101355. }
  101356. pes.data = payload.subarray(9 + payload[8]);
  101357. }, flushStream = function flushStream2(stream2, type3, forceFlush) {
  101358. var packetData = new Uint8Array(stream2.size), event2 = {
  101359. type: type3
  101360. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  101361. if (!stream2.data.length || stream2.size < 9) {
  101362. return;
  101363. }
  101364. event2.trackId = stream2.data[0].pid;
  101365. for (i2 = 0; i2 < stream2.data.length; i2++) {
  101366. fragment = stream2.data[i2];
  101367. packetData.set(fragment.data, offset);
  101368. offset += fragment.data.byteLength;
  101369. }
  101370. parsePes(packetData, event2);
  101371. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  101372. if (forceFlush || packetFlushable) {
  101373. stream2.size = 0;
  101374. stream2.data.length = 0;
  101375. }
  101376. if (packetFlushable) {
  101377. self2.trigger("data", event2);
  101378. }
  101379. };
  101380. _ElementaryStream.prototype.init.call(this);
  101381. this.push = function(data) {
  101382. ({
  101383. pat: function pat() {
  101384. },
  101385. pes: function pes() {
  101386. var stream2, streamType;
  101387. switch (data.streamType) {
  101388. case streamTypes.H264_STREAM_TYPE:
  101389. stream2 = video;
  101390. streamType = "video";
  101391. break;
  101392. case streamTypes.ADTS_STREAM_TYPE:
  101393. stream2 = audio;
  101394. streamType = "audio";
  101395. break;
  101396. case streamTypes.METADATA_STREAM_TYPE:
  101397. stream2 = timedMetadata;
  101398. streamType = "timed-metadata";
  101399. break;
  101400. default:
  101401. return;
  101402. }
  101403. if (data.payloadUnitStartIndicator) {
  101404. flushStream(stream2, streamType, true);
  101405. }
  101406. stream2.data.push(data);
  101407. stream2.size += data.data.byteLength;
  101408. },
  101409. pmt: function pmt() {
  101410. var event2 = {
  101411. type: "metadata",
  101412. tracks: []
  101413. };
  101414. programMapTable = data.programMapTable;
  101415. if (programMapTable.video !== null) {
  101416. event2.tracks.push({
  101417. timelineStartInfo: {
  101418. baseMediaDecodeTime: 0
  101419. },
  101420. id: +programMapTable.video,
  101421. codec: "avc",
  101422. type: "video"
  101423. });
  101424. }
  101425. if (programMapTable.audio !== null) {
  101426. event2.tracks.push({
  101427. timelineStartInfo: {
  101428. baseMediaDecodeTime: 0
  101429. },
  101430. id: +programMapTable.audio,
  101431. codec: "adts",
  101432. type: "audio"
  101433. });
  101434. }
  101435. segmentHadPmt = true;
  101436. self2.trigger("data", event2);
  101437. }
  101438. })[data.type]();
  101439. };
  101440. this.reset = function() {
  101441. video.size = 0;
  101442. video.data.length = 0;
  101443. audio.size = 0;
  101444. audio.data.length = 0;
  101445. this.trigger("reset");
  101446. };
  101447. this.flushStreams_ = function() {
  101448. flushStream(video, "video");
  101449. flushStream(audio, "audio");
  101450. flushStream(timedMetadata, "timed-metadata");
  101451. };
  101452. this.flush = function() {
  101453. if (!segmentHadPmt && programMapTable) {
  101454. var pmt = {
  101455. type: "metadata",
  101456. tracks: []
  101457. };
  101458. if (programMapTable.video !== null) {
  101459. pmt.tracks.push({
  101460. timelineStartInfo: {
  101461. baseMediaDecodeTime: 0
  101462. },
  101463. id: +programMapTable.video,
  101464. codec: "avc",
  101465. type: "video"
  101466. });
  101467. }
  101468. if (programMapTable.audio !== null) {
  101469. pmt.tracks.push({
  101470. timelineStartInfo: {
  101471. baseMediaDecodeTime: 0
  101472. },
  101473. id: +programMapTable.audio,
  101474. codec: "adts",
  101475. type: "audio"
  101476. });
  101477. }
  101478. self2.trigger("data", pmt);
  101479. }
  101480. segmentHadPmt = false;
  101481. this.flushStreams_();
  101482. this.trigger("done");
  101483. };
  101484. };
  101485. _ElementaryStream.prototype = new stream();
  101486. var m2ts = {
  101487. PAT_PID: 0,
  101488. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  101489. TransportPacketStream: _TransportPacketStream,
  101490. TransportParseStream: _TransportParseStream,
  101491. ElementaryStream: _ElementaryStream,
  101492. TimestampRolloverStream,
  101493. CaptionStream: captionStream.CaptionStream,
  101494. Cea608Stream: captionStream.Cea608Stream,
  101495. Cea708Stream: captionStream.Cea708Stream,
  101496. MetadataStream: metadataStream
  101497. };
  101498. for (var type2 in streamTypes) {
  101499. if (streamTypes.hasOwnProperty(type2)) {
  101500. m2ts[type2] = streamTypes[type2];
  101501. }
  101502. }
  101503. var m2ts_1 = m2ts;
  101504. var ONE_SECOND_IN_TS$2 = clock2.ONE_SECOND_IN_TS;
  101505. var _AdtsStream;
  101506. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  101507. _AdtsStream = function AdtsStream(handlePartialSegments) {
  101508. var buffer, frameNum = 0;
  101509. _AdtsStream.prototype.init.call(this);
  101510. this.skipWarn_ = function(start2, end) {
  101511. this.trigger("log", {
  101512. level: "warn",
  101513. message: "adts skiping bytes " + start2 + " to " + end + " in frame " + frameNum + " outside syncword"
  101514. });
  101515. };
  101516. this.push = function(packet) {
  101517. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  101518. if (!handlePartialSegments) {
  101519. frameNum = 0;
  101520. }
  101521. if (packet.type !== "audio") {
  101522. return;
  101523. }
  101524. if (buffer && buffer.length) {
  101525. oldBuffer = buffer;
  101526. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  101527. buffer.set(oldBuffer);
  101528. buffer.set(packet.data, oldBuffer.byteLength);
  101529. } else {
  101530. buffer = packet.data;
  101531. }
  101532. var skip;
  101533. while (i2 + 7 < buffer.length) {
  101534. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  101535. if (typeof skip !== "number") {
  101536. skip = i2;
  101537. }
  101538. i2++;
  101539. continue;
  101540. }
  101541. if (typeof skip === "number") {
  101542. this.skipWarn_(skip, i2);
  101543. skip = null;
  101544. }
  101545. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  101546. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  101547. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  101548. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  101549. if (buffer.byteLength - i2 < frameLength) {
  101550. break;
  101551. }
  101552. this.trigger("data", {
  101553. pts: packet.pts + frameNum * adtsFrameDuration,
  101554. dts: packet.dts + frameNum * adtsFrameDuration,
  101555. sampleCount,
  101556. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  101557. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  101558. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  101559. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  101560. samplesize: 16,
  101561. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  101562. });
  101563. frameNum++;
  101564. i2 += frameLength;
  101565. }
  101566. if (typeof skip === "number") {
  101567. this.skipWarn_(skip, i2);
  101568. skip = null;
  101569. }
  101570. buffer = buffer.subarray(i2);
  101571. };
  101572. this.flush = function() {
  101573. frameNum = 0;
  101574. this.trigger("done");
  101575. };
  101576. this.reset = function() {
  101577. buffer = void 0;
  101578. this.trigger("reset");
  101579. };
  101580. this.endTimeline = function() {
  101581. buffer = void 0;
  101582. this.trigger("endedtimeline");
  101583. };
  101584. };
  101585. _AdtsStream.prototype = new stream();
  101586. var adts = _AdtsStream;
  101587. var ExpGolomb;
  101588. ExpGolomb = function ExpGolomb2(workingData) {
  101589. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  101590. this.length = function() {
  101591. return 8 * workingBytesAvailable;
  101592. };
  101593. this.bitsAvailable = function() {
  101594. return 8 * workingBytesAvailable + workingBitsAvailable;
  101595. };
  101596. this.loadWord = function() {
  101597. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  101598. if (availableBytes === 0) {
  101599. throw new Error("no bytes available");
  101600. }
  101601. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  101602. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  101603. workingBitsAvailable = availableBytes * 8;
  101604. workingBytesAvailable -= availableBytes;
  101605. };
  101606. this.skipBits = function(count) {
  101607. var skipBytes;
  101608. if (workingBitsAvailable > count) {
  101609. workingWord <<= count;
  101610. workingBitsAvailable -= count;
  101611. } else {
  101612. count -= workingBitsAvailable;
  101613. skipBytes = Math.floor(count / 8);
  101614. count -= skipBytes * 8;
  101615. workingBytesAvailable -= skipBytes;
  101616. this.loadWord();
  101617. workingWord <<= count;
  101618. workingBitsAvailable -= count;
  101619. }
  101620. };
  101621. this.readBits = function(size) {
  101622. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  101623. workingBitsAvailable -= bits;
  101624. if (workingBitsAvailable > 0) {
  101625. workingWord <<= bits;
  101626. } else if (workingBytesAvailable > 0) {
  101627. this.loadWord();
  101628. }
  101629. bits = size - bits;
  101630. if (bits > 0) {
  101631. return valu << bits | this.readBits(bits);
  101632. }
  101633. return valu;
  101634. };
  101635. this.skipLeadingZeros = function() {
  101636. var leadingZeroCount;
  101637. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  101638. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  101639. workingWord <<= leadingZeroCount;
  101640. workingBitsAvailable -= leadingZeroCount;
  101641. return leadingZeroCount;
  101642. }
  101643. }
  101644. this.loadWord();
  101645. return leadingZeroCount + this.skipLeadingZeros();
  101646. };
  101647. this.skipUnsignedExpGolomb = function() {
  101648. this.skipBits(1 + this.skipLeadingZeros());
  101649. };
  101650. this.skipExpGolomb = function() {
  101651. this.skipBits(1 + this.skipLeadingZeros());
  101652. };
  101653. this.readUnsignedExpGolomb = function() {
  101654. var clz = this.skipLeadingZeros();
  101655. return this.readBits(clz + 1) - 1;
  101656. };
  101657. this.readExpGolomb = function() {
  101658. var valu = this.readUnsignedExpGolomb();
  101659. if (1 & valu) {
  101660. return 1 + valu >>> 1;
  101661. }
  101662. return -1 * (valu >>> 1);
  101663. };
  101664. this.readBoolean = function() {
  101665. return this.readBits(1) === 1;
  101666. };
  101667. this.readUnsignedByte = function() {
  101668. return this.readBits(8);
  101669. };
  101670. this.loadWord();
  101671. };
  101672. var expGolomb = ExpGolomb;
  101673. var _H264Stream, _NalByteStream;
  101674. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  101675. _NalByteStream = function NalByteStream() {
  101676. var syncPoint = 0, i2, buffer;
  101677. _NalByteStream.prototype.init.call(this);
  101678. this.push = function(data) {
  101679. var swapBuffer;
  101680. if (!buffer) {
  101681. buffer = data.data;
  101682. } else {
  101683. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  101684. swapBuffer.set(buffer);
  101685. swapBuffer.set(data.data, buffer.byteLength);
  101686. buffer = swapBuffer;
  101687. }
  101688. var len = buffer.byteLength;
  101689. for (; syncPoint < len - 3; syncPoint++) {
  101690. if (buffer[syncPoint + 2] === 1) {
  101691. i2 = syncPoint + 5;
  101692. break;
  101693. }
  101694. }
  101695. while (i2 < len) {
  101696. switch (buffer[i2]) {
  101697. case 0:
  101698. if (buffer[i2 - 1] !== 0) {
  101699. i2 += 2;
  101700. break;
  101701. } else if (buffer[i2 - 2] !== 0) {
  101702. i2++;
  101703. break;
  101704. }
  101705. if (syncPoint + 3 !== i2 - 2) {
  101706. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101707. }
  101708. do {
  101709. i2++;
  101710. } while (buffer[i2] !== 1 && i2 < len);
  101711. syncPoint = i2 - 2;
  101712. i2 += 3;
  101713. break;
  101714. case 1:
  101715. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  101716. i2 += 3;
  101717. break;
  101718. }
  101719. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101720. syncPoint = i2 - 2;
  101721. i2 += 3;
  101722. break;
  101723. default:
  101724. i2 += 3;
  101725. break;
  101726. }
  101727. }
  101728. buffer = buffer.subarray(syncPoint);
  101729. i2 -= syncPoint;
  101730. syncPoint = 0;
  101731. };
  101732. this.reset = function() {
  101733. buffer = null;
  101734. syncPoint = 0;
  101735. this.trigger("reset");
  101736. };
  101737. this.flush = function() {
  101738. if (buffer && buffer.byteLength > 3) {
  101739. this.trigger("data", buffer.subarray(syncPoint + 3));
  101740. }
  101741. buffer = null;
  101742. syncPoint = 0;
  101743. this.trigger("done");
  101744. };
  101745. this.endTimeline = function() {
  101746. this.flush();
  101747. this.trigger("endedtimeline");
  101748. };
  101749. };
  101750. _NalByteStream.prototype = new stream();
  101751. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  101752. 100: true,
  101753. 110: true,
  101754. 122: true,
  101755. 244: true,
  101756. 44: true,
  101757. 83: true,
  101758. 86: true,
  101759. 118: true,
  101760. 128: true,
  101761. 138: true,
  101762. 139: true,
  101763. 134: true
  101764. };
  101765. _H264Stream = function H264Stream2() {
  101766. var nalByteStream = new _NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  101767. _H264Stream.prototype.init.call(this);
  101768. self2 = this;
  101769. this.push = function(packet) {
  101770. if (packet.type !== "video") {
  101771. return;
  101772. }
  101773. trackId = packet.trackId;
  101774. currentPts = packet.pts;
  101775. currentDts = packet.dts;
  101776. nalByteStream.push(packet);
  101777. };
  101778. nalByteStream.on("data", function(data) {
  101779. var event2 = {
  101780. trackId,
  101781. pts: currentPts,
  101782. dts: currentDts,
  101783. data,
  101784. nalUnitTypeCode: data[0] & 31
  101785. };
  101786. switch (event2.nalUnitTypeCode) {
  101787. case 5:
  101788. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  101789. break;
  101790. case 6:
  101791. event2.nalUnitType = "sei_rbsp";
  101792. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101793. break;
  101794. case 7:
  101795. event2.nalUnitType = "seq_parameter_set_rbsp";
  101796. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101797. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  101798. break;
  101799. case 8:
  101800. event2.nalUnitType = "pic_parameter_set_rbsp";
  101801. break;
  101802. case 9:
  101803. event2.nalUnitType = "access_unit_delimiter_rbsp";
  101804. break;
  101805. }
  101806. self2.trigger("data", event2);
  101807. });
  101808. nalByteStream.on("done", function() {
  101809. self2.trigger("done");
  101810. });
  101811. nalByteStream.on("partialdone", function() {
  101812. self2.trigger("partialdone");
  101813. });
  101814. nalByteStream.on("reset", function() {
  101815. self2.trigger("reset");
  101816. });
  101817. nalByteStream.on("endedtimeline", function() {
  101818. self2.trigger("endedtimeline");
  101819. });
  101820. this.flush = function() {
  101821. nalByteStream.flush();
  101822. };
  101823. this.partialFlush = function() {
  101824. nalByteStream.partialFlush();
  101825. };
  101826. this.reset = function() {
  101827. nalByteStream.reset();
  101828. };
  101829. this.endTimeline = function() {
  101830. nalByteStream.endTimeline();
  101831. };
  101832. skipScalingList = function skipScalingList2(count, expGolombDecoder) {
  101833. var lastScale = 8, nextScale = 8, j, deltaScale;
  101834. for (j = 0; j < count; j++) {
  101835. if (nextScale !== 0) {
  101836. deltaScale = expGolombDecoder.readExpGolomb();
  101837. nextScale = (lastScale + deltaScale + 256) % 256;
  101838. }
  101839. lastScale = nextScale === 0 ? lastScale : nextScale;
  101840. }
  101841. };
  101842. discardEmulationPreventionBytes5 = function discardEmulationPreventionBytes6(data) {
  101843. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  101844. while (i2 < length - 2) {
  101845. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  101846. emulationPreventionBytesPositions.push(i2 + 2);
  101847. i2 += 2;
  101848. } else {
  101849. i2++;
  101850. }
  101851. }
  101852. if (emulationPreventionBytesPositions.length === 0) {
  101853. return data;
  101854. }
  101855. newLength = length - emulationPreventionBytesPositions.length;
  101856. newData = new Uint8Array(newLength);
  101857. var sourceIndex = 0;
  101858. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  101859. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  101860. sourceIndex++;
  101861. emulationPreventionBytesPositions.shift();
  101862. }
  101863. newData[i2] = data[sourceIndex];
  101864. }
  101865. return newData;
  101866. };
  101867. readSequenceParameterSet = function readSequenceParameterSet2(data) {
  101868. 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;
  101869. expGolombDecoder = new expGolomb(data);
  101870. profileIdc = expGolombDecoder.readUnsignedByte();
  101871. profileCompatibility = expGolombDecoder.readUnsignedByte();
  101872. levelIdc = expGolombDecoder.readUnsignedByte();
  101873. expGolombDecoder.skipUnsignedExpGolomb();
  101874. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  101875. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  101876. if (chromaFormatIdc === 3) {
  101877. expGolombDecoder.skipBits(1);
  101878. }
  101879. expGolombDecoder.skipUnsignedExpGolomb();
  101880. expGolombDecoder.skipUnsignedExpGolomb();
  101881. expGolombDecoder.skipBits(1);
  101882. if (expGolombDecoder.readBoolean()) {
  101883. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  101884. for (i2 = 0; i2 < scalingListCount; i2++) {
  101885. if (expGolombDecoder.readBoolean()) {
  101886. if (i2 < 6) {
  101887. skipScalingList(16, expGolombDecoder);
  101888. } else {
  101889. skipScalingList(64, expGolombDecoder);
  101890. }
  101891. }
  101892. }
  101893. }
  101894. }
  101895. expGolombDecoder.skipUnsignedExpGolomb();
  101896. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  101897. if (picOrderCntType === 0) {
  101898. expGolombDecoder.readUnsignedExpGolomb();
  101899. } else if (picOrderCntType === 1) {
  101900. expGolombDecoder.skipBits(1);
  101901. expGolombDecoder.skipExpGolomb();
  101902. expGolombDecoder.skipExpGolomb();
  101903. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  101904. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  101905. expGolombDecoder.skipExpGolomb();
  101906. }
  101907. }
  101908. expGolombDecoder.skipUnsignedExpGolomb();
  101909. expGolombDecoder.skipBits(1);
  101910. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101911. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101912. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  101913. if (frameMbsOnlyFlag === 0) {
  101914. expGolombDecoder.skipBits(1);
  101915. }
  101916. expGolombDecoder.skipBits(1);
  101917. if (expGolombDecoder.readBoolean()) {
  101918. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  101919. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  101920. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  101921. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  101922. }
  101923. if (expGolombDecoder.readBoolean()) {
  101924. if (expGolombDecoder.readBoolean()) {
  101925. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  101926. switch (aspectRatioIdc) {
  101927. case 1:
  101928. sarRatio = [1, 1];
  101929. break;
  101930. case 2:
  101931. sarRatio = [12, 11];
  101932. break;
  101933. case 3:
  101934. sarRatio = [10, 11];
  101935. break;
  101936. case 4:
  101937. sarRatio = [16, 11];
  101938. break;
  101939. case 5:
  101940. sarRatio = [40, 33];
  101941. break;
  101942. case 6:
  101943. sarRatio = [24, 11];
  101944. break;
  101945. case 7:
  101946. sarRatio = [20, 11];
  101947. break;
  101948. case 8:
  101949. sarRatio = [32, 11];
  101950. break;
  101951. case 9:
  101952. sarRatio = [80, 33];
  101953. break;
  101954. case 10:
  101955. sarRatio = [18, 11];
  101956. break;
  101957. case 11:
  101958. sarRatio = [15, 11];
  101959. break;
  101960. case 12:
  101961. sarRatio = [64, 33];
  101962. break;
  101963. case 13:
  101964. sarRatio = [160, 99];
  101965. break;
  101966. case 14:
  101967. sarRatio = [4, 3];
  101968. break;
  101969. case 15:
  101970. sarRatio = [3, 2];
  101971. break;
  101972. case 16:
  101973. sarRatio = [2, 1];
  101974. break;
  101975. case 255: {
  101976. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  101977. break;
  101978. }
  101979. }
  101980. if (sarRatio) {
  101981. sarRatio[0] / sarRatio[1];
  101982. }
  101983. }
  101984. }
  101985. return {
  101986. profileIdc,
  101987. levelIdc,
  101988. profileCompatibility,
  101989. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  101990. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  101991. sarRatio
  101992. };
  101993. };
  101994. };
  101995. _H264Stream.prototype = new stream();
  101996. var h2643 = {
  101997. H264Stream: _H264Stream,
  101998. NalByteStream: _NalByteStream
  101999. };
  102000. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  102001. var parseId3TagSize = function parseId3TagSize2(header, byteIndex) {
  102002. 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;
  102003. returnSize = returnSize >= 0 ? returnSize : 0;
  102004. if (footerPresent) {
  102005. return returnSize + 20;
  102006. }
  102007. return returnSize + 10;
  102008. };
  102009. var getId3Offset4 = function getId3Offset5(data, offset) {
  102010. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  102011. return offset;
  102012. }
  102013. offset += parseId3TagSize(data, offset);
  102014. return getId3Offset5(data, offset);
  102015. };
  102016. var isLikelyAacData$1 = function isLikelyAacData2(data) {
  102017. var offset = getId3Offset4(data, 0);
  102018. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  102019. };
  102020. var parseSyncSafeInteger = function parseSyncSafeInteger2(data) {
  102021. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  102022. };
  102023. var percentEncode = function percentEncode2(bytes, start2, end) {
  102024. var i2, result = "";
  102025. for (i2 = start2; i2 < end; i2++) {
  102026. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  102027. }
  102028. return result;
  102029. };
  102030. var parseIso88591 = function parseIso885912(bytes, start2, end) {
  102031. return unescape(percentEncode(bytes, start2, end));
  102032. };
  102033. var parseAdtsSize = function parseAdtsSize2(header, byteIndex) {
  102034. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  102035. return highTwo | middle | lowThree;
  102036. };
  102037. var parseType$2 = function parseType2(header, byteIndex) {
  102038. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  102039. return "timed-metadata";
  102040. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  102041. return "audio";
  102042. }
  102043. return null;
  102044. };
  102045. var parseSampleRate = function parseSampleRate2(packet) {
  102046. var i2 = 0;
  102047. while (i2 + 5 < packet.length) {
  102048. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  102049. i2++;
  102050. continue;
  102051. }
  102052. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  102053. }
  102054. return null;
  102055. };
  102056. var parseAacTimestamp = function parseAacTimestamp2(packet) {
  102057. var frameStart, frameSize, frame, frameHeader;
  102058. frameStart = 10;
  102059. if (packet[5] & 64) {
  102060. frameStart += 4;
  102061. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  102062. }
  102063. do {
  102064. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  102065. if (frameSize < 1) {
  102066. return null;
  102067. }
  102068. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  102069. if (frameHeader === "PRIV") {
  102070. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  102071. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  102072. if (frame[i2] === 0) {
  102073. var owner = parseIso88591(frame, 0, i2);
  102074. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  102075. var d2 = frame.subarray(i2 + 1);
  102076. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  102077. size *= 4;
  102078. size += d2[7] & 3;
  102079. return size;
  102080. }
  102081. break;
  102082. }
  102083. }
  102084. }
  102085. frameStart += 10;
  102086. frameStart += frameSize;
  102087. } while (frameStart < packet.byteLength);
  102088. return null;
  102089. };
  102090. var utils2 = {
  102091. isLikelyAacData: isLikelyAacData$1,
  102092. parseId3TagSize,
  102093. parseAdtsSize,
  102094. parseType: parseType$2,
  102095. parseSampleRate,
  102096. parseAacTimestamp
  102097. };
  102098. var _AacStream;
  102099. _AacStream = function AacStream() {
  102100. var everything = new Uint8Array(), timeStamp = 0;
  102101. _AacStream.prototype.init.call(this);
  102102. this.setTimestamp = function(timestamp) {
  102103. timeStamp = timestamp;
  102104. };
  102105. this.push = function(bytes) {
  102106. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  102107. if (everything.length) {
  102108. tempLength = everything.length;
  102109. everything = new Uint8Array(bytes.byteLength + tempLength);
  102110. everything.set(everything.subarray(0, tempLength));
  102111. everything.set(bytes, tempLength);
  102112. } else {
  102113. everything = bytes;
  102114. }
  102115. while (everything.length - byteIndex >= 3) {
  102116. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  102117. if (everything.length - byteIndex < 10) {
  102118. break;
  102119. }
  102120. frameSize = utils2.parseId3TagSize(everything, byteIndex);
  102121. if (byteIndex + frameSize > everything.length) {
  102122. break;
  102123. }
  102124. chunk = {
  102125. type: "timed-metadata",
  102126. data: everything.subarray(byteIndex, byteIndex + frameSize)
  102127. };
  102128. this.trigger("data", chunk);
  102129. byteIndex += frameSize;
  102130. continue;
  102131. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  102132. if (everything.length - byteIndex < 7) {
  102133. break;
  102134. }
  102135. frameSize = utils2.parseAdtsSize(everything, byteIndex);
  102136. if (byteIndex + frameSize > everything.length) {
  102137. break;
  102138. }
  102139. packet = {
  102140. type: "audio",
  102141. data: everything.subarray(byteIndex, byteIndex + frameSize),
  102142. pts: timeStamp,
  102143. dts: timeStamp
  102144. };
  102145. this.trigger("data", packet);
  102146. byteIndex += frameSize;
  102147. continue;
  102148. }
  102149. byteIndex++;
  102150. }
  102151. bytesLeft = everything.length - byteIndex;
  102152. if (bytesLeft > 0) {
  102153. everything = everything.subarray(byteIndex);
  102154. } else {
  102155. everything = new Uint8Array();
  102156. }
  102157. };
  102158. this.reset = function() {
  102159. everything = new Uint8Array();
  102160. this.trigger("reset");
  102161. };
  102162. this.endTimeline = function() {
  102163. everything = new Uint8Array();
  102164. this.trigger("endedtimeline");
  102165. };
  102166. };
  102167. _AacStream.prototype = new stream();
  102168. var aac3 = _AacStream;
  102169. var AUDIO_PROPERTIES = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  102170. var audioProperties = AUDIO_PROPERTIES;
  102171. var VIDEO_PROPERTIES = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  102172. var videoProperties = VIDEO_PROPERTIES;
  102173. var H264Stream = h2643.H264Stream;
  102174. var isLikelyAacData = utils2.isLikelyAacData;
  102175. var ONE_SECOND_IN_TS$12 = clock2.ONE_SECOND_IN_TS;
  102176. var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream;
  102177. var retriggerForStream = function retriggerForStream2(key, event2) {
  102178. event2.stream = key;
  102179. this.trigger("log", event2);
  102180. };
  102181. var addPipelineLogRetriggers = function addPipelineLogRetriggers2(transmuxer2, pipeline) {
  102182. var keys3 = Object.keys(pipeline);
  102183. for (var i2 = 0; i2 < keys3.length; i2++) {
  102184. var key = keys3[i2];
  102185. if (key === "headOfPipeline" || !pipeline[key].on) {
  102186. continue;
  102187. }
  102188. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  102189. }
  102190. };
  102191. var arrayEquals = function arrayEquals2(a, b) {
  102192. var i2;
  102193. if (a.length !== b.length) {
  102194. return false;
  102195. }
  102196. for (i2 = 0; i2 < a.length; i2++) {
  102197. if (a[i2] !== b[i2]) {
  102198. return false;
  102199. }
  102200. }
  102201. return true;
  102202. };
  102203. var generateSegmentTimingInfo = function generateSegmentTimingInfo2(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  102204. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  102205. return {
  102206. start: {
  102207. dts: baseMediaDecodeTime,
  102208. pts: baseMediaDecodeTime + ptsOffsetFromDts
  102209. },
  102210. end: {
  102211. dts: baseMediaDecodeTime + decodeDuration,
  102212. pts: baseMediaDecodeTime + presentationDuration
  102213. },
  102214. prependedContentDuration,
  102215. baseMediaDecodeTime
  102216. };
  102217. };
  102218. _AudioSegmentStream = function AudioSegmentStream(track, options2) {
  102219. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  102220. options2 = options2 || {};
  102221. sequenceNumber = options2.firstSequenceNumber || 0;
  102222. _AudioSegmentStream.prototype.init.call(this);
  102223. this.push = function(data) {
  102224. trackDecodeInfo.collectDtsInfo(track, data);
  102225. if (track) {
  102226. audioProperties.forEach(function(prop) {
  102227. track[prop] = data[prop];
  102228. });
  102229. }
  102230. adtsFrames.push(data);
  102231. };
  102232. this.setEarliestDts = function(earliestDts) {
  102233. earliestAllowedDts = earliestDts;
  102234. };
  102235. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102236. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  102237. };
  102238. this.setAudioAppendStart = function(timestamp) {
  102239. audioAppendStartTs = timestamp;
  102240. };
  102241. this.flush = function() {
  102242. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  102243. if (adtsFrames.length === 0) {
  102244. this.trigger("done", "AudioSegmentStream");
  102245. return;
  102246. }
  102247. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  102248. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102249. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  102250. track.samples = audioFrameUtils.generateSampleTable(frames);
  102251. mdat2 = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames));
  102252. adtsFrames = [];
  102253. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102254. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102255. sequenceNumber++;
  102256. boxes.set(moof2);
  102257. boxes.set(mdat2, moof2.byteLength);
  102258. trackDecodeInfo.clearDtsInfo(track);
  102259. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  102260. if (frames.length) {
  102261. segmentDuration = frames.length * frameDuration;
  102262. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  102263. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  102264. frames[0].dts,
  102265. frames[0].pts,
  102266. frames[0].dts + segmentDuration,
  102267. frames[0].pts + segmentDuration,
  102268. videoClockCyclesOfSilencePrefixed || 0
  102269. ));
  102270. this.trigger("timingInfo", {
  102271. start: frames[0].pts,
  102272. end: frames[0].pts + segmentDuration
  102273. });
  102274. }
  102275. this.trigger("data", {
  102276. track,
  102277. boxes
  102278. });
  102279. this.trigger("done", "AudioSegmentStream");
  102280. };
  102281. this.reset = function() {
  102282. trackDecodeInfo.clearDtsInfo(track);
  102283. adtsFrames = [];
  102284. this.trigger("reset");
  102285. };
  102286. };
  102287. _AudioSegmentStream.prototype = new stream();
  102288. _VideoSegmentStream = function VideoSegmentStream(track, options2) {
  102289. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  102290. options2 = options2 || {};
  102291. sequenceNumber = options2.firstSequenceNumber || 0;
  102292. _VideoSegmentStream.prototype.init.call(this);
  102293. delete track.minPTS;
  102294. this.gopCache_ = [];
  102295. this.push = function(nalUnit) {
  102296. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  102297. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  102298. config = nalUnit.config;
  102299. track.sps = [nalUnit.data];
  102300. videoProperties.forEach(function(prop) {
  102301. track[prop] = config[prop];
  102302. }, this);
  102303. }
  102304. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  102305. pps = nalUnit.data;
  102306. track.pps = [nalUnit.data];
  102307. }
  102308. nalUnits.push(nalUnit);
  102309. };
  102310. this.flush = function() {
  102311. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  102312. while (nalUnits.length) {
  102313. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  102314. break;
  102315. }
  102316. nalUnits.shift();
  102317. }
  102318. if (nalUnits.length === 0) {
  102319. this.resetStream_();
  102320. this.trigger("done", "VideoSegmentStream");
  102321. return;
  102322. }
  102323. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  102324. gops = frameUtils.groupFramesIntoGops(frames);
  102325. if (!gops[0][0].keyFrame) {
  102326. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  102327. if (gopForFusion) {
  102328. prependedContentDuration = gopForFusion.duration;
  102329. gops.unshift(gopForFusion);
  102330. gops.byteLength += gopForFusion.byteLength;
  102331. gops.nalCount += gopForFusion.nalCount;
  102332. gops.pts = gopForFusion.pts;
  102333. gops.dts = gopForFusion.dts;
  102334. gops.duration += gopForFusion.duration;
  102335. } else {
  102336. gops = frameUtils.extendFirstKeyFrame(gops);
  102337. }
  102338. }
  102339. if (gopsToAlignWith.length) {
  102340. var alignedGops;
  102341. if (options2.alignGopsAtEnd) {
  102342. alignedGops = this.alignGopsAtEnd_(gops);
  102343. } else {
  102344. alignedGops = this.alignGopsAtStart_(gops);
  102345. }
  102346. if (!alignedGops) {
  102347. this.gopCache_.unshift({
  102348. gop: gops.pop(),
  102349. pps: track.pps,
  102350. sps: track.sps
  102351. });
  102352. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102353. nalUnits = [];
  102354. this.resetStream_();
  102355. this.trigger("done", "VideoSegmentStream");
  102356. return;
  102357. }
  102358. trackDecodeInfo.clearDtsInfo(track);
  102359. gops = alignedGops;
  102360. }
  102361. trackDecodeInfo.collectDtsInfo(track, gops);
  102362. track.samples = frameUtils.generateSampleTable(gops);
  102363. mdat2 = mp4Generator.mdat(frameUtils.concatenateNalData(gops));
  102364. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102365. this.trigger("processedGopsInfo", gops.map(function(gop) {
  102366. return {
  102367. pts: gop.pts,
  102368. dts: gop.dts,
  102369. byteLength: gop.byteLength
  102370. };
  102371. }));
  102372. firstGop = gops[0];
  102373. lastGop = gops[gops.length - 1];
  102374. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  102375. this.trigger("timingInfo", {
  102376. start: gops[0].pts,
  102377. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  102378. });
  102379. this.gopCache_.unshift({
  102380. gop: gops.pop(),
  102381. pps: track.pps,
  102382. sps: track.sps
  102383. });
  102384. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102385. nalUnits = [];
  102386. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  102387. this.trigger("timelineStartInfo", track.timelineStartInfo);
  102388. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102389. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102390. sequenceNumber++;
  102391. boxes.set(moof2);
  102392. boxes.set(mdat2, moof2.byteLength);
  102393. this.trigger("data", {
  102394. track,
  102395. boxes
  102396. });
  102397. this.resetStream_();
  102398. this.trigger("done", "VideoSegmentStream");
  102399. };
  102400. this.reset = function() {
  102401. this.resetStream_();
  102402. nalUnits = [];
  102403. this.gopCache_.length = 0;
  102404. gopsToAlignWith.length = 0;
  102405. this.trigger("reset");
  102406. };
  102407. this.resetStream_ = function() {
  102408. trackDecodeInfo.clearDtsInfo(track);
  102409. config = void 0;
  102410. pps = void 0;
  102411. };
  102412. this.getGopForFusion_ = function(nalUnit) {
  102413. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  102414. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  102415. currentGopObj = this.gopCache_[i2];
  102416. currentGop = currentGopObj.gop;
  102417. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  102418. continue;
  102419. }
  102420. if (currentGop.dts < track.timelineStartInfo.dts) {
  102421. continue;
  102422. }
  102423. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  102424. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  102425. if (!nearestGopObj || nearestDistance > dtsDistance) {
  102426. nearestGopObj = currentGopObj;
  102427. nearestDistance = dtsDistance;
  102428. }
  102429. }
  102430. }
  102431. if (nearestGopObj) {
  102432. return nearestGopObj.gop;
  102433. }
  102434. return null;
  102435. };
  102436. this.alignGopsAtStart_ = function(gops) {
  102437. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  102438. byteLength = gops.byteLength;
  102439. nalCount = gops.nalCount;
  102440. duration5 = gops.duration;
  102441. alignIndex = gopIndex = 0;
  102442. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  102443. align = gopsToAlignWith[alignIndex];
  102444. gop = gops[gopIndex];
  102445. if (align.pts === gop.pts) {
  102446. break;
  102447. }
  102448. if (gop.pts > align.pts) {
  102449. alignIndex++;
  102450. continue;
  102451. }
  102452. gopIndex++;
  102453. byteLength -= gop.byteLength;
  102454. nalCount -= gop.nalCount;
  102455. duration5 -= gop.duration;
  102456. }
  102457. if (gopIndex === 0) {
  102458. return gops;
  102459. }
  102460. if (gopIndex === gops.length) {
  102461. return null;
  102462. }
  102463. alignedGops = gops.slice(gopIndex);
  102464. alignedGops.byteLength = byteLength;
  102465. alignedGops.duration = duration5;
  102466. alignedGops.nalCount = nalCount;
  102467. alignedGops.pts = alignedGops[0].pts;
  102468. alignedGops.dts = alignedGops[0].dts;
  102469. return alignedGops;
  102470. };
  102471. this.alignGopsAtEnd_ = function(gops) {
  102472. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  102473. alignIndex = gopsToAlignWith.length - 1;
  102474. gopIndex = gops.length - 1;
  102475. alignEndIndex = null;
  102476. matchFound = false;
  102477. while (alignIndex >= 0 && gopIndex >= 0) {
  102478. align = gopsToAlignWith[alignIndex];
  102479. gop = gops[gopIndex];
  102480. if (align.pts === gop.pts) {
  102481. matchFound = true;
  102482. break;
  102483. }
  102484. if (align.pts > gop.pts) {
  102485. alignIndex--;
  102486. continue;
  102487. }
  102488. if (alignIndex === gopsToAlignWith.length - 1) {
  102489. alignEndIndex = gopIndex;
  102490. }
  102491. gopIndex--;
  102492. }
  102493. if (!matchFound && alignEndIndex === null) {
  102494. return null;
  102495. }
  102496. var trimIndex;
  102497. if (matchFound) {
  102498. trimIndex = gopIndex;
  102499. } else {
  102500. trimIndex = alignEndIndex;
  102501. }
  102502. if (trimIndex === 0) {
  102503. return gops;
  102504. }
  102505. var alignedGops = gops.slice(trimIndex);
  102506. var metadata = alignedGops.reduce(function(total, gop2) {
  102507. total.byteLength += gop2.byteLength;
  102508. total.duration += gop2.duration;
  102509. total.nalCount += gop2.nalCount;
  102510. return total;
  102511. }, {
  102512. byteLength: 0,
  102513. duration: 0,
  102514. nalCount: 0
  102515. });
  102516. alignedGops.byteLength = metadata.byteLength;
  102517. alignedGops.duration = metadata.duration;
  102518. alignedGops.nalCount = metadata.nalCount;
  102519. alignedGops.pts = alignedGops[0].pts;
  102520. alignedGops.dts = alignedGops[0].dts;
  102521. return alignedGops;
  102522. };
  102523. this.alignGopsWith = function(newGopsToAlignWith) {
  102524. gopsToAlignWith = newGopsToAlignWith;
  102525. };
  102526. };
  102527. _VideoSegmentStream.prototype = new stream();
  102528. _CoalesceStream = function CoalesceStream(options2, metadataStream2) {
  102529. this.numberOfTracks = 0;
  102530. this.metadataStream = metadataStream2;
  102531. options2 = options2 || {};
  102532. if (typeof options2.remux !== "undefined") {
  102533. this.remuxTracks = !!options2.remux;
  102534. } else {
  102535. this.remuxTracks = true;
  102536. }
  102537. if (typeof options2.keepOriginalTimestamps === "boolean") {
  102538. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  102539. } else {
  102540. this.keepOriginalTimestamps = false;
  102541. }
  102542. this.pendingTracks = [];
  102543. this.videoTrack = null;
  102544. this.pendingBoxes = [];
  102545. this.pendingCaptions = [];
  102546. this.pendingMetadata = [];
  102547. this.pendingBytes = 0;
  102548. this.emittedTracks = 0;
  102549. _CoalesceStream.prototype.init.call(this);
  102550. this.push = function(output) {
  102551. if (output.text) {
  102552. return this.pendingCaptions.push(output);
  102553. }
  102554. if (output.frames) {
  102555. return this.pendingMetadata.push(output);
  102556. }
  102557. this.pendingTracks.push(output.track);
  102558. this.pendingBytes += output.boxes.byteLength;
  102559. if (output.track.type === "video") {
  102560. this.videoTrack = output.track;
  102561. this.pendingBoxes.push(output.boxes);
  102562. }
  102563. if (output.track.type === "audio") {
  102564. this.audioTrack = output.track;
  102565. this.pendingBoxes.unshift(output.boxes);
  102566. }
  102567. };
  102568. };
  102569. _CoalesceStream.prototype = new stream();
  102570. _CoalesceStream.prototype.flush = function(flushSource) {
  102571. var offset = 0, event2 = {
  102572. captions: [],
  102573. captionStreams: {},
  102574. metadata: [],
  102575. info: {}
  102576. }, caption, id3, initSegment, timelineStartPts = 0, i2;
  102577. if (this.pendingTracks.length < this.numberOfTracks) {
  102578. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  102579. return;
  102580. } else if (this.remuxTracks) {
  102581. return;
  102582. } else if (this.pendingTracks.length === 0) {
  102583. this.emittedTracks++;
  102584. if (this.emittedTracks >= this.numberOfTracks) {
  102585. this.trigger("done");
  102586. this.emittedTracks = 0;
  102587. }
  102588. return;
  102589. }
  102590. }
  102591. if (this.videoTrack) {
  102592. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  102593. videoProperties.forEach(function(prop) {
  102594. event2.info[prop] = this.videoTrack[prop];
  102595. }, this);
  102596. } else if (this.audioTrack) {
  102597. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  102598. audioProperties.forEach(function(prop) {
  102599. event2.info[prop] = this.audioTrack[prop];
  102600. }, this);
  102601. }
  102602. if (this.videoTrack || this.audioTrack) {
  102603. if (this.pendingTracks.length === 1) {
  102604. event2.type = this.pendingTracks[0].type;
  102605. } else {
  102606. event2.type = "combined";
  102607. }
  102608. this.emittedTracks += this.pendingTracks.length;
  102609. initSegment = mp4Generator.initSegment(this.pendingTracks);
  102610. event2.initSegment = new Uint8Array(initSegment.byteLength);
  102611. event2.initSegment.set(initSegment);
  102612. event2.data = new Uint8Array(this.pendingBytes);
  102613. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  102614. event2.data.set(this.pendingBoxes[i2], offset);
  102615. offset += this.pendingBoxes[i2].byteLength;
  102616. }
  102617. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  102618. caption = this.pendingCaptions[i2];
  102619. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  102620. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  102621. event2.captionStreams[caption.stream] = true;
  102622. event2.captions.push(caption);
  102623. }
  102624. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  102625. id3 = this.pendingMetadata[i2];
  102626. id3.cueTime = clock2.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps);
  102627. event2.metadata.push(id3);
  102628. }
  102629. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  102630. this.pendingTracks.length = 0;
  102631. this.videoTrack = null;
  102632. this.pendingBoxes.length = 0;
  102633. this.pendingCaptions.length = 0;
  102634. this.pendingBytes = 0;
  102635. this.pendingMetadata.length = 0;
  102636. this.trigger("data", event2);
  102637. for (i2 = 0; i2 < event2.captions.length; i2++) {
  102638. caption = event2.captions[i2];
  102639. this.trigger("caption", caption);
  102640. }
  102641. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  102642. id3 = event2.metadata[i2];
  102643. this.trigger("id3Frame", id3);
  102644. }
  102645. }
  102646. if (this.emittedTracks >= this.numberOfTracks) {
  102647. this.trigger("done");
  102648. this.emittedTracks = 0;
  102649. }
  102650. };
  102651. _CoalesceStream.prototype.setRemux = function(val) {
  102652. this.remuxTracks = val;
  102653. };
  102654. _Transmuxer = function Transmuxer(options2) {
  102655. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  102656. _Transmuxer.prototype.init.call(this);
  102657. options2 = options2 || {};
  102658. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  102659. this.transmuxPipeline_ = {};
  102660. this.setupAacPipeline = function() {
  102661. var pipeline = {};
  102662. this.transmuxPipeline_ = pipeline;
  102663. pipeline.type = "aac";
  102664. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102665. pipeline.aacStream = new aac3();
  102666. pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("audio");
  102667. pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("timed-metadata");
  102668. pipeline.adtsStream = new adts();
  102669. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102670. pipeline.headOfPipeline = pipeline.aacStream;
  102671. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  102672. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102673. pipeline.metadataStream.on("timestamp", function(frame) {
  102674. pipeline.aacStream.setTimestamp(frame.timeStamp);
  102675. });
  102676. pipeline.aacStream.on("data", function(data) {
  102677. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  102678. return;
  102679. }
  102680. audioTrack = audioTrack || {
  102681. timelineStartInfo: {
  102682. baseMediaDecodeTime: self2.baseMediaDecodeTime
  102683. },
  102684. codec: "adts",
  102685. type: "audio"
  102686. };
  102687. pipeline.coalesceStream.numberOfTracks++;
  102688. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102689. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102690. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102691. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102692. self2.trigger("trackinfo", {
  102693. hasAudio: !!audioTrack,
  102694. hasVideo: !!videoTrack
  102695. });
  102696. });
  102697. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102698. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102699. addPipelineLogRetriggers(this, pipeline);
  102700. };
  102701. this.setupTsPipeline = function() {
  102702. var pipeline = {};
  102703. this.transmuxPipeline_ = pipeline;
  102704. pipeline.type = "ts";
  102705. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102706. pipeline.packetStream = new m2ts_1.TransportPacketStream();
  102707. pipeline.parseStream = new m2ts_1.TransportParseStream();
  102708. pipeline.elementaryStream = new m2ts_1.ElementaryStream();
  102709. pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream();
  102710. pipeline.adtsStream = new adts();
  102711. pipeline.h264Stream = new H264Stream();
  102712. pipeline.captionStream = new m2ts_1.CaptionStream(options2);
  102713. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102714. pipeline.headOfPipeline = pipeline.packetStream;
  102715. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  102716. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  102717. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  102718. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102719. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  102720. pipeline.elementaryStream.on("data", function(data) {
  102721. var i2;
  102722. if (data.type === "metadata") {
  102723. i2 = data.tracks.length;
  102724. while (i2--) {
  102725. if (!videoTrack && data.tracks[i2].type === "video") {
  102726. videoTrack = data.tracks[i2];
  102727. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102728. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  102729. audioTrack = data.tracks[i2];
  102730. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102731. }
  102732. }
  102733. if (videoTrack && !pipeline.videoSegmentStream) {
  102734. pipeline.coalesceStream.numberOfTracks++;
  102735. pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options2);
  102736. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  102737. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  102738. if (audioTrack && !options2.keepOriginalTimestamps) {
  102739. audioTrack.timelineStartInfo = timelineStartInfo;
  102740. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  102741. }
  102742. });
  102743. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  102744. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  102745. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  102746. if (audioTrack) {
  102747. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  102748. }
  102749. });
  102750. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  102751. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  102752. }
  102753. if (audioTrack && !pipeline.audioSegmentStream) {
  102754. pipeline.coalesceStream.numberOfTracks++;
  102755. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102756. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102757. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102758. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  102759. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102760. }
  102761. self2.trigger("trackinfo", {
  102762. hasAudio: !!audioTrack,
  102763. hasVideo: !!videoTrack
  102764. });
  102765. }
  102766. });
  102767. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102768. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  102769. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  102770. self2.trigger("id3Frame", id3Frame);
  102771. });
  102772. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  102773. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102774. addPipelineLogRetriggers(this, pipeline);
  102775. };
  102776. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102777. var pipeline = this.transmuxPipeline_;
  102778. if (!options2.keepOriginalTimestamps) {
  102779. this.baseMediaDecodeTime = baseMediaDecodeTime;
  102780. }
  102781. if (audioTrack) {
  102782. audioTrack.timelineStartInfo.dts = void 0;
  102783. audioTrack.timelineStartInfo.pts = void 0;
  102784. trackDecodeInfo.clearDtsInfo(audioTrack);
  102785. if (pipeline.audioTimestampRolloverStream) {
  102786. pipeline.audioTimestampRolloverStream.discontinuity();
  102787. }
  102788. }
  102789. if (videoTrack) {
  102790. if (pipeline.videoSegmentStream) {
  102791. pipeline.videoSegmentStream.gopCache_ = [];
  102792. }
  102793. videoTrack.timelineStartInfo.dts = void 0;
  102794. videoTrack.timelineStartInfo.pts = void 0;
  102795. trackDecodeInfo.clearDtsInfo(videoTrack);
  102796. pipeline.captionStream.reset();
  102797. }
  102798. if (pipeline.timestampRolloverStream) {
  102799. pipeline.timestampRolloverStream.discontinuity();
  102800. }
  102801. };
  102802. this.setAudioAppendStart = function(timestamp) {
  102803. if (audioTrack) {
  102804. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  102805. }
  102806. };
  102807. this.setRemux = function(val) {
  102808. var pipeline = this.transmuxPipeline_;
  102809. options2.remux = val;
  102810. if (pipeline && pipeline.coalesceStream) {
  102811. pipeline.coalesceStream.setRemux(val);
  102812. }
  102813. };
  102814. this.alignGopsWith = function(gopsToAlignWith) {
  102815. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  102816. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  102817. }
  102818. };
  102819. this.getLogTrigger_ = function(key) {
  102820. var self3 = this;
  102821. return function(event2) {
  102822. event2.stream = key;
  102823. self3.trigger("log", event2);
  102824. };
  102825. };
  102826. this.push = function(data) {
  102827. if (hasFlushed) {
  102828. var isAac = isLikelyAacData(data);
  102829. if (isAac && this.transmuxPipeline_.type !== "aac") {
  102830. this.setupAacPipeline();
  102831. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  102832. this.setupTsPipeline();
  102833. }
  102834. hasFlushed = false;
  102835. }
  102836. this.transmuxPipeline_.headOfPipeline.push(data);
  102837. };
  102838. this.flush = function() {
  102839. hasFlushed = true;
  102840. this.transmuxPipeline_.headOfPipeline.flush();
  102841. };
  102842. this.endTimeline = function() {
  102843. this.transmuxPipeline_.headOfPipeline.endTimeline();
  102844. };
  102845. this.reset = function() {
  102846. if (this.transmuxPipeline_.headOfPipeline) {
  102847. this.transmuxPipeline_.headOfPipeline.reset();
  102848. }
  102849. };
  102850. this.resetCaptions = function() {
  102851. if (this.transmuxPipeline_.captionStream) {
  102852. this.transmuxPipeline_.captionStream.reset();
  102853. }
  102854. };
  102855. };
  102856. _Transmuxer.prototype = new stream();
  102857. var transmuxer = {
  102858. Transmuxer: _Transmuxer,
  102859. VideoSegmentStream: _VideoSegmentStream,
  102860. AudioSegmentStream: _AudioSegmentStream,
  102861. AUDIO_PROPERTIES: audioProperties,
  102862. VIDEO_PROPERTIES: videoProperties,
  102863. generateSegmentTimingInfo
  102864. };
  102865. var toUnsigned$3 = function toUnsigned2(value) {
  102866. return value >>> 0;
  102867. };
  102868. var toHexString$1 = function toHexString2(value) {
  102869. return ("00" + value.toString(16)).slice(-2);
  102870. };
  102871. var bin = {
  102872. toUnsigned: toUnsigned$3,
  102873. toHexString: toHexString$1
  102874. };
  102875. var parseType$1 = function parseType2(buffer) {
  102876. var result = "";
  102877. result += String.fromCharCode(buffer[0]);
  102878. result += String.fromCharCode(buffer[1]);
  102879. result += String.fromCharCode(buffer[2]);
  102880. result += String.fromCharCode(buffer[3]);
  102881. return result;
  102882. };
  102883. var parseType_1 = parseType$1;
  102884. var toUnsigned$2 = bin.toUnsigned;
  102885. var findBox4 = function findBox5(data, path) {
  102886. var results = [], i2, size, type3, end, subresults;
  102887. if (!path.length) {
  102888. return null;
  102889. }
  102890. for (i2 = 0; i2 < data.byteLength; ) {
  102891. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  102892. type3 = parseType_1(data.subarray(i2 + 4, i2 + 8));
  102893. end = size > 1 ? i2 + size : data.byteLength;
  102894. if (type3 === path[0]) {
  102895. if (path.length === 1) {
  102896. results.push(data.subarray(i2 + 8, end));
  102897. } else {
  102898. subresults = findBox5(data.subarray(i2 + 8, end), path.slice(1));
  102899. if (subresults.length) {
  102900. results = results.concat(subresults);
  102901. }
  102902. }
  102903. }
  102904. i2 = end;
  102905. }
  102906. return results;
  102907. };
  102908. var findBox_1 = findBox4;
  102909. var toUnsigned$1 = bin.toUnsigned;
  102910. var getUint64$12 = numbers2.getUint64;
  102911. var tfdt = function tfdt2(data) {
  102912. var result = {
  102913. version: data[0],
  102914. flags: new Uint8Array(data.subarray(1, 4))
  102915. };
  102916. if (result.version === 1) {
  102917. result.baseMediaDecodeTime = getUint64$12(data.subarray(4));
  102918. } else {
  102919. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  102920. }
  102921. return result;
  102922. };
  102923. var parseTfdt = tfdt;
  102924. var parseSampleFlags = function parseSampleFlags2(flags) {
  102925. return {
  102926. isLeading: (flags[0] & 12) >>> 2,
  102927. dependsOn: flags[0] & 3,
  102928. isDependedOn: (flags[1] & 192) >>> 6,
  102929. hasRedundancy: (flags[1] & 48) >>> 4,
  102930. paddingValue: (flags[1] & 14) >>> 1,
  102931. isNonSyncSample: flags[1] & 1,
  102932. degradationPriority: flags[2] << 8 | flags[3]
  102933. };
  102934. };
  102935. var parseSampleFlags_1 = parseSampleFlags;
  102936. var trun = function trun2(data) {
  102937. var result = {
  102938. version: data[0],
  102939. flags: new Uint8Array(data.subarray(1, 4)),
  102940. samples: []
  102941. }, 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;
  102942. if (dataOffsetPresent) {
  102943. result.dataOffset = view.getInt32(offset);
  102944. offset += 4;
  102945. }
  102946. if (firstSampleFlagsPresent && sampleCount) {
  102947. sample = {
  102948. flags: parseSampleFlags_1(data.subarray(offset, offset + 4))
  102949. };
  102950. offset += 4;
  102951. if (sampleDurationPresent) {
  102952. sample.duration = view.getUint32(offset);
  102953. offset += 4;
  102954. }
  102955. if (sampleSizePresent) {
  102956. sample.size = view.getUint32(offset);
  102957. offset += 4;
  102958. }
  102959. if (sampleCompositionTimeOffsetPresent) {
  102960. if (result.version === 1) {
  102961. sample.compositionTimeOffset = view.getInt32(offset);
  102962. } else {
  102963. sample.compositionTimeOffset = view.getUint32(offset);
  102964. }
  102965. offset += 4;
  102966. }
  102967. result.samples.push(sample);
  102968. sampleCount--;
  102969. }
  102970. while (sampleCount--) {
  102971. sample = {};
  102972. if (sampleDurationPresent) {
  102973. sample.duration = view.getUint32(offset);
  102974. offset += 4;
  102975. }
  102976. if (sampleSizePresent) {
  102977. sample.size = view.getUint32(offset);
  102978. offset += 4;
  102979. }
  102980. if (sampleFlagsPresent) {
  102981. sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4));
  102982. offset += 4;
  102983. }
  102984. if (sampleCompositionTimeOffsetPresent) {
  102985. if (result.version === 1) {
  102986. sample.compositionTimeOffset = view.getInt32(offset);
  102987. } else {
  102988. sample.compositionTimeOffset = view.getUint32(offset);
  102989. }
  102990. offset += 4;
  102991. }
  102992. result.samples.push(sample);
  102993. }
  102994. return result;
  102995. };
  102996. var parseTrun = trun;
  102997. var tfhd = function tfhd2(data) {
  102998. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  102999. version: data[0],
  103000. flags: new Uint8Array(data.subarray(1, 4)),
  103001. trackId: view.getUint32(4)
  103002. }, 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;
  103003. i2 = 8;
  103004. if (baseDataOffsetPresent) {
  103005. i2 += 4;
  103006. result.baseDataOffset = view.getUint32(12);
  103007. i2 += 4;
  103008. }
  103009. if (sampleDescriptionIndexPresent) {
  103010. result.sampleDescriptionIndex = view.getUint32(i2);
  103011. i2 += 4;
  103012. }
  103013. if (defaultSampleDurationPresent) {
  103014. result.defaultSampleDuration = view.getUint32(i2);
  103015. i2 += 4;
  103016. }
  103017. if (defaultSampleSizePresent) {
  103018. result.defaultSampleSize = view.getUint32(i2);
  103019. i2 += 4;
  103020. }
  103021. if (defaultSampleFlagsPresent) {
  103022. result.defaultSampleFlags = view.getUint32(i2);
  103023. }
  103024. if (durationIsEmpty) {
  103025. result.durationIsEmpty = true;
  103026. }
  103027. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  103028. result.baseDataOffsetIsMoof = true;
  103029. }
  103030. return result;
  103031. };
  103032. var parseTfhd = tfhd;
  103033. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  103034. var win2;
  103035. if (typeof window !== "undefined") {
  103036. win2 = window;
  103037. } else if (typeof commonjsGlobal2 !== "undefined") {
  103038. win2 = commonjsGlobal2;
  103039. } else if (typeof self !== "undefined") {
  103040. win2 = self;
  103041. } else {
  103042. win2 = {};
  103043. }
  103044. var window_12 = win2;
  103045. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  103046. var CaptionStream = captionStream.CaptionStream;
  103047. var mapToSample = function mapToSample2(offset, samples) {
  103048. var approximateOffset = offset;
  103049. for (var i2 = 0; i2 < samples.length; i2++) {
  103050. var sample = samples[i2];
  103051. if (approximateOffset < sample.size) {
  103052. return sample;
  103053. }
  103054. approximateOffset -= sample.size;
  103055. }
  103056. return null;
  103057. };
  103058. var findSeiNals = function findSeiNals2(avcStream, samples, trackId) {
  103059. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  103060. logs: [],
  103061. seiNals: []
  103062. }, seiNal, i2, length, lastMatchedSample;
  103063. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  103064. length = avcView.getUint32(i2);
  103065. i2 += 4;
  103066. if (length <= 0) {
  103067. continue;
  103068. }
  103069. switch (avcStream[i2] & 31) {
  103070. case 6:
  103071. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  103072. var matchingSample = mapToSample(i2, samples);
  103073. seiNal = {
  103074. nalUnitType: "sei_rbsp",
  103075. size: length,
  103076. data,
  103077. escapedRBSP: discardEmulationPreventionBytes4(data),
  103078. trackId
  103079. };
  103080. if (matchingSample) {
  103081. seiNal.pts = matchingSample.pts;
  103082. seiNal.dts = matchingSample.dts;
  103083. lastMatchedSample = matchingSample;
  103084. } else if (lastMatchedSample) {
  103085. seiNal.pts = lastMatchedSample.pts;
  103086. seiNal.dts = lastMatchedSample.dts;
  103087. } else {
  103088. result.logs.push({
  103089. level: "warn",
  103090. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  103091. });
  103092. break;
  103093. }
  103094. result.seiNals.push(seiNal);
  103095. break;
  103096. }
  103097. }
  103098. return result;
  103099. };
  103100. var parseSamples = function parseSamples2(truns, baseMediaDecodeTime, tfhd2) {
  103101. var currentDts = baseMediaDecodeTime;
  103102. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  103103. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  103104. var trackId = tfhd2.trackId;
  103105. var allSamples = [];
  103106. truns.forEach(function(trun2) {
  103107. var trackRun = parseTrun(trun2);
  103108. var samples = trackRun.samples;
  103109. samples.forEach(function(sample) {
  103110. if (sample.duration === void 0) {
  103111. sample.duration = defaultSampleDuration;
  103112. }
  103113. if (sample.size === void 0) {
  103114. sample.size = defaultSampleSize;
  103115. }
  103116. sample.trackId = trackId;
  103117. sample.dts = currentDts;
  103118. if (sample.compositionTimeOffset === void 0) {
  103119. sample.compositionTimeOffset = 0;
  103120. }
  103121. if (typeof currentDts === "bigint") {
  103122. sample.pts = currentDts + window_12.BigInt(sample.compositionTimeOffset);
  103123. currentDts += window_12.BigInt(sample.duration);
  103124. } else {
  103125. sample.pts = currentDts + sample.compositionTimeOffset;
  103126. currentDts += sample.duration;
  103127. }
  103128. });
  103129. allSamples = allSamples.concat(samples);
  103130. });
  103131. return allSamples;
  103132. };
  103133. var parseCaptionNals = function parseCaptionNals2(segment, videoTrackId) {
  103134. var trafs = findBox_1(segment, ["moof", "traf"]);
  103135. var mdats = findBox_1(segment, ["mdat"]);
  103136. var captionNals = {};
  103137. var mdatTrafPairs = [];
  103138. mdats.forEach(function(mdat2, index2) {
  103139. var matchingTraf = trafs[index2];
  103140. mdatTrafPairs.push({
  103141. mdat: mdat2,
  103142. traf: matchingTraf
  103143. });
  103144. });
  103145. mdatTrafPairs.forEach(function(pair) {
  103146. var mdat2 = pair.mdat;
  103147. var traf2 = pair.traf;
  103148. var tfhd2 = findBox_1(traf2, ["tfhd"]);
  103149. var headerInfo = parseTfhd(tfhd2[0]);
  103150. var trackId = headerInfo.trackId;
  103151. var tfdt2 = findBox_1(traf2, ["tfdt"]);
  103152. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt(tfdt2[0]).baseMediaDecodeTime : 0;
  103153. var truns = findBox_1(traf2, ["trun"]);
  103154. var samples;
  103155. var result;
  103156. if (videoTrackId === trackId && truns.length > 0) {
  103157. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  103158. result = findSeiNals(mdat2, samples, trackId);
  103159. if (!captionNals[trackId]) {
  103160. captionNals[trackId] = {
  103161. seiNals: [],
  103162. logs: []
  103163. };
  103164. }
  103165. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  103166. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  103167. }
  103168. });
  103169. return captionNals;
  103170. };
  103171. var parseEmbeddedCaptions = function parseEmbeddedCaptions2(segment, trackId, timescale3) {
  103172. var captionNals;
  103173. if (trackId === null) {
  103174. return null;
  103175. }
  103176. captionNals = parseCaptionNals(segment, trackId);
  103177. var trackNals = captionNals[trackId] || {};
  103178. return {
  103179. seiNals: trackNals.seiNals,
  103180. logs: trackNals.logs,
  103181. timescale: timescale3
  103182. };
  103183. };
  103184. var CaptionParser = function CaptionParser2() {
  103185. var isInitialized = false;
  103186. var captionStream2;
  103187. var segmentCache;
  103188. var trackId;
  103189. var timescale3;
  103190. var parsedCaptions;
  103191. var parsingPartial;
  103192. this.isInitialized = function() {
  103193. return isInitialized;
  103194. };
  103195. this.init = function(options2) {
  103196. captionStream2 = new CaptionStream();
  103197. isInitialized = true;
  103198. parsingPartial = options2 ? options2.isPartial : false;
  103199. captionStream2.on("data", function(event2) {
  103200. event2.startTime = event2.startPts / timescale3;
  103201. event2.endTime = event2.endPts / timescale3;
  103202. parsedCaptions.captions.push(event2);
  103203. parsedCaptions.captionStreams[event2.stream] = true;
  103204. });
  103205. captionStream2.on("log", function(log2) {
  103206. parsedCaptions.logs.push(log2);
  103207. });
  103208. };
  103209. this.isNewInit = function(videoTrackIds, timescales) {
  103210. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  103211. return false;
  103212. }
  103213. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  103214. };
  103215. this.parse = function(segment, videoTrackIds, timescales) {
  103216. var parsedData;
  103217. if (!this.isInitialized()) {
  103218. return null;
  103219. } else if (!videoTrackIds || !timescales) {
  103220. return null;
  103221. } else if (this.isNewInit(videoTrackIds, timescales)) {
  103222. trackId = videoTrackIds[0];
  103223. timescale3 = timescales[trackId];
  103224. } else if (trackId === null || !timescale3) {
  103225. segmentCache.push(segment);
  103226. return null;
  103227. }
  103228. while (segmentCache.length > 0) {
  103229. var cachedSegment = segmentCache.shift();
  103230. this.parse(cachedSegment, videoTrackIds, timescales);
  103231. }
  103232. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  103233. if (parsedData && parsedData.logs) {
  103234. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  103235. }
  103236. if (parsedData === null || !parsedData.seiNals) {
  103237. if (parsedCaptions.logs.length) {
  103238. return {
  103239. logs: parsedCaptions.logs,
  103240. captions: [],
  103241. captionStreams: []
  103242. };
  103243. }
  103244. return null;
  103245. }
  103246. this.pushNals(parsedData.seiNals);
  103247. this.flushStream();
  103248. return parsedCaptions;
  103249. };
  103250. this.pushNals = function(nals) {
  103251. if (!this.isInitialized() || !nals || nals.length === 0) {
  103252. return null;
  103253. }
  103254. nals.forEach(function(nal) {
  103255. captionStream2.push(nal);
  103256. });
  103257. };
  103258. this.flushStream = function() {
  103259. if (!this.isInitialized()) {
  103260. return null;
  103261. }
  103262. if (!parsingPartial) {
  103263. captionStream2.flush();
  103264. } else {
  103265. captionStream2.partialFlush();
  103266. }
  103267. };
  103268. this.clearParsedCaptions = function() {
  103269. parsedCaptions.captions = [];
  103270. parsedCaptions.captionStreams = {};
  103271. parsedCaptions.logs = [];
  103272. };
  103273. this.resetCaptionStream = function() {
  103274. if (!this.isInitialized()) {
  103275. return null;
  103276. }
  103277. captionStream2.reset();
  103278. };
  103279. this.clearAllCaptions = function() {
  103280. this.clearParsedCaptions();
  103281. this.resetCaptionStream();
  103282. };
  103283. this.reset = function() {
  103284. segmentCache = [];
  103285. trackId = null;
  103286. timescale3 = null;
  103287. if (!parsedCaptions) {
  103288. parsedCaptions = {
  103289. captions: [],
  103290. captionStreams: {},
  103291. logs: []
  103292. };
  103293. } else {
  103294. this.clearParsedCaptions();
  103295. }
  103296. this.resetCaptionStream();
  103297. };
  103298. this.reset();
  103299. };
  103300. var captionParser = CaptionParser;
  103301. var toUnsigned = bin.toUnsigned;
  103302. var toHexString = bin.toHexString;
  103303. var getUint642 = numbers2.getUint64;
  103304. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader;
  103305. timescale2 = function timescale3(init) {
  103306. var result = {}, traks = findBox_1(init, ["moov", "trak"]);
  103307. return traks.reduce(function(result2, trak2) {
  103308. var tkhd2, version2, index2, id, mdhd2;
  103309. tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103310. if (!tkhd2) {
  103311. return null;
  103312. }
  103313. version2 = tkhd2[0];
  103314. index2 = version2 === 0 ? 12 : 20;
  103315. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  103316. mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103317. if (!mdhd2) {
  103318. return null;
  103319. }
  103320. version2 = mdhd2[0];
  103321. index2 = version2 === 0 ? 12 : 20;
  103322. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103323. return result2;
  103324. }, result);
  103325. };
  103326. startTime = function startTime2(timescale3, fragment) {
  103327. var trafs;
  103328. trafs = findBox_1(fragment, ["moof", "traf"]);
  103329. var lowestTime = trafs.reduce(function(acc, traf2) {
  103330. var tfhd2 = findBox_1(traf2, ["tfhd"])[0];
  103331. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  103332. var scale = timescale3[id] || 9e4;
  103333. var tfdt2 = findBox_1(traf2, ["tfdt"])[0];
  103334. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  103335. var baseTime;
  103336. if (tfdt2[0] === 1) {
  103337. baseTime = getUint642(tfdt2.subarray(4, 12));
  103338. } else {
  103339. baseTime = dv.getUint32(4);
  103340. }
  103341. var seconds;
  103342. if (typeof baseTime === "bigint") {
  103343. seconds = baseTime / window_12.BigInt(scale);
  103344. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  103345. seconds = baseTime / scale;
  103346. }
  103347. if (seconds < Number.MAX_SAFE_INTEGER) {
  103348. seconds = Number(seconds);
  103349. }
  103350. if (seconds < acc) {
  103351. acc = seconds;
  103352. }
  103353. return acc;
  103354. }, Infinity);
  103355. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  103356. };
  103357. compositionStartTime = function compositionStartTime2(timescales, fragment) {
  103358. var trafBoxes = findBox_1(fragment, ["moof", "traf"]);
  103359. var baseMediaDecodeTime = 0;
  103360. var compositionTimeOffset = 0;
  103361. var trackId;
  103362. if (trafBoxes && trafBoxes.length) {
  103363. var tfhd2 = findBox_1(trafBoxes[0], ["tfhd"])[0];
  103364. var trun2 = findBox_1(trafBoxes[0], ["trun"])[0];
  103365. var tfdt2 = findBox_1(trafBoxes[0], ["tfdt"])[0];
  103366. if (tfhd2) {
  103367. var parsedTfhd = parseTfhd(tfhd2);
  103368. trackId = parsedTfhd.trackId;
  103369. }
  103370. if (tfdt2) {
  103371. var parsedTfdt = parseTfdt(tfdt2);
  103372. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  103373. }
  103374. if (trun2) {
  103375. var parsedTrun = parseTrun(trun2);
  103376. if (parsedTrun.samples && parsedTrun.samples.length) {
  103377. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  103378. }
  103379. }
  103380. }
  103381. var timescale3 = timescales[trackId] || 9e4;
  103382. if (typeof baseMediaDecodeTime === "bigint") {
  103383. compositionTimeOffset = window_12.BigInt(compositionTimeOffset);
  103384. timescale3 = window_12.BigInt(timescale3);
  103385. }
  103386. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  103387. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  103388. result = Number(result);
  103389. }
  103390. return result;
  103391. };
  103392. getVideoTrackIds = function getVideoTrackIds2(init) {
  103393. var traks = findBox_1(init, ["moov", "trak"]);
  103394. var videoTrackIds = [];
  103395. traks.forEach(function(trak2) {
  103396. var hdlrs = findBox_1(trak2, ["mdia", "hdlr"]);
  103397. var tkhds = findBox_1(trak2, ["tkhd"]);
  103398. hdlrs.forEach(function(hdlr2, index2) {
  103399. var handlerType = parseType_1(hdlr2.subarray(8, 12));
  103400. var tkhd2 = tkhds[index2];
  103401. var view;
  103402. var version2;
  103403. var trackId;
  103404. if (handlerType === "vide") {
  103405. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103406. version2 = view.getUint8(0);
  103407. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  103408. videoTrackIds.push(trackId);
  103409. }
  103410. });
  103411. });
  103412. return videoTrackIds;
  103413. };
  103414. getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader2(mdhd2) {
  103415. var version2 = mdhd2[0];
  103416. var index2 = version2 === 0 ? 12 : 20;
  103417. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103418. };
  103419. getTracks = function getTracks2(init) {
  103420. var traks = findBox_1(init, ["moov", "trak"]);
  103421. var tracks = [];
  103422. traks.forEach(function(trak2) {
  103423. var track = {};
  103424. var tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103425. var view, tkhdVersion;
  103426. if (tkhd2) {
  103427. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103428. tkhdVersion = view.getUint8(0);
  103429. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  103430. }
  103431. var hdlr2 = findBox_1(trak2, ["mdia", "hdlr"])[0];
  103432. if (hdlr2) {
  103433. var type3 = parseType_1(hdlr2.subarray(8, 12));
  103434. if (type3 === "vide") {
  103435. track.type = "video";
  103436. } else if (type3 === "soun") {
  103437. track.type = "audio";
  103438. } else {
  103439. track.type = type3;
  103440. }
  103441. }
  103442. var stsd2 = findBox_1(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  103443. if (stsd2) {
  103444. var sampleDescriptions = stsd2.subarray(8);
  103445. track.codec = parseType_1(sampleDescriptions.subarray(4, 8));
  103446. var codecBox = findBox_1(sampleDescriptions, [track.codec])[0];
  103447. var codecConfig, codecConfigType;
  103448. if (codecBox) {
  103449. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  103450. codecConfig = codecBox.subarray(78);
  103451. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103452. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  103453. track.codec += ".";
  103454. track.codec += toHexString(codecConfig[9]);
  103455. track.codec += toHexString(codecConfig[10]);
  103456. track.codec += toHexString(codecConfig[11]);
  103457. } else {
  103458. track.codec = "avc1.4d400d";
  103459. }
  103460. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  103461. codecConfig = codecBox.subarray(28);
  103462. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103463. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  103464. track.codec += "." + toHexString(codecConfig[19]);
  103465. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  103466. } else {
  103467. track.codec = "mp4a.40.2";
  103468. }
  103469. } else {
  103470. track.codec = track.codec.toLowerCase();
  103471. }
  103472. }
  103473. }
  103474. var mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103475. if (mdhd2) {
  103476. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  103477. }
  103478. tracks.push(track);
  103479. });
  103480. return tracks;
  103481. };
  103482. var probe$2 = {
  103483. findBox: findBox_1,
  103484. parseType: parseType_1,
  103485. timescale: timescale2,
  103486. startTime,
  103487. compositionStartTime,
  103488. videoTrackIds: getVideoTrackIds,
  103489. tracks: getTracks,
  103490. getTimescaleFromMediaHeader
  103491. };
  103492. var parsePid = function parsePid2(packet) {
  103493. var pid = packet[1] & 31;
  103494. pid <<= 8;
  103495. pid |= packet[2];
  103496. return pid;
  103497. };
  103498. var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator2(packet) {
  103499. return !!(packet[1] & 64);
  103500. };
  103501. var parseAdaptionField = function parseAdaptionField2(packet) {
  103502. var offset = 0;
  103503. if ((packet[3] & 48) >>> 4 > 1) {
  103504. offset += packet[4] + 1;
  103505. }
  103506. return offset;
  103507. };
  103508. var parseType = function parseType2(packet, pmtPid) {
  103509. var pid = parsePid(packet);
  103510. if (pid === 0) {
  103511. return "pat";
  103512. } else if (pid === pmtPid) {
  103513. return "pmt";
  103514. } else if (pmtPid) {
  103515. return "pes";
  103516. }
  103517. return null;
  103518. };
  103519. var parsePat = function parsePat2(packet) {
  103520. var pusi = parsePayloadUnitStartIndicator(packet);
  103521. var offset = 4 + parseAdaptionField(packet);
  103522. if (pusi) {
  103523. offset += packet[offset] + 1;
  103524. }
  103525. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  103526. };
  103527. var parsePmt = function parsePmt2(packet) {
  103528. var programMapTable = {};
  103529. var pusi = parsePayloadUnitStartIndicator(packet);
  103530. var payloadOffset = 4 + parseAdaptionField(packet);
  103531. if (pusi) {
  103532. payloadOffset += packet[payloadOffset] + 1;
  103533. }
  103534. if (!(packet[payloadOffset + 5] & 1)) {
  103535. return;
  103536. }
  103537. var sectionLength, tableEnd, programInfoLength;
  103538. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  103539. tableEnd = 3 + sectionLength - 4;
  103540. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  103541. var offset = 12 + programInfoLength;
  103542. while (offset < tableEnd) {
  103543. var i2 = payloadOffset + offset;
  103544. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  103545. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  103546. }
  103547. return programMapTable;
  103548. };
  103549. var parsePesType = function parsePesType2(packet, programMapTable) {
  103550. var pid = parsePid(packet);
  103551. var type3 = programMapTable[pid];
  103552. switch (type3) {
  103553. case streamTypes.H264_STREAM_TYPE:
  103554. return "video";
  103555. case streamTypes.ADTS_STREAM_TYPE:
  103556. return "audio";
  103557. case streamTypes.METADATA_STREAM_TYPE:
  103558. return "timed-metadata";
  103559. default:
  103560. return null;
  103561. }
  103562. };
  103563. var parsePesTime = function parsePesTime2(packet) {
  103564. var pusi = parsePayloadUnitStartIndicator(packet);
  103565. if (!pusi) {
  103566. return null;
  103567. }
  103568. var offset = 4 + parseAdaptionField(packet);
  103569. if (offset >= packet.byteLength) {
  103570. return null;
  103571. }
  103572. var pes = null;
  103573. var ptsDtsFlags;
  103574. ptsDtsFlags = packet[offset + 7];
  103575. if (ptsDtsFlags & 192) {
  103576. pes = {};
  103577. 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;
  103578. pes.pts *= 4;
  103579. pes.pts += (packet[offset + 13] & 6) >>> 1;
  103580. pes.dts = pes.pts;
  103581. if (ptsDtsFlags & 64) {
  103582. 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;
  103583. pes.dts *= 4;
  103584. pes.dts += (packet[offset + 18] & 6) >>> 1;
  103585. }
  103586. }
  103587. return pes;
  103588. };
  103589. var parseNalUnitType = function parseNalUnitType2(type3) {
  103590. switch (type3) {
  103591. case 5:
  103592. return "slice_layer_without_partitioning_rbsp_idr";
  103593. case 6:
  103594. return "sei_rbsp";
  103595. case 7:
  103596. return "seq_parameter_set_rbsp";
  103597. case 8:
  103598. return "pic_parameter_set_rbsp";
  103599. case 9:
  103600. return "access_unit_delimiter_rbsp";
  103601. default:
  103602. return null;
  103603. }
  103604. };
  103605. var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame2(packet) {
  103606. var offset = 4 + parseAdaptionField(packet);
  103607. var frameBuffer = packet.subarray(offset);
  103608. var frameI = 0;
  103609. var frameSyncPoint = 0;
  103610. var foundKeyFrame = false;
  103611. var nalType;
  103612. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  103613. if (frameBuffer[frameSyncPoint + 2] === 1) {
  103614. frameI = frameSyncPoint + 5;
  103615. break;
  103616. }
  103617. }
  103618. while (frameI < frameBuffer.byteLength) {
  103619. switch (frameBuffer[frameI]) {
  103620. case 0:
  103621. if (frameBuffer[frameI - 1] !== 0) {
  103622. frameI += 2;
  103623. break;
  103624. } else if (frameBuffer[frameI - 2] !== 0) {
  103625. frameI++;
  103626. break;
  103627. }
  103628. if (frameSyncPoint + 3 !== frameI - 2) {
  103629. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103630. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103631. foundKeyFrame = true;
  103632. }
  103633. }
  103634. do {
  103635. frameI++;
  103636. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  103637. frameSyncPoint = frameI - 2;
  103638. frameI += 3;
  103639. break;
  103640. case 1:
  103641. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  103642. frameI += 3;
  103643. break;
  103644. }
  103645. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103646. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103647. foundKeyFrame = true;
  103648. }
  103649. frameSyncPoint = frameI - 2;
  103650. frameI += 3;
  103651. break;
  103652. default:
  103653. frameI += 3;
  103654. break;
  103655. }
  103656. }
  103657. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  103658. frameI -= frameSyncPoint;
  103659. frameSyncPoint = 0;
  103660. if (frameBuffer && frameBuffer.byteLength > 3) {
  103661. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103662. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103663. foundKeyFrame = true;
  103664. }
  103665. }
  103666. return foundKeyFrame;
  103667. };
  103668. var probe$1 = {
  103669. parseType,
  103670. parsePat,
  103671. parsePmt,
  103672. parsePayloadUnitStartIndicator,
  103673. parsePesType,
  103674. parsePesTime,
  103675. videoPacketContainsKeyFrame
  103676. };
  103677. var handleRollover = timestampRolloverStream.handleRollover;
  103678. var probe = {};
  103679. probe.ts = probe$1;
  103680. probe.aac = utils2;
  103681. var ONE_SECOND_IN_TS2 = clock2.ONE_SECOND_IN_TS;
  103682. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  103683. var parsePsi_ = function parsePsi_2(bytes, pmt) {
  103684. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  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 "pat":
  103691. pmt.pid = probe.ts.parsePat(packet);
  103692. break;
  103693. case "pmt":
  103694. var table = probe.ts.parsePmt(packet);
  103695. pmt.table = pmt.table || {};
  103696. Object.keys(table).forEach(function(key) {
  103697. pmt.table[key] = table[key];
  103698. });
  103699. break;
  103700. }
  103701. startIndex += MP2T_PACKET_LENGTH;
  103702. endIndex += MP2T_PACKET_LENGTH;
  103703. continue;
  103704. }
  103705. startIndex++;
  103706. endIndex++;
  103707. }
  103708. };
  103709. var parseAudioPes_ = function parseAudioPes_2(bytes, pmt, result) {
  103710. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  103711. var endLoop = false;
  103712. while (endIndex <= bytes.byteLength) {
  103713. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  103714. packet = bytes.subarray(startIndex, endIndex);
  103715. type3 = probe.ts.parseType(packet, pmt.pid);
  103716. switch (type3) {
  103717. case "pes":
  103718. pesType = probe.ts.parsePesType(packet, pmt.table);
  103719. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103720. if (pesType === "audio" && pusi) {
  103721. parsed = probe.ts.parsePesTime(packet);
  103722. if (parsed) {
  103723. parsed.type = "audio";
  103724. result.audio.push(parsed);
  103725. endLoop = true;
  103726. }
  103727. }
  103728. break;
  103729. }
  103730. if (endLoop) {
  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 || endIndex === bytes.byteLength)) {
  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 === "audio" && pusi) {
  103752. parsed = probe.ts.parsePesTime(packet);
  103753. if (parsed) {
  103754. parsed.type = "audio";
  103755. result.audio.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 parseVideoPes_ = function parseVideoPes_2(bytes, pmt, result) {
  103773. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  103774. var endLoop = false;
  103775. var currentFrame = {
  103776. data: [],
  103777. size: 0
  103778. };
  103779. while (endIndex < bytes.byteLength) {
  103780. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103781. packet = bytes.subarray(startIndex, endIndex);
  103782. type3 = probe.ts.parseType(packet, pmt.pid);
  103783. switch (type3) {
  103784. case "pes":
  103785. pesType = probe.ts.parsePesType(packet, pmt.table);
  103786. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103787. if (pesType === "video") {
  103788. if (pusi && !endLoop) {
  103789. parsed = probe.ts.parsePesTime(packet);
  103790. if (parsed) {
  103791. parsed.type = "video";
  103792. result.video.push(parsed);
  103793. endLoop = true;
  103794. }
  103795. }
  103796. if (!result.firstKeyFrame) {
  103797. if (pusi) {
  103798. if (currentFrame.size !== 0) {
  103799. frame = new Uint8Array(currentFrame.size);
  103800. i2 = 0;
  103801. while (currentFrame.data.length) {
  103802. pes = currentFrame.data.shift();
  103803. frame.set(pes, i2);
  103804. i2 += pes.byteLength;
  103805. }
  103806. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  103807. var firstKeyFrame = probe.ts.parsePesTime(frame);
  103808. if (firstKeyFrame) {
  103809. result.firstKeyFrame = firstKeyFrame;
  103810. result.firstKeyFrame.type = "video";
  103811. } else {
  103812. 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.");
  103813. }
  103814. }
  103815. currentFrame.size = 0;
  103816. }
  103817. }
  103818. currentFrame.data.push(packet);
  103819. currentFrame.size += packet.byteLength;
  103820. }
  103821. }
  103822. break;
  103823. }
  103824. if (endLoop && result.firstKeyFrame) {
  103825. break;
  103826. }
  103827. startIndex += MP2T_PACKET_LENGTH;
  103828. endIndex += MP2T_PACKET_LENGTH;
  103829. continue;
  103830. }
  103831. startIndex++;
  103832. endIndex++;
  103833. }
  103834. endIndex = bytes.byteLength;
  103835. startIndex = endIndex - MP2T_PACKET_LENGTH;
  103836. endLoop = false;
  103837. while (startIndex >= 0) {
  103838. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103839. packet = bytes.subarray(startIndex, endIndex);
  103840. type3 = probe.ts.parseType(packet, pmt.pid);
  103841. switch (type3) {
  103842. case "pes":
  103843. pesType = probe.ts.parsePesType(packet, pmt.table);
  103844. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103845. if (pesType === "video" && pusi) {
  103846. parsed = probe.ts.parsePesTime(packet);
  103847. if (parsed) {
  103848. parsed.type = "video";
  103849. result.video.push(parsed);
  103850. endLoop = true;
  103851. }
  103852. }
  103853. break;
  103854. }
  103855. if (endLoop) {
  103856. break;
  103857. }
  103858. startIndex -= MP2T_PACKET_LENGTH;
  103859. endIndex -= MP2T_PACKET_LENGTH;
  103860. continue;
  103861. }
  103862. startIndex--;
  103863. endIndex--;
  103864. }
  103865. };
  103866. var adjustTimestamp_ = function adjustTimestamp_2(segmentInfo, baseTimestamp) {
  103867. if (segmentInfo.audio && segmentInfo.audio.length) {
  103868. var audioBaseTimestamp = baseTimestamp;
  103869. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  103870. audioBaseTimestamp = segmentInfo.audio[0].dts;
  103871. }
  103872. segmentInfo.audio.forEach(function(info) {
  103873. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  103874. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  103875. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103876. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103877. });
  103878. }
  103879. if (segmentInfo.video && segmentInfo.video.length) {
  103880. var videoBaseTimestamp = baseTimestamp;
  103881. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  103882. videoBaseTimestamp = segmentInfo.video[0].dts;
  103883. }
  103884. segmentInfo.video.forEach(function(info) {
  103885. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  103886. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  103887. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103888. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103889. });
  103890. if (segmentInfo.firstKeyFrame) {
  103891. var frame = segmentInfo.firstKeyFrame;
  103892. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  103893. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  103894. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  103895. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  103896. }
  103897. }
  103898. };
  103899. var inspectAac_ = function inspectAac_2(bytes) {
  103900. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  103901. while (bytes.length - byteIndex >= 3) {
  103902. var type3 = probe.aac.parseType(bytes, byteIndex);
  103903. switch (type3) {
  103904. case "timed-metadata":
  103905. if (bytes.length - byteIndex < 10) {
  103906. endLoop = true;
  103907. break;
  103908. }
  103909. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  103910. if (frameSize > bytes.length) {
  103911. endLoop = true;
  103912. break;
  103913. }
  103914. if (timestamp === null) {
  103915. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103916. timestamp = probe.aac.parseAacTimestamp(packet);
  103917. }
  103918. byteIndex += frameSize;
  103919. break;
  103920. case "audio":
  103921. if (bytes.length - byteIndex < 7) {
  103922. endLoop = true;
  103923. break;
  103924. }
  103925. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  103926. if (frameSize > bytes.length) {
  103927. endLoop = true;
  103928. break;
  103929. }
  103930. if (sampleRate === null) {
  103931. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103932. sampleRate = probe.aac.parseSampleRate(packet);
  103933. }
  103934. audioCount++;
  103935. byteIndex += frameSize;
  103936. break;
  103937. default:
  103938. byteIndex++;
  103939. break;
  103940. }
  103941. if (endLoop) {
  103942. return null;
  103943. }
  103944. }
  103945. if (sampleRate === null || timestamp === null) {
  103946. return null;
  103947. }
  103948. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  103949. var result = {
  103950. audio: [{
  103951. type: "audio",
  103952. dts: timestamp,
  103953. pts: timestamp
  103954. }, {
  103955. type: "audio",
  103956. dts: timestamp + audioCount * 1024 * audioTimescale,
  103957. pts: timestamp + audioCount * 1024 * audioTimescale
  103958. }]
  103959. };
  103960. return result;
  103961. };
  103962. var inspectTs_ = function inspectTs_2(bytes) {
  103963. var pmt = {
  103964. pid: null,
  103965. table: null
  103966. };
  103967. var result = {};
  103968. parsePsi_(bytes, pmt);
  103969. for (var pid in pmt.table) {
  103970. if (pmt.table.hasOwnProperty(pid)) {
  103971. var type3 = pmt.table[pid];
  103972. switch (type3) {
  103973. case streamTypes.H264_STREAM_TYPE:
  103974. result.video = [];
  103975. parseVideoPes_(bytes, pmt, result);
  103976. if (result.video.length === 0) {
  103977. delete result.video;
  103978. }
  103979. break;
  103980. case streamTypes.ADTS_STREAM_TYPE:
  103981. result.audio = [];
  103982. parseAudioPes_(bytes, pmt, result);
  103983. if (result.audio.length === 0) {
  103984. delete result.audio;
  103985. }
  103986. break;
  103987. }
  103988. }
  103989. }
  103990. return result;
  103991. };
  103992. var inspect = function inspect2(bytes, baseTimestamp) {
  103993. var isAacData = probe.aac.isLikelyAacData(bytes);
  103994. var result;
  103995. if (isAacData) {
  103996. result = inspectAac_(bytes);
  103997. } else {
  103998. result = inspectTs_(bytes);
  103999. }
  104000. if (!result || !result.audio && !result.video) {
  104001. return null;
  104002. }
  104003. adjustTimestamp_(result, baseTimestamp);
  104004. return result;
  104005. };
  104006. var tsInspector = {
  104007. inspect,
  104008. parseAudioPes_
  104009. };
  104010. var wireTransmuxerEvents = function wireTransmuxerEvents2(self2, transmuxer2) {
  104011. transmuxer2.on("data", function(segment) {
  104012. var initArray = segment.initSegment;
  104013. segment.initSegment = {
  104014. data: initArray.buffer,
  104015. byteOffset: initArray.byteOffset,
  104016. byteLength: initArray.byteLength
  104017. };
  104018. var typedArray = segment.data;
  104019. segment.data = typedArray.buffer;
  104020. self2.postMessage({
  104021. action: "data",
  104022. segment,
  104023. byteOffset: typedArray.byteOffset,
  104024. byteLength: typedArray.byteLength
  104025. }, [segment.data]);
  104026. });
  104027. transmuxer2.on("done", function(data) {
  104028. self2.postMessage({
  104029. action: "done"
  104030. });
  104031. });
  104032. transmuxer2.on("gopInfo", function(gopInfo) {
  104033. self2.postMessage({
  104034. action: "gopInfo",
  104035. gopInfo
  104036. });
  104037. });
  104038. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  104039. var videoSegmentTimingInfo = {
  104040. start: {
  104041. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  104042. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  104043. },
  104044. end: {
  104045. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  104046. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  104047. },
  104048. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  104049. };
  104050. if (timingInfo.prependedContentDuration) {
  104051. videoSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  104052. }
  104053. self2.postMessage({
  104054. action: "videoSegmentTimingInfo",
  104055. videoSegmentTimingInfo
  104056. });
  104057. });
  104058. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  104059. var audioSegmentTimingInfo = {
  104060. start: {
  104061. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  104062. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  104063. },
  104064. end: {
  104065. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  104066. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  104067. },
  104068. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  104069. };
  104070. if (timingInfo.prependedContentDuration) {
  104071. audioSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  104072. }
  104073. self2.postMessage({
  104074. action: "audioSegmentTimingInfo",
  104075. audioSegmentTimingInfo
  104076. });
  104077. });
  104078. transmuxer2.on("id3Frame", function(id3Frame) {
  104079. self2.postMessage({
  104080. action: "id3Frame",
  104081. id3Frame
  104082. });
  104083. });
  104084. transmuxer2.on("caption", function(caption) {
  104085. self2.postMessage({
  104086. action: "caption",
  104087. caption
  104088. });
  104089. });
  104090. transmuxer2.on("trackinfo", function(trackInfo) {
  104091. self2.postMessage({
  104092. action: "trackinfo",
  104093. trackInfo
  104094. });
  104095. });
  104096. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  104097. self2.postMessage({
  104098. action: "audioTimingInfo",
  104099. audioTimingInfo: {
  104100. start: clock2.videoTsToSeconds(audioTimingInfo.start),
  104101. end: clock2.videoTsToSeconds(audioTimingInfo.end)
  104102. }
  104103. });
  104104. });
  104105. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  104106. self2.postMessage({
  104107. action: "videoTimingInfo",
  104108. videoTimingInfo: {
  104109. start: clock2.videoTsToSeconds(videoTimingInfo.start),
  104110. end: clock2.videoTsToSeconds(videoTimingInfo.end)
  104111. }
  104112. });
  104113. });
  104114. transmuxer2.on("log", function(log2) {
  104115. self2.postMessage({
  104116. action: "log",
  104117. log: log2
  104118. });
  104119. });
  104120. };
  104121. var MessageHandlers = /* @__PURE__ */ function() {
  104122. function MessageHandlers2(self2, options2) {
  104123. this.options = options2 || {};
  104124. this.self = self2;
  104125. this.init();
  104126. }
  104127. var _proto = MessageHandlers2.prototype;
  104128. _proto.init = function init() {
  104129. if (this.transmuxer) {
  104130. this.transmuxer.dispose();
  104131. }
  104132. this.transmuxer = new transmuxer.Transmuxer(this.options);
  104133. wireTransmuxerEvents(this.self, this.transmuxer);
  104134. };
  104135. _proto.pushMp4Captions = function pushMp4Captions(data) {
  104136. if (!this.captionParser) {
  104137. this.captionParser = new captionParser();
  104138. this.captionParser.init();
  104139. }
  104140. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104141. var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  104142. this.self.postMessage({
  104143. action: "mp4Captions",
  104144. captions: parsed && parsed.captions || [],
  104145. logs: parsed && parsed.logs || [],
  104146. data: segment.buffer
  104147. }, [segment.buffer]);
  104148. };
  104149. _proto.probeMp4StartTime = function probeMp4StartTime(_ref) {
  104150. var timescales = _ref.timescales, data = _ref.data;
  104151. var startTime2 = probe$2.startTime(timescales, data);
  104152. this.self.postMessage({
  104153. action: "probeMp4StartTime",
  104154. startTime: startTime2,
  104155. data
  104156. }, [data.buffer]);
  104157. };
  104158. _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) {
  104159. var data = _ref2.data;
  104160. var tracks = probe$2.tracks(data);
  104161. this.self.postMessage({
  104162. action: "probeMp4Tracks",
  104163. tracks,
  104164. data
  104165. }, [data.buffer]);
  104166. };
  104167. _proto.probeTs = function probeTs(_ref3) {
  104168. var data = _ref3.data, baseStartTime = _ref3.baseStartTime;
  104169. var tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock2.ONE_SECOND_IN_TS : void 0;
  104170. var timeInfo = tsInspector.inspect(data, tsStartTime);
  104171. var result = null;
  104172. if (timeInfo) {
  104173. result = {
  104174. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  104175. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  104176. };
  104177. if (result.hasVideo) {
  104178. result.videoStart = timeInfo.video[0].ptsTime;
  104179. }
  104180. if (result.hasAudio) {
  104181. result.audioStart = timeInfo.audio[0].ptsTime;
  104182. }
  104183. }
  104184. this.self.postMessage({
  104185. action: "probeTs",
  104186. result,
  104187. data
  104188. }, [data.buffer]);
  104189. };
  104190. _proto.clearAllMp4Captions = function clearAllMp4Captions() {
  104191. if (this.captionParser) {
  104192. this.captionParser.clearAllCaptions();
  104193. }
  104194. };
  104195. _proto.clearParsedMp4Captions = function clearParsedMp4Captions() {
  104196. if (this.captionParser) {
  104197. this.captionParser.clearParsedCaptions();
  104198. }
  104199. };
  104200. _proto.push = function push(data) {
  104201. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104202. this.transmuxer.push(segment);
  104203. };
  104204. _proto.reset = function reset3() {
  104205. this.transmuxer.reset();
  104206. };
  104207. _proto.setTimestampOffset = function setTimestampOffset(data) {
  104208. var timestampOffset2 = data.timestampOffset || 0;
  104209. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock2.secondsToVideoTs(timestampOffset2)));
  104210. };
  104211. _proto.setAudioAppendStart = function setAudioAppendStart(data) {
  104212. this.transmuxer.setAudioAppendStart(Math.ceil(clock2.secondsToVideoTs(data.appendStart)));
  104213. };
  104214. _proto.setRemux = function setRemux(data) {
  104215. this.transmuxer.setRemux(data.remux);
  104216. };
  104217. _proto.flush = function flush(data) {
  104218. this.transmuxer.flush();
  104219. self.postMessage({
  104220. action: "done",
  104221. type: "transmuxed"
  104222. });
  104223. };
  104224. _proto.endTimeline = function endTimeline3() {
  104225. this.transmuxer.endTimeline();
  104226. self.postMessage({
  104227. action: "endedtimeline",
  104228. type: "transmuxed"
  104229. });
  104230. };
  104231. _proto.alignGopsWith = function alignGopsWith(data) {
  104232. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  104233. };
  104234. return MessageHandlers2;
  104235. }();
  104236. self.onmessage = function(event2) {
  104237. if (event2.data.action === "init" && event2.data.options) {
  104238. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  104239. return;
  104240. }
  104241. if (!this.messageHandlers) {
  104242. this.messageHandlers = new MessageHandlers(self);
  104243. }
  104244. if (event2.data && event2.data.action && event2.data.action !== "init") {
  104245. if (this.messageHandlers[event2.data.action]) {
  104246. this.messageHandlers[event2.data.action](event2.data);
  104247. }
  104248. }
  104249. };
  104250. }));
  104251. var TransmuxWorker = factory(workerCode$1);
  104252. var handleData_ = function handleData_2(event2, transmuxedData, callback2) {
  104253. 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;
  104254. transmuxedData.buffer.push({
  104255. captions,
  104256. captionStreams,
  104257. metadata
  104258. });
  104259. var boxes = event2.data.segment.boxes || {
  104260. data: event2.data.segment.data
  104261. };
  104262. var result = {
  104263. type: type2,
  104264. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  104265. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  104266. };
  104267. if (typeof videoFrameDtsTime !== "undefined") {
  104268. result.videoFrameDtsTime = videoFrameDtsTime;
  104269. }
  104270. if (typeof videoFramePtsTime !== "undefined") {
  104271. result.videoFramePtsTime = videoFramePtsTime;
  104272. }
  104273. callback2(result);
  104274. };
  104275. var handleDone_ = function handleDone_2(_ref) {
  104276. var transmuxedData = _ref.transmuxedData, callback2 = _ref.callback;
  104277. transmuxedData.buffer = [];
  104278. callback2(transmuxedData);
  104279. };
  104280. var handleGopInfo_ = function handleGopInfo_2(event2, transmuxedData) {
  104281. transmuxedData.gopInfo = event2.data.gopInfo;
  104282. };
  104283. var processTransmux = function processTransmux2(options2) {
  104284. 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;
  104285. var transmuxedData = {
  104286. buffer: []
  104287. };
  104288. var waitForEndedTimelineEvent = isEndOfTimeline;
  104289. var handleMessage = function handleMessage2(event2) {
  104290. if (transmuxer.currentTransmux !== options2) {
  104291. return;
  104292. }
  104293. if (event2.data.action === "data") {
  104294. handleData_(event2, transmuxedData, onData);
  104295. }
  104296. if (event2.data.action === "trackinfo") {
  104297. onTrackInfo(event2.data.trackInfo);
  104298. }
  104299. if (event2.data.action === "gopInfo") {
  104300. handleGopInfo_(event2, transmuxedData);
  104301. }
  104302. if (event2.data.action === "audioTimingInfo") {
  104303. onAudioTimingInfo(event2.data.audioTimingInfo);
  104304. }
  104305. if (event2.data.action === "videoTimingInfo") {
  104306. onVideoTimingInfo(event2.data.videoTimingInfo);
  104307. }
  104308. if (event2.data.action === "videoSegmentTimingInfo") {
  104309. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  104310. }
  104311. if (event2.data.action === "audioSegmentTimingInfo") {
  104312. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  104313. }
  104314. if (event2.data.action === "id3Frame") {
  104315. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  104316. }
  104317. if (event2.data.action === "caption") {
  104318. onCaptions(event2.data.caption);
  104319. }
  104320. if (event2.data.action === "endedtimeline") {
  104321. waitForEndedTimelineEvent = false;
  104322. onEndedTimeline();
  104323. }
  104324. if (event2.data.action === "log") {
  104325. onTransmuxerLog(event2.data.log);
  104326. }
  104327. if (event2.data.type !== "transmuxed") {
  104328. return;
  104329. }
  104330. if (waitForEndedTimelineEvent) {
  104331. return;
  104332. }
  104333. transmuxer.onmessage = null;
  104334. handleDone_({
  104335. transmuxedData,
  104336. callback: onDone
  104337. });
  104338. dequeue(transmuxer);
  104339. };
  104340. transmuxer.onmessage = handleMessage;
  104341. if (audioAppendStart) {
  104342. transmuxer.postMessage({
  104343. action: "setAudioAppendStart",
  104344. appendStart: audioAppendStart
  104345. });
  104346. }
  104347. if (Array.isArray(gopsToAlignWith)) {
  104348. transmuxer.postMessage({
  104349. action: "alignGopsWith",
  104350. gopsToAlignWith
  104351. });
  104352. }
  104353. if (typeof remux !== "undefined") {
  104354. transmuxer.postMessage({
  104355. action: "setRemux",
  104356. remux
  104357. });
  104358. }
  104359. if (bytes.byteLength) {
  104360. var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  104361. var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  104362. transmuxer.postMessage({
  104363. action: "push",
  104364. data: buffer,
  104365. byteOffset,
  104366. byteLength: bytes.byteLength
  104367. }, [buffer]);
  104368. }
  104369. if (isEndOfTimeline) {
  104370. transmuxer.postMessage({
  104371. action: "endTimeline"
  104372. });
  104373. }
  104374. transmuxer.postMessage({
  104375. action: "flush"
  104376. });
  104377. };
  104378. var dequeue = function dequeue2(transmuxer) {
  104379. transmuxer.currentTransmux = null;
  104380. if (transmuxer.transmuxQueue.length) {
  104381. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  104382. if (typeof transmuxer.currentTransmux === "function") {
  104383. transmuxer.currentTransmux();
  104384. } else {
  104385. processTransmux(transmuxer.currentTransmux);
  104386. }
  104387. }
  104388. };
  104389. var processAction = function processAction2(transmuxer, action) {
  104390. transmuxer.postMessage({
  104391. action
  104392. });
  104393. dequeue(transmuxer);
  104394. };
  104395. var enqueueAction = function enqueueAction2(action, transmuxer) {
  104396. if (!transmuxer.currentTransmux) {
  104397. transmuxer.currentTransmux = action;
  104398. processAction(transmuxer, action);
  104399. return;
  104400. }
  104401. transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action));
  104402. };
  104403. var reset = function reset2(transmuxer) {
  104404. enqueueAction("reset", transmuxer);
  104405. };
  104406. var endTimeline = function endTimeline2(transmuxer) {
  104407. enqueueAction("endTimeline", transmuxer);
  104408. };
  104409. var transmux = function transmux2(options2) {
  104410. if (!options2.transmuxer.currentTransmux) {
  104411. options2.transmuxer.currentTransmux = options2;
  104412. processTransmux(options2);
  104413. return;
  104414. }
  104415. options2.transmuxer.transmuxQueue.push(options2);
  104416. };
  104417. var createTransmuxer = function createTransmuxer2(options2) {
  104418. var transmuxer = new TransmuxWorker();
  104419. transmuxer.currentTransmux = null;
  104420. transmuxer.transmuxQueue = [];
  104421. var term = transmuxer.terminate;
  104422. transmuxer.terminate = function() {
  104423. transmuxer.currentTransmux = null;
  104424. transmuxer.transmuxQueue.length = 0;
  104425. return term.call(transmuxer);
  104426. };
  104427. transmuxer.postMessage({
  104428. action: "init",
  104429. options: options2
  104430. });
  104431. return transmuxer;
  104432. };
  104433. var segmentTransmuxer = {
  104434. reset,
  104435. endTimeline,
  104436. transmux,
  104437. createTransmuxer
  104438. };
  104439. var workerCallback = function workerCallback2(options2) {
  104440. var transmuxer = options2.transmuxer;
  104441. var endAction = options2.endAction || options2.action;
  104442. var callback2 = options2.callback;
  104443. var message = _extends$2({}, options2, {
  104444. endAction: null,
  104445. transmuxer: null,
  104446. callback: null
  104447. });
  104448. var listenForEndEvent = function listenForEndEvent2(event2) {
  104449. if (event2.data.action !== endAction) {
  104450. return;
  104451. }
  104452. transmuxer.removeEventListener("message", listenForEndEvent2);
  104453. if (event2.data.data) {
  104454. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  104455. if (options2.data) {
  104456. options2.data = event2.data.data;
  104457. }
  104458. }
  104459. callback2(event2.data);
  104460. };
  104461. transmuxer.addEventListener("message", listenForEndEvent);
  104462. if (options2.data) {
  104463. var isArrayBuffer = options2.data instanceof ArrayBuffer;
  104464. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  104465. message.byteLength = options2.data.byteLength;
  104466. var transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  104467. transmuxer.postMessage(message, transfers);
  104468. } else {
  104469. transmuxer.postMessage(message);
  104470. }
  104471. };
  104472. var REQUEST_ERRORS = {
  104473. FAILURE: 2,
  104474. TIMEOUT: -101,
  104475. ABORTED: -102
  104476. };
  104477. var abortAll = function abortAll2(activeXhrs) {
  104478. activeXhrs.forEach(function(xhr) {
  104479. xhr.abort();
  104480. });
  104481. };
  104482. var getRequestStats = function getRequestStats2(request) {
  104483. return {
  104484. bandwidth: request.bandwidth,
  104485. bytesReceived: request.bytesReceived || 0,
  104486. roundTripTime: request.roundTripTime || 0
  104487. };
  104488. };
  104489. var getProgressStats = function getProgressStats2(progressEvent) {
  104490. var request = progressEvent.target;
  104491. var roundTripTime = Date.now() - request.requestTime;
  104492. var stats = {
  104493. bandwidth: Infinity,
  104494. bytesReceived: 0,
  104495. roundTripTime: roundTripTime || 0
  104496. };
  104497. stats.bytesReceived = progressEvent.loaded;
  104498. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  104499. return stats;
  104500. };
  104501. var handleErrors = function handleErrors2(error, request) {
  104502. if (request.timedout) {
  104503. return {
  104504. status: request.status,
  104505. message: "HLS request timed-out at URL: " + request.uri,
  104506. code: REQUEST_ERRORS.TIMEOUT,
  104507. xhr: request
  104508. };
  104509. }
  104510. if (request.aborted) {
  104511. return {
  104512. status: request.status,
  104513. message: "HLS request aborted at URL: " + request.uri,
  104514. code: REQUEST_ERRORS.ABORTED,
  104515. xhr: request
  104516. };
  104517. }
  104518. if (error) {
  104519. return {
  104520. status: request.status,
  104521. message: "HLS request errored at URL: " + request.uri,
  104522. code: REQUEST_ERRORS.FAILURE,
  104523. xhr: request
  104524. };
  104525. }
  104526. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  104527. return {
  104528. status: request.status,
  104529. message: "Empty HLS response at URL: " + request.uri,
  104530. code: REQUEST_ERRORS.FAILURE,
  104531. xhr: request
  104532. };
  104533. }
  104534. return null;
  104535. };
  104536. var handleKeyResponse = function handleKeyResponse2(segment, objects, finishProcessingFn) {
  104537. return function(error, request) {
  104538. var response = request.response;
  104539. var errorObj = handleErrors(error, request);
  104540. if (errorObj) {
  104541. return finishProcessingFn(errorObj, segment);
  104542. }
  104543. if (response.byteLength !== 16) {
  104544. return finishProcessingFn({
  104545. status: request.status,
  104546. message: "Invalid HLS key at URL: " + request.uri,
  104547. code: REQUEST_ERRORS.FAILURE,
  104548. xhr: request
  104549. }, segment);
  104550. }
  104551. var view = new DataView(response);
  104552. var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  104553. for (var i2 = 0; i2 < objects.length; i2++) {
  104554. objects[i2].bytes = bytes;
  104555. }
  104556. return finishProcessingFn(null, segment);
  104557. };
  104558. };
  104559. var parseInitSegment = function parseInitSegment2(segment, _callback) {
  104560. var type2 = detectContainerForBytes2(segment.map.bytes);
  104561. if (type2 !== "mp4") {
  104562. var uri = segment.map.resolvedUri || segment.map.uri;
  104563. return _callback({
  104564. internal: true,
  104565. message: "Found unsupported " + (type2 || "unknown") + " container for initialization segment at URL: " + uri,
  104566. code: REQUEST_ERRORS.FAILURE
  104567. });
  104568. }
  104569. workerCallback({
  104570. action: "probeMp4Tracks",
  104571. data: segment.map.bytes,
  104572. transmuxer: segment.transmuxer,
  104573. callback: function callback2(_ref) {
  104574. var tracks = _ref.tracks, data = _ref.data;
  104575. segment.map.bytes = data;
  104576. tracks.forEach(function(track) {
  104577. segment.map.tracks = segment.map.tracks || {};
  104578. if (segment.map.tracks[track.type]) {
  104579. return;
  104580. }
  104581. segment.map.tracks[track.type] = track;
  104582. if (typeof track.id === "number" && track.timescale) {
  104583. segment.map.timescales = segment.map.timescales || {};
  104584. segment.map.timescales[track.id] = track.timescale;
  104585. }
  104586. });
  104587. return _callback(null);
  104588. }
  104589. });
  104590. };
  104591. var handleInitSegmentResponse = function handleInitSegmentResponse2(_ref2) {
  104592. var segment = _ref2.segment, finishProcessingFn = _ref2.finishProcessingFn;
  104593. return function(error, request) {
  104594. var errorObj = handleErrors(error, request);
  104595. if (errorObj) {
  104596. return finishProcessingFn(errorObj, segment);
  104597. }
  104598. var bytes = new Uint8Array(request.response);
  104599. if (segment.map.key) {
  104600. segment.map.encryptedBytes = bytes;
  104601. return finishProcessingFn(null, segment);
  104602. }
  104603. segment.map.bytes = bytes;
  104604. parseInitSegment(segment, function(parseError) {
  104605. if (parseError) {
  104606. parseError.xhr = request;
  104607. parseError.status = request.status;
  104608. return finishProcessingFn(parseError, segment);
  104609. }
  104610. finishProcessingFn(null, segment);
  104611. });
  104612. };
  104613. };
  104614. var handleSegmentResponse = function handleSegmentResponse2(_ref3) {
  104615. var segment = _ref3.segment, finishProcessingFn = _ref3.finishProcessingFn, responseType = _ref3.responseType;
  104616. return function(error, request) {
  104617. var errorObj = handleErrors(error, request);
  104618. if (errorObj) {
  104619. return finishProcessingFn(errorObj, segment);
  104620. }
  104621. var newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0));
  104622. segment.stats = getRequestStats(request);
  104623. if (segment.key) {
  104624. segment.encryptedBytes = new Uint8Array(newBytes);
  104625. } else {
  104626. segment.bytes = new Uint8Array(newBytes);
  104627. }
  104628. return finishProcessingFn(null, segment);
  104629. };
  104630. };
  104631. var transmuxAndNotify = function transmuxAndNotify2(_ref4) {
  104632. 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;
  104633. var fmp4Tracks = segment.map && segment.map.tracks || {};
  104634. var isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  104635. var audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  104636. var audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  104637. var videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  104638. var videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  104639. var finish = function finish2() {
  104640. return transmux({
  104641. bytes,
  104642. transmuxer: segment.transmuxer,
  104643. audioAppendStart: segment.audioAppendStart,
  104644. gopsToAlignWith: segment.gopsToAlignWith,
  104645. remux: isMuxed3,
  104646. onData: function onData(result) {
  104647. result.type = result.type === "combined" ? "video" : result.type;
  104648. dataFn(segment, result);
  104649. },
  104650. onTrackInfo: function onTrackInfo(trackInfo) {
  104651. if (trackInfoFn) {
  104652. if (isMuxed3) {
  104653. trackInfo.isMuxed = true;
  104654. }
  104655. trackInfoFn(segment, trackInfo);
  104656. }
  104657. },
  104658. onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) {
  104659. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  104660. audioStartFn(audioTimingInfo.start);
  104661. audioStartFn = null;
  104662. }
  104663. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  104664. audioEndFn(audioTimingInfo.end);
  104665. }
  104666. },
  104667. onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) {
  104668. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  104669. videoStartFn(videoTimingInfo.start);
  104670. videoStartFn = null;
  104671. }
  104672. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  104673. videoEndFn(videoTimingInfo.end);
  104674. }
  104675. },
  104676. onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) {
  104677. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  104678. },
  104679. onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) {
  104680. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  104681. },
  104682. onId3: function onId3(id3Frames, dispatchType) {
  104683. id3Fn(segment, id3Frames, dispatchType);
  104684. },
  104685. onCaptions: function onCaptions(captions) {
  104686. captionsFn(segment, [captions]);
  104687. },
  104688. isEndOfTimeline,
  104689. onEndedTimeline: function onEndedTimeline() {
  104690. endedTimelineFn();
  104691. },
  104692. onTransmuxerLog,
  104693. onDone: function onDone(result) {
  104694. if (!doneFn) {
  104695. return;
  104696. }
  104697. result.type = result.type === "combined" ? "video" : result.type;
  104698. doneFn(null, segment, result);
  104699. }
  104700. });
  104701. };
  104702. workerCallback({
  104703. action: "probeTs",
  104704. transmuxer: segment.transmuxer,
  104705. data: bytes,
  104706. baseStartTime: segment.baseStartTime,
  104707. callback: function callback2(data) {
  104708. segment.bytes = bytes = data.data;
  104709. var probeResult = data.result;
  104710. if (probeResult) {
  104711. trackInfoFn(segment, {
  104712. hasAudio: probeResult.hasAudio,
  104713. hasVideo: probeResult.hasVideo,
  104714. isMuxed: isMuxed3
  104715. });
  104716. trackInfoFn = null;
  104717. if (probeResult.hasAudio && !isMuxed3) {
  104718. audioStartFn(probeResult.audioStart);
  104719. }
  104720. if (probeResult.hasVideo) {
  104721. videoStartFn(probeResult.videoStart);
  104722. }
  104723. audioStartFn = null;
  104724. videoStartFn = null;
  104725. }
  104726. finish();
  104727. }
  104728. });
  104729. };
  104730. var handleSegmentBytes = function handleSegmentBytes2(_ref5) {
  104731. 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;
  104732. var bytesAsUint8Array = new Uint8Array(bytes);
  104733. if (isLikelyFmp4MediaSegment2(bytesAsUint8Array)) {
  104734. segment.isFmp4 = true;
  104735. var tracks = segment.map.tracks;
  104736. var trackInfo = {
  104737. isFmp4: true,
  104738. hasVideo: !!tracks.video,
  104739. hasAudio: !!tracks.audio
  104740. };
  104741. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  104742. trackInfo.audioCodec = tracks.audio.codec;
  104743. }
  104744. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  104745. trackInfo.videoCodec = tracks.video.codec;
  104746. }
  104747. if (tracks.video && tracks.audio) {
  104748. trackInfo.isMuxed = true;
  104749. }
  104750. trackInfoFn(segment, trackInfo);
  104751. var finishLoading = function finishLoading2(captions) {
  104752. dataFn(segment, {
  104753. data: bytesAsUint8Array,
  104754. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  104755. });
  104756. if (captions && captions.length) {
  104757. captionsFn(segment, captions);
  104758. }
  104759. doneFn(null, segment, {});
  104760. };
  104761. workerCallback({
  104762. action: "probeMp4StartTime",
  104763. timescales: segment.map.timescales,
  104764. data: bytesAsUint8Array,
  104765. transmuxer: segment.transmuxer,
  104766. callback: function callback2(_ref6) {
  104767. var data = _ref6.data, startTime = _ref6.startTime;
  104768. bytes = data.buffer;
  104769. segment.bytes = bytesAsUint8Array = data;
  104770. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  104771. timingInfoFn(segment, "audio", "start", startTime);
  104772. }
  104773. if (trackInfo.hasVideo) {
  104774. timingInfoFn(segment, "video", "start", startTime);
  104775. }
  104776. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  104777. finishLoading();
  104778. return;
  104779. }
  104780. workerCallback({
  104781. action: "pushMp4Captions",
  104782. endAction: "mp4Captions",
  104783. transmuxer: segment.transmuxer,
  104784. data: bytesAsUint8Array,
  104785. timescales: segment.map.timescales,
  104786. trackIds: [tracks.video.id],
  104787. callback: function callback3(message) {
  104788. bytes = message.data.buffer;
  104789. segment.bytes = bytesAsUint8Array = message.data;
  104790. message.logs.forEach(function(log2) {
  104791. onTransmuxerLog(videojs.mergeOptions(log2, {
  104792. stream: "mp4CaptionParser"
  104793. }));
  104794. });
  104795. finishLoading(message.captions);
  104796. }
  104797. });
  104798. }
  104799. });
  104800. return;
  104801. }
  104802. if (!segment.transmuxer) {
  104803. doneFn(null, segment, {});
  104804. return;
  104805. }
  104806. if (typeof segment.container === "undefined") {
  104807. segment.container = detectContainerForBytes2(bytesAsUint8Array);
  104808. }
  104809. if (segment.container !== "ts" && segment.container !== "aac") {
  104810. trackInfoFn(segment, {
  104811. hasAudio: false,
  104812. hasVideo: false
  104813. });
  104814. doneFn(null, segment, {});
  104815. return;
  104816. }
  104817. transmuxAndNotify({
  104818. segment,
  104819. bytes,
  104820. trackInfoFn,
  104821. timingInfoFn,
  104822. videoSegmentTimingInfoFn,
  104823. audioSegmentTimingInfoFn,
  104824. id3Fn,
  104825. captionsFn,
  104826. isEndOfTimeline,
  104827. endedTimelineFn,
  104828. dataFn,
  104829. doneFn,
  104830. onTransmuxerLog
  104831. });
  104832. };
  104833. var decrypt = function decrypt2(_ref7, callback2) {
  104834. var id = _ref7.id, key = _ref7.key, encryptedBytes = _ref7.encryptedBytes, decryptionWorker = _ref7.decryptionWorker;
  104835. var decryptionHandler = function decryptionHandler2(event2) {
  104836. if (event2.data.source === id) {
  104837. decryptionWorker.removeEventListener("message", decryptionHandler2);
  104838. var decrypted = event2.data.decrypted;
  104839. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  104840. }
  104841. };
  104842. decryptionWorker.addEventListener("message", decryptionHandler);
  104843. var keyBytes;
  104844. if (key.bytes.slice) {
  104845. keyBytes = key.bytes.slice();
  104846. } else {
  104847. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  104848. }
  104849. decryptionWorker.postMessage(createTransferableMessage({
  104850. source: id,
  104851. encrypted: encryptedBytes,
  104852. key: keyBytes,
  104853. iv: key.iv
  104854. }), [encryptedBytes.buffer, keyBytes.buffer]);
  104855. };
  104856. var decryptSegment = function decryptSegment2(_ref8) {
  104857. 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;
  104858. decrypt({
  104859. id: segment.requestId,
  104860. key: segment.key,
  104861. encryptedBytes: segment.encryptedBytes,
  104862. decryptionWorker
  104863. }, function(decryptedBytes) {
  104864. segment.bytes = decryptedBytes;
  104865. handleSegmentBytes({
  104866. segment,
  104867. bytes: segment.bytes,
  104868. trackInfoFn,
  104869. timingInfoFn,
  104870. videoSegmentTimingInfoFn,
  104871. audioSegmentTimingInfoFn,
  104872. id3Fn,
  104873. captionsFn,
  104874. isEndOfTimeline,
  104875. endedTimelineFn,
  104876. dataFn,
  104877. doneFn,
  104878. onTransmuxerLog
  104879. });
  104880. });
  104881. };
  104882. var waitForCompletion = function waitForCompletion2(_ref9) {
  104883. 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;
  104884. var count = 0;
  104885. var didError = false;
  104886. return function(error, segment) {
  104887. if (didError) {
  104888. return;
  104889. }
  104890. if (error) {
  104891. didError = true;
  104892. abortAll(activeXhrs);
  104893. return doneFn(error, segment);
  104894. }
  104895. count += 1;
  104896. if (count === activeXhrs.length) {
  104897. var segmentFinish = function segmentFinish2() {
  104898. if (segment.encryptedBytes) {
  104899. return decryptSegment({
  104900. decryptionWorker,
  104901. segment,
  104902. trackInfoFn,
  104903. timingInfoFn,
  104904. videoSegmentTimingInfoFn,
  104905. audioSegmentTimingInfoFn,
  104906. id3Fn,
  104907. captionsFn,
  104908. isEndOfTimeline,
  104909. endedTimelineFn,
  104910. dataFn,
  104911. doneFn,
  104912. onTransmuxerLog
  104913. });
  104914. }
  104915. handleSegmentBytes({
  104916. segment,
  104917. bytes: segment.bytes,
  104918. trackInfoFn,
  104919. timingInfoFn,
  104920. videoSegmentTimingInfoFn,
  104921. audioSegmentTimingInfoFn,
  104922. id3Fn,
  104923. captionsFn,
  104924. isEndOfTimeline,
  104925. endedTimelineFn,
  104926. dataFn,
  104927. doneFn,
  104928. onTransmuxerLog
  104929. });
  104930. };
  104931. segment.endOfAllRequests = Date.now();
  104932. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  104933. return decrypt({
  104934. decryptionWorker,
  104935. id: segment.requestId + "-init",
  104936. encryptedBytes: segment.map.encryptedBytes,
  104937. key: segment.map.key
  104938. }, function(decryptedBytes) {
  104939. segment.map.bytes = decryptedBytes;
  104940. parseInitSegment(segment, function(parseError) {
  104941. if (parseError) {
  104942. abortAll(activeXhrs);
  104943. return doneFn(parseError, segment);
  104944. }
  104945. segmentFinish();
  104946. });
  104947. });
  104948. }
  104949. segmentFinish();
  104950. }
  104951. };
  104952. };
  104953. var handleLoadEnd = function handleLoadEnd2(_ref10) {
  104954. var loadendState = _ref10.loadendState, abortFn = _ref10.abortFn;
  104955. return function(event2) {
  104956. var request = event2.target;
  104957. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  104958. abortFn();
  104959. loadendState.calledAbortFn = true;
  104960. }
  104961. };
  104962. };
  104963. var handleProgress = function handleProgress2(_ref11) {
  104964. var segment = _ref11.segment, progressFn = _ref11.progressFn;
  104965. _ref11.trackInfoFn;
  104966. _ref11.timingInfoFn;
  104967. _ref11.videoSegmentTimingInfoFn;
  104968. _ref11.audioSegmentTimingInfoFn;
  104969. _ref11.id3Fn;
  104970. _ref11.captionsFn;
  104971. _ref11.isEndOfTimeline;
  104972. _ref11.endedTimelineFn;
  104973. _ref11.dataFn;
  104974. return function(event2) {
  104975. var request = event2.target;
  104976. if (request.aborted) {
  104977. return;
  104978. }
  104979. segment.stats = videojs.mergeOptions(segment.stats, getProgressStats(event2));
  104980. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  104981. segment.stats.firstBytesReceivedAt = Date.now();
  104982. }
  104983. return progressFn(event2, segment);
  104984. };
  104985. };
  104986. var mediaSegmentRequest = function mediaSegmentRequest2(_ref12) {
  104987. 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;
  104988. var activeXhrs = [];
  104989. var finishProcessingFn = waitForCompletion({
  104990. activeXhrs,
  104991. decryptionWorker,
  104992. trackInfoFn,
  104993. timingInfoFn,
  104994. videoSegmentTimingInfoFn,
  104995. audioSegmentTimingInfoFn,
  104996. id3Fn,
  104997. captionsFn,
  104998. isEndOfTimeline,
  104999. endedTimelineFn,
  105000. dataFn,
  105001. doneFn,
  105002. onTransmuxerLog
  105003. });
  105004. if (segment.key && !segment.key.bytes) {
  105005. var objects = [segment.key];
  105006. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  105007. objects.push(segment.map.key);
  105008. }
  105009. var keyRequestOptions = videojs.mergeOptions(xhrOptions, {
  105010. uri: segment.key.resolvedUri,
  105011. responseType: "arraybuffer"
  105012. });
  105013. var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn);
  105014. var keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  105015. activeXhrs.push(keyXhr);
  105016. }
  105017. if (segment.map && !segment.map.bytes) {
  105018. var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  105019. if (differentMapKey) {
  105020. var mapKeyRequestOptions = videojs.mergeOptions(xhrOptions, {
  105021. uri: segment.map.key.resolvedUri,
  105022. responseType: "arraybuffer"
  105023. });
  105024. var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn);
  105025. var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  105026. activeXhrs.push(mapKeyXhr);
  105027. }
  105028. var initSegmentOptions = videojs.mergeOptions(xhrOptions, {
  105029. uri: segment.map.resolvedUri,
  105030. responseType: "arraybuffer",
  105031. headers: segmentXhrHeaders(segment.map)
  105032. });
  105033. var initSegmentRequestCallback = handleInitSegmentResponse({
  105034. segment,
  105035. finishProcessingFn
  105036. });
  105037. var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  105038. activeXhrs.push(initSegmentXhr);
  105039. }
  105040. var segmentRequestOptions = videojs.mergeOptions(xhrOptions, {
  105041. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  105042. responseType: "arraybuffer",
  105043. headers: segmentXhrHeaders(segment)
  105044. });
  105045. var segmentRequestCallback = handleSegmentResponse({
  105046. segment,
  105047. finishProcessingFn,
  105048. responseType: segmentRequestOptions.responseType
  105049. });
  105050. var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  105051. segmentXhr.addEventListener("progress", handleProgress({
  105052. segment,
  105053. progressFn,
  105054. trackInfoFn,
  105055. timingInfoFn,
  105056. videoSegmentTimingInfoFn,
  105057. audioSegmentTimingInfoFn,
  105058. id3Fn,
  105059. captionsFn,
  105060. isEndOfTimeline,
  105061. endedTimelineFn,
  105062. dataFn
  105063. }));
  105064. activeXhrs.push(segmentXhr);
  105065. var loadendState = {};
  105066. activeXhrs.forEach(function(activeXhr) {
  105067. activeXhr.addEventListener("loadend", handleLoadEnd({
  105068. loadendState,
  105069. abortFn
  105070. }));
  105071. });
  105072. return function() {
  105073. return abortAll(activeXhrs);
  105074. };
  105075. };
  105076. var logFn$1 = logger("CodecUtils");
  105077. var getCodecs = function getCodecs2(media) {
  105078. var mediaAttributes = media.attributes || {};
  105079. if (mediaAttributes.CODECS) {
  105080. return parseCodecs2(mediaAttributes.CODECS);
  105081. }
  105082. };
  105083. var isMaat = function isMaat2(master, media) {
  105084. var mediaAttributes = media.attributes || {};
  105085. return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  105086. };
  105087. var isMuxed = function isMuxed2(master, media) {
  105088. if (!isMaat(master, media)) {
  105089. return true;
  105090. }
  105091. var mediaAttributes = media.attributes || {};
  105092. var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  105093. for (var groupId in audioGroup) {
  105094. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  105095. return true;
  105096. }
  105097. }
  105098. return false;
  105099. };
  105100. var unwrapCodecList = function unwrapCodecList2(codecList) {
  105101. var codecs = {};
  105102. codecList.forEach(function(_ref) {
  105103. var mediaType = _ref.mediaType, type2 = _ref.type, details = _ref.details;
  105104. codecs[mediaType] = codecs[mediaType] || [];
  105105. codecs[mediaType].push(translateLegacyCodec2("" + type2 + details));
  105106. });
  105107. Object.keys(codecs).forEach(function(mediaType) {
  105108. if (codecs[mediaType].length > 1) {
  105109. 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.");
  105110. codecs[mediaType] = null;
  105111. return;
  105112. }
  105113. codecs[mediaType] = codecs[mediaType][0];
  105114. });
  105115. return codecs;
  105116. };
  105117. var codecCount = function codecCount2(codecObj) {
  105118. var count = 0;
  105119. if (codecObj.audio) {
  105120. count++;
  105121. }
  105122. if (codecObj.video) {
  105123. count++;
  105124. }
  105125. return count;
  105126. };
  105127. var codecsForPlaylist = function codecsForPlaylist2(master, media) {
  105128. var mediaAttributes = media.attributes || {};
  105129. var codecInfo = unwrapCodecList(getCodecs(media) || []);
  105130. if (isMaat(master, media) && !codecInfo.audio) {
  105131. if (!isMuxed(master, media)) {
  105132. var defaultCodecs = unwrapCodecList(codecsFromDefault2(master, mediaAttributes.AUDIO) || []);
  105133. if (defaultCodecs.audio) {
  105134. codecInfo.audio = defaultCodecs.audio;
  105135. }
  105136. }
  105137. }
  105138. return codecInfo;
  105139. };
  105140. var logFn = logger("PlaylistSelector");
  105141. var representationToString = function representationToString2(representation) {
  105142. if (!representation || !representation.playlist) {
  105143. return;
  105144. }
  105145. var playlist = representation.playlist;
  105146. return JSON.stringify({
  105147. id: playlist.id,
  105148. bandwidth: representation.bandwidth,
  105149. width: representation.width,
  105150. height: representation.height,
  105151. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  105152. });
  105153. };
  105154. var safeGetComputedStyle = function safeGetComputedStyle2(el, property) {
  105155. if (!el) {
  105156. return "";
  105157. }
  105158. var result = window_1.getComputedStyle(el);
  105159. if (!result) {
  105160. return "";
  105161. }
  105162. return result[property];
  105163. };
  105164. var stableSort = function stableSort2(array, sortFn) {
  105165. var newArray = array.slice();
  105166. array.sort(function(left, right) {
  105167. var cmp = sortFn(left, right);
  105168. if (cmp === 0) {
  105169. return newArray.indexOf(left) - newArray.indexOf(right);
  105170. }
  105171. return cmp;
  105172. });
  105173. };
  105174. var comparePlaylistBandwidth = function comparePlaylistBandwidth2(left, right) {
  105175. var leftBandwidth;
  105176. var rightBandwidth;
  105177. if (left.attributes.BANDWIDTH) {
  105178. leftBandwidth = left.attributes.BANDWIDTH;
  105179. }
  105180. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  105181. if (right.attributes.BANDWIDTH) {
  105182. rightBandwidth = right.attributes.BANDWIDTH;
  105183. }
  105184. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  105185. return leftBandwidth - rightBandwidth;
  105186. };
  105187. var comparePlaylistResolution = function comparePlaylistResolution2(left, right) {
  105188. var leftWidth;
  105189. var rightWidth;
  105190. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  105191. leftWidth = left.attributes.RESOLUTION.width;
  105192. }
  105193. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  105194. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  105195. rightWidth = right.attributes.RESOLUTION.width;
  105196. }
  105197. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  105198. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  105199. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  105200. }
  105201. return leftWidth - rightWidth;
  105202. };
  105203. var simpleSelector = function simpleSelector2(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) {
  105204. if (!master) {
  105205. return;
  105206. }
  105207. var options2 = {
  105208. bandwidth: playerBandwidth,
  105209. width: playerWidth,
  105210. height: playerHeight,
  105211. limitRenditionByPlayerDimensions
  105212. };
  105213. var playlists = master.playlists;
  105214. if (Playlist.isAudioOnly(master)) {
  105215. playlists = masterPlaylistController.getAudioTrackPlaylists_();
  105216. options2.audioOnly = true;
  105217. }
  105218. var sortedPlaylistReps = playlists.map(function(playlist) {
  105219. var bandwidth2;
  105220. var width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  105221. var height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  105222. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  105223. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  105224. return {
  105225. bandwidth: bandwidth2,
  105226. width: width2,
  105227. height: height2,
  105228. playlist
  105229. };
  105230. });
  105231. stableSort(sortedPlaylistReps, function(left, right) {
  105232. return left.bandwidth - right.bandwidth;
  105233. });
  105234. sortedPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105235. return !Playlist.isIncompatible(rep2.playlist);
  105236. });
  105237. var enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105238. return Playlist.isEnabled(rep2.playlist);
  105239. });
  105240. if (!enabledPlaylistReps.length) {
  105241. enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105242. return !Playlist.isDisabled(rep2.playlist);
  105243. });
  105244. }
  105245. var bandwidthPlaylistReps = enabledPlaylistReps.filter(function(rep2) {
  105246. return rep2.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth;
  105247. });
  105248. var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  105249. var bandwidthBestRep = bandwidthPlaylistReps.filter(function(rep2) {
  105250. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105251. })[0];
  105252. if (limitRenditionByPlayerDimensions === false) {
  105253. var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105254. if (_chosenRep && _chosenRep.playlist) {
  105255. var type2 = "sortedPlaylistReps";
  105256. if (bandwidthBestRep) {
  105257. type2 = "bandwidthBestRep";
  105258. }
  105259. if (enabledPlaylistReps[0]) {
  105260. type2 = "enabledPlaylistReps";
  105261. }
  105262. logFn("choosing " + representationToString(_chosenRep) + " using " + type2 + " with options", options2);
  105263. return _chosenRep.playlist;
  105264. }
  105265. logFn("could not choose a playlist with options", options2);
  105266. return null;
  105267. }
  105268. var haveResolution = bandwidthPlaylistReps.filter(function(rep2) {
  105269. return rep2.width && rep2.height;
  105270. });
  105271. stableSort(haveResolution, function(left, right) {
  105272. return left.width - right.width;
  105273. });
  105274. var resolutionBestRepList = haveResolution.filter(function(rep2) {
  105275. return rep2.width === playerWidth && rep2.height === playerHeight;
  105276. });
  105277. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  105278. var resolutionBestRep = resolutionBestRepList.filter(function(rep2) {
  105279. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105280. })[0];
  105281. var resolutionPlusOneList;
  105282. var resolutionPlusOneSmallest;
  105283. var resolutionPlusOneRep;
  105284. if (!resolutionBestRep) {
  105285. resolutionPlusOneList = haveResolution.filter(function(rep2) {
  105286. return rep2.width > playerWidth || rep2.height > playerHeight;
  105287. });
  105288. resolutionPlusOneSmallest = resolutionPlusOneList.filter(function(rep2) {
  105289. return rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height;
  105290. });
  105291. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  105292. resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function(rep2) {
  105293. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105294. })[0];
  105295. }
  105296. var leastPixelDiffRep;
  105297. if (masterPlaylistController.experimentalLeastPixelDiffSelector) {
  105298. var leastPixelDiffList = haveResolution.map(function(rep2) {
  105299. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  105300. return rep2;
  105301. });
  105302. stableSort(leastPixelDiffList, function(left, right) {
  105303. if (left.pixelDiff === right.pixelDiff) {
  105304. return right.bandwidth - left.bandwidth;
  105305. }
  105306. return left.pixelDiff - right.pixelDiff;
  105307. });
  105308. leastPixelDiffRep = leastPixelDiffList[0];
  105309. }
  105310. var chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105311. if (chosenRep && chosenRep.playlist) {
  105312. var _type = "sortedPlaylistReps";
  105313. if (leastPixelDiffRep) {
  105314. _type = "leastPixelDiffRep";
  105315. } else if (resolutionPlusOneRep) {
  105316. _type = "resolutionPlusOneRep";
  105317. } else if (resolutionBestRep) {
  105318. _type = "resolutionBestRep";
  105319. } else if (bandwidthBestRep) {
  105320. _type = "bandwidthBestRep";
  105321. } else if (enabledPlaylistReps[0]) {
  105322. _type = "enabledPlaylistReps";
  105323. }
  105324. logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options2);
  105325. return chosenRep.playlist;
  105326. }
  105327. logFn("could not choose a playlist with options", options2);
  105328. return null;
  105329. };
  105330. var lastBandwidthSelector = function lastBandwidthSelector2() {
  105331. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105332. 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_);
  105333. };
  105334. var movingAverageBandwidthSelector = function movingAverageBandwidthSelector2(decay) {
  105335. var average = -1;
  105336. var lastSystemBandwidth = -1;
  105337. if (decay < 0 || decay > 1) {
  105338. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  105339. }
  105340. return function() {
  105341. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105342. if (average < 0) {
  105343. average = this.systemBandwidth;
  105344. lastSystemBandwidth = this.systemBandwidth;
  105345. }
  105346. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  105347. average = decay * this.systemBandwidth + (1 - decay) * average;
  105348. lastSystemBandwidth = this.systemBandwidth;
  105349. }
  105350. 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_);
  105351. };
  105352. };
  105353. var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector2(settings) {
  105354. 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;
  105355. var compatiblePlaylists = master.playlists.filter(function(playlist) {
  105356. return !Playlist.isIncompatible(playlist);
  105357. });
  105358. var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled);
  105359. if (!enabledPlaylists.length) {
  105360. enabledPlaylists = compatiblePlaylists.filter(function(playlist) {
  105361. return !Playlist.isDisabled(playlist);
  105362. });
  105363. }
  105364. var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, "BANDWIDTH"));
  105365. var rebufferingEstimates = bandwidthPlaylists.map(function(playlist) {
  105366. var syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  105367. var numRequests = syncPoint ? 1 : 2;
  105368. var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  105369. var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  105370. return {
  105371. playlist,
  105372. rebufferingImpact
  105373. };
  105374. });
  105375. var noRebufferingPlaylists = rebufferingEstimates.filter(function(estimate) {
  105376. return estimate.rebufferingImpact <= 0;
  105377. });
  105378. stableSort(noRebufferingPlaylists, function(a, b) {
  105379. return comparePlaylistBandwidth(b.playlist, a.playlist);
  105380. });
  105381. if (noRebufferingPlaylists.length) {
  105382. return noRebufferingPlaylists[0];
  105383. }
  105384. stableSort(rebufferingEstimates, function(a, b) {
  105385. return a.rebufferingImpact - b.rebufferingImpact;
  105386. });
  105387. return rebufferingEstimates[0] || null;
  105388. };
  105389. var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector2() {
  105390. var _this = this;
  105391. var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled);
  105392. stableSort(playlists, function(a, b) {
  105393. return comparePlaylistBandwidth(a, b);
  105394. });
  105395. var playlistsWithVideo = playlists.filter(function(playlist) {
  105396. return !!codecsForPlaylist(_this.playlists.master, playlist).video;
  105397. });
  105398. return playlistsWithVideo[0] || null;
  105399. };
  105400. var concatSegments = function concatSegments2(segmentObj) {
  105401. var offset = 0;
  105402. var tempBuffer;
  105403. if (segmentObj.bytes) {
  105404. tempBuffer = new Uint8Array(segmentObj.bytes);
  105405. segmentObj.segments.forEach(function(segment) {
  105406. tempBuffer.set(segment, offset);
  105407. offset += segment.byteLength;
  105408. });
  105409. }
  105410. return tempBuffer;
  105411. };
  105412. var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists2(inbandTextTracks, tech, captionStream) {
  105413. if (!inbandTextTracks[captionStream]) {
  105414. tech.trigger({
  105415. type: "usage",
  105416. name: "vhs-608"
  105417. });
  105418. tech.trigger({
  105419. type: "usage",
  105420. name: "hls-608"
  105421. });
  105422. var instreamId = captionStream;
  105423. if (/^cc708_/.test(captionStream)) {
  105424. instreamId = "SERVICE" + captionStream.split("_")[1];
  105425. }
  105426. var track = tech.textTracks().getTrackById(instreamId);
  105427. if (track) {
  105428. inbandTextTracks[captionStream] = track;
  105429. } else {
  105430. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  105431. var label2 = captionStream;
  105432. var language = captionStream;
  105433. var def = false;
  105434. var captionService = captionServices[instreamId];
  105435. if (captionService) {
  105436. label2 = captionService.label;
  105437. language = captionService.language;
  105438. def = captionService["default"];
  105439. }
  105440. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  105441. kind: "captions",
  105442. id: instreamId,
  105443. "default": def,
  105444. label: label2,
  105445. language
  105446. }, false).track;
  105447. }
  105448. }
  105449. };
  105450. var addCaptionData = function addCaptionData2(_ref) {
  105451. var inbandTextTracks = _ref.inbandTextTracks, captionArray = _ref.captionArray, timestampOffset2 = _ref.timestampOffset;
  105452. if (!captionArray) {
  105453. return;
  105454. }
  105455. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105456. captionArray.forEach(function(caption) {
  105457. var track = caption.stream;
  105458. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  105459. });
  105460. };
  105461. var deprecateOldCue = function deprecateOldCue2(cue) {
  105462. Object.defineProperties(cue.frame, {
  105463. id: {
  105464. get: function get7() {
  105465. videojs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  105466. return cue.value.key;
  105467. }
  105468. },
  105469. value: {
  105470. get: function get7() {
  105471. videojs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  105472. return cue.value.data;
  105473. }
  105474. },
  105475. privateData: {
  105476. get: function get7() {
  105477. videojs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  105478. return cue.value.data;
  105479. }
  105480. }
  105481. });
  105482. };
  105483. var addMetadata = function addMetadata2(_ref2) {
  105484. var inbandTextTracks = _ref2.inbandTextTracks, metadataArray = _ref2.metadataArray, timestampOffset2 = _ref2.timestampOffset, videoDuration = _ref2.videoDuration;
  105485. if (!metadataArray) {
  105486. return;
  105487. }
  105488. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105489. var metadataTrack = inbandTextTracks.metadataTrack_;
  105490. if (!metadataTrack) {
  105491. return;
  105492. }
  105493. metadataArray.forEach(function(metadata) {
  105494. var time = metadata.cueTime + timestampOffset2;
  105495. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  105496. return;
  105497. }
  105498. metadata.frames.forEach(function(frame) {
  105499. var cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  105500. cue.frame = frame;
  105501. cue.value = frame;
  105502. deprecateOldCue(cue);
  105503. metadataTrack.addCue(cue);
  105504. });
  105505. });
  105506. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  105507. return;
  105508. }
  105509. var cues = metadataTrack.cues;
  105510. var cuesArray = [];
  105511. for (var i2 = 0; i2 < cues.length; i2++) {
  105512. if (cues[i2]) {
  105513. cuesArray.push(cues[i2]);
  105514. }
  105515. }
  105516. var cuesGroupedByStartTime = cuesArray.reduce(function(obj, cue) {
  105517. var timeSlot = obj[cue.startTime] || [];
  105518. timeSlot.push(cue);
  105519. obj[cue.startTime] = timeSlot;
  105520. return obj;
  105521. }, {});
  105522. var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function(a, b) {
  105523. return Number(a) - Number(b);
  105524. });
  105525. sortedStartTimes.forEach(function(startTime, idx) {
  105526. var cueGroup = cuesGroupedByStartTime[startTime];
  105527. var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  105528. cueGroup.forEach(function(cue) {
  105529. cue.endTime = nextTime;
  105530. });
  105531. });
  105532. };
  105533. var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists2(inbandTextTracks, dispatchType, tech) {
  105534. if (inbandTextTracks.metadataTrack_) {
  105535. return;
  105536. }
  105537. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  105538. kind: "metadata",
  105539. label: "Timed Metadata"
  105540. }, false).track;
  105541. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  105542. };
  105543. var removeCuesFromTrack = function removeCuesFromTrack2(start2, end, track) {
  105544. var i2;
  105545. var cue;
  105546. if (!track) {
  105547. return;
  105548. }
  105549. if (!track.cues) {
  105550. return;
  105551. }
  105552. i2 = track.cues.length;
  105553. while (i2--) {
  105554. cue = track.cues[i2];
  105555. if (cue.startTime >= start2 && cue.endTime <= end) {
  105556. track.removeCue(cue);
  105557. }
  105558. }
  105559. };
  105560. var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack2(track) {
  105561. var cues = track.cues;
  105562. if (!cues) {
  105563. return;
  105564. }
  105565. for (var i2 = 0; i2 < cues.length; i2++) {
  105566. var duplicates = [];
  105567. var occurrences = 0;
  105568. for (var j = 0; j < cues.length; j++) {
  105569. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  105570. occurrences++;
  105571. if (occurrences > 1) {
  105572. duplicates.push(cues[j]);
  105573. }
  105574. }
  105575. }
  105576. if (duplicates.length) {
  105577. duplicates.forEach(function(dupe) {
  105578. return track.removeCue(dupe);
  105579. });
  105580. }
  105581. }
  105582. };
  105583. var gopsSafeToAlignWith = function gopsSafeToAlignWith2(buffer, currentTime, mapping) {
  105584. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  105585. return [];
  105586. }
  105587. var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS);
  105588. var i2;
  105589. for (i2 = 0; i2 < buffer.length; i2++) {
  105590. if (buffer[i2].pts > currentTimePts) {
  105591. break;
  105592. }
  105593. }
  105594. return buffer.slice(i2);
  105595. };
  105596. var updateGopBuffer = function updateGopBuffer2(buffer, gops, replace) {
  105597. if (!gops.length) {
  105598. return buffer;
  105599. }
  105600. if (replace) {
  105601. return gops.slice();
  105602. }
  105603. var start2 = gops[0].pts;
  105604. var i2 = 0;
  105605. for (i2; i2 < buffer.length; i2++) {
  105606. if (buffer[i2].pts >= start2) {
  105607. break;
  105608. }
  105609. }
  105610. return buffer.slice(0, i2).concat(gops);
  105611. };
  105612. var removeGopBuffer = function removeGopBuffer2(buffer, start2, end, mapping) {
  105613. var startPts = Math.ceil((start2 - mapping) * clock.ONE_SECOND_IN_TS);
  105614. var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS);
  105615. var updatedBuffer = buffer.slice();
  105616. var i2 = buffer.length;
  105617. while (i2--) {
  105618. if (buffer[i2].pts <= endPts) {
  105619. break;
  105620. }
  105621. }
  105622. if (i2 === -1) {
  105623. return updatedBuffer;
  105624. }
  105625. var j = i2 + 1;
  105626. while (j--) {
  105627. if (buffer[j].pts <= startPts) {
  105628. break;
  105629. }
  105630. }
  105631. j = Math.max(j, 0);
  105632. updatedBuffer.splice(j, i2 - j + 1);
  105633. return updatedBuffer;
  105634. };
  105635. var shallowEqual = function shallowEqual2(a, b) {
  105636. if (!a && !b || !a && b || a && !b) {
  105637. return false;
  105638. }
  105639. if (a === b) {
  105640. return true;
  105641. }
  105642. var akeys = Object.keys(a).sort();
  105643. var bkeys = Object.keys(b).sort();
  105644. if (akeys.length !== bkeys.length) {
  105645. return false;
  105646. }
  105647. for (var i2 = 0; i2 < akeys.length; i2++) {
  105648. var key = akeys[i2];
  105649. if (key !== bkeys[i2]) {
  105650. return false;
  105651. }
  105652. if (a[key] !== b[key]) {
  105653. return false;
  105654. }
  105655. }
  105656. return true;
  105657. };
  105658. var QUOTA_EXCEEDED_ERR = 22;
  105659. var getSyncSegmentCandidate = function getSyncSegmentCandidate2(currentTimeline, segments, targetTime) {
  105660. segments = segments || [];
  105661. var timelineSegments = [];
  105662. var time = 0;
  105663. for (var i2 = 0; i2 < segments.length; i2++) {
  105664. var segment = segments[i2];
  105665. if (currentTimeline === segment.timeline) {
  105666. timelineSegments.push(i2);
  105667. time += segment.duration;
  105668. if (time > targetTime) {
  105669. return i2;
  105670. }
  105671. }
  105672. }
  105673. if (timelineSegments.length === 0) {
  105674. return 0;
  105675. }
  105676. return timelineSegments[timelineSegments.length - 1];
  105677. };
  105678. var MIN_BACK_BUFFER = 1;
  105679. var CHECK_BUFFER_DELAY = 500;
  105680. var finite = function finite2(num) {
  105681. return typeof num === "number" && isFinite(num);
  105682. };
  105683. var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60;
  105684. var illegalMediaSwitch = function illegalMediaSwitch2(loaderType, startingMedia, trackInfo) {
  105685. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  105686. return null;
  105687. }
  105688. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  105689. return "Neither audio nor video found in segment.";
  105690. }
  105691. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  105692. 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.";
  105693. }
  105694. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  105695. 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.";
  105696. }
  105697. return null;
  105698. };
  105699. var safeBackBufferTrimTime = function safeBackBufferTrimTime2(seekable3, currentTime, targetDuration) {
  105700. var trimTime = currentTime - Config.BACK_BUFFER_LENGTH;
  105701. if (seekable3.length) {
  105702. trimTime = Math.max(trimTime, seekable3.start(0));
  105703. }
  105704. var maxTrimTime = currentTime - targetDuration;
  105705. return Math.min(maxTrimTime, trimTime);
  105706. };
  105707. var segmentInfoString = function segmentInfoString2(segmentInfo) {
  105708. 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;
  105709. var segmentLen = segments.length - 1;
  105710. var selection = "mediaIndex/partIndex increment";
  105711. if (segmentInfo.getMediaInfoForTime) {
  105712. selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")";
  105713. } else if (segmentInfo.isSyncRequest) {
  105714. selection = "getSyncSegmentCandidate (isSyncRequest)";
  105715. }
  105716. if (segmentInfo.independent) {
  105717. selection += " with independent " + segmentInfo.independent;
  105718. }
  105719. var hasPartIndex = typeof partIndex === "number";
  105720. var name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  105721. var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({
  105722. preloadSegment: segment
  105723. }) - 1 : 0;
  105724. 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 + "]");
  105725. };
  105726. var timingInfoPropertyForMedia = function timingInfoPropertyForMedia2(mediaType) {
  105727. return mediaType + "TimingInfo";
  105728. };
  105729. var timestampOffsetForSegment = function timestampOffsetForSegment2(_ref) {
  105730. var segmentTimeline = _ref.segmentTimeline, currentTimeline = _ref.currentTimeline, startOfSegment = _ref.startOfSegment, buffered = _ref.buffered, overrideCheck = _ref.overrideCheck;
  105731. if (!overrideCheck && segmentTimeline === currentTimeline) {
  105732. return null;
  105733. }
  105734. if (segmentTimeline < currentTimeline) {
  105735. return startOfSegment;
  105736. }
  105737. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  105738. };
  105739. var shouldWaitForTimelineChange = function shouldWaitForTimelineChange2(_ref2) {
  105740. var timelineChangeController = _ref2.timelineChangeController, currentTimeline = _ref2.currentTimeline, segmentTimeline = _ref2.segmentTimeline, loaderType = _ref2.loaderType, audioDisabled = _ref2.audioDisabled;
  105741. if (currentTimeline === segmentTimeline) {
  105742. return false;
  105743. }
  105744. if (loaderType === "audio") {
  105745. var lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  105746. type: "main"
  105747. });
  105748. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  105749. }
  105750. if (loaderType === "main" && audioDisabled) {
  105751. var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  105752. type: "audio"
  105753. });
  105754. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  105755. return false;
  105756. }
  105757. return true;
  105758. }
  105759. return false;
  105760. };
  105761. var mediaDuration = function mediaDuration2(timingInfos) {
  105762. var maxDuration = 0;
  105763. ["video", "audio"].forEach(function(type2) {
  105764. var typeTimingInfo = timingInfos[type2 + "TimingInfo"];
  105765. if (!typeTimingInfo) {
  105766. return;
  105767. }
  105768. var start2 = typeTimingInfo.start, end = typeTimingInfo.end;
  105769. var duration5;
  105770. if (typeof start2 === "bigint" || typeof end === "bigint") {
  105771. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  105772. } else if (typeof start2 === "number" && typeof end === "number") {
  105773. duration5 = end - start2;
  105774. }
  105775. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  105776. maxDuration = duration5;
  105777. }
  105778. });
  105779. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  105780. maxDuration = Number(maxDuration);
  105781. }
  105782. return maxDuration;
  105783. };
  105784. var segmentTooLong = function segmentTooLong2(_ref3) {
  105785. var segmentDuration = _ref3.segmentDuration, maxDuration = _ref3.maxDuration;
  105786. if (!segmentDuration) {
  105787. return false;
  105788. }
  105789. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR;
  105790. };
  105791. var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage2(segmentInfo, sourceType) {
  105792. if (sourceType !== "hls") {
  105793. return null;
  105794. }
  105795. var segmentDuration = mediaDuration({
  105796. audioTimingInfo: segmentInfo.audioTimingInfo,
  105797. videoTimingInfo: segmentInfo.videoTimingInfo
  105798. });
  105799. if (!segmentDuration) {
  105800. return null;
  105801. }
  105802. var targetDuration = segmentInfo.playlist.targetDuration;
  105803. var isSegmentWayTooLong = segmentTooLong({
  105804. segmentDuration,
  105805. maxDuration: targetDuration * 2
  105806. });
  105807. var isSegmentSlightlyTooLong = segmentTooLong({
  105808. segmentDuration,
  105809. maxDuration: targetDuration
  105810. });
  105811. 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";
  105812. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  105813. return {
  105814. severity: isSegmentWayTooLong ? "warn" : "info",
  105815. message: segmentTooLongMessage
  105816. };
  105817. }
  105818. return null;
  105819. };
  105820. var SegmentLoader = /* @__PURE__ */ function(_videojs$EventTarget) {
  105821. _inheritsLoose(SegmentLoader2, _videojs$EventTarget);
  105822. function SegmentLoader2(settings, options2) {
  105823. var _this;
  105824. _this = _videojs$EventTarget.call(this) || this;
  105825. if (!settings) {
  105826. throw new TypeError("Initialization settings are required");
  105827. }
  105828. if (typeof settings.currentTime !== "function") {
  105829. throw new TypeError("No currentTime getter specified");
  105830. }
  105831. if (!settings.mediaSource) {
  105832. throw new TypeError("No MediaSource specified");
  105833. }
  105834. _this.bandwidth = settings.bandwidth;
  105835. _this.throughput = {
  105836. rate: 0,
  105837. count: 0
  105838. };
  105839. _this.roundTrip = NaN;
  105840. _this.resetStats_();
  105841. _this.mediaIndex = null;
  105842. _this.partIndex = null;
  105843. _this.hasPlayed_ = settings.hasPlayed;
  105844. _this.currentTime_ = settings.currentTime;
  105845. _this.seekable_ = settings.seekable;
  105846. _this.seeking_ = settings.seeking;
  105847. _this.duration_ = settings.duration;
  105848. _this.mediaSource_ = settings.mediaSource;
  105849. _this.vhs_ = settings.vhs;
  105850. _this.loaderType_ = settings.loaderType;
  105851. _this.currentMediaInfo_ = void 0;
  105852. _this.startingMediaInfo_ = void 0;
  105853. _this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  105854. _this.goalBufferLength_ = settings.goalBufferLength;
  105855. _this.sourceType_ = settings.sourceType;
  105856. _this.sourceUpdater_ = settings.sourceUpdater;
  105857. _this.inbandTextTracks_ = settings.inbandTextTracks;
  105858. _this.state_ = "INIT";
  105859. _this.timelineChangeController_ = settings.timelineChangeController;
  105860. _this.shouldSaveSegmentTimingInfo_ = true;
  105861. _this.parse708captions_ = settings.parse708captions;
  105862. _this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  105863. _this.captionServices_ = settings.captionServices;
  105864. _this.experimentalExactManifestTimings = settings.experimentalExactManifestTimings;
  105865. _this.checkBufferTimeout_ = null;
  105866. _this.error_ = void 0;
  105867. _this.currentTimeline_ = -1;
  105868. _this.pendingSegment_ = null;
  105869. _this.xhrOptions_ = null;
  105870. _this.pendingSegments_ = [];
  105871. _this.audioDisabled_ = false;
  105872. _this.isPendingTimestampOffset_ = false;
  105873. _this.gopBuffer_ = [];
  105874. _this.timeMapping_ = 0;
  105875. _this.safeAppend_ = videojs.browser.IE_VERSION >= 11;
  105876. _this.appendInitSegment_ = {
  105877. audio: true,
  105878. video: true
  105879. };
  105880. _this.playlistOfLastInitSegment_ = {
  105881. audio: null,
  105882. video: null
  105883. };
  105884. _this.callQueue_ = [];
  105885. _this.loadQueue_ = [];
  105886. _this.metadataQueue_ = {
  105887. id3: [],
  105888. caption: []
  105889. };
  105890. _this.waitingOnRemove_ = false;
  105891. _this.quotaExceededErrorRetryTimeout_ = null;
  105892. _this.activeInitSegmentId_ = null;
  105893. _this.initSegments_ = {};
  105894. _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  105895. _this.keyCache_ = {};
  105896. _this.decrypter_ = settings.decrypter;
  105897. _this.syncController_ = settings.syncController;
  105898. _this.syncPoint_ = {
  105899. segmentIndex: 0,
  105900. time: 0
  105901. };
  105902. _this.transmuxer_ = _this.createTransmuxer_();
  105903. _this.triggerSyncInfoUpdate_ = function() {
  105904. return _this.trigger("syncinfoupdate");
  105905. };
  105906. _this.syncController_.on("syncinfoupdate", _this.triggerSyncInfoUpdate_);
  105907. _this.mediaSource_.addEventListener("sourceopen", function() {
  105908. if (!_this.isEndOfStream_()) {
  105909. _this.ended_ = false;
  105910. }
  105911. });
  105912. _this.fetchAtBuffer_ = false;
  105913. _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]");
  105914. Object.defineProperty(_assertThisInitialized(_this), "state", {
  105915. get: function get7() {
  105916. return this.state_;
  105917. },
  105918. set: function set4(newState) {
  105919. if (newState !== this.state_) {
  105920. this.logger_(this.state_ + " -> " + newState);
  105921. this.state_ = newState;
  105922. this.trigger("statechange");
  105923. }
  105924. }
  105925. });
  105926. _this.sourceUpdater_.on("ready", function() {
  105927. if (_this.hasEnoughInfoToAppend_()) {
  105928. _this.processCallQueue_();
  105929. }
  105930. });
  105931. if (_this.loaderType_ === "main") {
  105932. _this.timelineChangeController_.on("pendingtimelinechange", function() {
  105933. if (_this.hasEnoughInfoToAppend_()) {
  105934. _this.processCallQueue_();
  105935. }
  105936. });
  105937. }
  105938. if (_this.loaderType_ === "audio") {
  105939. _this.timelineChangeController_.on("timelinechange", function() {
  105940. if (_this.hasEnoughInfoToLoad_()) {
  105941. _this.processLoadQueue_();
  105942. }
  105943. if (_this.hasEnoughInfoToAppend_()) {
  105944. _this.processCallQueue_();
  105945. }
  105946. });
  105947. }
  105948. return _this;
  105949. }
  105950. var _proto = SegmentLoader2.prototype;
  105951. _proto.createTransmuxer_ = function createTransmuxer_() {
  105952. return segmentTransmuxer.createTransmuxer({
  105953. remux: false,
  105954. alignGopsAtEnd: this.safeAppend_,
  105955. keepOriginalTimestamps: true,
  105956. parse708captions: this.parse708captions_,
  105957. captionServices: this.captionServices_
  105958. });
  105959. };
  105960. _proto.resetStats_ = function resetStats_() {
  105961. this.mediaBytesTransferred = 0;
  105962. this.mediaRequests = 0;
  105963. this.mediaRequestsAborted = 0;
  105964. this.mediaRequestsTimedout = 0;
  105965. this.mediaRequestsErrored = 0;
  105966. this.mediaTransferDuration = 0;
  105967. this.mediaSecondsLoaded = 0;
  105968. this.mediaAppends = 0;
  105969. };
  105970. _proto.dispose = function dispose() {
  105971. this.trigger("dispose");
  105972. this.state = "DISPOSED";
  105973. this.pause();
  105974. this.abort_();
  105975. if (this.transmuxer_) {
  105976. this.transmuxer_.terminate();
  105977. }
  105978. this.resetStats_();
  105979. if (this.checkBufferTimeout_) {
  105980. window_1.clearTimeout(this.checkBufferTimeout_);
  105981. }
  105982. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  105983. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  105984. }
  105985. this.off();
  105986. };
  105987. _proto.setAudio = function setAudio(enable) {
  105988. this.audioDisabled_ = !enable;
  105989. if (enable) {
  105990. this.appendInitSegment_.audio = true;
  105991. } else {
  105992. this.sourceUpdater_.removeAudio(0, this.duration_());
  105993. }
  105994. };
  105995. _proto.abort = function abort2() {
  105996. if (this.state !== "WAITING") {
  105997. if (this.pendingSegment_) {
  105998. this.pendingSegment_ = null;
  105999. }
  106000. return;
  106001. }
  106002. this.abort_();
  106003. this.state = "READY";
  106004. if (!this.paused()) {
  106005. this.monitorBuffer_();
  106006. }
  106007. };
  106008. _proto.abort_ = function abort_() {
  106009. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  106010. this.pendingSegment_.abortRequests();
  106011. }
  106012. this.pendingSegment_ = null;
  106013. this.callQueue_ = [];
  106014. this.loadQueue_ = [];
  106015. this.metadataQueue_.id3 = [];
  106016. this.metadataQueue_.caption = [];
  106017. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  106018. this.waitingOnRemove_ = false;
  106019. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  106020. this.quotaExceededErrorRetryTimeout_ = null;
  106021. };
  106022. _proto.checkForAbort_ = function checkForAbort_(requestId) {
  106023. if (this.state === "APPENDING" && !this.pendingSegment_) {
  106024. this.state = "READY";
  106025. return true;
  106026. }
  106027. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  106028. return true;
  106029. }
  106030. return false;
  106031. };
  106032. _proto.error = function error(_error) {
  106033. if (typeof _error !== "undefined") {
  106034. this.logger_("error occurred:", _error);
  106035. this.error_ = _error;
  106036. }
  106037. this.pendingSegment_ = null;
  106038. return this.error_;
  106039. };
  106040. _proto.endOfStream = function endOfStream2() {
  106041. this.ended_ = true;
  106042. if (this.transmuxer_) {
  106043. segmentTransmuxer.reset(this.transmuxer_);
  106044. }
  106045. this.gopBuffer_.length = 0;
  106046. this.pause();
  106047. this.trigger("ended");
  106048. };
  106049. _proto.buffered_ = function buffered_() {
  106050. var trackInfo = this.getMediaInfo_();
  106051. if (!this.sourceUpdater_ || !trackInfo) {
  106052. return videojs.createTimeRanges();
  106053. }
  106054. if (this.loaderType_ === "main") {
  106055. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  106056. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  106057. return this.sourceUpdater_.buffered();
  106058. }
  106059. if (hasVideo) {
  106060. return this.sourceUpdater_.videoBuffered();
  106061. }
  106062. }
  106063. return this.sourceUpdater_.audioBuffered();
  106064. };
  106065. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  106066. if (set4 === void 0) {
  106067. set4 = false;
  106068. }
  106069. if (!map) {
  106070. return null;
  106071. }
  106072. var id = initSegmentId(map);
  106073. var storedMap = this.initSegments_[id];
  106074. if (set4 && !storedMap && map.bytes) {
  106075. this.initSegments_[id] = storedMap = {
  106076. resolvedUri: map.resolvedUri,
  106077. byterange: map.byterange,
  106078. bytes: map.bytes,
  106079. tracks: map.tracks,
  106080. timescales: map.timescales
  106081. };
  106082. }
  106083. return storedMap || map;
  106084. };
  106085. _proto.segmentKey = function segmentKey(key, set4) {
  106086. if (set4 === void 0) {
  106087. set4 = false;
  106088. }
  106089. if (!key) {
  106090. return null;
  106091. }
  106092. var id = segmentKeyId(key);
  106093. var storedKey = this.keyCache_[id];
  106094. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  106095. this.keyCache_[id] = storedKey = {
  106096. resolvedUri: key.resolvedUri,
  106097. bytes: key.bytes
  106098. };
  106099. }
  106100. var result = {
  106101. resolvedUri: (storedKey || key).resolvedUri
  106102. };
  106103. if (storedKey) {
  106104. result.bytes = storedKey.bytes;
  106105. }
  106106. return result;
  106107. };
  106108. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  106109. return this.playlist_ && !this.paused();
  106110. };
  106111. _proto.load = function load() {
  106112. this.monitorBuffer_();
  106113. if (!this.playlist_) {
  106114. return;
  106115. }
  106116. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106117. return this.init_();
  106118. }
  106119. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  106120. return;
  106121. }
  106122. this.state = "READY";
  106123. };
  106124. _proto.init_ = function init_() {
  106125. this.state = "READY";
  106126. this.resetEverything();
  106127. return this.monitorBuffer_();
  106128. };
  106129. _proto.playlist = function playlist(newPlaylist, options2) {
  106130. if (options2 === void 0) {
  106131. options2 = {};
  106132. }
  106133. if (!newPlaylist) {
  106134. return;
  106135. }
  106136. var oldPlaylist = this.playlist_;
  106137. var segmentInfo = this.pendingSegment_;
  106138. this.playlist_ = newPlaylist;
  106139. this.xhrOptions_ = options2;
  106140. if (this.state === "INIT") {
  106141. newPlaylist.syncInfo = {
  106142. mediaSequence: newPlaylist.mediaSequence,
  106143. time: 0
  106144. };
  106145. if (this.loaderType_ === "main") {
  106146. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  106147. }
  106148. }
  106149. var oldId = null;
  106150. if (oldPlaylist) {
  106151. if (oldPlaylist.id) {
  106152. oldId = oldPlaylist.id;
  106153. } else if (oldPlaylist.uri) {
  106154. oldId = oldPlaylist.uri;
  106155. }
  106156. }
  106157. this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]");
  106158. this.trigger("syncinfoupdate");
  106159. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106160. return this.init_();
  106161. }
  106162. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  106163. if (this.mediaIndex !== null) {
  106164. if (!newPlaylist.endList) {
  106165. this.resetLoader();
  106166. } else {
  106167. this.resyncLoader();
  106168. }
  106169. }
  106170. this.currentMediaInfo_ = void 0;
  106171. this.trigger("playlistupdate");
  106172. return;
  106173. }
  106174. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  106175. this.logger_("live window shift [" + mediaSequenceDiff + "]");
  106176. if (this.mediaIndex !== null) {
  106177. this.mediaIndex -= mediaSequenceDiff;
  106178. if (this.mediaIndex < 0) {
  106179. this.mediaIndex = null;
  106180. this.partIndex = null;
  106181. } else {
  106182. var segment = this.playlist_.segments[this.mediaIndex];
  106183. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  106184. var mediaIndex = this.mediaIndex;
  106185. this.logger_("currently processing part (index " + this.partIndex + ") no longer exists.");
  106186. this.resetLoader();
  106187. this.mediaIndex = mediaIndex;
  106188. }
  106189. }
  106190. }
  106191. if (segmentInfo) {
  106192. segmentInfo.mediaIndex -= mediaSequenceDiff;
  106193. if (segmentInfo.mediaIndex < 0) {
  106194. segmentInfo.mediaIndex = null;
  106195. segmentInfo.partIndex = null;
  106196. } else {
  106197. if (segmentInfo.mediaIndex >= 0) {
  106198. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  106199. }
  106200. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  106201. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  106202. }
  106203. }
  106204. }
  106205. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  106206. };
  106207. _proto.pause = function pause() {
  106208. if (this.checkBufferTimeout_) {
  106209. window_1.clearTimeout(this.checkBufferTimeout_);
  106210. this.checkBufferTimeout_ = null;
  106211. }
  106212. };
  106213. _proto.paused = function paused() {
  106214. return this.checkBufferTimeout_ === null;
  106215. };
  106216. _proto.resetEverything = function resetEverything(done) {
  106217. this.ended_ = false;
  106218. this.activeInitSegmentId_ = null;
  106219. this.appendInitSegment_ = {
  106220. audio: true,
  106221. video: true
  106222. };
  106223. this.resetLoader();
  106224. this.remove(0, Infinity, done);
  106225. if (this.transmuxer_) {
  106226. this.transmuxer_.postMessage({
  106227. action: "clearAllMp4Captions"
  106228. });
  106229. this.transmuxer_.postMessage({
  106230. action: "reset"
  106231. });
  106232. }
  106233. };
  106234. _proto.resetLoader = function resetLoader() {
  106235. this.fetchAtBuffer_ = false;
  106236. this.resyncLoader();
  106237. };
  106238. _proto.resyncLoader = function resyncLoader() {
  106239. if (this.transmuxer_) {
  106240. segmentTransmuxer.reset(this.transmuxer_);
  106241. }
  106242. this.mediaIndex = null;
  106243. this.partIndex = null;
  106244. this.syncPoint_ = null;
  106245. this.isPendingTimestampOffset_ = false;
  106246. this.callQueue_ = [];
  106247. this.loadQueue_ = [];
  106248. this.metadataQueue_.id3 = [];
  106249. this.metadataQueue_.caption = [];
  106250. this.abort();
  106251. if (this.transmuxer_) {
  106252. this.transmuxer_.postMessage({
  106253. action: "clearParsedMp4Captions"
  106254. });
  106255. }
  106256. };
  106257. _proto.remove = function remove2(start2, end, done, force) {
  106258. if (done === void 0) {
  106259. done = function done2() {
  106260. };
  106261. }
  106262. if (force === void 0) {
  106263. force = false;
  106264. }
  106265. if (end === Infinity) {
  106266. end = this.duration_();
  106267. }
  106268. if (end <= start2) {
  106269. this.logger_("skipping remove because end ${end} is <= start ${start}");
  106270. return;
  106271. }
  106272. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  106273. this.logger_("skipping remove because no source updater or starting media info");
  106274. return;
  106275. }
  106276. var removesRemaining = 1;
  106277. var removeFinished = function removeFinished2() {
  106278. removesRemaining--;
  106279. if (removesRemaining === 0) {
  106280. done();
  106281. }
  106282. };
  106283. if (force || !this.audioDisabled_) {
  106284. removesRemaining++;
  106285. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  106286. }
  106287. if (force || this.loaderType_ === "main") {
  106288. this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start2, end, this.timeMapping_);
  106289. removesRemaining++;
  106290. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  106291. }
  106292. for (var track in this.inbandTextTracks_) {
  106293. removeCuesFromTrack(start2, end, this.inbandTextTracks_[track]);
  106294. }
  106295. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  106296. removeFinished();
  106297. };
  106298. _proto.monitorBuffer_ = function monitorBuffer_() {
  106299. if (this.checkBufferTimeout_) {
  106300. window_1.clearTimeout(this.checkBufferTimeout_);
  106301. }
  106302. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  106303. };
  106304. _proto.monitorBufferTick_ = function monitorBufferTick_() {
  106305. if (this.state === "READY") {
  106306. this.fillBuffer_();
  106307. }
  106308. if (this.checkBufferTimeout_) {
  106309. window_1.clearTimeout(this.checkBufferTimeout_);
  106310. }
  106311. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY);
  106312. };
  106313. _proto.fillBuffer_ = function fillBuffer_() {
  106314. if (this.sourceUpdater_.updating()) {
  106315. return;
  106316. }
  106317. var segmentInfo = this.chooseNextRequest_();
  106318. if (!segmentInfo) {
  106319. return;
  106320. }
  106321. if (typeof segmentInfo.timestampOffset === "number") {
  106322. this.isPendingTimestampOffset_ = false;
  106323. this.timelineChangeController_.pendingTimelineChange({
  106324. type: this.loaderType_,
  106325. from: this.currentTimeline_,
  106326. to: segmentInfo.timeline
  106327. });
  106328. }
  106329. this.loadSegment_(segmentInfo);
  106330. };
  106331. _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) {
  106332. if (mediaIndex === void 0) {
  106333. mediaIndex = this.mediaIndex;
  106334. }
  106335. if (playlist === void 0) {
  106336. playlist = this.playlist_;
  106337. }
  106338. if (partIndex === void 0) {
  106339. partIndex = this.partIndex;
  106340. }
  106341. if (!playlist || !this.mediaSource_) {
  106342. return false;
  106343. }
  106344. var segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  106345. var appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  106346. var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  106347. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  106348. };
  106349. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  106350. var buffered = this.buffered_();
  106351. var bufferedEnd = lastBufferedEnd(buffered) || 0;
  106352. var bufferedTime = timeAheadOf(buffered, this.currentTime_());
  106353. var preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  106354. var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  106355. var segments = this.playlist_.segments;
  106356. if (!segments.length || preloaded || haveEnoughBuffer) {
  106357. return null;
  106358. }
  106359. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  106360. var next = {
  106361. partIndex: null,
  106362. mediaIndex: null,
  106363. startOfSegment: null,
  106364. playlist: this.playlist_,
  106365. isSyncRequest: Boolean(!this.syncPoint_)
  106366. };
  106367. if (next.isSyncRequest) {
  106368. next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd);
  106369. } else if (this.mediaIndex !== null) {
  106370. var segment = segments[this.mediaIndex];
  106371. var partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  106372. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  106373. if (segment.parts && segment.parts[partIndex + 1]) {
  106374. next.mediaIndex = this.mediaIndex;
  106375. next.partIndex = partIndex + 1;
  106376. } else {
  106377. next.mediaIndex = this.mediaIndex + 1;
  106378. }
  106379. } else {
  106380. var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({
  106381. experimentalExactManifestTimings: this.experimentalExactManifestTimings,
  106382. playlist: this.playlist_,
  106383. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  106384. startingPartIndex: this.syncPoint_.partIndex,
  106385. startingSegmentIndex: this.syncPoint_.segmentIndex,
  106386. startTime: this.syncPoint_.time
  106387. }), segmentIndex = _Playlist$getMediaInf.segmentIndex, startTime = _Playlist$getMediaInf.startTime, _partIndex = _Playlist$getMediaInf.partIndex;
  106388. next.getMediaInfoForTime = this.fetchAtBuffer_ ? "bufferedEnd " + bufferedEnd : "currentTime " + this.currentTime_();
  106389. next.mediaIndex = segmentIndex;
  106390. next.startOfSegment = startTime;
  106391. next.partIndex = _partIndex;
  106392. }
  106393. var nextSegment = segments[next.mediaIndex];
  106394. var nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  106395. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  106396. return null;
  106397. }
  106398. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  106399. next.partIndex = 0;
  106400. nextPart = nextSegment.parts[0];
  106401. }
  106402. if (!bufferedTime && nextPart && !nextPart.independent) {
  106403. if (next.partIndex === 0) {
  106404. var lastSegment = segments[next.mediaIndex - 1];
  106405. var lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  106406. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  106407. next.mediaIndex -= 1;
  106408. next.partIndex = lastSegment.parts.length - 1;
  106409. next.independent = "previous segment";
  106410. }
  106411. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  106412. next.partIndex -= 1;
  106413. next.independent = "previous part";
  106414. }
  106415. }
  106416. var ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  106417. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  106418. return null;
  106419. }
  106420. return this.generateSegmentInfo_(next);
  106421. };
  106422. _proto.generateSegmentInfo_ = function generateSegmentInfo_(options2) {
  106423. 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;
  106424. var segment = playlist.segments[mediaIndex];
  106425. var part = typeof partIndex === "number" && segment.parts[partIndex];
  106426. var segmentInfo = {
  106427. requestId: "segment-loader-" + Math.random(),
  106428. uri: part && part.resolvedUri || segment.resolvedUri,
  106429. mediaIndex,
  106430. partIndex: part ? partIndex : null,
  106431. isSyncRequest,
  106432. startOfSegment,
  106433. playlist,
  106434. bytes: null,
  106435. encryptedBytes: null,
  106436. timestampOffset: null,
  106437. timeline: segment.timeline,
  106438. duration: part && part.duration || segment.duration,
  106439. segment,
  106440. part,
  106441. byteLength: 0,
  106442. transmuxer: this.transmuxer_,
  106443. getMediaInfoForTime: getMediaInfoForTime3,
  106444. independent
  106445. };
  106446. var overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  106447. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  106448. segmentTimeline: segment.timeline,
  106449. currentTimeline: this.currentTimeline_,
  106450. startOfSegment,
  106451. buffered: this.buffered_(),
  106452. overrideCheck
  106453. });
  106454. var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered());
  106455. if (typeof audioBufferedEnd === "number") {
  106456. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  106457. }
  106458. if (this.sourceUpdater_.videoBuffered().length) {
  106459. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(
  106460. this.gopBuffer_,
  106461. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  106462. this.timeMapping_
  106463. );
  106464. }
  106465. return segmentInfo;
  106466. };
  106467. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options2) {
  106468. return timestampOffsetForSegment(options2);
  106469. };
  106470. _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) {
  106471. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  106472. return;
  106473. }
  106474. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  106475. return;
  106476. }
  106477. var currentTime = this.currentTime_();
  106478. var measuredBandwidth = stats.bandwidth;
  106479. var segmentDuration = this.pendingSegment_.duration;
  106480. var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  106481. var timeUntilRebuffer$12 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  106482. if (requestTimeRemaining <= timeUntilRebuffer$12) {
  106483. return;
  106484. }
  106485. var switchCandidate = minRebufferMaxBandwidthSelector({
  106486. master: this.vhs_.playlists.master,
  106487. currentTime,
  106488. bandwidth: measuredBandwidth,
  106489. duration: this.duration_(),
  106490. segmentDuration,
  106491. timeUntilRebuffer: timeUntilRebuffer$12,
  106492. currentTimeline: this.currentTimeline_,
  106493. syncController: this.syncController_
  106494. });
  106495. if (!switchCandidate) {
  106496. return;
  106497. }
  106498. var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$12;
  106499. var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  106500. var minimumTimeSaving = 0.5;
  106501. if (timeUntilRebuffer$12 <= TIME_FUDGE_FACTOR) {
  106502. minimumTimeSaving = 1;
  106503. }
  106504. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  106505. return;
  106506. }
  106507. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1;
  106508. this.trigger("earlyabort");
  106509. };
  106510. _proto.handleAbort_ = function handleAbort_(segmentInfo) {
  106511. this.logger_("Aborting " + segmentInfoString(segmentInfo));
  106512. this.mediaRequestsAborted += 1;
  106513. };
  106514. _proto.handleProgress_ = function handleProgress_(event2, simpleSegment) {
  106515. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106516. if (this.checkForAbort_(simpleSegment.requestId)) {
  106517. return;
  106518. }
  106519. this.trigger("progress");
  106520. };
  106521. _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) {
  106522. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106523. if (this.checkForAbort_(simpleSegment.requestId)) {
  106524. return;
  106525. }
  106526. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  106527. return;
  106528. }
  106529. trackInfo = trackInfo || {};
  106530. if (!shallowEqual(this.currentMediaInfo_, trackInfo)) {
  106531. this.appendInitSegment_ = {
  106532. audio: true,
  106533. video: true
  106534. };
  106535. this.startingMediaInfo_ = trackInfo;
  106536. this.currentMediaInfo_ = trackInfo;
  106537. this.logger_("trackinfo update", trackInfo);
  106538. this.trigger("trackinfo");
  106539. }
  106540. if (this.checkForAbort_(simpleSegment.requestId)) {
  106541. return;
  106542. }
  106543. this.pendingSegment_.trackInfo = trackInfo;
  106544. if (this.hasEnoughInfoToAppend_()) {
  106545. this.processCallQueue_();
  106546. }
  106547. };
  106548. _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  106549. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106550. if (this.checkForAbort_(simpleSegment.requestId)) {
  106551. return;
  106552. }
  106553. var segmentInfo = this.pendingSegment_;
  106554. var timingInfoProperty = timingInfoPropertyForMedia(mediaType);
  106555. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  106556. segmentInfo[timingInfoProperty][timeType] = time;
  106557. this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time);
  106558. if (this.hasEnoughInfoToAppend_()) {
  106559. this.processCallQueue_();
  106560. }
  106561. };
  106562. _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) {
  106563. var _this2 = this;
  106564. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106565. if (this.checkForAbort_(simpleSegment.requestId)) {
  106566. return;
  106567. }
  106568. if (captionData.length === 0) {
  106569. this.logger_("SegmentLoader received no captions from a caption event");
  106570. return;
  106571. }
  106572. var segmentInfo = this.pendingSegment_;
  106573. if (!segmentInfo.hasAppendedData_) {
  106574. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  106575. return;
  106576. }
  106577. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106578. var captionTracks = {};
  106579. captionData.forEach(function(caption) {
  106580. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  106581. startTime: Infinity,
  106582. captions: [],
  106583. endTime: 0
  106584. };
  106585. var captionTrack = captionTracks[caption.stream];
  106586. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  106587. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  106588. captionTrack.captions.push(caption);
  106589. });
  106590. Object.keys(captionTracks).forEach(function(trackName) {
  106591. var _captionTracks$trackN = captionTracks[trackName], startTime = _captionTracks$trackN.startTime, endTime = _captionTracks$trackN.endTime, captions = _captionTracks$trackN.captions;
  106592. var inbandTextTracks = _this2.inbandTextTracks_;
  106593. _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName);
  106594. createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName);
  106595. removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]);
  106596. addCaptionData({
  106597. captionArray: captions,
  106598. inbandTextTracks,
  106599. timestampOffset: timestampOffset2
  106600. });
  106601. });
  106602. if (this.transmuxer_) {
  106603. this.transmuxer_.postMessage({
  106604. action: "clearParsedMp4Captions"
  106605. });
  106606. }
  106607. };
  106608. _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) {
  106609. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106610. if (this.checkForAbort_(simpleSegment.requestId)) {
  106611. return;
  106612. }
  106613. var segmentInfo = this.pendingSegment_;
  106614. if (!segmentInfo.hasAppendedData_) {
  106615. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  106616. return;
  106617. }
  106618. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106619. createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  106620. addMetadata({
  106621. inbandTextTracks: this.inbandTextTracks_,
  106622. metadataArray: id3Frames,
  106623. timestampOffset: timestampOffset2,
  106624. videoDuration: this.duration_()
  106625. });
  106626. };
  106627. _proto.processMetadataQueue_ = function processMetadataQueue_() {
  106628. this.metadataQueue_.id3.forEach(function(fn2) {
  106629. return fn2();
  106630. });
  106631. this.metadataQueue_.caption.forEach(function(fn2) {
  106632. return fn2();
  106633. });
  106634. this.metadataQueue_.id3 = [];
  106635. this.metadataQueue_.caption = [];
  106636. };
  106637. _proto.processCallQueue_ = function processCallQueue_() {
  106638. var callQueue = this.callQueue_;
  106639. this.callQueue_ = [];
  106640. callQueue.forEach(function(fun) {
  106641. return fun();
  106642. });
  106643. };
  106644. _proto.processLoadQueue_ = function processLoadQueue_() {
  106645. var loadQueue = this.loadQueue_;
  106646. this.loadQueue_ = [];
  106647. loadQueue.forEach(function(fun) {
  106648. return fun();
  106649. });
  106650. };
  106651. _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() {
  106652. if (this.loaderType_ !== "audio") {
  106653. return true;
  106654. }
  106655. var segmentInfo = this.pendingSegment_;
  106656. if (!segmentInfo) {
  106657. return false;
  106658. }
  106659. if (!this.getCurrentMediaInfo_()) {
  106660. return true;
  106661. }
  106662. if (shouldWaitForTimelineChange({
  106663. timelineChangeController: this.timelineChangeController_,
  106664. currentTimeline: this.currentTimeline_,
  106665. segmentTimeline: segmentInfo.timeline,
  106666. loaderType: this.loaderType_,
  106667. audioDisabled: this.audioDisabled_
  106668. })) {
  106669. return false;
  106670. }
  106671. return true;
  106672. };
  106673. _proto.getCurrentMediaInfo_ = function getCurrentMediaInfo_(segmentInfo) {
  106674. if (segmentInfo === void 0) {
  106675. segmentInfo = this.pendingSegment_;
  106676. }
  106677. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  106678. };
  106679. _proto.getMediaInfo_ = function getMediaInfo_(segmentInfo) {
  106680. if (segmentInfo === void 0) {
  106681. segmentInfo = this.pendingSegment_;
  106682. }
  106683. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  106684. };
  106685. _proto.getPendingSegmentPlaylist = function getPendingSegmentPlaylist() {
  106686. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  106687. };
  106688. _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() {
  106689. if (!this.sourceUpdater_.ready()) {
  106690. return false;
  106691. }
  106692. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  106693. return false;
  106694. }
  106695. var segmentInfo = this.pendingSegment_;
  106696. var trackInfo = this.getCurrentMediaInfo_();
  106697. if (!segmentInfo || !trackInfo) {
  106698. return false;
  106699. }
  106700. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  106701. if (hasVideo && !segmentInfo.videoTimingInfo) {
  106702. return false;
  106703. }
  106704. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  106705. return false;
  106706. }
  106707. if (shouldWaitForTimelineChange({
  106708. timelineChangeController: this.timelineChangeController_,
  106709. currentTimeline: this.currentTimeline_,
  106710. segmentTimeline: segmentInfo.timeline,
  106711. loaderType: this.loaderType_,
  106712. audioDisabled: this.audioDisabled_
  106713. })) {
  106714. return false;
  106715. }
  106716. return true;
  106717. };
  106718. _proto.handleData_ = function handleData_3(simpleSegment, result) {
  106719. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106720. if (this.checkForAbort_(simpleSegment.requestId)) {
  106721. return;
  106722. }
  106723. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  106724. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  106725. return;
  106726. }
  106727. var segmentInfo = this.pendingSegment_;
  106728. this.setTimeMapping_(segmentInfo.timeline);
  106729. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  106730. if (this.mediaSource_.readyState === "closed") {
  106731. return;
  106732. }
  106733. if (simpleSegment.map) {
  106734. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  106735. segmentInfo.segment.map = simpleSegment.map;
  106736. }
  106737. if (simpleSegment.key) {
  106738. this.segmentKey(simpleSegment.key, true);
  106739. }
  106740. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  106741. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  106742. if (segmentInfo.isFmp4) {
  106743. this.trigger("fmp4");
  106744. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start;
  106745. } else {
  106746. var trackInfo = this.getCurrentMediaInfo_();
  106747. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  106748. var firstVideoFrameTimeForData;
  106749. if (useVideoTimingInfo) {
  106750. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  106751. }
  106752. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  106753. currentStart: segmentInfo.timingInfo.start,
  106754. playlist: segmentInfo.playlist,
  106755. mediaIndex: segmentInfo.mediaIndex,
  106756. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  106757. useVideoTimingInfo,
  106758. firstVideoFrameTimeForData,
  106759. videoTimingInfo: segmentInfo.videoTimingInfo,
  106760. audioTimingInfo: segmentInfo.audioTimingInfo
  106761. });
  106762. }
  106763. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  106764. this.updateSourceBufferTimestampOffset_(segmentInfo);
  106765. if (segmentInfo.isSyncRequest) {
  106766. this.updateTimingInfoEnd_(segmentInfo);
  106767. this.syncController_.saveSegmentTimingInfo({
  106768. segmentInfo,
  106769. shouldSaveTimelineMapping: this.loaderType_ === "main"
  106770. });
  106771. var next = this.chooseNextRequest_();
  106772. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  106773. this.logger_("sync segment was incorrect, not appending");
  106774. return;
  106775. }
  106776. this.logger_("sync segment was correct, appending");
  106777. }
  106778. segmentInfo.hasAppendedData_ = true;
  106779. this.processMetadataQueue_();
  106780. this.appendData_(segmentInfo, result);
  106781. };
  106782. _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type2) {
  106783. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  106784. this.appendInitSegment_ = {
  106785. audio: true,
  106786. video: true
  106787. };
  106788. }
  106789. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  106790. this.appendInitSegment_[type2] = true;
  106791. }
  106792. };
  106793. _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) {
  106794. var type2 = _ref4.type, initSegment = _ref4.initSegment, map = _ref4.map, playlist = _ref4.playlist;
  106795. if (map) {
  106796. var id = initSegmentId(map);
  106797. if (this.activeInitSegmentId_ === id) {
  106798. return null;
  106799. }
  106800. initSegment = this.initSegmentForMap(map, true).bytes;
  106801. this.activeInitSegmentId_ = id;
  106802. }
  106803. if (initSegment && this.appendInitSegment_[type2]) {
  106804. this.playlistOfLastInitSegment_[type2] = playlist;
  106805. this.appendInitSegment_[type2] = false;
  106806. this.activeInitSegmentId_ = null;
  106807. return initSegment;
  106808. }
  106809. return null;
  106810. };
  106811. _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) {
  106812. var _this3 = this;
  106813. var segmentInfo = _ref5.segmentInfo, type2 = _ref5.type, bytes = _ref5.bytes;
  106814. var audioBuffered = this.sourceUpdater_.audioBuffered();
  106815. var videoBuffered = this.sourceUpdater_.videoBuffered();
  106816. if (audioBuffered.length > 1) {
  106817. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray(audioBuffered).join(", "));
  106818. }
  106819. if (videoBuffered.length > 1) {
  106820. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray(videoBuffered).join(", "));
  106821. }
  106822. var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  106823. var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  106824. var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  106825. var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  106826. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) {
  106827. 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(", ") + ", "));
  106828. this.error({
  106829. message: "Quota exceeded error with append of a single segment of content",
  106830. excludeUntil: Infinity
  106831. });
  106832. this.trigger("error");
  106833. return;
  106834. }
  106835. this.waitingOnRemove_ = true;
  106836. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  106837. segmentInfo,
  106838. type: type2,
  106839. bytes
  106840. }));
  106841. var currentTime = this.currentTime_();
  106842. var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER;
  106843. this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil);
  106844. this.remove(0, timeToRemoveUntil, function() {
  106845. _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s");
  106846. _this3.waitingOnRemove_ = false;
  106847. _this3.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(function() {
  106848. _this3.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  106849. _this3.quotaExceededErrorRetryTimeout_ = null;
  106850. _this3.processCallQueue_();
  106851. }, MIN_BACK_BUFFER * 1e3);
  106852. }, true);
  106853. };
  106854. _proto.handleAppendError_ = function handleAppendError_(_ref6, error) {
  106855. var segmentInfo = _ref6.segmentInfo, type2 = _ref6.type, bytes = _ref6.bytes;
  106856. if (!error) {
  106857. return;
  106858. }
  106859. if (error.code === QUOTA_EXCEEDED_ERR) {
  106860. this.handleQuotaExceededError_({
  106861. segmentInfo,
  106862. type: type2,
  106863. bytes
  106864. });
  106865. return;
  106866. }
  106867. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  106868. this.error(type2 + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id));
  106869. this.trigger("appenderror");
  106870. };
  106871. _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) {
  106872. var segmentInfo = _ref7.segmentInfo, type2 = _ref7.type, initSegment = _ref7.initSegment, data = _ref7.data, bytes = _ref7.bytes;
  106873. if (!bytes) {
  106874. var segments = [data];
  106875. var byteLength = data.byteLength;
  106876. if (initSegment) {
  106877. segments.unshift(initSegment);
  106878. byteLength += initSegment.byteLength;
  106879. }
  106880. bytes = concatSegments({
  106881. bytes: byteLength,
  106882. segments
  106883. });
  106884. }
  106885. this.sourceUpdater_.appendBuffer({
  106886. segmentInfo,
  106887. type: type2,
  106888. bytes
  106889. }, this.handleAppendError_.bind(this, {
  106890. segmentInfo,
  106891. type: type2,
  106892. bytes
  106893. }));
  106894. };
  106895. _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  106896. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  106897. return;
  106898. }
  106899. var segment = this.pendingSegment_.segment;
  106900. var timingInfoProperty = type2 + "TimingInfo";
  106901. if (!segment[timingInfoProperty]) {
  106902. segment[timingInfoProperty] = {};
  106903. }
  106904. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  106905. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  106906. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  106907. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  106908. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  106909. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  106910. };
  106911. _proto.appendData_ = function appendData_(segmentInfo, result) {
  106912. var type2 = result.type, data = result.data;
  106913. if (!data || !data.byteLength) {
  106914. return;
  106915. }
  106916. if (type2 === "audio" && this.audioDisabled_) {
  106917. return;
  106918. }
  106919. var initSegment = this.getInitSegmentAndUpdateState_({
  106920. type: type2,
  106921. initSegment: result.initSegment,
  106922. playlist: segmentInfo.playlist,
  106923. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  106924. });
  106925. this.appendToSourceBuffer_({
  106926. segmentInfo,
  106927. type: type2,
  106928. initSegment,
  106929. data
  106930. });
  106931. };
  106932. _proto.loadSegment_ = function loadSegment_(segmentInfo) {
  106933. var _this4 = this;
  106934. this.state = "WAITING";
  106935. this.pendingSegment_ = segmentInfo;
  106936. this.trimBackBuffer_(segmentInfo);
  106937. if (typeof segmentInfo.timestampOffset === "number") {
  106938. if (this.transmuxer_) {
  106939. this.transmuxer_.postMessage({
  106940. action: "clearAllMp4Captions"
  106941. });
  106942. }
  106943. }
  106944. if (!this.hasEnoughInfoToLoad_()) {
  106945. this.loadQueue_.push(function() {
  106946. var options2 = _extends$2({}, segmentInfo, {
  106947. forceTimestampOffset: true
  106948. });
  106949. _extends$2(segmentInfo, _this4.generateSegmentInfo_(options2));
  106950. _this4.isPendingTimestampOffset_ = false;
  106951. _this4.updateTransmuxerAndRequestSegment_(segmentInfo);
  106952. });
  106953. return;
  106954. }
  106955. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  106956. };
  106957. _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) {
  106958. var _this5 = this;
  106959. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  106960. this.gopBuffer_.length = 0;
  106961. segmentInfo.gopsToAlignWith = [];
  106962. this.timeMapping_ = 0;
  106963. this.transmuxer_.postMessage({
  106964. action: "reset"
  106965. });
  106966. this.transmuxer_.postMessage({
  106967. action: "setTimestampOffset",
  106968. timestampOffset: segmentInfo.timestampOffset
  106969. });
  106970. }
  106971. var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  106972. var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  106973. var isWalkingForward = this.mediaIndex !== null;
  106974. var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  106975. var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  106976. this.logger_("Requesting " + segmentInfoString(segmentInfo));
  106977. if (simpleSegment.map && !simpleSegment.map.bytes) {
  106978. this.logger_("going to request init segment.");
  106979. this.appendInitSegment_ = {
  106980. video: true,
  106981. audio: true
  106982. };
  106983. }
  106984. segmentInfo.abortRequests = mediaSegmentRequest({
  106985. xhr: this.vhs_.xhr,
  106986. xhrOptions: this.xhrOptions_,
  106987. decryptionWorker: this.decrypter_,
  106988. segment: simpleSegment,
  106989. abortFn: this.handleAbort_.bind(this, segmentInfo),
  106990. progressFn: this.handleProgress_.bind(this),
  106991. trackInfoFn: this.handleTrackInfo_.bind(this),
  106992. timingInfoFn: this.handleTimingInfo_.bind(this),
  106993. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  106994. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  106995. captionsFn: this.handleCaptions_.bind(this),
  106996. isEndOfTimeline,
  106997. endedTimelineFn: function endedTimelineFn() {
  106998. _this5.logger_("received endedtimeline callback");
  106999. },
  107000. id3Fn: this.handleId3_.bind(this),
  107001. dataFn: this.handleData_.bind(this),
  107002. doneFn: this.segmentRequestFinished_.bind(this),
  107003. onTransmuxerLog: function onTransmuxerLog(_ref8) {
  107004. var message = _ref8.message, level = _ref8.level, stream = _ref8.stream;
  107005. _this5.logger_(segmentInfoString(segmentInfo) + " logged from transmuxer stream " + stream + " as a " + level + ": " + message);
  107006. }
  107007. });
  107008. };
  107009. _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) {
  107010. var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  107011. if (removeToTime > 0) {
  107012. this.remove(0, removeToTime);
  107013. }
  107014. };
  107015. _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) {
  107016. var segment = segmentInfo.segment;
  107017. var part = segmentInfo.part;
  107018. var simpleSegment = {
  107019. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  107020. byterange: part ? part.byterange : segment.byterange,
  107021. requestId: segmentInfo.requestId,
  107022. transmuxer: segmentInfo.transmuxer,
  107023. audioAppendStart: segmentInfo.audioAppendStart,
  107024. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  107025. part: segmentInfo.part
  107026. };
  107027. var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  107028. if (previousSegment && previousSegment.timeline === segment.timeline) {
  107029. if (previousSegment.videoTimingInfo) {
  107030. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  107031. } else if (previousSegment.audioTimingInfo) {
  107032. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  107033. }
  107034. }
  107035. if (segment.key) {
  107036. var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  107037. simpleSegment.key = this.segmentKey(segment.key);
  107038. simpleSegment.key.iv = iv;
  107039. }
  107040. if (segment.map) {
  107041. simpleSegment.map = this.initSegmentForMap(segment.map);
  107042. }
  107043. return simpleSegment;
  107044. };
  107045. _proto.saveTransferStats_ = function saveTransferStats_(stats) {
  107046. this.mediaRequests += 1;
  107047. if (stats) {
  107048. this.mediaBytesTransferred += stats.bytesReceived;
  107049. this.mediaTransferDuration += stats.roundTripTime;
  107050. }
  107051. };
  107052. _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration5, stats) {
  107053. this.pendingSegment_.byteLength = stats.bytesReceived;
  107054. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  107055. this.logger_("Ignoring segment's bandwidth because its duration of " + duration5 + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS));
  107056. return;
  107057. }
  107058. this.bandwidth = stats.bandwidth;
  107059. this.roundTrip = stats.roundTripTime;
  107060. };
  107061. _proto.handleTimeout_ = function handleTimeout_() {
  107062. this.mediaRequestsTimedout += 1;
  107063. this.bandwidth = 1;
  107064. this.roundTrip = NaN;
  107065. this.trigger("bandwidthupdate");
  107066. this.trigger("timeout");
  107067. };
  107068. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  107069. if (this.callQueue_.length) {
  107070. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  107071. return;
  107072. }
  107073. this.saveTransferStats_(simpleSegment.stats);
  107074. if (!this.pendingSegment_) {
  107075. return;
  107076. }
  107077. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  107078. return;
  107079. }
  107080. if (error) {
  107081. this.pendingSegment_ = null;
  107082. this.state = "READY";
  107083. if (error.code === REQUEST_ERRORS.ABORTED) {
  107084. return;
  107085. }
  107086. this.pause();
  107087. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  107088. this.handleTimeout_();
  107089. return;
  107090. }
  107091. this.mediaRequestsErrored += 1;
  107092. this.error(error);
  107093. this.trigger("error");
  107094. return;
  107095. }
  107096. var segmentInfo = this.pendingSegment_;
  107097. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  107098. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  107099. if (result.gopInfo) {
  107100. this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  107101. }
  107102. this.state = "APPENDING";
  107103. this.trigger("appending");
  107104. this.waitForAppendsToComplete_(segmentInfo);
  107105. };
  107106. _proto.setTimeMapping_ = function setTimeMapping_(timeline) {
  107107. var timelineMapping = this.syncController_.mappingForTimeline(timeline);
  107108. if (timelineMapping !== null) {
  107109. this.timeMapping_ = timelineMapping;
  107110. }
  107111. };
  107112. _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) {
  107113. if (typeof segment.start === "number" && typeof segment.end === "number") {
  107114. this.mediaSecondsLoaded += segment.end - segment.start;
  107115. } else {
  107116. this.mediaSecondsLoaded += segment.duration;
  107117. }
  107118. };
  107119. _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  107120. if (timestampOffset2 === null) {
  107121. return false;
  107122. }
  107123. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  107124. return true;
  107125. }
  107126. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  107127. return true;
  107128. }
  107129. return false;
  107130. };
  107131. _proto.trueSegmentStart_ = function trueSegmentStart_(_ref9) {
  107132. 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;
  107133. if (typeof currentStart !== "undefined") {
  107134. return currentStart;
  107135. }
  107136. if (!useVideoTimingInfo) {
  107137. return audioTimingInfo.start;
  107138. }
  107139. var previousSegment = playlist.segments[mediaIndex - 1];
  107140. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  107141. return firstVideoFrameTimeForData;
  107142. }
  107143. return videoTimingInfo.start;
  107144. };
  107145. _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) {
  107146. var trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  107147. if (!trackInfo) {
  107148. this.error({
  107149. message: "No starting media returned, likely due to an unsupported media format.",
  107150. blacklistDuration: Infinity
  107151. });
  107152. this.trigger("error");
  107153. return;
  107154. }
  107155. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  107156. var waitForVideo = this.loaderType_ === "main" && hasVideo;
  107157. var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  107158. segmentInfo.waitingOnAppends = 0;
  107159. if (!segmentInfo.hasAppendedData_) {
  107160. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  107161. this.isPendingTimestampOffset_ = true;
  107162. }
  107163. segmentInfo.timingInfo = {
  107164. start: 0
  107165. };
  107166. segmentInfo.waitingOnAppends++;
  107167. if (!this.isPendingTimestampOffset_) {
  107168. this.updateSourceBufferTimestampOffset_(segmentInfo);
  107169. this.processMetadataQueue_();
  107170. }
  107171. this.checkAppendsDone_(segmentInfo);
  107172. return;
  107173. }
  107174. if (waitForVideo) {
  107175. segmentInfo.waitingOnAppends++;
  107176. }
  107177. if (waitForAudio) {
  107178. segmentInfo.waitingOnAppends++;
  107179. }
  107180. if (waitForVideo) {
  107181. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107182. }
  107183. if (waitForAudio) {
  107184. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107185. }
  107186. };
  107187. _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) {
  107188. if (this.checkForAbort_(segmentInfo.requestId)) {
  107189. return;
  107190. }
  107191. segmentInfo.waitingOnAppends--;
  107192. if (segmentInfo.waitingOnAppends === 0) {
  107193. this.handleAppendsDone_();
  107194. }
  107195. };
  107196. _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) {
  107197. var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  107198. if (illegalMediaSwitchError) {
  107199. this.error({
  107200. message: illegalMediaSwitchError,
  107201. blacklistDuration: Infinity
  107202. });
  107203. this.trigger("error");
  107204. return true;
  107205. }
  107206. return false;
  107207. };
  107208. _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) {
  107209. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  107210. return;
  107211. }
  107212. var didChange = false;
  107213. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  107214. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  107215. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  107216. timingInfo: segmentInfo.timingInfo
  107217. });
  107218. segmentInfo.changedTimestampOffset = true;
  107219. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  107220. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  107221. didChange = true;
  107222. }
  107223. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  107224. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  107225. didChange = true;
  107226. }
  107227. if (didChange) {
  107228. this.trigger("timestampoffset");
  107229. }
  107230. };
  107231. _proto.getSegmentStartTimeForTimestampOffsetCalculation_ = function getSegmentStartTimeForTimestampOffsetCalculation_(_ref10) {
  107232. var videoTimingInfo = _ref10.videoTimingInfo, audioTimingInfo = _ref10.audioTimingInfo, timingInfo = _ref10.timingInfo;
  107233. if (!this.useDtsForTimestampOffset_) {
  107234. return timingInfo.start;
  107235. }
  107236. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  107237. return videoTimingInfo.transmuxedDecodeStart;
  107238. }
  107239. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  107240. return audioTimingInfo.transmuxedDecodeStart;
  107241. }
  107242. return timingInfo.start;
  107243. };
  107244. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) {
  107245. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  107246. var trackInfo = this.getMediaInfo_();
  107247. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  107248. var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  107249. if (!prioritizedTimingInfo) {
  107250. return;
  107251. }
  107252. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  107253. };
  107254. _proto.handleAppendsDone_ = function handleAppendsDone_() {
  107255. if (this.pendingSegment_) {
  107256. this.trigger("appendsdone");
  107257. }
  107258. if (!this.pendingSegment_) {
  107259. this.state = "READY";
  107260. if (!this.paused()) {
  107261. this.monitorBuffer_();
  107262. }
  107263. return;
  107264. }
  107265. var segmentInfo = this.pendingSegment_;
  107266. this.updateTimingInfoEnd_(segmentInfo);
  107267. if (this.shouldSaveSegmentTimingInfo_) {
  107268. this.syncController_.saveSegmentTimingInfo({
  107269. segmentInfo,
  107270. shouldSaveTimelineMapping: this.loaderType_ === "main"
  107271. });
  107272. }
  107273. var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_);
  107274. if (segmentDurationMessage) {
  107275. if (segmentDurationMessage.severity === "warn") {
  107276. videojs.log.warn(segmentDurationMessage.message);
  107277. } else {
  107278. this.logger_(segmentDurationMessage.message);
  107279. }
  107280. }
  107281. this.recordThroughput_(segmentInfo);
  107282. this.pendingSegment_ = null;
  107283. this.state = "READY";
  107284. if (segmentInfo.isSyncRequest) {
  107285. this.trigger("syncinfoupdate");
  107286. if (!segmentInfo.hasAppendedData_) {
  107287. this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo));
  107288. return;
  107289. }
  107290. }
  107291. this.logger_("Appended " + segmentInfoString(segmentInfo));
  107292. this.addSegmentMetadataCue_(segmentInfo);
  107293. this.fetchAtBuffer_ = true;
  107294. if (this.currentTimeline_ !== segmentInfo.timeline) {
  107295. this.timelineChangeController_.lastTimelineChange({
  107296. type: this.loaderType_,
  107297. from: this.currentTimeline_,
  107298. to: segmentInfo.timeline
  107299. });
  107300. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  107301. this.timelineChangeController_.lastTimelineChange({
  107302. type: "audio",
  107303. from: this.currentTimeline_,
  107304. to: segmentInfo.timeline
  107305. });
  107306. }
  107307. }
  107308. this.currentTimeline_ = segmentInfo.timeline;
  107309. this.trigger("syncinfoupdate");
  107310. var segment = segmentInfo.segment;
  107311. var part = segmentInfo.part;
  107312. var badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  107313. var badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  107314. if (badSegmentGuess || badPartGuess) {
  107315. this.logger_("bad " + (badSegmentGuess ? "segment" : "part") + " " + segmentInfoString(segmentInfo));
  107316. this.resetEverything();
  107317. return;
  107318. }
  107319. var isWalkingForward = this.mediaIndex !== null;
  107320. if (isWalkingForward) {
  107321. this.trigger("bandwidthupdate");
  107322. }
  107323. this.trigger("progress");
  107324. this.mediaIndex = segmentInfo.mediaIndex;
  107325. this.partIndex = segmentInfo.partIndex;
  107326. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  107327. this.endOfStream();
  107328. }
  107329. this.trigger("appended");
  107330. if (segmentInfo.hasAppendedData_) {
  107331. this.mediaAppends++;
  107332. }
  107333. if (!this.paused()) {
  107334. this.monitorBuffer_();
  107335. }
  107336. };
  107337. _proto.recordThroughput_ = function recordThroughput_(segmentInfo) {
  107338. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  107339. 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));
  107340. return;
  107341. }
  107342. var rate = this.throughput.rate;
  107343. var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  107344. var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  107345. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  107346. };
  107347. _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) {
  107348. if (!this.segmentMetadataTrack_) {
  107349. return;
  107350. }
  107351. var segment = segmentInfo.segment;
  107352. var start2 = segment.start;
  107353. var end = segment.end;
  107354. if (!finite(start2) || !finite(end)) {
  107355. return;
  107356. }
  107357. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  107358. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  107359. var value = {
  107360. custom: segment.custom,
  107361. dateTimeObject: segment.dateTimeObject,
  107362. dateTimeString: segment.dateTimeString,
  107363. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  107364. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  107365. codecs: segmentInfo.playlist.attributes.CODECS,
  107366. byteLength: segmentInfo.byteLength,
  107367. uri: segmentInfo.uri,
  107368. timeline: segmentInfo.timeline,
  107369. playlist: segmentInfo.playlist.id,
  107370. start: start2,
  107371. end
  107372. };
  107373. var data = JSON.stringify(value);
  107374. var cue = new Cue(start2, end, data);
  107375. cue.value = value;
  107376. this.segmentMetadataTrack_.addCue(cue);
  107377. };
  107378. return SegmentLoader2;
  107379. }(videojs.EventTarget);
  107380. function noop() {
  107381. }
  107382. var toTitleCase2 = function toTitleCase3(string) {
  107383. if (typeof string !== "string") {
  107384. return string;
  107385. }
  107386. return string.replace(/./, function(w) {
  107387. return w.toUpperCase();
  107388. });
  107389. };
  107390. var bufferTypes = ["video", "audio"];
  107391. var _updating = function updating2(type2, sourceUpdater) {
  107392. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107393. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  107394. };
  107395. var nextQueueIndexOfType = function nextQueueIndexOfType2(type2, queue) {
  107396. for (var i2 = 0; i2 < queue.length; i2++) {
  107397. var queueEntry = queue[i2];
  107398. if (queueEntry.type === "mediaSource") {
  107399. return null;
  107400. }
  107401. if (queueEntry.type === type2) {
  107402. return i2;
  107403. }
  107404. }
  107405. return null;
  107406. };
  107407. var shiftQueue = function shiftQueue2(type2, sourceUpdater) {
  107408. if (sourceUpdater.queue.length === 0) {
  107409. return;
  107410. }
  107411. var queueIndex = 0;
  107412. var queueEntry = sourceUpdater.queue[queueIndex];
  107413. if (queueEntry.type === "mediaSource") {
  107414. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  107415. sourceUpdater.queue.shift();
  107416. queueEntry.action(sourceUpdater);
  107417. if (queueEntry.doneFn) {
  107418. queueEntry.doneFn();
  107419. }
  107420. shiftQueue2("audio", sourceUpdater);
  107421. shiftQueue2("video", sourceUpdater);
  107422. }
  107423. return;
  107424. }
  107425. if (type2 === "mediaSource") {
  107426. return;
  107427. }
  107428. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || _updating(type2, sourceUpdater)) {
  107429. return;
  107430. }
  107431. if (queueEntry.type !== type2) {
  107432. queueIndex = nextQueueIndexOfType(type2, sourceUpdater.queue);
  107433. if (queueIndex === null) {
  107434. return;
  107435. }
  107436. queueEntry = sourceUpdater.queue[queueIndex];
  107437. }
  107438. sourceUpdater.queue.splice(queueIndex, 1);
  107439. sourceUpdater.queuePending[type2] = queueEntry;
  107440. queueEntry.action(type2, sourceUpdater);
  107441. if (!queueEntry.doneFn) {
  107442. sourceUpdater.queuePending[type2] = null;
  107443. shiftQueue2(type2, sourceUpdater);
  107444. return;
  107445. }
  107446. };
  107447. var cleanupBuffer = function cleanupBuffer2(type2, sourceUpdater) {
  107448. var buffer = sourceUpdater[type2 + "Buffer"];
  107449. var titleType = toTitleCase2(type2);
  107450. if (!buffer) {
  107451. return;
  107452. }
  107453. buffer.removeEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107454. buffer.removeEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107455. sourceUpdater.codecs[type2] = null;
  107456. sourceUpdater[type2 + "Buffer"] = null;
  107457. };
  107458. var inSourceBuffers = function inSourceBuffers2(mediaSource, sourceBuffer) {
  107459. return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  107460. };
  107461. var actions = {
  107462. appendBuffer: function appendBuffer(bytes, segmentInfo, onError2) {
  107463. return function(type2, sourceUpdater) {
  107464. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107465. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107466. return;
  107467. }
  107468. sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type2 + "Buffer");
  107469. try {
  107470. sourceBuffer.appendBuffer(bytes);
  107471. } catch (e) {
  107472. sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? "(QUOTA_EXCEEDED_ERR) " : "") + ("when appending segment " + segmentInfo.mediaIndex + " to " + type2 + "Buffer"));
  107473. sourceUpdater.queuePending[type2] = null;
  107474. onError2(e);
  107475. }
  107476. };
  107477. },
  107478. remove: function remove(start2, end) {
  107479. return function(type2, sourceUpdater) {
  107480. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107481. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107482. return;
  107483. }
  107484. sourceUpdater.logger_("Removing " + start2 + " to " + end + " from " + type2 + "Buffer");
  107485. try {
  107486. sourceBuffer.remove(start2, end);
  107487. } catch (e) {
  107488. sourceUpdater.logger_("Remove " + start2 + " to " + end + " from " + type2 + "Buffer failed");
  107489. }
  107490. };
  107491. },
  107492. timestampOffset: function timestampOffset(offset) {
  107493. return function(type2, sourceUpdater) {
  107494. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107495. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107496. return;
  107497. }
  107498. sourceUpdater.logger_("Setting " + type2 + "timestampOffset to " + offset);
  107499. sourceBuffer.timestampOffset = offset;
  107500. };
  107501. },
  107502. callback: function callback(_callback) {
  107503. return function(type2, sourceUpdater) {
  107504. _callback();
  107505. };
  107506. },
  107507. endOfStream: function endOfStream(error) {
  107508. return function(sourceUpdater) {
  107509. if (sourceUpdater.mediaSource.readyState !== "open") {
  107510. return;
  107511. }
  107512. sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || "") + ")");
  107513. try {
  107514. sourceUpdater.mediaSource.endOfStream(error);
  107515. } catch (e) {
  107516. videojs.log.warn("Failed to call media source endOfStream", e);
  107517. }
  107518. };
  107519. },
  107520. duration: function duration4(_duration) {
  107521. return function(sourceUpdater) {
  107522. sourceUpdater.logger_("Setting mediaSource duration to " + _duration);
  107523. try {
  107524. sourceUpdater.mediaSource.duration = _duration;
  107525. } catch (e) {
  107526. videojs.log.warn("Failed to set media source duration", e);
  107527. }
  107528. };
  107529. },
  107530. abort: function abort() {
  107531. return function(type2, sourceUpdater) {
  107532. if (sourceUpdater.mediaSource.readyState !== "open") {
  107533. return;
  107534. }
  107535. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107536. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107537. return;
  107538. }
  107539. sourceUpdater.logger_("calling abort on " + type2 + "Buffer");
  107540. try {
  107541. sourceBuffer.abort();
  107542. } catch (e) {
  107543. videojs.log.warn("Failed to abort on " + type2 + "Buffer", e);
  107544. }
  107545. };
  107546. },
  107547. addSourceBuffer: function addSourceBuffer(type2, codec) {
  107548. return function(sourceUpdater) {
  107549. var titleType = toTitleCase2(type2);
  107550. var mime = getMimeForCodec2(codec);
  107551. sourceUpdater.logger_("Adding " + type2 + "Buffer with codec " + codec + " to mediaSource");
  107552. var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  107553. sourceBuffer.addEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107554. sourceBuffer.addEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107555. sourceUpdater.codecs[type2] = codec;
  107556. sourceUpdater[type2 + "Buffer"] = sourceBuffer;
  107557. };
  107558. },
  107559. removeSourceBuffer: function removeSourceBuffer(type2) {
  107560. return function(sourceUpdater) {
  107561. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107562. cleanupBuffer(type2, sourceUpdater);
  107563. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107564. return;
  107565. }
  107566. sourceUpdater.logger_("Removing " + type2 + "Buffer with codec " + sourceUpdater.codecs[type2] + " from mediaSource");
  107567. try {
  107568. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  107569. } catch (e) {
  107570. videojs.log.warn("Failed to removeSourceBuffer " + type2 + "Buffer", e);
  107571. }
  107572. };
  107573. },
  107574. changeType: function changeType(codec) {
  107575. return function(type2, sourceUpdater) {
  107576. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107577. var mime = getMimeForCodec2(codec);
  107578. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107579. return;
  107580. }
  107581. if (sourceUpdater.codecs[type2] === codec) {
  107582. return;
  107583. }
  107584. sourceUpdater.logger_("changing " + type2 + "Buffer codec from " + sourceUpdater.codecs[type2] + " to " + codec);
  107585. sourceBuffer.changeType(mime);
  107586. sourceUpdater.codecs[type2] = codec;
  107587. };
  107588. }
  107589. };
  107590. var pushQueue = function pushQueue2(_ref) {
  107591. var type2 = _ref.type, sourceUpdater = _ref.sourceUpdater, action = _ref.action, doneFn = _ref.doneFn, name = _ref.name;
  107592. sourceUpdater.queue.push({
  107593. type: type2,
  107594. action,
  107595. doneFn,
  107596. name
  107597. });
  107598. shiftQueue(type2, sourceUpdater);
  107599. };
  107600. var onUpdateend = function onUpdateend2(type2, sourceUpdater) {
  107601. return function(e) {
  107602. if (sourceUpdater.queuePending[type2]) {
  107603. var doneFn = sourceUpdater.queuePending[type2].doneFn;
  107604. sourceUpdater.queuePending[type2] = null;
  107605. if (doneFn) {
  107606. doneFn(sourceUpdater[type2 + "Error_"]);
  107607. }
  107608. }
  107609. shiftQueue(type2, sourceUpdater);
  107610. };
  107611. };
  107612. var SourceUpdater = /* @__PURE__ */ function(_videojs$EventTarget) {
  107613. _inheritsLoose(SourceUpdater2, _videojs$EventTarget);
  107614. function SourceUpdater2(mediaSource) {
  107615. var _this;
  107616. _this = _videojs$EventTarget.call(this) || this;
  107617. _this.mediaSource = mediaSource;
  107618. _this.sourceopenListener_ = function() {
  107619. return shiftQueue("mediaSource", _assertThisInitialized(_this));
  107620. };
  107621. _this.mediaSource.addEventListener("sourceopen", _this.sourceopenListener_);
  107622. _this.logger_ = logger("SourceUpdater");
  107623. _this.audioTimestampOffset_ = 0;
  107624. _this.videoTimestampOffset_ = 0;
  107625. _this.queue = [];
  107626. _this.queuePending = {
  107627. audio: null,
  107628. video: null
  107629. };
  107630. _this.delayedAudioAppendQueue_ = [];
  107631. _this.videoAppendQueued_ = false;
  107632. _this.codecs = {};
  107633. _this.onVideoUpdateEnd_ = onUpdateend("video", _assertThisInitialized(_this));
  107634. _this.onAudioUpdateEnd_ = onUpdateend("audio", _assertThisInitialized(_this));
  107635. _this.onVideoError_ = function(e) {
  107636. _this.videoError_ = e;
  107637. };
  107638. _this.onAudioError_ = function(e) {
  107639. _this.audioError_ = e;
  107640. };
  107641. _this.createdSourceBuffers_ = false;
  107642. _this.initializedEme_ = false;
  107643. _this.triggeredReady_ = false;
  107644. return _this;
  107645. }
  107646. var _proto = SourceUpdater2.prototype;
  107647. _proto.initializedEme = function initializedEme() {
  107648. this.initializedEme_ = true;
  107649. this.triggerReady();
  107650. };
  107651. _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() {
  107652. return this.createdSourceBuffers_;
  107653. };
  107654. _proto.hasInitializedAnyEme = function hasInitializedAnyEme() {
  107655. return this.initializedEme_;
  107656. };
  107657. _proto.ready = function ready() {
  107658. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  107659. };
  107660. _proto.createSourceBuffers = function createSourceBuffers(codecs) {
  107661. if (this.hasCreatedSourceBuffers()) {
  107662. return;
  107663. }
  107664. this.addOrChangeSourceBuffers(codecs);
  107665. this.createdSourceBuffers_ = true;
  107666. this.trigger("createdsourcebuffers");
  107667. this.triggerReady();
  107668. };
  107669. _proto.triggerReady = function triggerReady() {
  107670. if (this.ready() && !this.triggeredReady_) {
  107671. this.triggeredReady_ = true;
  107672. this.trigger("ready");
  107673. }
  107674. };
  107675. _proto.addSourceBuffer = function addSourceBuffer2(type2, codec) {
  107676. pushQueue({
  107677. type: "mediaSource",
  107678. sourceUpdater: this,
  107679. action: actions.addSourceBuffer(type2, codec),
  107680. name: "addSourceBuffer"
  107681. });
  107682. };
  107683. _proto.abort = function abort2(type2) {
  107684. pushQueue({
  107685. type: type2,
  107686. sourceUpdater: this,
  107687. action: actions.abort(type2),
  107688. name: "abort"
  107689. });
  107690. };
  107691. _proto.removeSourceBuffer = function removeSourceBuffer2(type2) {
  107692. if (!this.canRemoveSourceBuffer()) {
  107693. videojs.log.error("removeSourceBuffer is not supported!");
  107694. return;
  107695. }
  107696. pushQueue({
  107697. type: "mediaSource",
  107698. sourceUpdater: this,
  107699. action: actions.removeSourceBuffer(type2),
  107700. name: "removeSourceBuffer"
  107701. });
  107702. };
  107703. _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() {
  107704. return !videojs.browser.IE_VERSION && !videojs.browser.IS_FIREFOX && window_1.MediaSource && window_1.MediaSource.prototype && typeof window_1.MediaSource.prototype.removeSourceBuffer === "function";
  107705. };
  107706. SourceUpdater2.canChangeType = function canChangeType() {
  107707. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  107708. };
  107709. _proto.canChangeType = function canChangeType() {
  107710. return this.constructor.canChangeType();
  107711. };
  107712. _proto.changeType = function changeType2(type2, codec) {
  107713. if (!this.canChangeType()) {
  107714. videojs.log.error("changeType is not supported!");
  107715. return;
  107716. }
  107717. pushQueue({
  107718. type: type2,
  107719. sourceUpdater: this,
  107720. action: actions.changeType(codec),
  107721. name: "changeType"
  107722. });
  107723. };
  107724. _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) {
  107725. var _this2 = this;
  107726. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  107727. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  107728. }
  107729. Object.keys(codecs).forEach(function(type2) {
  107730. var codec = codecs[type2];
  107731. if (!_this2.hasCreatedSourceBuffers()) {
  107732. return _this2.addSourceBuffer(type2, codec);
  107733. }
  107734. if (_this2.canChangeType()) {
  107735. _this2.changeType(type2, codec);
  107736. }
  107737. });
  107738. };
  107739. _proto.appendBuffer = function appendBuffer2(options2, doneFn) {
  107740. var _this3 = this;
  107741. var segmentInfo = options2.segmentInfo, type2 = options2.type, bytes = options2.bytes;
  107742. this.processedAppend_ = true;
  107743. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  107744. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  107745. this.logger_("delayed audio append of " + bytes.length + " until video append");
  107746. return;
  107747. }
  107748. var onError2 = doneFn;
  107749. pushQueue({
  107750. type: type2,
  107751. sourceUpdater: this,
  107752. action: actions.appendBuffer(bytes, segmentInfo || {
  107753. mediaIndex: -1
  107754. }, onError2),
  107755. doneFn,
  107756. name: "appendBuffer"
  107757. });
  107758. if (type2 === "video") {
  107759. this.videoAppendQueued_ = true;
  107760. if (!this.delayedAudioAppendQueue_.length) {
  107761. return;
  107762. }
  107763. var queue = this.delayedAudioAppendQueue_.slice();
  107764. this.logger_("queuing delayed audio " + queue.length + " appendBuffers");
  107765. this.delayedAudioAppendQueue_.length = 0;
  107766. queue.forEach(function(que) {
  107767. _this3.appendBuffer.apply(_this3, que);
  107768. });
  107769. }
  107770. };
  107771. _proto.audioBuffered = function audioBuffered() {
  107772. if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) {
  107773. return videojs.createTimeRange();
  107774. }
  107775. return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs.createTimeRange();
  107776. };
  107777. _proto.videoBuffered = function videoBuffered() {
  107778. if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) {
  107779. return videojs.createTimeRange();
  107780. }
  107781. return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs.createTimeRange();
  107782. };
  107783. _proto.buffered = function buffered() {
  107784. var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  107785. var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  107786. if (audio && !video) {
  107787. return this.audioBuffered();
  107788. }
  107789. if (video && !audio) {
  107790. return this.videoBuffered();
  107791. }
  107792. return bufferIntersection(this.audioBuffered(), this.videoBuffered());
  107793. };
  107794. _proto.setDuration = function setDuration(duration5, doneFn) {
  107795. if (doneFn === void 0) {
  107796. doneFn = noop;
  107797. }
  107798. pushQueue({
  107799. type: "mediaSource",
  107800. sourceUpdater: this,
  107801. action: actions.duration(duration5),
  107802. name: "duration",
  107803. doneFn
  107804. });
  107805. };
  107806. _proto.endOfStream = function endOfStream2(error, doneFn) {
  107807. if (error === void 0) {
  107808. error = null;
  107809. }
  107810. if (doneFn === void 0) {
  107811. doneFn = noop;
  107812. }
  107813. if (typeof error !== "string") {
  107814. error = void 0;
  107815. }
  107816. pushQueue({
  107817. type: "mediaSource",
  107818. sourceUpdater: this,
  107819. action: actions.endOfStream(error),
  107820. name: "endOfStream",
  107821. doneFn
  107822. });
  107823. };
  107824. _proto.removeAudio = function removeAudio(start2, end, done) {
  107825. if (done === void 0) {
  107826. done = noop;
  107827. }
  107828. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  107829. done();
  107830. return;
  107831. }
  107832. pushQueue({
  107833. type: "audio",
  107834. sourceUpdater: this,
  107835. action: actions.remove(start2, end),
  107836. doneFn: done,
  107837. name: "remove"
  107838. });
  107839. };
  107840. _proto.removeVideo = function removeVideo(start2, end, done) {
  107841. if (done === void 0) {
  107842. done = noop;
  107843. }
  107844. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  107845. done();
  107846. return;
  107847. }
  107848. pushQueue({
  107849. type: "video",
  107850. sourceUpdater: this,
  107851. action: actions.remove(start2, end),
  107852. doneFn: done,
  107853. name: "remove"
  107854. });
  107855. };
  107856. _proto.updating = function updating3() {
  107857. if (_updating("audio", this) || _updating("video", this)) {
  107858. return true;
  107859. }
  107860. return false;
  107861. };
  107862. _proto.audioTimestampOffset = function audioTimestampOffset(offset) {
  107863. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  107864. pushQueue({
  107865. type: "audio",
  107866. sourceUpdater: this,
  107867. action: actions.timestampOffset(offset),
  107868. name: "timestampOffset"
  107869. });
  107870. this.audioTimestampOffset_ = offset;
  107871. }
  107872. return this.audioTimestampOffset_;
  107873. };
  107874. _proto.videoTimestampOffset = function videoTimestampOffset(offset) {
  107875. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  107876. pushQueue({
  107877. type: "video",
  107878. sourceUpdater: this,
  107879. action: actions.timestampOffset(offset),
  107880. name: "timestampOffset"
  107881. });
  107882. this.videoTimestampOffset_ = offset;
  107883. }
  107884. return this.videoTimestampOffset_;
  107885. };
  107886. _proto.audioQueueCallback = function audioQueueCallback(callback2) {
  107887. if (!this.audioBuffer) {
  107888. return;
  107889. }
  107890. pushQueue({
  107891. type: "audio",
  107892. sourceUpdater: this,
  107893. action: actions.callback(callback2),
  107894. name: "callback"
  107895. });
  107896. };
  107897. _proto.videoQueueCallback = function videoQueueCallback(callback2) {
  107898. if (!this.videoBuffer) {
  107899. return;
  107900. }
  107901. pushQueue({
  107902. type: "video",
  107903. sourceUpdater: this,
  107904. action: actions.callback(callback2),
  107905. name: "callback"
  107906. });
  107907. };
  107908. _proto.dispose = function dispose() {
  107909. var _this4 = this;
  107910. this.trigger("dispose");
  107911. bufferTypes.forEach(function(type2) {
  107912. _this4.abort(type2);
  107913. if (_this4.canRemoveSourceBuffer()) {
  107914. _this4.removeSourceBuffer(type2);
  107915. } else {
  107916. _this4[type2 + "QueueCallback"](function() {
  107917. return cleanupBuffer(type2, _this4);
  107918. });
  107919. }
  107920. });
  107921. this.videoAppendQueued_ = false;
  107922. this.delayedAudioAppendQueue_.length = 0;
  107923. if (this.sourceopenListener_) {
  107924. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  107925. }
  107926. this.off();
  107927. };
  107928. return SourceUpdater2;
  107929. }(videojs.EventTarget);
  107930. var uint8ToUtf8 = function uint8ToUtf82(uintArray) {
  107931. return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  107932. };
  107933. var VTT_LINE_TERMINATORS = new Uint8Array("\n\n".split("").map(function(_char3) {
  107934. return _char3.charCodeAt(0);
  107935. }));
  107936. var NoVttJsError = /* @__PURE__ */ function(_Error) {
  107937. _inheritsLoose(NoVttJsError2, _Error);
  107938. function NoVttJsError2() {
  107939. return _Error.call(this, "Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.") || this;
  107940. }
  107941. return NoVttJsError2;
  107942. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  107943. var VTTSegmentLoader = /* @__PURE__ */ function(_SegmentLoader) {
  107944. _inheritsLoose(VTTSegmentLoader2, _SegmentLoader);
  107945. function VTTSegmentLoader2(settings, options2) {
  107946. var _this;
  107947. if (options2 === void 0) {
  107948. options2 = {};
  107949. }
  107950. _this = _SegmentLoader.call(this, settings, options2) || this;
  107951. _this.mediaSource_ = null;
  107952. _this.subtitlesTrack_ = null;
  107953. _this.loaderType_ = "subtitle";
  107954. _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  107955. _this.loadVttJs = settings.loadVttJs;
  107956. _this.shouldSaveSegmentTimingInfo_ = false;
  107957. return _this;
  107958. }
  107959. var _proto = VTTSegmentLoader2.prototype;
  107960. _proto.createTransmuxer_ = function createTransmuxer_() {
  107961. return null;
  107962. };
  107963. _proto.buffered_ = function buffered_() {
  107964. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  107965. return videojs.createTimeRanges();
  107966. }
  107967. var cues = this.subtitlesTrack_.cues;
  107968. var start2 = cues[0].startTime;
  107969. var end = cues[cues.length - 1].startTime;
  107970. return videojs.createTimeRanges([[start2, end]]);
  107971. };
  107972. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  107973. if (set4 === void 0) {
  107974. set4 = false;
  107975. }
  107976. if (!map) {
  107977. return null;
  107978. }
  107979. var id = initSegmentId(map);
  107980. var storedMap = this.initSegments_[id];
  107981. if (set4 && !storedMap && map.bytes) {
  107982. var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;
  107983. var combinedSegment = new Uint8Array(combinedByteLength);
  107984. combinedSegment.set(map.bytes);
  107985. combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);
  107986. this.initSegments_[id] = storedMap = {
  107987. resolvedUri: map.resolvedUri,
  107988. byterange: map.byterange,
  107989. bytes: combinedSegment
  107990. };
  107991. }
  107992. return storedMap || map;
  107993. };
  107994. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  107995. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  107996. };
  107997. _proto.init_ = function init_() {
  107998. this.state = "READY";
  107999. this.resetEverything();
  108000. return this.monitorBuffer_();
  108001. };
  108002. _proto.track = function track(_track) {
  108003. if (typeof _track === "undefined") {
  108004. return this.subtitlesTrack_;
  108005. }
  108006. this.subtitlesTrack_ = _track;
  108007. if (this.state === "INIT" && this.couldBeginLoading_()) {
  108008. this.init_();
  108009. }
  108010. return this.subtitlesTrack_;
  108011. };
  108012. _proto.remove = function remove2(start2, end) {
  108013. removeCuesFromTrack(start2, end, this.subtitlesTrack_);
  108014. };
  108015. _proto.fillBuffer_ = function fillBuffer_() {
  108016. var _this2 = this;
  108017. var segmentInfo = this.chooseNextRequest_();
  108018. if (!segmentInfo) {
  108019. return;
  108020. }
  108021. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  108022. var checkTimestampOffset = function checkTimestampOffset2() {
  108023. _this2.state = "READY";
  108024. if (!_this2.paused()) {
  108025. _this2.monitorBuffer_();
  108026. }
  108027. };
  108028. this.syncController_.one("timestampoffset", checkTimestampOffset);
  108029. this.state = "WAITING_ON_TIMELINE";
  108030. return;
  108031. }
  108032. this.loadSegment_(segmentInfo);
  108033. };
  108034. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() {
  108035. return null;
  108036. };
  108037. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  108038. return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this));
  108039. };
  108040. _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) {
  108041. while (segmentInfo && segmentInfo.segment.empty) {
  108042. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  108043. segmentInfo = null;
  108044. break;
  108045. }
  108046. segmentInfo = this.generateSegmentInfo_({
  108047. playlist: segmentInfo.playlist,
  108048. mediaIndex: segmentInfo.mediaIndex + 1,
  108049. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  108050. isSyncRequest: segmentInfo.isSyncRequest
  108051. });
  108052. }
  108053. return segmentInfo;
  108054. };
  108055. _proto.stopForError = function stopForError(error) {
  108056. this.error(error);
  108057. this.state = "READY";
  108058. this.pause();
  108059. this.trigger("error");
  108060. };
  108061. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  108062. var _this3 = this;
  108063. if (!this.subtitlesTrack_) {
  108064. this.state = "READY";
  108065. return;
  108066. }
  108067. this.saveTransferStats_(simpleSegment.stats);
  108068. if (!this.pendingSegment_) {
  108069. this.state = "READY";
  108070. this.mediaRequestsAborted += 1;
  108071. return;
  108072. }
  108073. if (error) {
  108074. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  108075. this.handleTimeout_();
  108076. }
  108077. if (error.code === REQUEST_ERRORS.ABORTED) {
  108078. this.mediaRequestsAborted += 1;
  108079. } else {
  108080. this.mediaRequestsErrored += 1;
  108081. }
  108082. this.stopForError(error);
  108083. return;
  108084. }
  108085. var segmentInfo = this.pendingSegment_;
  108086. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  108087. if (simpleSegment.key) {
  108088. this.segmentKey(simpleSegment.key, true);
  108089. }
  108090. this.state = "APPENDING";
  108091. this.trigger("appending");
  108092. var segment = segmentInfo.segment;
  108093. if (segment.map) {
  108094. segment.map.bytes = simpleSegment.map.bytes;
  108095. }
  108096. segmentInfo.bytes = simpleSegment.bytes;
  108097. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  108098. this.state = "WAITING_ON_VTTJS";
  108099. this.loadVttJs().then(function() {
  108100. return _this3.segmentRequestFinished_(error, simpleSegment, result);
  108101. }, function() {
  108102. return _this3.stopForError({
  108103. message: "Error loading vtt.js"
  108104. });
  108105. });
  108106. return;
  108107. }
  108108. segment.requested = true;
  108109. try {
  108110. this.parseVTTCues_(segmentInfo);
  108111. } catch (e) {
  108112. this.stopForError({
  108113. message: e.message
  108114. });
  108115. return;
  108116. }
  108117. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  108118. if (segmentInfo.cues.length) {
  108119. segmentInfo.timingInfo = {
  108120. start: segmentInfo.cues[0].startTime,
  108121. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  108122. };
  108123. } else {
  108124. segmentInfo.timingInfo = {
  108125. start: segmentInfo.startOfSegment,
  108126. end: segmentInfo.startOfSegment + segmentInfo.duration
  108127. };
  108128. }
  108129. if (segmentInfo.isSyncRequest) {
  108130. this.trigger("syncinfoupdate");
  108131. this.pendingSegment_ = null;
  108132. this.state = "READY";
  108133. return;
  108134. }
  108135. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  108136. this.mediaSecondsLoaded += segment.duration;
  108137. segmentInfo.cues.forEach(function(cue) {
  108138. _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  108139. });
  108140. removeDuplicateCuesFromTrack(this.subtitlesTrack_);
  108141. this.handleAppendsDone_();
  108142. };
  108143. _proto.handleData_ = function handleData_3() {
  108144. };
  108145. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {
  108146. };
  108147. _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) {
  108148. var decoder;
  108149. var decodeBytesToString = false;
  108150. if (typeof window_1.WebVTT !== "function") {
  108151. throw new NoVttJsError();
  108152. }
  108153. if (typeof window_1.TextDecoder === "function") {
  108154. decoder = new window_1.TextDecoder("utf8");
  108155. } else {
  108156. decoder = window_1.WebVTT.StringDecoder();
  108157. decodeBytesToString = true;
  108158. }
  108159. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  108160. segmentInfo.cues = [];
  108161. segmentInfo.timestampmap = {
  108162. MPEGTS: 0,
  108163. LOCAL: 0
  108164. };
  108165. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  108166. parser2.ontimestampmap = function(map) {
  108167. segmentInfo.timestampmap = map;
  108168. };
  108169. parser2.onparsingerror = function(error) {
  108170. videojs.log.warn("Error encountered when parsing cues: " + error.message);
  108171. };
  108172. if (segmentInfo.segment.map) {
  108173. var mapData = segmentInfo.segment.map.bytes;
  108174. if (decodeBytesToString) {
  108175. mapData = uint8ToUtf8(mapData);
  108176. }
  108177. parser2.parse(mapData);
  108178. }
  108179. var segmentData = segmentInfo.bytes;
  108180. if (decodeBytesToString) {
  108181. segmentData = uint8ToUtf8(segmentData);
  108182. }
  108183. parser2.parse(segmentData);
  108184. parser2.flush();
  108185. };
  108186. _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  108187. var segment = segmentInfo.segment;
  108188. if (!mappingObj) {
  108189. return;
  108190. }
  108191. if (!segmentInfo.cues.length) {
  108192. segment.empty = true;
  108193. return;
  108194. }
  108195. var timestampmap = segmentInfo.timestampmap;
  108196. var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  108197. segmentInfo.cues.forEach(function(cue) {
  108198. cue.startTime += diff;
  108199. cue.endTime += diff;
  108200. });
  108201. if (!playlist.syncInfo) {
  108202. var firstStart = segmentInfo.cues[0].startTime;
  108203. var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  108204. playlist.syncInfo = {
  108205. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  108206. time: Math.min(firstStart, lastStart - segment.duration)
  108207. };
  108208. }
  108209. };
  108210. return VTTSegmentLoader2;
  108211. }(SegmentLoader);
  108212. var findAdCue = function findAdCue2(track, mediaTime) {
  108213. var cues = track.cues;
  108214. for (var i2 = 0; i2 < cues.length; i2++) {
  108215. var cue = cues[i2];
  108216. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  108217. return cue;
  108218. }
  108219. }
  108220. return null;
  108221. };
  108222. var updateAdCues = function updateAdCues2(media, track, offset) {
  108223. if (offset === void 0) {
  108224. offset = 0;
  108225. }
  108226. if (!media.segments) {
  108227. return;
  108228. }
  108229. var mediaTime = offset;
  108230. var cue;
  108231. for (var i2 = 0; i2 < media.segments.length; i2++) {
  108232. var segment = media.segments[i2];
  108233. if (!cue) {
  108234. cue = findAdCue(track, mediaTime + segment.duration / 2);
  108235. }
  108236. if (cue) {
  108237. if ("cueIn" in segment) {
  108238. cue.endTime = mediaTime;
  108239. cue.adEndTime = mediaTime;
  108240. mediaTime += segment.duration;
  108241. cue = null;
  108242. continue;
  108243. }
  108244. if (mediaTime < cue.endTime) {
  108245. mediaTime += segment.duration;
  108246. continue;
  108247. }
  108248. cue.endTime += segment.duration;
  108249. } else {
  108250. if ("cueOut" in segment) {
  108251. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  108252. cue.adStartTime = mediaTime;
  108253. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  108254. track.addCue(cue);
  108255. }
  108256. if ("cueOutCont" in segment) {
  108257. var _segment$cueOutCont$s = segment.cueOutCont.split("/").map(parseFloat), adOffset = _segment$cueOutCont$s[0], adTotal = _segment$cueOutCont$s[1];
  108258. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  108259. cue.adStartTime = mediaTime - adOffset;
  108260. cue.adEndTime = cue.adStartTime + adTotal;
  108261. track.addCue(cue);
  108262. }
  108263. }
  108264. mediaTime += segment.duration;
  108265. }
  108266. };
  108267. var MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC = 86400;
  108268. var syncPointStrategies = [
  108269. {
  108270. name: "VOD",
  108271. run: function run(syncController, playlist, duration5, currentTimeline, currentTime) {
  108272. if (duration5 !== Infinity) {
  108273. var syncPoint = {
  108274. time: 0,
  108275. segmentIndex: 0,
  108276. partIndex: null
  108277. };
  108278. return syncPoint;
  108279. }
  108280. return null;
  108281. }
  108282. },
  108283. {
  108284. name: "ProgramDateTime",
  108285. run: function run2(syncController, playlist, duration5, currentTimeline, currentTime) {
  108286. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  108287. return null;
  108288. }
  108289. var syncPoint = null;
  108290. var lastDistance = null;
  108291. var partsAndSegments = getPartsAndSegments(playlist);
  108292. currentTime = currentTime || 0;
  108293. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108294. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108295. var partAndSegment = partsAndSegments[index2];
  108296. var segment = partAndSegment.segment;
  108297. var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  108298. if (!datetimeMapping || !segment.dateTimeObject) {
  108299. continue;
  108300. }
  108301. var segmentTime = segment.dateTimeObject.getTime() / 1e3;
  108302. var start2 = segmentTime + datetimeMapping;
  108303. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  108304. for (var z = 0; z < partAndSegment.partIndex; z++) {
  108305. start2 += segment.parts[z].duration;
  108306. }
  108307. }
  108308. var distance2 = Math.abs(currentTime - start2);
  108309. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  108310. break;
  108311. }
  108312. lastDistance = distance2;
  108313. syncPoint = {
  108314. time: start2,
  108315. segmentIndex: partAndSegment.segmentIndex,
  108316. partIndex: partAndSegment.partIndex
  108317. };
  108318. }
  108319. return syncPoint;
  108320. }
  108321. },
  108322. {
  108323. name: "Segment",
  108324. run: function run3(syncController, playlist, duration5, currentTimeline, currentTime) {
  108325. var syncPoint = null;
  108326. var lastDistance = null;
  108327. currentTime = currentTime || 0;
  108328. var partsAndSegments = getPartsAndSegments(playlist);
  108329. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108330. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108331. var partAndSegment = partsAndSegments[index2];
  108332. var segment = partAndSegment.segment;
  108333. var start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  108334. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  108335. var distance2 = Math.abs(currentTime - start2);
  108336. if (lastDistance !== null && lastDistance < distance2) {
  108337. break;
  108338. }
  108339. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108340. lastDistance = distance2;
  108341. syncPoint = {
  108342. time: start2,
  108343. segmentIndex: partAndSegment.segmentIndex,
  108344. partIndex: partAndSegment.partIndex
  108345. };
  108346. }
  108347. }
  108348. }
  108349. return syncPoint;
  108350. }
  108351. },
  108352. {
  108353. name: "Discontinuity",
  108354. run: function run4(syncController, playlist, duration5, currentTimeline, currentTime) {
  108355. var syncPoint = null;
  108356. currentTime = currentTime || 0;
  108357. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108358. var lastDistance = null;
  108359. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108360. var segmentIndex = playlist.discontinuityStarts[i2];
  108361. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108362. var discontinuitySync = syncController.discontinuities[discontinuity];
  108363. if (discontinuitySync) {
  108364. var distance2 = Math.abs(currentTime - discontinuitySync.time);
  108365. if (lastDistance !== null && lastDistance < distance2) {
  108366. break;
  108367. }
  108368. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108369. lastDistance = distance2;
  108370. syncPoint = {
  108371. time: discontinuitySync.time,
  108372. segmentIndex,
  108373. partIndex: null
  108374. };
  108375. }
  108376. }
  108377. }
  108378. }
  108379. return syncPoint;
  108380. }
  108381. },
  108382. {
  108383. name: "Playlist",
  108384. run: function run5(syncController, playlist, duration5, currentTimeline, currentTime) {
  108385. if (playlist.syncInfo) {
  108386. var syncPoint = {
  108387. time: playlist.syncInfo.time,
  108388. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  108389. partIndex: null
  108390. };
  108391. return syncPoint;
  108392. }
  108393. return null;
  108394. }
  108395. }
  108396. ];
  108397. var SyncController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108398. _inheritsLoose(SyncController2, _videojs$EventTarget);
  108399. function SyncController2(options2) {
  108400. var _this;
  108401. _this = _videojs$EventTarget.call(this) || this;
  108402. _this.timelines = [];
  108403. _this.discontinuities = [];
  108404. _this.timelineToDatetimeMappings = {};
  108405. _this.logger_ = logger("SyncController");
  108406. return _this;
  108407. }
  108408. var _proto = SyncController2.prototype;
  108409. _proto.getSyncPoint = function getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  108410. var syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  108411. if (!syncPoints.length) {
  108412. return null;
  108413. }
  108414. return this.selectSyncPoint_(syncPoints, {
  108415. key: "time",
  108416. value: currentTime
  108417. });
  108418. };
  108419. _proto.getExpiredTime = function getExpiredTime(playlist, duration5) {
  108420. if (!playlist || !playlist.segments) {
  108421. return null;
  108422. }
  108423. var syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  108424. if (!syncPoints.length) {
  108425. return null;
  108426. }
  108427. var syncPoint = this.selectSyncPoint_(syncPoints, {
  108428. key: "segmentIndex",
  108429. value: 0
  108430. });
  108431. if (syncPoint.segmentIndex > 0) {
  108432. syncPoint.time *= -1;
  108433. }
  108434. return Math.abs(syncPoint.time + sumDurations({
  108435. defaultDuration: playlist.targetDuration,
  108436. durationList: playlist.segments,
  108437. startIndex: syncPoint.segmentIndex,
  108438. endIndex: 0
  108439. }));
  108440. };
  108441. _proto.runStrategies_ = function runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  108442. var syncPoints = [];
  108443. for (var i2 = 0; i2 < syncPointStrategies.length; i2++) {
  108444. var strategy = syncPointStrategies[i2];
  108445. var syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  108446. if (syncPoint) {
  108447. syncPoint.strategy = strategy.name;
  108448. syncPoints.push({
  108449. strategy: strategy.name,
  108450. syncPoint
  108451. });
  108452. }
  108453. }
  108454. return syncPoints;
  108455. };
  108456. _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) {
  108457. var bestSyncPoint = syncPoints[0].syncPoint;
  108458. var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  108459. var bestStrategy = syncPoints[0].strategy;
  108460. for (var i2 = 1; i2 < syncPoints.length; i2++) {
  108461. var newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  108462. if (newDistance < bestDistance) {
  108463. bestDistance = newDistance;
  108464. bestSyncPoint = syncPoints[i2].syncPoint;
  108465. bestStrategy = syncPoints[i2].strategy;
  108466. }
  108467. }
  108468. 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 : "") + "]");
  108469. return bestSyncPoint;
  108470. };
  108471. _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  108472. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  108473. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC) {
  108474. videojs.log.warn("Not saving expired segment info. Media sequence gap " + mediaSequenceDiff + " is too large.");
  108475. return;
  108476. }
  108477. for (var i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  108478. var lastRemovedSegment = oldPlaylist.segments[i2];
  108479. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  108480. newPlaylist.syncInfo = {
  108481. mediaSequence: oldPlaylist.mediaSequence + i2,
  108482. time: lastRemovedSegment.start
  108483. };
  108484. this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]"));
  108485. this.trigger("syncinfoupdate");
  108486. break;
  108487. }
  108488. }
  108489. };
  108490. _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) {
  108491. this.timelineToDatetimeMappings = {};
  108492. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  108493. var firstSegment = playlist.segments[0];
  108494. var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  108495. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  108496. }
  108497. };
  108498. _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) {
  108499. var segmentInfo = _ref.segmentInfo, shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping;
  108500. var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  108501. var segment = segmentInfo.segment;
  108502. if (didCalculateSegmentTimeMapping) {
  108503. this.saveDiscontinuitySyncInfo_(segmentInfo);
  108504. if (!segmentInfo.playlist.syncInfo) {
  108505. segmentInfo.playlist.syncInfo = {
  108506. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  108507. time: segment.start
  108508. };
  108509. }
  108510. }
  108511. var dateTime = segment.dateTimeObject;
  108512. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  108513. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  108514. }
  108515. };
  108516. _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) {
  108517. if (typeof this.timelines[timeline] === "undefined") {
  108518. return null;
  108519. }
  108520. return this.timelines[timeline].time;
  108521. };
  108522. _proto.mappingForTimeline = function mappingForTimeline(timeline) {
  108523. if (typeof this.timelines[timeline] === "undefined") {
  108524. return null;
  108525. }
  108526. return this.timelines[timeline].mapping;
  108527. };
  108528. _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  108529. var segment = segmentInfo.segment;
  108530. var part = segmentInfo.part;
  108531. var mappingObj = this.timelines[segmentInfo.timeline];
  108532. var start2;
  108533. var end;
  108534. if (typeof segmentInfo.timestampOffset === "number") {
  108535. mappingObj = {
  108536. time: segmentInfo.startOfSegment,
  108537. mapping: segmentInfo.startOfSegment - timingInfo.start
  108538. };
  108539. if (shouldSaveTimelineMapping) {
  108540. this.timelines[segmentInfo.timeline] = mappingObj;
  108541. this.trigger("timestampoffset");
  108542. this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]"));
  108543. }
  108544. start2 = segmentInfo.startOfSegment;
  108545. end = timingInfo.end + mappingObj.mapping;
  108546. } else if (mappingObj) {
  108547. start2 = timingInfo.start + mappingObj.mapping;
  108548. end = timingInfo.end + mappingObj.mapping;
  108549. } else {
  108550. return false;
  108551. }
  108552. if (part) {
  108553. part.start = start2;
  108554. part.end = end;
  108555. }
  108556. if (!segment.start || start2 < segment.start) {
  108557. segment.start = start2;
  108558. }
  108559. segment.end = end;
  108560. return true;
  108561. };
  108562. _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) {
  108563. var playlist = segmentInfo.playlist;
  108564. var segment = segmentInfo.segment;
  108565. if (segment.discontinuity) {
  108566. this.discontinuities[segment.timeline] = {
  108567. time: segment.start,
  108568. accuracy: 0
  108569. };
  108570. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108571. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108572. var segmentIndex = playlist.discontinuityStarts[i2];
  108573. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108574. var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  108575. var accuracy = Math.abs(mediaIndexDiff);
  108576. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  108577. var time = void 0;
  108578. if (mediaIndexDiff < 0) {
  108579. time = segment.start - sumDurations({
  108580. defaultDuration: playlist.targetDuration,
  108581. durationList: playlist.segments,
  108582. startIndex: segmentInfo.mediaIndex,
  108583. endIndex: segmentIndex
  108584. });
  108585. } else {
  108586. time = segment.end + sumDurations({
  108587. defaultDuration: playlist.targetDuration,
  108588. durationList: playlist.segments,
  108589. startIndex: segmentInfo.mediaIndex + 1,
  108590. endIndex: segmentIndex
  108591. });
  108592. }
  108593. this.discontinuities[discontinuity] = {
  108594. time,
  108595. accuracy
  108596. };
  108597. }
  108598. }
  108599. }
  108600. };
  108601. _proto.dispose = function dispose() {
  108602. this.trigger("dispose");
  108603. this.off();
  108604. };
  108605. return SyncController2;
  108606. }(videojs.EventTarget);
  108607. var TimelineChangeController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108608. _inheritsLoose(TimelineChangeController2, _videojs$EventTarget);
  108609. function TimelineChangeController2() {
  108610. var _this;
  108611. _this = _videojs$EventTarget.call(this) || this;
  108612. _this.pendingTimelineChanges_ = {};
  108613. _this.lastTimelineChanges_ = {};
  108614. return _this;
  108615. }
  108616. var _proto = TimelineChangeController2.prototype;
  108617. _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type2) {
  108618. this.pendingTimelineChanges_[type2] = null;
  108619. this.trigger("pendingtimelinechange");
  108620. };
  108621. _proto.pendingTimelineChange = function pendingTimelineChange(_ref) {
  108622. var type2 = _ref.type, from3 = _ref.from, to = _ref.to;
  108623. if (typeof from3 === "number" && typeof to === "number") {
  108624. this.pendingTimelineChanges_[type2] = {
  108625. type: type2,
  108626. from: from3,
  108627. to
  108628. };
  108629. this.trigger("pendingtimelinechange");
  108630. }
  108631. return this.pendingTimelineChanges_[type2];
  108632. };
  108633. _proto.lastTimelineChange = function lastTimelineChange(_ref2) {
  108634. var type2 = _ref2.type, from3 = _ref2.from, to = _ref2.to;
  108635. if (typeof from3 === "number" && typeof to === "number") {
  108636. this.lastTimelineChanges_[type2] = {
  108637. type: type2,
  108638. from: from3,
  108639. to
  108640. };
  108641. delete this.pendingTimelineChanges_[type2];
  108642. this.trigger("timelinechange");
  108643. }
  108644. return this.lastTimelineChanges_[type2];
  108645. };
  108646. _proto.dispose = function dispose() {
  108647. this.trigger("dispose");
  108648. this.pendingTimelineChanges_ = {};
  108649. this.lastTimelineChanges_ = {};
  108650. this.off();
  108651. };
  108652. return TimelineChangeController2;
  108653. }(videojs.EventTarget);
  108654. var workerCode = transform(getWorkerString(function() {
  108655. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  108656. function createCommonjsModule(fn2, basedir, module2) {
  108657. return module2 = {
  108658. path: basedir,
  108659. exports: {},
  108660. require: function require2(path, base2) {
  108661. return commonjsRequire(path, base2 === void 0 || base2 === null ? module2.path : base2);
  108662. }
  108663. }, fn2(module2, module2.exports), module2.exports;
  108664. }
  108665. function commonjsRequire() {
  108666. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  108667. }
  108668. var createClass = createCommonjsModule(function(module2) {
  108669. function _defineProperties(target, props) {
  108670. for (var i2 = 0; i2 < props.length; i2++) {
  108671. var descriptor = props[i2];
  108672. descriptor.enumerable = descriptor.enumerable || false;
  108673. descriptor.configurable = true;
  108674. if ("value" in descriptor)
  108675. descriptor.writable = true;
  108676. Object.defineProperty(target, descriptor.key, descriptor);
  108677. }
  108678. }
  108679. function _createClass(Constructor, protoProps, staticProps) {
  108680. if (protoProps)
  108681. _defineProperties(Constructor.prototype, protoProps);
  108682. if (staticProps)
  108683. _defineProperties(Constructor, staticProps);
  108684. return Constructor;
  108685. }
  108686. module2.exports = _createClass;
  108687. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108688. });
  108689. var setPrototypeOf = createCommonjsModule(function(module2) {
  108690. function _setPrototypeOf2(o, p) {
  108691. module2.exports = _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf3(o2, p2) {
  108692. o2.__proto__ = p2;
  108693. return o2;
  108694. };
  108695. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108696. return _setPrototypeOf2(o, p);
  108697. }
  108698. module2.exports = _setPrototypeOf2;
  108699. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108700. });
  108701. var inheritsLoose = createCommonjsModule(function(module2) {
  108702. function _inheritsLoose2(subClass, superClass) {
  108703. subClass.prototype = Object.create(superClass.prototype);
  108704. subClass.prototype.constructor = subClass;
  108705. setPrototypeOf(subClass, superClass);
  108706. }
  108707. module2.exports = _inheritsLoose2;
  108708. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108709. });
  108710. var Stream2 = /* @__PURE__ */ function() {
  108711. function Stream3() {
  108712. this.listeners = {};
  108713. }
  108714. var _proto = Stream3.prototype;
  108715. _proto.on = function on3(type2, listener) {
  108716. if (!this.listeners[type2]) {
  108717. this.listeners[type2] = [];
  108718. }
  108719. this.listeners[type2].push(listener);
  108720. };
  108721. _proto.off = function off2(type2, listener) {
  108722. if (!this.listeners[type2]) {
  108723. return false;
  108724. }
  108725. var index2 = this.listeners[type2].indexOf(listener);
  108726. this.listeners[type2] = this.listeners[type2].slice(0);
  108727. this.listeners[type2].splice(index2, 1);
  108728. return index2 > -1;
  108729. };
  108730. _proto.trigger = function trigger2(type2) {
  108731. var callbacks = this.listeners[type2];
  108732. if (!callbacks) {
  108733. return;
  108734. }
  108735. if (arguments.length === 2) {
  108736. var length = callbacks.length;
  108737. for (var i2 = 0; i2 < length; ++i2) {
  108738. callbacks[i2].call(this, arguments[1]);
  108739. }
  108740. } else {
  108741. var args = Array.prototype.slice.call(arguments, 1);
  108742. var _length = callbacks.length;
  108743. for (var _i = 0; _i < _length; ++_i) {
  108744. callbacks[_i].apply(this, args);
  108745. }
  108746. }
  108747. };
  108748. _proto.dispose = function dispose() {
  108749. this.listeners = {};
  108750. };
  108751. _proto.pipe = function pipe(destination2) {
  108752. this.on("data", function(data) {
  108753. destination2.push(data);
  108754. });
  108755. };
  108756. return Stream3;
  108757. }();
  108758. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  108759. function unpad(padded) {
  108760. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  108761. }
  108762. /*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
  108763. var precompute = function precompute2() {
  108764. var tables = [[[], [], [], [], []], [[], [], [], [], []]];
  108765. var encTable = tables[0];
  108766. var decTable = tables[1];
  108767. var sbox = encTable[4];
  108768. var sboxInv = decTable[4];
  108769. var i2;
  108770. var x;
  108771. var xInv;
  108772. var d2 = [];
  108773. var th = [];
  108774. var x2;
  108775. var x4;
  108776. var x8;
  108777. var s;
  108778. var tEnc;
  108779. var tDec;
  108780. for (i2 = 0; i2 < 256; i2++) {
  108781. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  108782. }
  108783. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  108784. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  108785. s = s >> 8 ^ s & 255 ^ 99;
  108786. sbox[x] = s;
  108787. sboxInv[s] = x;
  108788. x8 = d2[x4 = d2[x2 = d2[x]]];
  108789. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  108790. tEnc = d2[s] * 257 ^ s * 16843008;
  108791. for (i2 = 0; i2 < 4; i2++) {
  108792. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  108793. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  108794. }
  108795. }
  108796. for (i2 = 0; i2 < 5; i2++) {
  108797. encTable[i2] = encTable[i2].slice(0);
  108798. decTable[i2] = decTable[i2].slice(0);
  108799. }
  108800. return tables;
  108801. };
  108802. var aesTables = null;
  108803. var AES = /* @__PURE__ */ function() {
  108804. function AES2(key) {
  108805. if (!aesTables) {
  108806. aesTables = precompute();
  108807. }
  108808. 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()]];
  108809. var i2;
  108810. var j;
  108811. var tmp;
  108812. var sbox = this._tables[0][4];
  108813. var decTable = this._tables[1];
  108814. var keyLen = key.length;
  108815. var rcon = 1;
  108816. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  108817. throw new Error("Invalid aes key size");
  108818. }
  108819. var encKey = key.slice(0);
  108820. var decKey = [];
  108821. this._key = [encKey, decKey];
  108822. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  108823. tmp = encKey[i2 - 1];
  108824. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  108825. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  108826. if (i2 % keyLen === 0) {
  108827. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  108828. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  108829. }
  108830. }
  108831. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  108832. }
  108833. for (j = 0; i2; j++, i2--) {
  108834. tmp = encKey[j & 3 ? i2 : i2 - 4];
  108835. if (i2 <= 4 || j < 4) {
  108836. decKey[j] = tmp;
  108837. } else {
  108838. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  108839. }
  108840. }
  108841. }
  108842. var _proto = AES2.prototype;
  108843. _proto.decrypt = function decrypt4(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  108844. var key = this._key[1];
  108845. var a = encrypted0 ^ key[0];
  108846. var b = encrypted3 ^ key[1];
  108847. var c = encrypted2 ^ key[2];
  108848. var d2 = encrypted1 ^ key[3];
  108849. var a2;
  108850. var b2;
  108851. var c2;
  108852. var nInnerRounds = key.length / 4 - 2;
  108853. var i2;
  108854. var kIndex = 4;
  108855. var table = this._tables[1];
  108856. var table0 = table[0];
  108857. var table1 = table[1];
  108858. var table2 = table[2];
  108859. var table3 = table[3];
  108860. var sbox = table[4];
  108861. for (i2 = 0; i2 < nInnerRounds; i2++) {
  108862. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  108863. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  108864. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  108865. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  108866. kIndex += 4;
  108867. a = a2;
  108868. b = b2;
  108869. c = c2;
  108870. }
  108871. for (i2 = 0; i2 < 4; i2++) {
  108872. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  108873. a2 = a;
  108874. a = b;
  108875. b = c;
  108876. c = d2;
  108877. d2 = a2;
  108878. }
  108879. };
  108880. return AES2;
  108881. }();
  108882. var AsyncStream = /* @__PURE__ */ function(_Stream) {
  108883. inheritsLoose(AsyncStream2, _Stream);
  108884. function AsyncStream2() {
  108885. var _this;
  108886. _this = _Stream.call(this, Stream2) || this;
  108887. _this.jobs = [];
  108888. _this.delay = 1;
  108889. _this.timeout_ = null;
  108890. return _this;
  108891. }
  108892. var _proto = AsyncStream2.prototype;
  108893. _proto.processJob_ = function processJob_() {
  108894. this.jobs.shift()();
  108895. if (this.jobs.length) {
  108896. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108897. } else {
  108898. this.timeout_ = null;
  108899. }
  108900. };
  108901. _proto.push = function push(job) {
  108902. this.jobs.push(job);
  108903. if (!this.timeout_) {
  108904. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108905. }
  108906. };
  108907. return AsyncStream2;
  108908. }(Stream2);
  108909. var ntoh = function ntoh2(word) {
  108910. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  108911. };
  108912. var decrypt3 = function decrypt4(encrypted, key, initVector) {
  108913. var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  108914. var decipher = new AES(Array.prototype.slice.call(key));
  108915. var decrypted = new Uint8Array(encrypted.byteLength);
  108916. var decrypted32 = new Int32Array(decrypted.buffer);
  108917. var init0;
  108918. var init1;
  108919. var init2;
  108920. var init3;
  108921. var encrypted0;
  108922. var encrypted1;
  108923. var encrypted2;
  108924. var encrypted3;
  108925. var wordIx;
  108926. init0 = initVector[0];
  108927. init1 = initVector[1];
  108928. init2 = initVector[2];
  108929. init3 = initVector[3];
  108930. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  108931. encrypted0 = ntoh(encrypted32[wordIx]);
  108932. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  108933. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  108934. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  108935. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  108936. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  108937. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  108938. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  108939. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  108940. init0 = encrypted0;
  108941. init1 = encrypted1;
  108942. init2 = encrypted2;
  108943. init3 = encrypted3;
  108944. }
  108945. return decrypted;
  108946. };
  108947. var Decrypter2 = /* @__PURE__ */ function() {
  108948. function Decrypter3(encrypted, key, initVector, done) {
  108949. var step = Decrypter3.STEP;
  108950. var encrypted32 = new Int32Array(encrypted.buffer);
  108951. var decrypted = new Uint8Array(encrypted.byteLength);
  108952. var i2 = 0;
  108953. this.asyncStream_ = new AsyncStream();
  108954. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108955. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  108956. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  108957. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108958. }
  108959. this.asyncStream_.push(function() {
  108960. done(null, unpad(decrypted));
  108961. });
  108962. }
  108963. var _proto = Decrypter3.prototype;
  108964. _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
  108965. return function() {
  108966. var bytes = decrypt3(encrypted, key, initVector);
  108967. decrypted.set(bytes, encrypted.byteOffset);
  108968. };
  108969. };
  108970. createClass(Decrypter3, null, [{
  108971. key: "STEP",
  108972. get: function get7() {
  108973. return 32e3;
  108974. }
  108975. }]);
  108976. return Decrypter3;
  108977. }();
  108978. var win2;
  108979. if (typeof window !== "undefined") {
  108980. win2 = window;
  108981. } else if (typeof commonjsGlobal2 !== "undefined") {
  108982. win2 = commonjsGlobal2;
  108983. } else if (typeof self !== "undefined") {
  108984. win2 = self;
  108985. } else {
  108986. win2 = {};
  108987. }
  108988. var window_12 = win2;
  108989. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  108990. if (ArrayBuffer.isView === "function") {
  108991. return ArrayBuffer.isView(obj);
  108992. }
  108993. return obj && obj.buffer instanceof ArrayBuffer;
  108994. };
  108995. var BigInt2 = window_12.BigInt || Number;
  108996. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  108997. var createTransferableMessage3 = function createTransferableMessage4(message) {
  108998. var transferable = {};
  108999. Object.keys(message).forEach(function(key) {
  109000. var value = message[key];
  109001. if (isArrayBufferView4(value)) {
  109002. transferable[key] = {
  109003. bytes: value.buffer,
  109004. byteOffset: value.byteOffset,
  109005. byteLength: value.byteLength
  109006. };
  109007. } else {
  109008. transferable[key] = value;
  109009. }
  109010. });
  109011. return transferable;
  109012. };
  109013. self.onmessage = function(event2) {
  109014. var data = event2.data;
  109015. var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  109016. var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  109017. var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  109018. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  109019. self.postMessage(createTransferableMessage3({
  109020. source: data.source,
  109021. decrypted: bytes
  109022. }), [bytes.buffer]);
  109023. });
  109024. };
  109025. }));
  109026. var Decrypter = factory(workerCode);
  109027. var audioTrackKind_ = function audioTrackKind_2(properties) {
  109028. var kind = properties["default"] ? "main" : "alternative";
  109029. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  109030. kind = "main-desc";
  109031. }
  109032. return kind;
  109033. };
  109034. var stopLoaders = function stopLoaders2(segmentLoader, mediaType) {
  109035. segmentLoader.abort();
  109036. segmentLoader.pause();
  109037. if (mediaType && mediaType.activePlaylistLoader) {
  109038. mediaType.activePlaylistLoader.pause();
  109039. mediaType.activePlaylistLoader = null;
  109040. }
  109041. };
  109042. var startLoaders = function startLoaders2(playlistLoader, mediaType) {
  109043. mediaType.activePlaylistLoader = playlistLoader;
  109044. playlistLoader.load();
  109045. };
  109046. var onGroupChanged = function onGroupChanged2(type2, settings) {
  109047. return function() {
  109048. var _settings$segmentLoad = settings.segmentLoaders, segmentLoader = _settings$segmentLoad[type2], mainSegmentLoader = _settings$segmentLoad.main, mediaType = settings.mediaTypes[type2];
  109049. var activeTrack2 = mediaType.activeTrack();
  109050. var activeGroup3 = mediaType.getActiveGroup();
  109051. var previousActiveLoader = mediaType.activePlaylistLoader;
  109052. var lastGroup = mediaType.lastGroup_;
  109053. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  109054. return;
  109055. }
  109056. mediaType.lastGroup_ = activeGroup3;
  109057. mediaType.lastTrack_ = activeTrack2;
  109058. stopLoaders(segmentLoader, mediaType);
  109059. if (!activeGroup3 || activeGroup3.isMasterPlaylist) {
  109060. return;
  109061. }
  109062. if (!activeGroup3.playlistLoader) {
  109063. if (previousActiveLoader) {
  109064. mainSegmentLoader.resetEverything();
  109065. }
  109066. return;
  109067. }
  109068. segmentLoader.resyncLoader();
  109069. startLoaders(activeGroup3.playlistLoader, mediaType);
  109070. };
  109071. };
  109072. var onGroupChanging = function onGroupChanging2(type2, settings) {
  109073. return function() {
  109074. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109075. mediaType.lastGroup_ = null;
  109076. segmentLoader.abort();
  109077. segmentLoader.pause();
  109078. };
  109079. };
  109080. var onTrackChanged = function onTrackChanged2(type2, settings) {
  109081. return function() {
  109082. var masterPlaylistLoader = settings.masterPlaylistLoader, _settings$segmentLoad2 = settings.segmentLoaders, segmentLoader = _settings$segmentLoad2[type2], mainSegmentLoader = _settings$segmentLoad2.main, mediaType = settings.mediaTypes[type2];
  109083. var activeTrack2 = mediaType.activeTrack();
  109084. var activeGroup3 = mediaType.getActiveGroup();
  109085. var previousActiveLoader = mediaType.activePlaylistLoader;
  109086. var lastTrack = mediaType.lastTrack_;
  109087. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  109088. return;
  109089. }
  109090. mediaType.lastGroup_ = activeGroup3;
  109091. mediaType.lastTrack_ = activeTrack2;
  109092. stopLoaders(segmentLoader, mediaType);
  109093. if (!activeGroup3) {
  109094. return;
  109095. }
  109096. if (activeGroup3.isMasterPlaylist) {
  109097. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  109098. return;
  109099. }
  109100. var mpc = settings.vhs.masterPlaylistController_;
  109101. var newPlaylist = mpc.selectPlaylist();
  109102. if (mpc.media() === newPlaylist) {
  109103. return;
  109104. }
  109105. mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack2.id);
  109106. masterPlaylistLoader.pause();
  109107. mainSegmentLoader.resetEverything();
  109108. mpc.fastQualityChange_(newPlaylist);
  109109. return;
  109110. }
  109111. if (type2 === "AUDIO") {
  109112. if (!activeGroup3.playlistLoader) {
  109113. mainSegmentLoader.setAudio(true);
  109114. mainSegmentLoader.resetEverything();
  109115. return;
  109116. }
  109117. segmentLoader.setAudio(true);
  109118. mainSegmentLoader.setAudio(false);
  109119. }
  109120. if (previousActiveLoader === activeGroup3.playlistLoader) {
  109121. startLoaders(activeGroup3.playlistLoader, mediaType);
  109122. return;
  109123. }
  109124. if (segmentLoader.track) {
  109125. segmentLoader.track(activeTrack2);
  109126. }
  109127. segmentLoader.resetEverything();
  109128. startLoaders(activeGroup3.playlistLoader, mediaType);
  109129. };
  109130. };
  109131. var onError = {
  109132. AUDIO: function AUDIO(type2, settings) {
  109133. return function() {
  109134. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2], blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist;
  109135. stopLoaders(segmentLoader, mediaType);
  109136. var activeTrack2 = mediaType.activeTrack();
  109137. var activeGroup3 = mediaType.activeGroup();
  109138. var id = (activeGroup3.filter(function(group) {
  109139. return group["default"];
  109140. })[0] || activeGroup3[0]).id;
  109141. var defaultTrack = mediaType.tracks[id];
  109142. if (activeTrack2 === defaultTrack) {
  109143. blacklistCurrentPlaylist({
  109144. message: "Problem encountered loading the default audio track."
  109145. });
  109146. return;
  109147. }
  109148. videojs.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  109149. for (var trackId in mediaType.tracks) {
  109150. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  109151. }
  109152. mediaType.onTrackChanged();
  109153. };
  109154. },
  109155. SUBTITLES: function SUBTITLES(type2, settings) {
  109156. return function() {
  109157. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109158. videojs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  109159. stopLoaders(segmentLoader, mediaType);
  109160. var track = mediaType.activeTrack();
  109161. if (track) {
  109162. track.mode = "disabled";
  109163. }
  109164. mediaType.onTrackChanged();
  109165. };
  109166. }
  109167. };
  109168. var setupListeners = {
  109169. AUDIO: function AUDIO2(type2, playlistLoader, settings) {
  109170. if (!playlistLoader) {
  109171. return;
  109172. }
  109173. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2];
  109174. playlistLoader.on("loadedmetadata", function() {
  109175. var media = playlistLoader.media();
  109176. segmentLoader.playlist(media, requestOptions);
  109177. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109178. segmentLoader.load();
  109179. }
  109180. });
  109181. playlistLoader.on("loadedplaylist", function() {
  109182. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109183. if (!tech.paused()) {
  109184. segmentLoader.load();
  109185. }
  109186. });
  109187. playlistLoader.on("error", onError[type2](type2, settings));
  109188. },
  109189. SUBTITLES: function SUBTITLES2(type2, playlistLoader, settings) {
  109190. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109191. playlistLoader.on("loadedmetadata", function() {
  109192. var media = playlistLoader.media();
  109193. segmentLoader.playlist(media, requestOptions);
  109194. segmentLoader.track(mediaType.activeTrack());
  109195. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109196. segmentLoader.load();
  109197. }
  109198. });
  109199. playlistLoader.on("loadedplaylist", function() {
  109200. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109201. if (!tech.paused()) {
  109202. segmentLoader.load();
  109203. }
  109204. });
  109205. playlistLoader.on("error", onError[type2](type2, settings));
  109206. }
  109207. };
  109208. var initialize = {
  109209. "AUDIO": function AUDIO3(type2, settings) {
  109210. 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;
  109211. var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master);
  109212. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  109213. mediaGroups[type2] = {
  109214. main: {
  109215. "default": {
  109216. "default": true
  109217. }
  109218. }
  109219. };
  109220. if (audioOnlyMaster) {
  109221. mediaGroups[type2].main["default"].playlists = masterPlaylistLoader.master.playlists;
  109222. }
  109223. }
  109224. for (var groupId in mediaGroups[type2]) {
  109225. if (!groups[groupId]) {
  109226. groups[groupId] = [];
  109227. }
  109228. for (var variantLabel in mediaGroups[type2][groupId]) {
  109229. var properties = mediaGroups[type2][groupId][variantLabel];
  109230. var playlistLoader = void 0;
  109231. if (audioOnlyMaster) {
  109232. logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist");
  109233. properties.isMasterPlaylist = true;
  109234. playlistLoader = null;
  109235. } else if (sourceType === "vhs-json" && properties.playlists) {
  109236. playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions);
  109237. } else if (properties.resolvedUri) {
  109238. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109239. } else if (properties.playlists && sourceType === "dash") {
  109240. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109241. } else {
  109242. playlistLoader = null;
  109243. }
  109244. properties = videojs.mergeOptions({
  109245. id: variantLabel,
  109246. playlistLoader
  109247. }, properties);
  109248. setupListeners[type2](type2, properties.playlistLoader, settings);
  109249. groups[groupId].push(properties);
  109250. if (typeof tracks[variantLabel] === "undefined") {
  109251. var track = new videojs.AudioTrack({
  109252. id: variantLabel,
  109253. kind: audioTrackKind_(properties),
  109254. enabled: false,
  109255. language: properties.language,
  109256. "default": properties["default"],
  109257. label: variantLabel
  109258. });
  109259. tracks[variantLabel] = track;
  109260. }
  109261. }
  109262. }
  109263. segmentLoader.on("error", onError[type2](type2, settings));
  109264. },
  109265. "SUBTITLES": function SUBTITLES3(type2, settings) {
  109266. 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;
  109267. for (var groupId in mediaGroups[type2]) {
  109268. if (!groups[groupId]) {
  109269. groups[groupId] = [];
  109270. }
  109271. for (var variantLabel in mediaGroups[type2][groupId]) {
  109272. if (mediaGroups[type2][groupId][variantLabel].forced) {
  109273. continue;
  109274. }
  109275. var properties = mediaGroups[type2][groupId][variantLabel];
  109276. var playlistLoader = void 0;
  109277. if (sourceType === "hls") {
  109278. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109279. } else if (sourceType === "dash") {
  109280. var playlists = properties.playlists.filter(function(p) {
  109281. return p.excludeUntil !== Infinity;
  109282. });
  109283. if (!playlists.length) {
  109284. return;
  109285. }
  109286. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109287. } else if (sourceType === "vhs-json") {
  109288. playlistLoader = new PlaylistLoader(
  109289. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  109290. vhs,
  109291. requestOptions
  109292. );
  109293. }
  109294. properties = videojs.mergeOptions({
  109295. id: variantLabel,
  109296. playlistLoader
  109297. }, properties);
  109298. setupListeners[type2](type2, properties.playlistLoader, settings);
  109299. groups[groupId].push(properties);
  109300. if (typeof tracks[variantLabel] === "undefined") {
  109301. var track = tech.addRemoteTextTrack({
  109302. id: variantLabel,
  109303. kind: "subtitles",
  109304. "default": properties["default"] && properties.autoselect,
  109305. language: properties.language,
  109306. label: variantLabel
  109307. }, false).track;
  109308. tracks[variantLabel] = track;
  109309. }
  109310. }
  109311. }
  109312. segmentLoader.on("error", onError[type2](type2, settings));
  109313. },
  109314. "CLOSED-CAPTIONS": function CLOSEDCAPTIONS(type2, settings) {
  109315. var tech = settings.tech, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$3 = settings.mediaTypes[type2], groups = _settings$mediaTypes$3.groups, tracks = _settings$mediaTypes$3.tracks;
  109316. for (var groupId in mediaGroups[type2]) {
  109317. if (!groups[groupId]) {
  109318. groups[groupId] = [];
  109319. }
  109320. for (var variantLabel in mediaGroups[type2][groupId]) {
  109321. var properties = mediaGroups[type2][groupId][variantLabel];
  109322. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  109323. continue;
  109324. }
  109325. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  109326. var newProps = {
  109327. label: variantLabel,
  109328. language: properties.language,
  109329. instreamId: properties.instreamId,
  109330. "default": properties["default"] && properties.autoselect
  109331. };
  109332. if (captionServices[newProps.instreamId]) {
  109333. newProps = videojs.mergeOptions(newProps, captionServices[newProps.instreamId]);
  109334. }
  109335. if (newProps["default"] === void 0) {
  109336. delete newProps["default"];
  109337. }
  109338. groups[groupId].push(videojs.mergeOptions({
  109339. id: variantLabel
  109340. }, properties));
  109341. if (typeof tracks[variantLabel] === "undefined") {
  109342. var track = tech.addRemoteTextTrack({
  109343. id: newProps.instreamId,
  109344. kind: "captions",
  109345. "default": newProps["default"],
  109346. language: newProps.language,
  109347. label: newProps.label
  109348. }, false).track;
  109349. tracks[variantLabel] = track;
  109350. }
  109351. }
  109352. }
  109353. }
  109354. };
  109355. var groupMatch = function groupMatch2(list, media) {
  109356. for (var i2 = 0; i2 < list.length; i2++) {
  109357. if (playlistMatch(media, list[i2])) {
  109358. return true;
  109359. }
  109360. if (list[i2].playlists && groupMatch2(list[i2].playlists, media)) {
  109361. return true;
  109362. }
  109363. }
  109364. return false;
  109365. };
  109366. var activeGroup = function activeGroup2(type2, settings) {
  109367. return function(track) {
  109368. var masterPlaylistLoader = settings.masterPlaylistLoader, groups = settings.mediaTypes[type2].groups;
  109369. var media = masterPlaylistLoader.media();
  109370. if (!media) {
  109371. return null;
  109372. }
  109373. var variants = null;
  109374. if (media.attributes[type2]) {
  109375. variants = groups[media.attributes[type2]];
  109376. }
  109377. var groupKeys = Object.keys(groups);
  109378. if (!variants) {
  109379. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly(settings.master)) {
  109380. for (var i2 = 0; i2 < groupKeys.length; i2++) {
  109381. var groupPropertyList = groups[groupKeys[i2]];
  109382. if (groupMatch(groupPropertyList, media)) {
  109383. variants = groupPropertyList;
  109384. break;
  109385. }
  109386. }
  109387. } else if (groups.main) {
  109388. variants = groups.main;
  109389. } else if (groupKeys.length === 1) {
  109390. variants = groups[groupKeys[0]];
  109391. }
  109392. }
  109393. if (typeof track === "undefined") {
  109394. return variants;
  109395. }
  109396. if (track === null || !variants) {
  109397. return null;
  109398. }
  109399. return variants.filter(function(props) {
  109400. return props.id === track.id;
  109401. })[0] || null;
  109402. };
  109403. };
  109404. var activeTrack = {
  109405. AUDIO: function AUDIO4(type2, settings) {
  109406. return function() {
  109407. var tracks = settings.mediaTypes[type2].tracks;
  109408. for (var id in tracks) {
  109409. if (tracks[id].enabled) {
  109410. return tracks[id];
  109411. }
  109412. }
  109413. return null;
  109414. };
  109415. },
  109416. SUBTITLES: function SUBTITLES4(type2, settings) {
  109417. return function() {
  109418. var tracks = settings.mediaTypes[type2].tracks;
  109419. for (var id in tracks) {
  109420. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  109421. return tracks[id];
  109422. }
  109423. }
  109424. return null;
  109425. };
  109426. }
  109427. };
  109428. var getActiveGroup = function getActiveGroup2(type2, _ref) {
  109429. var mediaTypes2 = _ref.mediaTypes;
  109430. return function() {
  109431. var activeTrack_ = mediaTypes2[type2].activeTrack();
  109432. if (!activeTrack_) {
  109433. return null;
  109434. }
  109435. return mediaTypes2[type2].activeGroup(activeTrack_);
  109436. };
  109437. };
  109438. var setupMediaGroups = function setupMediaGroups2(settings) {
  109439. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109440. initialize[type2](type2, settings);
  109441. });
  109442. 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;
  109443. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109444. mediaTypes2[type2].activeGroup = activeGroup(type2, settings);
  109445. mediaTypes2[type2].activeTrack = activeTrack[type2](type2, settings);
  109446. mediaTypes2[type2].onGroupChanged = onGroupChanged(type2, settings);
  109447. mediaTypes2[type2].onGroupChanging = onGroupChanging(type2, settings);
  109448. mediaTypes2[type2].onTrackChanged = onTrackChanged(type2, settings);
  109449. mediaTypes2[type2].getActiveGroup = getActiveGroup(type2, settings);
  109450. });
  109451. var audioGroup = mediaTypes2.AUDIO.activeGroup();
  109452. if (audioGroup) {
  109453. var groupId = (audioGroup.filter(function(group) {
  109454. return group["default"];
  109455. })[0] || audioGroup[0]).id;
  109456. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  109457. mediaTypes2.AUDIO.onGroupChanged();
  109458. mediaTypes2.AUDIO.onTrackChanged();
  109459. var activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  109460. if (!activeAudioGroup.playlistLoader) {
  109461. mainSegmentLoader.setAudio(true);
  109462. } else {
  109463. mainSegmentLoader.setAudio(false);
  109464. audioSegmentLoader.setAudio(true);
  109465. }
  109466. }
  109467. masterPlaylistLoader.on("mediachange", function() {
  109468. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109469. return mediaTypes2[type2].onGroupChanged();
  109470. });
  109471. });
  109472. masterPlaylistLoader.on("mediachanging", function() {
  109473. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109474. return mediaTypes2[type2].onGroupChanging();
  109475. });
  109476. });
  109477. var onAudioTrackChanged = function onAudioTrackChanged2() {
  109478. mediaTypes2.AUDIO.onTrackChanged();
  109479. tech.trigger({
  109480. type: "usage",
  109481. name: "vhs-audio-change"
  109482. });
  109483. tech.trigger({
  109484. type: "usage",
  109485. name: "hls-audio-change"
  109486. });
  109487. };
  109488. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  109489. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109490. vhs.on("dispose", function() {
  109491. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  109492. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109493. });
  109494. tech.clearTracks("audio");
  109495. for (var id in mediaTypes2.AUDIO.tracks) {
  109496. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  109497. }
  109498. };
  109499. var createMediaTypes = function createMediaTypes2() {
  109500. var mediaTypes2 = {};
  109501. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109502. mediaTypes2[type2] = {
  109503. groups: {},
  109504. tracks: {},
  109505. activePlaylistLoader: null,
  109506. activeGroup: noop,
  109507. activeTrack: noop,
  109508. getActiveGroup: noop,
  109509. onGroupChanged: noop,
  109510. onTrackChanged: noop,
  109511. lastTrack_: null,
  109512. logger_: logger("MediaGroups[" + type2 + "]")
  109513. };
  109514. });
  109515. return mediaTypes2;
  109516. };
  109517. var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2;
  109518. var Vhs$1;
  109519. var loaderStats = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  109520. var sumLoaderStat = function sumLoaderStat2(stat) {
  109521. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  109522. };
  109523. var shouldSwitchToMedia = function shouldSwitchToMedia2(_ref) {
  109524. 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;
  109525. if (!nextPlaylist) {
  109526. videojs.log.warn("We received no playlist to switch to. Please check your stream.");
  109527. return false;
  109528. }
  109529. var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || "null") + " -> " + nextPlaylist.id;
  109530. if (!currentPlaylist) {
  109531. log2(sharedLogLine + " as current playlist is not set");
  109532. return true;
  109533. }
  109534. if (nextPlaylist.id === currentPlaylist.id) {
  109535. return false;
  109536. }
  109537. var isBuffered = Boolean(findRange(buffered, currentTime).length);
  109538. if (!currentPlaylist.endList) {
  109539. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  109540. log2("not " + sharedLogLine + " as current playlist is live llhls, but currentTime isn't in buffered.");
  109541. return false;
  109542. }
  109543. log2(sharedLogLine + " as current playlist is live");
  109544. return true;
  109545. }
  109546. var forwardBuffer = timeAheadOf(buffered, currentTime);
  109547. var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE;
  109548. if (duration5 < maxBufferLowWaterLine) {
  109549. log2(sharedLogLine + " as duration < max low water line (" + duration5 + " < " + maxBufferLowWaterLine + ")");
  109550. return true;
  109551. }
  109552. var nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  109553. var currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  109554. if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  109555. var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")";
  109556. if (experimentalBufferBasedABR) {
  109557. logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")";
  109558. }
  109559. log2(logLine);
  109560. return true;
  109561. }
  109562. if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  109563. var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")";
  109564. if (experimentalBufferBasedABR) {
  109565. _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")";
  109566. }
  109567. log2(_logLine);
  109568. return true;
  109569. }
  109570. log2("not " + sharedLogLine + " as no switching criteria met");
  109571. return false;
  109572. };
  109573. var MasterPlaylistController = /* @__PURE__ */ function(_videojs$EventTarget) {
  109574. _inheritsLoose(MasterPlaylistController2, _videojs$EventTarget);
  109575. function MasterPlaylistController2(options2) {
  109576. var _this;
  109577. _this = _videojs$EventTarget.call(this) || this;
  109578. 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;
  109579. if (!src) {
  109580. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  109581. }
  109582. var maxPlaylistRetries = options2.maxPlaylistRetries;
  109583. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  109584. maxPlaylistRetries = Infinity;
  109585. }
  109586. Vhs$1 = externVhs;
  109587. _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR);
  109588. _this.experimentalLeastPixelDiffSelector = Boolean(experimentalLeastPixelDiffSelector);
  109589. _this.withCredentials = withCredentials;
  109590. _this.tech_ = tech;
  109591. _this.vhs_ = tech.vhs;
  109592. _this.sourceType_ = sourceType;
  109593. _this.useCueTags_ = useCueTags;
  109594. _this.blacklistDuration = blacklistDuration;
  109595. _this.maxPlaylistRetries = maxPlaylistRetries;
  109596. _this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  109597. if (_this.useCueTags_) {
  109598. _this.cueTagsTrack_ = _this.tech_.addTextTrack("metadata", "ad-cues");
  109599. _this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  109600. }
  109601. _this.requestOptions_ = {
  109602. withCredentials,
  109603. handleManifestRedirects,
  109604. maxPlaylistRetries,
  109605. timeout: null
  109606. };
  109607. _this.on("error", _this.pauseLoading);
  109608. _this.mediaTypes_ = createMediaTypes();
  109609. _this.mediaSource = new window_1.MediaSource();
  109610. _this.handleDurationChange_ = _this.handleDurationChange_.bind(_assertThisInitialized(_this));
  109611. _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(_assertThisInitialized(_this));
  109612. _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(_assertThisInitialized(_this));
  109613. _this.mediaSource.addEventListener("durationchange", _this.handleDurationChange_);
  109614. _this.mediaSource.addEventListener("sourceopen", _this.handleSourceOpen_);
  109615. _this.mediaSource.addEventListener("sourceended", _this.handleSourceEnded_);
  109616. _this.seekable_ = videojs.createTimeRanges();
  109617. _this.hasPlayed_ = false;
  109618. _this.syncController_ = new SyncController(options2);
  109619. _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  109620. kind: "metadata",
  109621. label: "segment-metadata"
  109622. }, false).track;
  109623. _this.decrypter_ = new Decrypter();
  109624. _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource);
  109625. _this.inbandTextTracks_ = {};
  109626. _this.timelineChangeController_ = new TimelineChangeController();
  109627. var segmentLoaderSettings = {
  109628. vhs: _this.vhs_,
  109629. parse708captions: options2.parse708captions,
  109630. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  109631. captionServices,
  109632. mediaSource: _this.mediaSource,
  109633. currentTime: _this.tech_.currentTime.bind(_this.tech_),
  109634. seekable: function seekable3() {
  109635. return _this.seekable();
  109636. },
  109637. seeking: function seeking() {
  109638. return _this.tech_.seeking();
  109639. },
  109640. duration: function duration5() {
  109641. return _this.duration();
  109642. },
  109643. hasPlayed: function hasPlayed() {
  109644. return _this.hasPlayed_;
  109645. },
  109646. goalBufferLength: function goalBufferLength() {
  109647. return _this.goalBufferLength();
  109648. },
  109649. bandwidth: bandwidth2,
  109650. syncController: _this.syncController_,
  109651. decrypter: _this.decrypter_,
  109652. sourceType: _this.sourceType_,
  109653. inbandTextTracks: _this.inbandTextTracks_,
  109654. cacheEncryptionKeys,
  109655. sourceUpdater: _this.sourceUpdater_,
  109656. timelineChangeController: _this.timelineChangeController_,
  109657. experimentalExactManifestTimings: options2.experimentalExactManifestTimings
  109658. };
  109659. _this.masterPlaylistLoader_ = _this.sourceType_ === "dash" ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_);
  109660. _this.setupMasterPlaylistLoaderListeners_();
  109661. _this.mainSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109662. segmentMetadataTrack: _this.segmentMetadataTrack_,
  109663. loaderType: "main"
  109664. }), options2);
  109665. _this.audioSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109666. loaderType: "audio"
  109667. }), options2);
  109668. _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109669. loaderType: "vtt",
  109670. featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks,
  109671. loadVttJs: function loadVttJs() {
  109672. return new Promise(function(resolve2, reject2) {
  109673. function onLoad() {
  109674. tech.off("vttjserror", onError2);
  109675. resolve2();
  109676. }
  109677. function onError2() {
  109678. tech.off("vttjsloaded", onLoad);
  109679. reject2();
  109680. }
  109681. tech.one("vttjsloaded", onLoad);
  109682. tech.one("vttjserror", onError2);
  109683. tech.addWebVttScript_();
  109684. });
  109685. }
  109686. }), options2);
  109687. _this.setupSegmentLoaderListeners_();
  109688. if (_this.experimentalBufferBasedABR) {
  109689. _this.masterPlaylistLoader_.one("loadedplaylist", function() {
  109690. return _this.startABRTimer_();
  109691. });
  109692. _this.tech_.on("pause", function() {
  109693. return _this.stopABRTimer_();
  109694. });
  109695. _this.tech_.on("play", function() {
  109696. return _this.startABRTimer_();
  109697. });
  109698. }
  109699. loaderStats.forEach(function(stat) {
  109700. _this[stat + "_"] = sumLoaderStat.bind(_assertThisInitialized(_this), stat);
  109701. });
  109702. _this.logger_ = logger("MPC");
  109703. _this.triggeredFmp4Usage = false;
  109704. if (_this.tech_.preload() === "none") {
  109705. _this.loadOnPlay_ = function() {
  109706. _this.loadOnPlay_ = null;
  109707. _this.masterPlaylistLoader_.load();
  109708. };
  109709. _this.tech_.one("play", _this.loadOnPlay_);
  109710. } else {
  109711. _this.masterPlaylistLoader_.load();
  109712. }
  109713. _this.timeToLoadedData__ = -1;
  109714. _this.mainAppendsToLoadedData__ = -1;
  109715. _this.audioAppendsToLoadedData__ = -1;
  109716. var event2 = _this.tech_.preload() === "none" ? "play" : "loadstart";
  109717. _this.tech_.one(event2, function() {
  109718. var timeToLoadedDataStart = Date.now();
  109719. _this.tech_.one("loadeddata", function() {
  109720. _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  109721. _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends;
  109722. _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends;
  109723. });
  109724. });
  109725. return _this;
  109726. }
  109727. var _proto = MasterPlaylistController2.prototype;
  109728. _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() {
  109729. return this.mainAppendsToLoadedData__;
  109730. };
  109731. _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() {
  109732. return this.audioAppendsToLoadedData__;
  109733. };
  109734. _proto.appendsToLoadedData_ = function appendsToLoadedData_() {
  109735. var main = this.mainAppendsToLoadedData_();
  109736. var audio = this.audioAppendsToLoadedData_();
  109737. if (main === -1 || audio === -1) {
  109738. return -1;
  109739. }
  109740. return main + audio;
  109741. };
  109742. _proto.timeToLoadedData_ = function timeToLoadedData_() {
  109743. return this.timeToLoadedData__;
  109744. };
  109745. _proto.checkABR_ = function checkABR_(reason) {
  109746. if (reason === void 0) {
  109747. reason = "abr";
  109748. }
  109749. var nextPlaylist = this.selectPlaylist();
  109750. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  109751. this.switchMedia_(nextPlaylist, reason);
  109752. }
  109753. };
  109754. _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) {
  109755. var oldMedia = this.media();
  109756. var oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  109757. var newId = playlist.id || playlist.uri;
  109758. if (oldId && oldId !== newId) {
  109759. this.logger_("switch media " + oldId + " -> " + newId + " from " + cause);
  109760. this.tech_.trigger({
  109761. type: "usage",
  109762. name: "vhs-rendition-change-" + cause
  109763. });
  109764. }
  109765. this.masterPlaylistLoader_.media(playlist, delay);
  109766. };
  109767. _proto.startABRTimer_ = function startABRTimer_() {
  109768. var _this2 = this;
  109769. this.stopABRTimer_();
  109770. this.abrTimer_ = window_1.setInterval(function() {
  109771. return _this2.checkABR_();
  109772. }, 250);
  109773. };
  109774. _proto.stopABRTimer_ = function stopABRTimer_() {
  109775. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  109776. return;
  109777. }
  109778. window_1.clearInterval(this.abrTimer_);
  109779. this.abrTimer_ = null;
  109780. };
  109781. _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() {
  109782. var master = this.master();
  109783. var defaultPlaylists = master && master.playlists || [];
  109784. if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) {
  109785. return defaultPlaylists;
  109786. }
  109787. var AUDIO5 = master.mediaGroups.AUDIO;
  109788. var groupKeys = Object.keys(AUDIO5);
  109789. var track;
  109790. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  109791. track = this.mediaTypes_.AUDIO.activeTrack();
  109792. } else {
  109793. var defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  109794. for (var label2 in defaultGroup) {
  109795. if (defaultGroup[label2]["default"]) {
  109796. track = {
  109797. label: label2
  109798. };
  109799. break;
  109800. }
  109801. }
  109802. }
  109803. if (!track) {
  109804. return defaultPlaylists;
  109805. }
  109806. var playlists = [];
  109807. for (var group in AUDIO5) {
  109808. if (AUDIO5[group][track.label]) {
  109809. var properties = AUDIO5[group][track.label];
  109810. if (properties.playlists && properties.playlists.length) {
  109811. playlists.push.apply(playlists, properties.playlists);
  109812. } else if (properties.uri) {
  109813. playlists.push(properties);
  109814. } else if (master.playlists.length) {
  109815. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  109816. var playlist = master.playlists[i2];
  109817. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  109818. playlists.push(playlist);
  109819. }
  109820. }
  109821. }
  109822. }
  109823. }
  109824. if (!playlists.length) {
  109825. return defaultPlaylists;
  109826. }
  109827. return playlists;
  109828. };
  109829. _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() {
  109830. var _this3 = this;
  109831. this.masterPlaylistLoader_.on("loadedmetadata", function() {
  109832. var media = _this3.masterPlaylistLoader_.media();
  109833. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109834. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109835. _this3.requestOptions_.timeout = 0;
  109836. } else {
  109837. _this3.requestOptions_.timeout = requestTimeout;
  109838. }
  109839. if (media.endList && _this3.tech_.preload() !== "none") {
  109840. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109841. _this3.mainSegmentLoader_.load();
  109842. }
  109843. setupMediaGroups({
  109844. sourceType: _this3.sourceType_,
  109845. segmentLoaders: {
  109846. AUDIO: _this3.audioSegmentLoader_,
  109847. SUBTITLES: _this3.subtitleSegmentLoader_,
  109848. main: _this3.mainSegmentLoader_
  109849. },
  109850. tech: _this3.tech_,
  109851. requestOptions: _this3.requestOptions_,
  109852. masterPlaylistLoader: _this3.masterPlaylistLoader_,
  109853. vhs: _this3.vhs_,
  109854. master: _this3.master(),
  109855. mediaTypes: _this3.mediaTypes_,
  109856. blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3)
  109857. });
  109858. _this3.triggerPresenceUsage_(_this3.master(), media);
  109859. _this3.setupFirstPlay();
  109860. if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  109861. _this3.trigger("selectedinitialmedia");
  109862. } else {
  109863. _this3.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", function() {
  109864. _this3.trigger("selectedinitialmedia");
  109865. });
  109866. }
  109867. });
  109868. this.masterPlaylistLoader_.on("loadedplaylist", function() {
  109869. if (_this3.loadOnPlay_) {
  109870. _this3.tech_.off("play", _this3.loadOnPlay_);
  109871. }
  109872. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109873. if (!updatedPlaylist) {
  109874. _this3.excludeUnsupportedVariants_();
  109875. var selectedMedia;
  109876. if (_this3.enableLowInitialPlaylist) {
  109877. selectedMedia = _this3.selectInitialPlaylist();
  109878. }
  109879. if (!selectedMedia) {
  109880. selectedMedia = _this3.selectPlaylist();
  109881. }
  109882. if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) {
  109883. return;
  109884. }
  109885. _this3.initialMedia_ = selectedMedia;
  109886. _this3.switchMedia_(_this3.initialMedia_, "initial");
  109887. var haveJsonSource = _this3.sourceType_ === "vhs-json" && _this3.initialMedia_.segments;
  109888. if (!haveJsonSource) {
  109889. return;
  109890. }
  109891. updatedPlaylist = _this3.initialMedia_;
  109892. }
  109893. _this3.handleUpdatedMediaPlaylist(updatedPlaylist);
  109894. });
  109895. this.masterPlaylistLoader_.on("error", function() {
  109896. _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error);
  109897. });
  109898. this.masterPlaylistLoader_.on("mediachanging", function() {
  109899. _this3.mainSegmentLoader_.abort();
  109900. _this3.mainSegmentLoader_.pause();
  109901. });
  109902. this.masterPlaylistLoader_.on("mediachange", function() {
  109903. var media = _this3.masterPlaylistLoader_.media();
  109904. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109905. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109906. _this3.requestOptions_.timeout = 0;
  109907. } else {
  109908. _this3.requestOptions_.timeout = requestTimeout;
  109909. }
  109910. _this3.masterPlaylistLoader_.load();
  109911. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109912. _this3.mainSegmentLoader_.load();
  109913. _this3.tech_.trigger({
  109914. type: "mediachange",
  109915. bubbles: true
  109916. });
  109917. });
  109918. this.masterPlaylistLoader_.on("playlistunchanged", function() {
  109919. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109920. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  109921. return;
  109922. }
  109923. var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist);
  109924. if (playlistOutdated) {
  109925. _this3.blacklistCurrentPlaylist({
  109926. message: "Playlist no longer updating.",
  109927. reason: "playlist-unchanged"
  109928. });
  109929. _this3.tech_.trigger("playliststuck");
  109930. }
  109931. });
  109932. this.masterPlaylistLoader_.on("renditiondisabled", function() {
  109933. _this3.tech_.trigger({
  109934. type: "usage",
  109935. name: "vhs-rendition-disabled"
  109936. });
  109937. _this3.tech_.trigger({
  109938. type: "usage",
  109939. name: "hls-rendition-disabled"
  109940. });
  109941. });
  109942. this.masterPlaylistLoader_.on("renditionenabled", function() {
  109943. _this3.tech_.trigger({
  109944. type: "usage",
  109945. name: "vhs-rendition-enabled"
  109946. });
  109947. _this3.tech_.trigger({
  109948. type: "usage",
  109949. name: "hls-rendition-enabled"
  109950. });
  109951. });
  109952. };
  109953. _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) {
  109954. if (this.useCueTags_) {
  109955. this.updateAdCues_(updatedPlaylist);
  109956. }
  109957. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  109958. this.updateDuration(!updatedPlaylist.endList);
  109959. if (!this.tech_.paused()) {
  109960. this.mainSegmentLoader_.load();
  109961. if (this.audioSegmentLoader_) {
  109962. this.audioSegmentLoader_.load();
  109963. }
  109964. }
  109965. };
  109966. _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) {
  109967. var mediaGroups = master.mediaGroups || {};
  109968. var defaultDemuxed = true;
  109969. var audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  109970. for (var mediaGroup in mediaGroups.AUDIO) {
  109971. for (var label2 in mediaGroups.AUDIO[mediaGroup]) {
  109972. var properties = mediaGroups.AUDIO[mediaGroup][label2];
  109973. if (!properties.uri) {
  109974. defaultDemuxed = false;
  109975. }
  109976. }
  109977. }
  109978. if (defaultDemuxed) {
  109979. this.tech_.trigger({
  109980. type: "usage",
  109981. name: "vhs-demuxed"
  109982. });
  109983. this.tech_.trigger({
  109984. type: "usage",
  109985. name: "hls-demuxed"
  109986. });
  109987. }
  109988. if (Object.keys(mediaGroups.SUBTITLES).length) {
  109989. this.tech_.trigger({
  109990. type: "usage",
  109991. name: "vhs-webvtt"
  109992. });
  109993. this.tech_.trigger({
  109994. type: "usage",
  109995. name: "hls-webvtt"
  109996. });
  109997. }
  109998. if (Vhs$1.Playlist.isAes(media)) {
  109999. this.tech_.trigger({
  110000. type: "usage",
  110001. name: "vhs-aes"
  110002. });
  110003. this.tech_.trigger({
  110004. type: "usage",
  110005. name: "hls-aes"
  110006. });
  110007. }
  110008. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  110009. this.tech_.trigger({
  110010. type: "usage",
  110011. name: "vhs-alternate-audio"
  110012. });
  110013. this.tech_.trigger({
  110014. type: "usage",
  110015. name: "hls-alternate-audio"
  110016. });
  110017. }
  110018. if (this.useCueTags_) {
  110019. this.tech_.trigger({
  110020. type: "usage",
  110021. name: "vhs-playlist-cue-tags"
  110022. });
  110023. this.tech_.trigger({
  110024. type: "usage",
  110025. name: "hls-playlist-cue-tags"
  110026. });
  110027. }
  110028. };
  110029. _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) {
  110030. var currentPlaylist = this.masterPlaylistLoader_.media() || this.masterPlaylistLoader_.pendingMedia_;
  110031. var currentTime = this.tech_.currentTime();
  110032. var bufferLowWaterLine = this.bufferLowWaterLine();
  110033. var bufferHighWaterLine = this.bufferHighWaterLine();
  110034. var buffered = this.tech_.buffered();
  110035. return shouldSwitchToMedia({
  110036. buffered,
  110037. currentTime,
  110038. currentPlaylist,
  110039. nextPlaylist,
  110040. bufferLowWaterLine,
  110041. bufferHighWaterLine,
  110042. duration: this.duration(),
  110043. experimentalBufferBasedABR: this.experimentalBufferBasedABR,
  110044. log: this.logger_
  110045. });
  110046. };
  110047. _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() {
  110048. var _this4 = this;
  110049. this.mainSegmentLoader_.on("bandwidthupdate", function() {
  110050. _this4.checkABR_("bandwidthupdate");
  110051. _this4.tech_.trigger("bandwidthupdate");
  110052. });
  110053. this.mainSegmentLoader_.on("timeout", function() {
  110054. if (_this4.experimentalBufferBasedABR) {
  110055. _this4.mainSegmentLoader_.load();
  110056. }
  110057. });
  110058. if (!this.experimentalBufferBasedABR) {
  110059. this.mainSegmentLoader_.on("progress", function() {
  110060. _this4.trigger("progress");
  110061. });
  110062. }
  110063. this.mainSegmentLoader_.on("error", function() {
  110064. _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error());
  110065. });
  110066. this.mainSegmentLoader_.on("appenderror", function() {
  110067. _this4.error = _this4.mainSegmentLoader_.error_;
  110068. _this4.trigger("error");
  110069. });
  110070. this.mainSegmentLoader_.on("syncinfoupdate", function() {
  110071. _this4.onSyncInfoUpdate_();
  110072. });
  110073. this.mainSegmentLoader_.on("timestampoffset", function() {
  110074. _this4.tech_.trigger({
  110075. type: "usage",
  110076. name: "vhs-timestamp-offset"
  110077. });
  110078. _this4.tech_.trigger({
  110079. type: "usage",
  110080. name: "hls-timestamp-offset"
  110081. });
  110082. });
  110083. this.audioSegmentLoader_.on("syncinfoupdate", function() {
  110084. _this4.onSyncInfoUpdate_();
  110085. });
  110086. this.audioSegmentLoader_.on("appenderror", function() {
  110087. _this4.error = _this4.audioSegmentLoader_.error_;
  110088. _this4.trigger("error");
  110089. });
  110090. this.mainSegmentLoader_.on("ended", function() {
  110091. _this4.logger_("main segment loader ended");
  110092. _this4.onEndOfStream();
  110093. });
  110094. this.mainSegmentLoader_.on("earlyabort", function(event2) {
  110095. if (_this4.experimentalBufferBasedABR) {
  110096. return;
  110097. }
  110098. _this4.delegateLoaders_("all", ["abort"]);
  110099. _this4.blacklistCurrentPlaylist({
  110100. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  110101. }, ABORT_EARLY_BLACKLIST_SECONDS);
  110102. });
  110103. var updateCodecs = function updateCodecs2() {
  110104. if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) {
  110105. return _this4.tryToCreateSourceBuffers_();
  110106. }
  110107. var codecs = _this4.getCodecsOrExclude_();
  110108. if (!codecs) {
  110109. return;
  110110. }
  110111. _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  110112. };
  110113. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  110114. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  110115. this.mainSegmentLoader_.on("fmp4", function() {
  110116. if (!_this4.triggeredFmp4Usage) {
  110117. _this4.tech_.trigger({
  110118. type: "usage",
  110119. name: "vhs-fmp4"
  110120. });
  110121. _this4.tech_.trigger({
  110122. type: "usage",
  110123. name: "hls-fmp4"
  110124. });
  110125. _this4.triggeredFmp4Usage = true;
  110126. }
  110127. });
  110128. this.audioSegmentLoader_.on("fmp4", function() {
  110129. if (!_this4.triggeredFmp4Usage) {
  110130. _this4.tech_.trigger({
  110131. type: "usage",
  110132. name: "vhs-fmp4"
  110133. });
  110134. _this4.tech_.trigger({
  110135. type: "usage",
  110136. name: "hls-fmp4"
  110137. });
  110138. _this4.triggeredFmp4Usage = true;
  110139. }
  110140. });
  110141. this.audioSegmentLoader_.on("ended", function() {
  110142. _this4.logger_("audioSegmentLoader ended");
  110143. _this4.onEndOfStream();
  110144. });
  110145. };
  110146. _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() {
  110147. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  110148. };
  110149. _proto.load = function load() {
  110150. this.mainSegmentLoader_.load();
  110151. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110152. this.audioSegmentLoader_.load();
  110153. }
  110154. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110155. this.subtitleSegmentLoader_.load();
  110156. }
  110157. };
  110158. _proto.smoothQualityChange_ = function smoothQualityChange_(media) {
  110159. if (media === void 0) {
  110160. media = this.selectPlaylist();
  110161. }
  110162. this.fastQualityChange_(media);
  110163. };
  110164. _proto.fastQualityChange_ = function fastQualityChange_(media) {
  110165. var _this5 = this;
  110166. if (media === void 0) {
  110167. media = this.selectPlaylist();
  110168. }
  110169. if (media === this.masterPlaylistLoader_.media()) {
  110170. this.logger_("skipping fastQualityChange because new media is same as old");
  110171. return;
  110172. }
  110173. this.switchMedia_(media, "fast-quality");
  110174. this.mainSegmentLoader_.resetEverything(function() {
  110175. if (videojs.browser.IE_VERSION || videojs.browser.IS_EDGE) {
  110176. _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04);
  110177. } else {
  110178. _this5.tech_.setCurrentTime(_this5.tech_.currentTime());
  110179. }
  110180. });
  110181. };
  110182. _proto.play = function play() {
  110183. if (this.setupFirstPlay()) {
  110184. return;
  110185. }
  110186. if (this.tech_.ended()) {
  110187. this.tech_.setCurrentTime(0);
  110188. }
  110189. if (this.hasPlayed_) {
  110190. this.load();
  110191. }
  110192. var seekable3 = this.tech_.seekable();
  110193. if (this.tech_.duration() === Infinity) {
  110194. if (this.tech_.currentTime() < seekable3.start(0)) {
  110195. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  110196. }
  110197. }
  110198. };
  110199. _proto.setupFirstPlay = function setupFirstPlay() {
  110200. var _this6 = this;
  110201. var media = this.masterPlaylistLoader_.media();
  110202. if (!media || this.tech_.paused() || this.hasPlayed_) {
  110203. return false;
  110204. }
  110205. if (!media.endList) {
  110206. var seekable3 = this.seekable();
  110207. if (!seekable3.length) {
  110208. return false;
  110209. }
  110210. if (videojs.browser.IE_VERSION && this.tech_.readyState() === 0) {
  110211. this.tech_.one("loadedmetadata", function() {
  110212. _this6.trigger("firstplay");
  110213. _this6.tech_.setCurrentTime(seekable3.end(0));
  110214. _this6.hasPlayed_ = true;
  110215. });
  110216. return false;
  110217. }
  110218. this.trigger("firstplay");
  110219. this.tech_.setCurrentTime(seekable3.end(0));
  110220. }
  110221. this.hasPlayed_ = true;
  110222. this.load();
  110223. return true;
  110224. };
  110225. _proto.handleSourceOpen_ = function handleSourceOpen_() {
  110226. this.tryToCreateSourceBuffers_();
  110227. if (this.tech_.autoplay()) {
  110228. var playPromise = this.tech_.play();
  110229. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  110230. playPromise.then(null, function(e) {
  110231. });
  110232. }
  110233. }
  110234. this.trigger("sourceopen");
  110235. };
  110236. _proto.handleSourceEnded_ = function handleSourceEnded_() {
  110237. if (!this.inbandTextTracks_.metadataTrack_) {
  110238. return;
  110239. }
  110240. var cues = this.inbandTextTracks_.metadataTrack_.cues;
  110241. if (!cues || !cues.length) {
  110242. return;
  110243. }
  110244. var duration5 = this.duration();
  110245. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  110246. };
  110247. _proto.handleDurationChange_ = function handleDurationChange_() {
  110248. this.tech_.trigger("durationchange");
  110249. };
  110250. _proto.onEndOfStream = function onEndOfStream() {
  110251. var isEndOfStream = this.mainSegmentLoader_.ended_;
  110252. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110253. var mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  110254. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  110255. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  110256. } else {
  110257. isEndOfStream = this.audioSegmentLoader_.ended_;
  110258. }
  110259. }
  110260. if (!isEndOfStream) {
  110261. return;
  110262. }
  110263. this.stopABRTimer_();
  110264. this.sourceUpdater_.endOfStream();
  110265. };
  110266. _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) {
  110267. var seekable3 = this.seekable();
  110268. if (!seekable3.length) {
  110269. return false;
  110270. }
  110271. var expired = this.syncController_.getExpiredTime(playlist, this.duration());
  110272. if (expired === null) {
  110273. return false;
  110274. }
  110275. var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);
  110276. var currentTime = this.tech_.currentTime();
  110277. var buffered = this.tech_.buffered();
  110278. if (!buffered.length) {
  110279. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;
  110280. }
  110281. var bufferedEnd = buffered.end(buffered.length - 1);
  110282. return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;
  110283. };
  110284. _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) {
  110285. if (error === void 0) {
  110286. error = {};
  110287. }
  110288. var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media();
  110289. blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration;
  110290. if (!currentPlaylist) {
  110291. this.error = error;
  110292. if (this.mediaSource.readyState !== "open") {
  110293. this.trigger("error");
  110294. } else {
  110295. this.sourceUpdater_.endOfStream("network");
  110296. }
  110297. return;
  110298. }
  110299. currentPlaylist.playlistErrors_++;
  110300. var playlists = this.masterPlaylistLoader_.master.playlists;
  110301. var enabledPlaylists = playlists.filter(isEnabled);
  110302. var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist;
  110303. if (playlists.length === 1 && blacklistDuration !== Infinity) {
  110304. videojs.log.warn("Problem encountered with playlist " + currentPlaylist.id + ". Trying again since it is the only playlist.");
  110305. this.tech_.trigger("retryplaylist");
  110306. return this.masterPlaylistLoader_.load(isFinalRendition);
  110307. }
  110308. if (isFinalRendition) {
  110309. var reincluded = false;
  110310. playlists.forEach(function(playlist) {
  110311. if (playlist === currentPlaylist) {
  110312. return;
  110313. }
  110314. var excludeUntil2 = playlist.excludeUntil;
  110315. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  110316. reincluded = true;
  110317. delete playlist.excludeUntil;
  110318. }
  110319. });
  110320. if (reincluded) {
  110321. videojs.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  110322. this.tech_.trigger("retryplaylist");
  110323. }
  110324. }
  110325. var excludeUntil;
  110326. if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) {
  110327. excludeUntil = Infinity;
  110328. } else {
  110329. excludeUntil = Date.now() + blacklistDuration * 1e3;
  110330. }
  110331. currentPlaylist.excludeUntil = excludeUntil;
  110332. if (error.reason) {
  110333. currentPlaylist.lastExcludeReason_ = error.reason;
  110334. }
  110335. this.tech_.trigger("blacklistplaylist");
  110336. this.tech_.trigger({
  110337. type: "usage",
  110338. name: "vhs-rendition-blacklisted"
  110339. });
  110340. this.tech_.trigger({
  110341. type: "usage",
  110342. name: "hls-rendition-blacklisted"
  110343. });
  110344. var nextPlaylist = this.selectPlaylist();
  110345. if (!nextPlaylist) {
  110346. this.error = "Playback cannot continue. No available working or supported playlists.";
  110347. this.trigger("error");
  110348. return;
  110349. }
  110350. var logFn2 = error.internal ? this.logger_ : videojs.log.warn;
  110351. var errorMessage = error.message ? " " + error.message : "";
  110352. logFn2((error.internal ? "Internal problem" : "Problem") + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + "."));
  110353. if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) {
  110354. this.delegateLoaders_("audio", ["abort", "pause"]);
  110355. }
  110356. if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) {
  110357. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  110358. }
  110359. this.delegateLoaders_("main", ["abort", "pause"]);
  110360. var delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  110361. var shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  110362. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  110363. };
  110364. _proto.pauseLoading = function pauseLoading() {
  110365. this.delegateLoaders_("all", ["abort", "pause"]);
  110366. this.stopABRTimer_();
  110367. };
  110368. _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) {
  110369. var _this7 = this;
  110370. var loaders = [];
  110371. var dontFilterPlaylist = filter === "all";
  110372. if (dontFilterPlaylist || filter === "main") {
  110373. loaders.push(this.masterPlaylistLoader_);
  110374. }
  110375. var mediaTypes2 = [];
  110376. if (dontFilterPlaylist || filter === "audio") {
  110377. mediaTypes2.push("AUDIO");
  110378. }
  110379. if (dontFilterPlaylist || filter === "subtitle") {
  110380. mediaTypes2.push("CLOSED-CAPTIONS");
  110381. mediaTypes2.push("SUBTITLES");
  110382. }
  110383. mediaTypes2.forEach(function(mediaType) {
  110384. var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader;
  110385. if (loader) {
  110386. loaders.push(loader);
  110387. }
  110388. });
  110389. ["main", "audio", "subtitle"].forEach(function(name) {
  110390. var loader = _this7[name + "SegmentLoader_"];
  110391. if (loader && (filter === name || filter === "all")) {
  110392. loaders.push(loader);
  110393. }
  110394. });
  110395. loaders.forEach(function(loader) {
  110396. return fnNames.forEach(function(fnName) {
  110397. if (typeof loader[fnName] === "function") {
  110398. loader[fnName]();
  110399. }
  110400. });
  110401. });
  110402. };
  110403. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  110404. var buffered = findRange(this.tech_.buffered(), currentTime);
  110405. if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) {
  110406. return 0;
  110407. }
  110408. if (!this.masterPlaylistLoader_.media().segments) {
  110409. return 0;
  110410. }
  110411. if (buffered && buffered.length) {
  110412. return currentTime;
  110413. }
  110414. this.mainSegmentLoader_.resetEverything();
  110415. this.mainSegmentLoader_.abort();
  110416. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110417. this.audioSegmentLoader_.resetEverything();
  110418. this.audioSegmentLoader_.abort();
  110419. }
  110420. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110421. this.subtitleSegmentLoader_.resetEverything();
  110422. this.subtitleSegmentLoader_.abort();
  110423. }
  110424. this.load();
  110425. };
  110426. _proto.duration = function duration5() {
  110427. if (!this.masterPlaylistLoader_) {
  110428. return 0;
  110429. }
  110430. var media = this.masterPlaylistLoader_.media();
  110431. if (!media) {
  110432. return 0;
  110433. }
  110434. if (!media.endList) {
  110435. return Infinity;
  110436. }
  110437. if (this.mediaSource) {
  110438. return this.mediaSource.duration;
  110439. }
  110440. return Vhs$1.Playlist.duration(media);
  110441. };
  110442. _proto.seekable = function seekable3() {
  110443. return this.seekable_;
  110444. };
  110445. _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() {
  110446. var audioSeekable;
  110447. if (!this.masterPlaylistLoader_) {
  110448. return;
  110449. }
  110450. var media = this.masterPlaylistLoader_.media();
  110451. if (!media) {
  110452. return;
  110453. }
  110454. var expired = this.syncController_.getExpiredTime(media, this.duration());
  110455. if (expired === null) {
  110456. return;
  110457. }
  110458. var master = this.masterPlaylistLoader_.master;
  110459. var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110460. if (mainSeekable.length === 0) {
  110461. return;
  110462. }
  110463. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110464. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  110465. expired = this.syncController_.getExpiredTime(media, this.duration());
  110466. if (expired === null) {
  110467. return;
  110468. }
  110469. audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110470. if (audioSeekable.length === 0) {
  110471. return;
  110472. }
  110473. }
  110474. var oldEnd;
  110475. var oldStart;
  110476. if (this.seekable_ && this.seekable_.length) {
  110477. oldEnd = this.seekable_.end(0);
  110478. oldStart = this.seekable_.start(0);
  110479. }
  110480. if (!audioSeekable) {
  110481. this.seekable_ = mainSeekable;
  110482. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  110483. this.seekable_ = mainSeekable;
  110484. } else {
  110485. 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)]]);
  110486. }
  110487. if (this.seekable_ && this.seekable_.length) {
  110488. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  110489. return;
  110490. }
  110491. }
  110492. this.logger_("seekable updated [" + printableRange(this.seekable_) + "]");
  110493. this.tech_.trigger("seekablechanged");
  110494. };
  110495. _proto.updateDuration = function updateDuration(isLive) {
  110496. if (this.updateDuration_) {
  110497. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110498. this.updateDuration_ = null;
  110499. }
  110500. if (this.mediaSource.readyState !== "open") {
  110501. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  110502. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  110503. return;
  110504. }
  110505. if (isLive) {
  110506. var seekable3 = this.seekable();
  110507. if (!seekable3.length) {
  110508. return;
  110509. }
  110510. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  110511. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  110512. }
  110513. return;
  110514. }
  110515. var buffered = this.tech_.buffered();
  110516. var duration5 = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media());
  110517. if (buffered.length > 0) {
  110518. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  110519. }
  110520. if (this.mediaSource.duration !== duration5) {
  110521. this.sourceUpdater_.setDuration(duration5);
  110522. }
  110523. };
  110524. _proto.dispose = function dispose() {
  110525. var _this8 = this;
  110526. this.trigger("dispose");
  110527. this.decrypter_.terminate();
  110528. this.masterPlaylistLoader_.dispose();
  110529. this.mainSegmentLoader_.dispose();
  110530. if (this.loadOnPlay_) {
  110531. this.tech_.off("play", this.loadOnPlay_);
  110532. }
  110533. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  110534. var groups = _this8.mediaTypes_[type2].groups;
  110535. for (var id in groups) {
  110536. groups[id].forEach(function(group) {
  110537. if (group.playlistLoader) {
  110538. group.playlistLoader.dispose();
  110539. }
  110540. });
  110541. }
  110542. });
  110543. this.audioSegmentLoader_.dispose();
  110544. this.subtitleSegmentLoader_.dispose();
  110545. this.sourceUpdater_.dispose();
  110546. this.timelineChangeController_.dispose();
  110547. this.stopABRTimer_();
  110548. if (this.updateDuration_) {
  110549. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110550. }
  110551. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  110552. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  110553. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  110554. this.off();
  110555. };
  110556. _proto.master = function master() {
  110557. return this.masterPlaylistLoader_.master;
  110558. };
  110559. _proto.media = function media() {
  110560. return this.masterPlaylistLoader_.media() || this.initialMedia_;
  110561. };
  110562. _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() {
  110563. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110564. var hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  110565. var hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  110566. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  110567. return false;
  110568. }
  110569. return true;
  110570. };
  110571. _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() {
  110572. var _this9 = this;
  110573. var media = {
  110574. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  110575. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  110576. };
  110577. var playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  110578. media.video = media.main;
  110579. var playlistCodecs = codecsForPlaylist(this.master(), playlist);
  110580. var codecs = {};
  110581. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110582. if (media.main.hasVideo) {
  110583. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC;
  110584. }
  110585. if (media.main.isMuxed) {
  110586. codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC);
  110587. }
  110588. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  110589. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC;
  110590. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  110591. }
  110592. if (!codecs.audio && !codecs.video) {
  110593. this.blacklistCurrentPlaylist({
  110594. playlist,
  110595. message: "Could not determine codecs for playlist.",
  110596. blacklistDuration: Infinity
  110597. });
  110598. return;
  110599. }
  110600. var supportFunction = function supportFunction2(isFmp4, codec) {
  110601. return isFmp4 ? browserSupportsCodec2(codec) : muxerSupportsCodec2(codec);
  110602. };
  110603. var unsupportedCodecs = {};
  110604. var unsupportedAudio;
  110605. ["video", "audio"].forEach(function(type2) {
  110606. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  110607. var supporter = media[type2].isFmp4 ? "browser" : "muxer";
  110608. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  110609. unsupportedCodecs[supporter].push(codecs[type2]);
  110610. if (type2 === "audio") {
  110611. unsupportedAudio = supporter;
  110612. }
  110613. }
  110614. });
  110615. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  110616. var audioGroup = playlist.attributes.AUDIO;
  110617. this.master().playlists.forEach(function(variant) {
  110618. var variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  110619. if (variantAudioGroup === audioGroup && variant !== playlist) {
  110620. variant.excludeUntil = Infinity;
  110621. }
  110622. });
  110623. this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + ' does not support codec(s): "' + codecs.audio + '"');
  110624. }
  110625. if (Object.keys(unsupportedCodecs).length) {
  110626. var message = Object.keys(unsupportedCodecs).reduce(function(acc, supporter) {
  110627. if (acc) {
  110628. acc += ", ";
  110629. }
  110630. acc += supporter + ' does not support codec(s): "' + unsupportedCodecs[supporter].join(",") + '"';
  110631. return acc;
  110632. }, "") + ".";
  110633. this.blacklistCurrentPlaylist({
  110634. playlist,
  110635. internal: true,
  110636. message,
  110637. blacklistDuration: Infinity
  110638. });
  110639. return;
  110640. }
  110641. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  110642. var switchMessages = [];
  110643. ["video", "audio"].forEach(function(type2) {
  110644. var newCodec = (parseCodecs2(_this9.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  110645. var oldCodec = (parseCodecs2(codecs[type2] || "")[0] || {}).type;
  110646. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  110647. switchMessages.push('"' + _this9.sourceUpdater_.codecs[type2] + '" -> "' + codecs[type2] + '"');
  110648. }
  110649. });
  110650. if (switchMessages.length) {
  110651. this.blacklistCurrentPlaylist({
  110652. playlist,
  110653. message: "Codec switching not supported: " + switchMessages.join(", ") + ".",
  110654. blacklistDuration: Infinity,
  110655. internal: true
  110656. });
  110657. return;
  110658. }
  110659. }
  110660. return codecs;
  110661. };
  110662. _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() {
  110663. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  110664. return;
  110665. }
  110666. if (!this.areMediaTypesKnown_()) {
  110667. return;
  110668. }
  110669. var codecs = this.getCodecsOrExclude_();
  110670. if (!codecs) {
  110671. return;
  110672. }
  110673. this.sourceUpdater_.createSourceBuffers(codecs);
  110674. var codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  110675. this.excludeIncompatibleVariants_(codecString);
  110676. };
  110677. _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() {
  110678. var _this10 = this;
  110679. var playlists = this.master().playlists;
  110680. var ids = [];
  110681. Object.keys(playlists).forEach(function(key) {
  110682. var variant = playlists[key];
  110683. if (ids.indexOf(variant.id) !== -1) {
  110684. return;
  110685. }
  110686. ids.push(variant.id);
  110687. var codecs = codecsForPlaylist(_this10.master, variant);
  110688. var unsupported = [];
  110689. if (codecs.audio && !muxerSupportsCodec2(codecs.audio) && !browserSupportsCodec2(codecs.audio)) {
  110690. unsupported.push("audio codec " + codecs.audio);
  110691. }
  110692. if (codecs.video && !muxerSupportsCodec2(codecs.video) && !browserSupportsCodec2(codecs.video)) {
  110693. unsupported.push("video codec " + codecs.video);
  110694. }
  110695. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  110696. unsupported.push("text codec " + codecs.text);
  110697. }
  110698. if (unsupported.length) {
  110699. variant.excludeUntil = Infinity;
  110700. _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(", "));
  110701. }
  110702. });
  110703. };
  110704. _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) {
  110705. var _this11 = this;
  110706. var ids = [];
  110707. var playlists = this.master().playlists;
  110708. var codecs = unwrapCodecList(parseCodecs2(codecString));
  110709. var codecCount_ = codecCount(codecs);
  110710. var videoDetails = codecs.video && parseCodecs2(codecs.video)[0] || null;
  110711. var audioDetails = codecs.audio && parseCodecs2(codecs.audio)[0] || null;
  110712. Object.keys(playlists).forEach(function(key) {
  110713. var variant = playlists[key];
  110714. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  110715. return;
  110716. }
  110717. ids.push(variant.id);
  110718. var blacklistReasons = [];
  110719. var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant);
  110720. var variantCodecCount = codecCount(variantCodecs);
  110721. if (!variantCodecs.audio && !variantCodecs.video) {
  110722. return;
  110723. }
  110724. if (variantCodecCount !== codecCount_) {
  110725. blacklistReasons.push('codec count "' + variantCodecCount + '" !== "' + codecCount_ + '"');
  110726. }
  110727. if (!_this11.sourceUpdater_.canChangeType()) {
  110728. var variantVideoDetails = variantCodecs.video && parseCodecs2(variantCodecs.video)[0] || null;
  110729. var variantAudioDetails = variantCodecs.audio && parseCodecs2(variantCodecs.audio)[0] || null;
  110730. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  110731. blacklistReasons.push('video codec "' + variantVideoDetails.type + '" !== "' + videoDetails.type + '"');
  110732. }
  110733. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  110734. blacklistReasons.push('audio codec "' + variantAudioDetails.type + '" !== "' + audioDetails.type + '"');
  110735. }
  110736. }
  110737. if (blacklistReasons.length) {
  110738. variant.excludeUntil = Infinity;
  110739. _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(" && "));
  110740. }
  110741. });
  110742. };
  110743. _proto.updateAdCues_ = function updateAdCues_(media) {
  110744. var offset = 0;
  110745. var seekable3 = this.seekable();
  110746. if (seekable3.length) {
  110747. offset = seekable3.start(0);
  110748. }
  110749. updateAdCues(media, this.cueTagsTrack_, offset);
  110750. };
  110751. _proto.goalBufferLength = function goalBufferLength() {
  110752. var currentTime = this.tech_.currentTime();
  110753. var initial = Config.GOAL_BUFFER_LENGTH;
  110754. var rate = Config.GOAL_BUFFER_LENGTH_RATE;
  110755. var max2 = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);
  110756. return Math.min(initial + currentTime * rate, max2);
  110757. };
  110758. _proto.bufferLowWaterLine = function bufferLowWaterLine() {
  110759. var currentTime = this.tech_.currentTime();
  110760. var initial = Config.BUFFER_LOW_WATER_LINE;
  110761. var rate = Config.BUFFER_LOW_WATER_LINE_RATE;
  110762. var max2 = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);
  110763. var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  110764. return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max2);
  110765. };
  110766. _proto.bufferHighWaterLine = function bufferHighWaterLine() {
  110767. return Config.BUFFER_HIGH_WATER_LINE;
  110768. };
  110769. return MasterPlaylistController2;
  110770. }(videojs.EventTarget);
  110771. var enableFunction = function enableFunction2(loader, playlistID, changePlaylistFn) {
  110772. return function(enable) {
  110773. var playlist = loader.master.playlists[playlistID];
  110774. var incompatible = isIncompatible(playlist);
  110775. var currentlyEnabled = isEnabled(playlist);
  110776. if (typeof enable === "undefined") {
  110777. return currentlyEnabled;
  110778. }
  110779. if (enable) {
  110780. delete playlist.disabled;
  110781. } else {
  110782. playlist.disabled = true;
  110783. }
  110784. if (enable !== currentlyEnabled && !incompatible) {
  110785. changePlaylistFn();
  110786. if (enable) {
  110787. loader.trigger("renditionenabled");
  110788. } else {
  110789. loader.trigger("renditiondisabled");
  110790. }
  110791. }
  110792. return enable;
  110793. };
  110794. };
  110795. var Representation = function Representation2(vhsHandler, playlist, id) {
  110796. var mpc = vhsHandler.masterPlaylistController_, smoothQualityChange = vhsHandler.options_.smoothQualityChange;
  110797. var changeType2 = smoothQualityChange ? "smooth" : "fast";
  110798. var qualityChangeFunction = mpc[changeType2 + "QualityChange_"].bind(mpc);
  110799. if (playlist.attributes) {
  110800. var resolution = playlist.attributes.RESOLUTION;
  110801. this.width = resolution && resolution.width;
  110802. this.height = resolution && resolution.height;
  110803. this.bandwidth = playlist.attributes.BANDWIDTH;
  110804. this.frameRate = playlist.attributes["FRAME-RATE"];
  110805. }
  110806. this.codecs = codecsForPlaylist(mpc.master(), playlist);
  110807. this.playlist = playlist;
  110808. this.id = id;
  110809. this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  110810. };
  110811. var renditionSelectionMixin = function renditionSelectionMixin2(vhsHandler) {
  110812. vhsHandler.representations = function() {
  110813. var master = vhsHandler.masterPlaylistController_.master();
  110814. var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists;
  110815. if (!playlists) {
  110816. return [];
  110817. }
  110818. return playlists.filter(function(media) {
  110819. return !isIncompatible(media);
  110820. }).map(function(e, i2) {
  110821. return new Representation(vhsHandler, e, e.id);
  110822. });
  110823. };
  110824. };
  110825. var timerCancelEvents = ["seeking", "seeked", "pause", "playing", "error"];
  110826. var PlaybackWatcher = /* @__PURE__ */ function() {
  110827. function PlaybackWatcher2(options2) {
  110828. var _this = this;
  110829. this.masterPlaylistController_ = options2.masterPlaylistController;
  110830. this.tech_ = options2.tech;
  110831. this.seekable = options2.seekable;
  110832. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  110833. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  110834. this.media = options2.media;
  110835. this.consecutiveUpdates = 0;
  110836. this.lastRecordedTime = null;
  110837. this.timer_ = null;
  110838. this.checkCurrentTimeTimeout_ = null;
  110839. this.logger_ = logger("PlaybackWatcher");
  110840. this.logger_("initialize");
  110841. var playHandler = function playHandler2() {
  110842. return _this.monitorCurrentTime_();
  110843. };
  110844. var canPlayHandler = function canPlayHandler2() {
  110845. return _this.monitorCurrentTime_();
  110846. };
  110847. var waitingHandler = function waitingHandler2() {
  110848. return _this.techWaiting_();
  110849. };
  110850. var cancelTimerHandler = function cancelTimerHandler2() {
  110851. return _this.cancelTimer_();
  110852. };
  110853. var mpc = this.masterPlaylistController_;
  110854. var loaderTypes = ["main", "subtitle", "audio"];
  110855. var loaderChecks = {};
  110856. loaderTypes.forEach(function(type2) {
  110857. loaderChecks[type2] = {
  110858. reset: function reset3() {
  110859. return _this.resetSegmentDownloads_(type2);
  110860. },
  110861. updateend: function updateend() {
  110862. return _this.checkSegmentDownloads_(type2);
  110863. }
  110864. };
  110865. mpc[type2 + "SegmentLoader_"].on("appendsdone", loaderChecks[type2].updateend);
  110866. mpc[type2 + "SegmentLoader_"].on("playlistupdate", loaderChecks[type2].reset);
  110867. _this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  110868. });
  110869. var setSeekingHandlers = function setSeekingHandlers2(fn2) {
  110870. ["main", "audio"].forEach(function(type2) {
  110871. mpc[type2 + "SegmentLoader_"][fn2]("appended", _this.seekingAppendCheck_);
  110872. });
  110873. };
  110874. this.seekingAppendCheck_ = function() {
  110875. if (_this.fixesBadSeeks_()) {
  110876. _this.consecutiveUpdates = 0;
  110877. _this.lastRecordedTime = _this.tech_.currentTime();
  110878. setSeekingHandlers("off");
  110879. }
  110880. };
  110881. this.clearSeekingAppendCheck_ = function() {
  110882. return setSeekingHandlers("off");
  110883. };
  110884. this.watchForBadSeeking_ = function() {
  110885. _this.clearSeekingAppendCheck_();
  110886. setSeekingHandlers("on");
  110887. };
  110888. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  110889. this.tech_.on("seeking", this.watchForBadSeeking_);
  110890. this.tech_.on("waiting", waitingHandler);
  110891. this.tech_.on(timerCancelEvents, cancelTimerHandler);
  110892. this.tech_.on("canplay", canPlayHandler);
  110893. this.tech_.one("play", playHandler);
  110894. this.dispose = function() {
  110895. _this.clearSeekingAppendCheck_();
  110896. _this.logger_("dispose");
  110897. _this.tech_.off("waiting", waitingHandler);
  110898. _this.tech_.off(timerCancelEvents, cancelTimerHandler);
  110899. _this.tech_.off("canplay", canPlayHandler);
  110900. _this.tech_.off("play", playHandler);
  110901. _this.tech_.off("seeking", _this.watchForBadSeeking_);
  110902. _this.tech_.off("seeked", _this.clearSeekingAppendCheck_);
  110903. loaderTypes.forEach(function(type2) {
  110904. mpc[type2 + "SegmentLoader_"].off("appendsdone", loaderChecks[type2].updateend);
  110905. mpc[type2 + "SegmentLoader_"].off("playlistupdate", loaderChecks[type2].reset);
  110906. _this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  110907. });
  110908. if (_this.checkCurrentTimeTimeout_) {
  110909. window_1.clearTimeout(_this.checkCurrentTimeTimeout_);
  110910. }
  110911. _this.cancelTimer_();
  110912. };
  110913. }
  110914. var _proto = PlaybackWatcher2.prototype;
  110915. _proto.monitorCurrentTime_ = function monitorCurrentTime_() {
  110916. this.checkCurrentTime_();
  110917. if (this.checkCurrentTimeTimeout_) {
  110918. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  110919. }
  110920. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  110921. };
  110922. _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type2) {
  110923. var loader = this.masterPlaylistController_[type2 + "SegmentLoader_"];
  110924. if (this[type2 + "StalledDownloads_"] > 0) {
  110925. this.logger_("resetting possible stalled download count for " + type2 + " loader");
  110926. }
  110927. this[type2 + "StalledDownloads_"] = 0;
  110928. this[type2 + "Buffered_"] = loader.buffered_();
  110929. };
  110930. _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type2) {
  110931. var mpc = this.masterPlaylistController_;
  110932. var loader = mpc[type2 + "SegmentLoader_"];
  110933. var buffered = loader.buffered_();
  110934. var isBufferedDifferent = isRangeDifferent(this[type2 + "Buffered_"], buffered);
  110935. this[type2 + "Buffered_"] = buffered;
  110936. if (isBufferedDifferent) {
  110937. this.resetSegmentDownloads_(type2);
  110938. return;
  110939. }
  110940. this[type2 + "StalledDownloads_"]++;
  110941. this.logger_("found #" + this[type2 + "StalledDownloads_"] + " " + type2 + " appends that did not increase buffer (possible stalled download)", {
  110942. playlistId: loader.playlist_ && loader.playlist_.id,
  110943. buffered: timeRangesToArray(buffered)
  110944. });
  110945. if (this[type2 + "StalledDownloads_"] < 10) {
  110946. return;
  110947. }
  110948. this.logger_(type2 + " loader stalled download exclusion");
  110949. this.resetSegmentDownloads_(type2);
  110950. this.tech_.trigger({
  110951. type: "usage",
  110952. name: "vhs-" + type2 + "-download-exclusion"
  110953. });
  110954. if (type2 === "subtitle") {
  110955. return;
  110956. }
  110957. mpc.blacklistCurrentPlaylist({
  110958. message: "Excessive " + type2 + " segment downloading detected."
  110959. }, Infinity);
  110960. };
  110961. _proto.checkCurrentTime_ = function checkCurrentTime_() {
  110962. if (this.tech_.paused() || this.tech_.seeking()) {
  110963. return;
  110964. }
  110965. var currentTime = this.tech_.currentTime();
  110966. var buffered = this.tech_.buffered();
  110967. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {
  110968. return this.techWaiting_();
  110969. }
  110970. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  110971. this.consecutiveUpdates++;
  110972. this.waiting_();
  110973. } else if (currentTime === this.lastRecordedTime) {
  110974. this.consecutiveUpdates++;
  110975. } else {
  110976. this.consecutiveUpdates = 0;
  110977. this.lastRecordedTime = currentTime;
  110978. }
  110979. };
  110980. _proto.cancelTimer_ = function cancelTimer_() {
  110981. this.consecutiveUpdates = 0;
  110982. if (this.timer_) {
  110983. this.logger_("cancelTimer_");
  110984. clearTimeout(this.timer_);
  110985. }
  110986. this.timer_ = null;
  110987. };
  110988. _proto.fixesBadSeeks_ = function fixesBadSeeks_() {
  110989. var seeking = this.tech_.seeking();
  110990. if (!seeking) {
  110991. return false;
  110992. }
  110993. var seekable3 = this.seekable();
  110994. var currentTime = this.tech_.currentTime();
  110995. var isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  110996. var seekTo;
  110997. if (isAfterSeekableRange) {
  110998. var seekableEnd = seekable3.end(seekable3.length - 1);
  110999. seekTo = seekableEnd;
  111000. }
  111001. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  111002. var seekableStart = seekable3.start(0);
  111003. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA);
  111004. }
  111005. if (typeof seekTo !== "undefined") {
  111006. this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable3) + ". Seeking to ") + (seekTo + "."));
  111007. this.tech_.setCurrentTime(seekTo);
  111008. return true;
  111009. }
  111010. var sourceUpdater = this.masterPlaylistController_.sourceUpdater_;
  111011. var buffered = this.tech_.buffered();
  111012. var audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  111013. var videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  111014. var media = this.media();
  111015. var minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2;
  111016. var bufferedToCheck = [audioBuffered, videoBuffered];
  111017. for (var i2 = 0; i2 < bufferedToCheck.length; i2++) {
  111018. if (!bufferedToCheck[i2]) {
  111019. continue;
  111020. }
  111021. var timeAhead = timeAheadOf(bufferedToCheck[i2], currentTime);
  111022. if (timeAhead < minAppendedDuration) {
  111023. return false;
  111024. }
  111025. }
  111026. var nextRange = findNextRange(buffered, currentTime);
  111027. if (nextRange.length === 0) {
  111028. return false;
  111029. }
  111030. seekTo = nextRange.start(0) + SAFE_TIME_DELTA;
  111031. this.logger_("Buffered region starts (" + nextRange.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + "."));
  111032. this.tech_.setCurrentTime(seekTo);
  111033. return true;
  111034. };
  111035. _proto.waiting_ = function waiting_() {
  111036. if (this.techWaiting_()) {
  111037. return;
  111038. }
  111039. var currentTime = this.tech_.currentTime();
  111040. var buffered = this.tech_.buffered();
  111041. var currentRange = findRange(buffered, currentTime);
  111042. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  111043. this.cancelTimer_();
  111044. this.tech_.setCurrentTime(currentTime);
  111045. 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.");
  111046. this.tech_.trigger({
  111047. type: "usage",
  111048. name: "vhs-unknown-waiting"
  111049. });
  111050. this.tech_.trigger({
  111051. type: "usage",
  111052. name: "hls-unknown-waiting"
  111053. });
  111054. return;
  111055. }
  111056. };
  111057. _proto.techWaiting_ = function techWaiting_() {
  111058. var seekable3 = this.seekable();
  111059. var currentTime = this.tech_.currentTime();
  111060. if (this.tech_.seeking() || this.timer_ !== null) {
  111061. return true;
  111062. }
  111063. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  111064. var livePoint = seekable3.end(seekable3.length - 1);
  111065. this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint));
  111066. this.cancelTimer_();
  111067. this.tech_.setCurrentTime(livePoint);
  111068. this.tech_.trigger({
  111069. type: "usage",
  111070. name: "vhs-live-resync"
  111071. });
  111072. this.tech_.trigger({
  111073. type: "usage",
  111074. name: "hls-live-resync"
  111075. });
  111076. return true;
  111077. }
  111078. var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_;
  111079. var buffered = this.tech_.buffered();
  111080. var videoUnderflow = this.videoUnderflow_({
  111081. audioBuffered: sourceUpdater.audioBuffered(),
  111082. videoBuffered: sourceUpdater.videoBuffered(),
  111083. currentTime
  111084. });
  111085. if (videoUnderflow) {
  111086. this.cancelTimer_();
  111087. this.tech_.setCurrentTime(currentTime);
  111088. this.tech_.trigger({
  111089. type: "usage",
  111090. name: "vhs-video-underflow"
  111091. });
  111092. this.tech_.trigger({
  111093. type: "usage",
  111094. name: "hls-video-underflow"
  111095. });
  111096. return true;
  111097. }
  111098. var nextRange = findNextRange(buffered, currentTime);
  111099. if (nextRange.length > 0) {
  111100. var difference = nextRange.start(0) - currentTime;
  111101. this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0)));
  111102. this.cancelTimer_();
  111103. this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1e3, currentTime);
  111104. return true;
  111105. }
  111106. return false;
  111107. };
  111108. _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) {
  111109. if (allowSeeksWithinUnsafeLiveWindow === void 0) {
  111110. allowSeeksWithinUnsafeLiveWindow = false;
  111111. }
  111112. if (!seekable3.length) {
  111113. return false;
  111114. }
  111115. var allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA;
  111116. var isLive = !playlist.endList;
  111117. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  111118. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  111119. }
  111120. if (currentTime > allowedEnd) {
  111121. return true;
  111122. }
  111123. return false;
  111124. };
  111125. _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable3, currentTime) {
  111126. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  111127. return true;
  111128. }
  111129. return false;
  111130. };
  111131. _proto.videoUnderflow_ = function videoUnderflow_(_ref) {
  111132. var videoBuffered = _ref.videoBuffered, audioBuffered = _ref.audioBuffered, currentTime = _ref.currentTime;
  111133. if (!videoBuffered) {
  111134. return;
  111135. }
  111136. var gap;
  111137. if (videoBuffered.length && audioBuffered.length) {
  111138. var lastVideoRange = findRange(videoBuffered, currentTime - 3);
  111139. var videoRange = findRange(videoBuffered, currentTime);
  111140. var audioRange = findRange(audioBuffered, currentTime);
  111141. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  111142. gap = {
  111143. start: lastVideoRange.end(0),
  111144. end: audioRange.end(0)
  111145. };
  111146. }
  111147. } else {
  111148. var nextRange = findNextRange(videoBuffered, currentTime);
  111149. if (!nextRange.length) {
  111150. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  111151. }
  111152. }
  111153. if (gap) {
  111154. this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime));
  111155. return true;
  111156. }
  111157. return false;
  111158. };
  111159. _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) {
  111160. var buffered = this.tech_.buffered();
  111161. var currentTime = this.tech_.currentTime();
  111162. var nextRange = findNextRange(buffered, currentTime);
  111163. this.cancelTimer_();
  111164. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  111165. return;
  111166. }
  111167. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  111168. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);
  111169. this.tech_.trigger({
  111170. type: "usage",
  111171. name: "vhs-gap-skip"
  111172. });
  111173. this.tech_.trigger({
  111174. type: "usage",
  111175. name: "hls-gap-skip"
  111176. });
  111177. };
  111178. _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) {
  111179. var gaps = findGaps(buffered);
  111180. for (var i2 = 0; i2 < gaps.length; i2++) {
  111181. var start2 = gaps.start(i2);
  111182. var end = gaps.end(i2);
  111183. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  111184. return {
  111185. start: start2,
  111186. end
  111187. };
  111188. }
  111189. }
  111190. return null;
  111191. };
  111192. return PlaybackWatcher2;
  111193. }();
  111194. var defaultOptions = {
  111195. errorInterval: 30,
  111196. getSource: function getSource(next) {
  111197. var tech = this.tech({
  111198. IWillNotUseThisInPlugins: true
  111199. });
  111200. var sourceObj = tech.currentSource_ || this.currentSource();
  111201. return next(sourceObj);
  111202. }
  111203. };
  111204. var initPlugin = function initPlugin2(player, options2) {
  111205. var lastCalled = 0;
  111206. var seekTo = 0;
  111207. var localOptions = videojs.mergeOptions(defaultOptions, options2);
  111208. player.ready(function() {
  111209. player.trigger({
  111210. type: "usage",
  111211. name: "vhs-error-reload-initialized"
  111212. });
  111213. player.trigger({
  111214. type: "usage",
  111215. name: "hls-error-reload-initialized"
  111216. });
  111217. });
  111218. var loadedMetadataHandler = function loadedMetadataHandler2() {
  111219. if (seekTo) {
  111220. player.currentTime(seekTo);
  111221. }
  111222. };
  111223. var setSource2 = function setSource3(sourceObj) {
  111224. if (sourceObj === null || sourceObj === void 0) {
  111225. return;
  111226. }
  111227. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  111228. player.one("loadedmetadata", loadedMetadataHandler);
  111229. player.src(sourceObj);
  111230. player.trigger({
  111231. type: "usage",
  111232. name: "vhs-error-reload"
  111233. });
  111234. player.trigger({
  111235. type: "usage",
  111236. name: "hls-error-reload"
  111237. });
  111238. player.play();
  111239. };
  111240. var errorHandler = function errorHandler2() {
  111241. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  111242. player.trigger({
  111243. type: "usage",
  111244. name: "vhs-error-reload-canceled"
  111245. });
  111246. player.trigger({
  111247. type: "usage",
  111248. name: "hls-error-reload-canceled"
  111249. });
  111250. return;
  111251. }
  111252. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  111253. videojs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  111254. return;
  111255. }
  111256. lastCalled = Date.now();
  111257. return localOptions.getSource.call(player, setSource2);
  111258. };
  111259. var cleanupEvents = function cleanupEvents2() {
  111260. player.off("loadedmetadata", loadedMetadataHandler);
  111261. player.off("error", errorHandler);
  111262. player.off("dispose", cleanupEvents2);
  111263. };
  111264. var reinitPlugin = function reinitPlugin2(newOptions) {
  111265. cleanupEvents();
  111266. initPlugin2(player, newOptions);
  111267. };
  111268. player.on("error", errorHandler);
  111269. player.on("dispose", cleanupEvents);
  111270. player.reloadSourceOnError = reinitPlugin;
  111271. };
  111272. var reloadSourceOnError = function reloadSourceOnError2(options2) {
  111273. initPlugin(this, options2);
  111274. };
  111275. var version$4 = "2.16.2";
  111276. var version$3 = "6.0.1";
  111277. var version$2 = "0.22.1";
  111278. var version$1$1 = "4.8.0";
  111279. var version$6 = "3.1.3";
  111280. var Vhs = {
  111281. PlaylistLoader,
  111282. Playlist,
  111283. utils,
  111284. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,
  111285. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,
  111286. lastBandwidthSelector,
  111287. movingAverageBandwidthSelector,
  111288. comparePlaylistBandwidth,
  111289. comparePlaylistResolution,
  111290. xhr: xhrFactory()
  111291. };
  111292. Object.keys(Config).forEach(function(prop) {
  111293. Object.defineProperty(Vhs, prop, {
  111294. get: function get7() {
  111295. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111296. return Config[prop];
  111297. },
  111298. set: function set4(value) {
  111299. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111300. if (typeof value !== "number" || value < 0) {
  111301. videojs.log.warn("value of Vhs." + prop + " must be greater than or equal to 0");
  111302. return;
  111303. }
  111304. Config[prop] = value;
  111305. }
  111306. });
  111307. });
  111308. var LOCAL_STORAGE_KEY = "videojs-vhs";
  111309. var handleVhsMediaChange = function handleVhsMediaChange2(qualityLevels2, playlistLoader) {
  111310. var newPlaylist = playlistLoader.media();
  111311. var selectedIndex = -1;
  111312. for (var i2 = 0; i2 < qualityLevels2.length; i2++) {
  111313. if (qualityLevels2[i2].id === newPlaylist.id) {
  111314. selectedIndex = i2;
  111315. break;
  111316. }
  111317. }
  111318. qualityLevels2.selectedIndex_ = selectedIndex;
  111319. qualityLevels2.trigger({
  111320. selectedIndex,
  111321. type: "change"
  111322. });
  111323. };
  111324. var handleVhsLoadedMetadata = function handleVhsLoadedMetadata2(qualityLevels2, vhs) {
  111325. vhs.representations().forEach(function(rep2) {
  111326. qualityLevels2.addQualityLevel(rep2);
  111327. });
  111328. handleVhsMediaChange(qualityLevels2, vhs.playlists);
  111329. };
  111330. Vhs.canPlaySource = function() {
  111331. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111332. };
  111333. var emeKeySystems = function emeKeySystems2(keySystemOptions, mainPlaylist, audioPlaylist) {
  111334. if (!keySystemOptions) {
  111335. return keySystemOptions;
  111336. }
  111337. var codecs = {};
  111338. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  111339. codecs = unwrapCodecList(parseCodecs2(mainPlaylist.attributes.CODECS));
  111340. }
  111341. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  111342. codecs.audio = audioPlaylist.attributes.CODECS;
  111343. }
  111344. var videoContentType = getMimeForCodec2(codecs.video);
  111345. var audioContentType = getMimeForCodec2(codecs.audio);
  111346. var keySystemContentTypes = {};
  111347. for (var keySystem in keySystemOptions) {
  111348. keySystemContentTypes[keySystem] = {};
  111349. if (audioContentType) {
  111350. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  111351. }
  111352. if (videoContentType) {
  111353. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  111354. }
  111355. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  111356. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  111357. }
  111358. if (typeof keySystemOptions[keySystem] === "string") {
  111359. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  111360. }
  111361. }
  111362. return videojs.mergeOptions(keySystemOptions, keySystemContentTypes);
  111363. };
  111364. var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions2(playlists, keySystems) {
  111365. return playlists.reduce(function(keySystemsArr, playlist) {
  111366. if (!playlist.contentProtection) {
  111367. return keySystemsArr;
  111368. }
  111369. var keySystemsOptions = keySystems.reduce(function(keySystemsObj, keySystem) {
  111370. var keySystemOptions = playlist.contentProtection[keySystem];
  111371. if (keySystemOptions && keySystemOptions.pssh) {
  111372. keySystemsObj[keySystem] = {
  111373. pssh: keySystemOptions.pssh
  111374. };
  111375. }
  111376. return keySystemsObj;
  111377. }, {});
  111378. if (Object.keys(keySystemsOptions).length) {
  111379. keySystemsArr.push(keySystemsOptions);
  111380. }
  111381. return keySystemsArr;
  111382. }, []);
  111383. };
  111384. var waitForKeySessionCreation = function waitForKeySessionCreation2(_ref) {
  111385. var player = _ref.player, sourceKeySystems = _ref.sourceKeySystems, audioMedia = _ref.audioMedia, mainPlaylists = _ref.mainPlaylists;
  111386. if (!player.eme.initializeMediaKeys) {
  111387. return Promise.resolve();
  111388. }
  111389. var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  111390. var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));
  111391. var initializationFinishedPromises = [];
  111392. var keySessionCreatedPromises = [];
  111393. keySystemsOptionsArr.forEach(function(keySystemsOptions) {
  111394. keySessionCreatedPromises.push(new Promise(function(resolve2, reject2) {
  111395. player.tech_.one("keysessioncreated", resolve2);
  111396. }));
  111397. initializationFinishedPromises.push(new Promise(function(resolve2, reject2) {
  111398. player.eme.initializeMediaKeys({
  111399. keySystems: keySystemsOptions
  111400. }, function(err) {
  111401. if (err) {
  111402. reject2(err);
  111403. return;
  111404. }
  111405. resolve2();
  111406. });
  111407. }));
  111408. });
  111409. return Promise.race([
  111410. Promise.all(initializationFinishedPromises),
  111411. Promise.race(keySessionCreatedPromises)
  111412. ]);
  111413. };
  111414. var setupEmeOptions = function setupEmeOptions2(_ref2) {
  111415. var player = _ref2.player, sourceKeySystems = _ref2.sourceKeySystems, media = _ref2.media, audioMedia = _ref2.audioMedia;
  111416. var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);
  111417. if (!sourceOptions) {
  111418. return false;
  111419. }
  111420. player.currentSource().keySystems = sourceOptions;
  111421. if (sourceOptions && !player.eme) {
  111422. videojs.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  111423. return false;
  111424. }
  111425. return true;
  111426. };
  111427. var getVhsLocalStorage = function getVhsLocalStorage2() {
  111428. if (!window_1.localStorage) {
  111429. return null;
  111430. }
  111431. var storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY);
  111432. if (!storedObject) {
  111433. return null;
  111434. }
  111435. try {
  111436. return JSON.parse(storedObject);
  111437. } catch (e) {
  111438. return null;
  111439. }
  111440. };
  111441. var updateVhsLocalStorage = function updateVhsLocalStorage2(options2) {
  111442. if (!window_1.localStorage) {
  111443. return false;
  111444. }
  111445. var objectToStore = getVhsLocalStorage();
  111446. objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options2) : options2;
  111447. try {
  111448. window_1.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));
  111449. } catch (e) {
  111450. return false;
  111451. }
  111452. return objectToStore;
  111453. };
  111454. var expandDataUri = function expandDataUri2(dataUri) {
  111455. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  111456. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  111457. }
  111458. return dataUri;
  111459. };
  111460. Vhs.supportsNativeHls = function() {
  111461. if (!document_1 || !document_1.createElement) {
  111462. return false;
  111463. }
  111464. var video = document_1.createElement("video");
  111465. if (!videojs.getTech("Html5").isSupported()) {
  111466. return false;
  111467. }
  111468. var canPlay = [
  111469. "application/vnd.apple.mpegurl",
  111470. "audio/mpegurl",
  111471. "audio/x-mpegurl",
  111472. "application/x-mpegurl",
  111473. "video/x-mpegurl",
  111474. "video/mpegurl",
  111475. "application/mpegurl"
  111476. ];
  111477. return canPlay.some(function(canItPlay) {
  111478. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  111479. });
  111480. }();
  111481. Vhs.supportsNativeDash = function() {
  111482. if (!document_1 || !document_1.createElement || !videojs.getTech("Html5").isSupported()) {
  111483. return false;
  111484. }
  111485. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  111486. }();
  111487. Vhs.supportsTypeNatively = function(type2) {
  111488. if (type2 === "hls") {
  111489. return Vhs.supportsNativeHls;
  111490. }
  111491. if (type2 === "dash") {
  111492. return Vhs.supportsNativeDash;
  111493. }
  111494. return false;
  111495. };
  111496. Vhs.isSupported = function() {
  111497. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111498. };
  111499. var Component = videojs.getComponent("Component");
  111500. var VhsHandler = /* @__PURE__ */ function(_Component) {
  111501. _inheritsLoose(VhsHandler2, _Component);
  111502. function VhsHandler2(source, tech, options2) {
  111503. var _this;
  111504. _this = _Component.call(this, tech, videojs.mergeOptions(options2.hls, options2.vhs)) || this;
  111505. if (options2.hls && Object.keys(options2.hls).length) {
  111506. videojs.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.");
  111507. }
  111508. if (typeof options2.initialBandwidth === "number") {
  111509. _this.options_.bandwidth = options2.initialBandwidth;
  111510. }
  111511. _this.logger_ = logger("VhsHandler");
  111512. if (tech.options_ && tech.options_.playerId) {
  111513. var _player = videojs(tech.options_.playerId);
  111514. if (!_player.hasOwnProperty("hls")) {
  111515. Object.defineProperty(_player, "hls", {
  111516. get: function get7() {
  111517. videojs.log.warn("player.hls is deprecated. Use player.tech().vhs instead.");
  111518. tech.trigger({
  111519. type: "usage",
  111520. name: "hls-player-access"
  111521. });
  111522. return _assertThisInitialized(_this);
  111523. },
  111524. configurable: true
  111525. });
  111526. }
  111527. if (!_player.hasOwnProperty("vhs")) {
  111528. Object.defineProperty(_player, "vhs", {
  111529. get: function get7() {
  111530. videojs.log.warn("player.vhs is deprecated. Use player.tech().vhs instead.");
  111531. tech.trigger({
  111532. type: "usage",
  111533. name: "vhs-player-access"
  111534. });
  111535. return _assertThisInitialized(_this);
  111536. },
  111537. configurable: true
  111538. });
  111539. }
  111540. if (!_player.hasOwnProperty("dash")) {
  111541. Object.defineProperty(_player, "dash", {
  111542. get: function get7() {
  111543. videojs.log.warn("player.dash is deprecated. Use player.tech().vhs instead.");
  111544. return _assertThisInitialized(_this);
  111545. },
  111546. configurable: true
  111547. });
  111548. }
  111549. _this.player_ = _player;
  111550. }
  111551. _this.tech_ = tech;
  111552. _this.source_ = source;
  111553. _this.stats = {};
  111554. _this.ignoreNextSeekingEvent_ = false;
  111555. _this.setOptions_();
  111556. if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  111557. tech.overrideNativeAudioTracks(true);
  111558. tech.overrideNativeVideoTracks(true);
  111559. } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  111560. throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
  111561. }
  111562. _this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], function(event2) {
  111563. var fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  111564. if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) {
  111565. _this.masterPlaylistController_.fastQualityChange_();
  111566. } else {
  111567. _this.masterPlaylistController_.checkABR_();
  111568. }
  111569. });
  111570. _this.on(_this.tech_, "seeking", function() {
  111571. if (this.ignoreNextSeekingEvent_) {
  111572. this.ignoreNextSeekingEvent_ = false;
  111573. return;
  111574. }
  111575. this.setCurrentTime(this.tech_.currentTime());
  111576. });
  111577. _this.on(_this.tech_, "error", function() {
  111578. if (this.tech_.error() && this.masterPlaylistController_) {
  111579. this.masterPlaylistController_.pauseLoading();
  111580. }
  111581. });
  111582. _this.on(_this.tech_, "play", _this.play);
  111583. return _this;
  111584. }
  111585. var _proto = VhsHandler2.prototype;
  111586. _proto.setOptions_ = function setOptions_() {
  111587. var _this2 = this;
  111588. this.options_.withCredentials = this.options_.withCredentials || false;
  111589. this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true;
  111590. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  111591. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  111592. this.options_.smoothQualityChange = this.options_.smoothQualityChange || false;
  111593. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  111594. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  111595. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  111596. this.options_.customTagParsers = this.options_.customTagParsers || [];
  111597. this.options_.customTagMappers = this.options_.customTagMappers || [];
  111598. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  111599. if (typeof this.options_.blacklistDuration !== "number") {
  111600. this.options_.blacklistDuration = 5 * 60;
  111601. }
  111602. if (typeof this.options_.bandwidth !== "number") {
  111603. if (this.options_.useBandwidthFromLocalStorage) {
  111604. var storedObject = getVhsLocalStorage();
  111605. if (storedObject && storedObject.bandwidth) {
  111606. this.options_.bandwidth = storedObject.bandwidth;
  111607. this.tech_.trigger({
  111608. type: "usage",
  111609. name: "vhs-bandwidth-from-local-storage"
  111610. });
  111611. this.tech_.trigger({
  111612. type: "usage",
  111613. name: "hls-bandwidth-from-local-storage"
  111614. });
  111615. }
  111616. if (storedObject && storedObject.throughput) {
  111617. this.options_.throughput = storedObject.throughput;
  111618. this.tech_.trigger({
  111619. type: "usage",
  111620. name: "vhs-throughput-from-local-storage"
  111621. });
  111622. this.tech_.trigger({
  111623. type: "usage",
  111624. name: "hls-throughput-from-local-storage"
  111625. });
  111626. }
  111627. }
  111628. }
  111629. if (typeof this.options_.bandwidth !== "number") {
  111630. this.options_.bandwidth = Config.INITIAL_BANDWIDTH;
  111631. }
  111632. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH;
  111633. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "smoothQualityChange", "customTagParsers", "customTagMappers", "handleManifestRedirects", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "experimentalBufferBasedABR", "liveRangeSafeTimeDelta", "experimentalLLHLS", "useNetworkInformationApi", "useDtsForTimestampOffset", "experimentalExactManifestTimings", "experimentalLeastPixelDiffSelector"].forEach(function(option) {
  111634. if (typeof _this2.source_[option] !== "undefined") {
  111635. _this2.options_[option] = _this2.source_[option];
  111636. }
  111637. });
  111638. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  111639. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  111640. };
  111641. _proto.src = function src(_src, type2) {
  111642. var _this3 = this;
  111643. if (!_src) {
  111644. return;
  111645. }
  111646. this.setOptions_();
  111647. this.options_.src = expandDataUri(this.source_.src);
  111648. this.options_.tech = this.tech_;
  111649. this.options_.externVhs = Vhs;
  111650. this.options_.sourceType = simpleTypeFromSourceType2(type2);
  111651. this.options_.seekTo = function(time) {
  111652. _this3.tech_.setCurrentTime(time);
  111653. };
  111654. if (this.options_.smoothQualityChange) {
  111655. videojs.log.warn("smoothQualityChange is deprecated and will be removed in the next major version");
  111656. }
  111657. this.masterPlaylistController_ = new MasterPlaylistController(this.options_);
  111658. var playbackWatcherOptions = videojs.mergeOptions({
  111659. liveRangeSafeTimeDelta: SAFE_TIME_DELTA
  111660. }, this.options_, {
  111661. seekable: function seekable3() {
  111662. return _this3.seekable();
  111663. },
  111664. media: function media() {
  111665. return _this3.masterPlaylistController_.media();
  111666. },
  111667. masterPlaylistController: this.masterPlaylistController_
  111668. });
  111669. this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);
  111670. this.masterPlaylistController_.on("error", function() {
  111671. var player = videojs.players[_this3.tech_.options_.playerId];
  111672. var error = _this3.masterPlaylistController_.error;
  111673. if (typeof error === "object" && !error.code) {
  111674. error.code = 3;
  111675. } else if (typeof error === "string") {
  111676. error = {
  111677. message: error,
  111678. code: 3
  111679. };
  111680. }
  111681. player.error(error);
  111682. });
  111683. var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR;
  111684. this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  111685. this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this);
  111686. this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;
  111687. this.mediaSource = this.masterPlaylistController_.mediaSource;
  111688. Object.defineProperties(this, {
  111689. selectPlaylist: {
  111690. get: function get7() {
  111691. return this.masterPlaylistController_.selectPlaylist;
  111692. },
  111693. set: function set4(selectPlaylist) {
  111694. this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this);
  111695. }
  111696. },
  111697. throughput: {
  111698. get: function get7() {
  111699. return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate;
  111700. },
  111701. set: function set4(throughput) {
  111702. this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput;
  111703. this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1;
  111704. }
  111705. },
  111706. bandwidth: {
  111707. get: function get7() {
  111708. var playerBandwidthEst = this.masterPlaylistController_.mainSegmentLoader_.bandwidth;
  111709. var networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  111710. var tenMbpsAsBitsPerSecond = 1e7;
  111711. if (this.options_.useNetworkInformationApi && networkInformation) {
  111712. var networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  111713. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  111714. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  111715. } else {
  111716. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  111717. }
  111718. }
  111719. return playerBandwidthEst;
  111720. },
  111721. set: function set4(bandwidth2) {
  111722. this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  111723. this.masterPlaylistController_.mainSegmentLoader_.throughput = {
  111724. rate: 0,
  111725. count: 0
  111726. };
  111727. }
  111728. },
  111729. systemBandwidth: {
  111730. get: function get7() {
  111731. var invBandwidth = 1 / (this.bandwidth || 1);
  111732. var invThroughput;
  111733. if (this.throughput > 0) {
  111734. invThroughput = 1 / this.throughput;
  111735. } else {
  111736. invThroughput = 0;
  111737. }
  111738. var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  111739. return systemBitrate;
  111740. },
  111741. set: function set4() {
  111742. videojs.log.error('The "systemBandwidth" property is read-only');
  111743. }
  111744. }
  111745. });
  111746. if (this.options_.bandwidth) {
  111747. this.bandwidth = this.options_.bandwidth;
  111748. }
  111749. if (this.options_.throughput) {
  111750. this.throughput = this.options_.throughput;
  111751. }
  111752. Object.defineProperties(this.stats, {
  111753. bandwidth: {
  111754. get: function get7() {
  111755. return _this3.bandwidth || 0;
  111756. },
  111757. enumerable: true
  111758. },
  111759. mediaRequests: {
  111760. get: function get7() {
  111761. return _this3.masterPlaylistController_.mediaRequests_() || 0;
  111762. },
  111763. enumerable: true
  111764. },
  111765. mediaRequestsAborted: {
  111766. get: function get7() {
  111767. return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0;
  111768. },
  111769. enumerable: true
  111770. },
  111771. mediaRequestsTimedout: {
  111772. get: function get7() {
  111773. return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0;
  111774. },
  111775. enumerable: true
  111776. },
  111777. mediaRequestsErrored: {
  111778. get: function get7() {
  111779. return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0;
  111780. },
  111781. enumerable: true
  111782. },
  111783. mediaTransferDuration: {
  111784. get: function get7() {
  111785. return _this3.masterPlaylistController_.mediaTransferDuration_() || 0;
  111786. },
  111787. enumerable: true
  111788. },
  111789. mediaBytesTransferred: {
  111790. get: function get7() {
  111791. return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0;
  111792. },
  111793. enumerable: true
  111794. },
  111795. mediaSecondsLoaded: {
  111796. get: function get7() {
  111797. return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0;
  111798. },
  111799. enumerable: true
  111800. },
  111801. mediaAppends: {
  111802. get: function get7() {
  111803. return _this3.masterPlaylistController_.mediaAppends_() || 0;
  111804. },
  111805. enumerable: true
  111806. },
  111807. mainAppendsToLoadedData: {
  111808. get: function get7() {
  111809. return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0;
  111810. },
  111811. enumerable: true
  111812. },
  111813. audioAppendsToLoadedData: {
  111814. get: function get7() {
  111815. return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0;
  111816. },
  111817. enumerable: true
  111818. },
  111819. appendsToLoadedData: {
  111820. get: function get7() {
  111821. return _this3.masterPlaylistController_.appendsToLoadedData_() || 0;
  111822. },
  111823. enumerable: true
  111824. },
  111825. timeToLoadedData: {
  111826. get: function get7() {
  111827. return _this3.masterPlaylistController_.timeToLoadedData_() || 0;
  111828. },
  111829. enumerable: true
  111830. },
  111831. buffered: {
  111832. get: function get7() {
  111833. return timeRangesToArray(_this3.tech_.buffered());
  111834. },
  111835. enumerable: true
  111836. },
  111837. currentTime: {
  111838. get: function get7() {
  111839. return _this3.tech_.currentTime();
  111840. },
  111841. enumerable: true
  111842. },
  111843. currentSource: {
  111844. get: function get7() {
  111845. return _this3.tech_.currentSource_;
  111846. },
  111847. enumerable: true
  111848. },
  111849. currentTech: {
  111850. get: function get7() {
  111851. return _this3.tech_.name_;
  111852. },
  111853. enumerable: true
  111854. },
  111855. duration: {
  111856. get: function get7() {
  111857. return _this3.tech_.duration();
  111858. },
  111859. enumerable: true
  111860. },
  111861. master: {
  111862. get: function get7() {
  111863. return _this3.playlists.master;
  111864. },
  111865. enumerable: true
  111866. },
  111867. playerDimensions: {
  111868. get: function get7() {
  111869. return _this3.tech_.currentDimensions();
  111870. },
  111871. enumerable: true
  111872. },
  111873. seekable: {
  111874. get: function get7() {
  111875. return timeRangesToArray(_this3.tech_.seekable());
  111876. },
  111877. enumerable: true
  111878. },
  111879. timestamp: {
  111880. get: function get7() {
  111881. return Date.now();
  111882. },
  111883. enumerable: true
  111884. },
  111885. videoPlaybackQuality: {
  111886. get: function get7() {
  111887. return _this3.tech_.getVideoPlaybackQuality();
  111888. },
  111889. enumerable: true
  111890. }
  111891. });
  111892. this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));
  111893. this.tech_.on("bandwidthupdate", function() {
  111894. if (_this3.options_.useBandwidthFromLocalStorage) {
  111895. updateVhsLocalStorage({
  111896. bandwidth: _this3.bandwidth,
  111897. throughput: Math.round(_this3.throughput)
  111898. });
  111899. }
  111900. });
  111901. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  111902. renditionSelectionMixin(_this3);
  111903. });
  111904. this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers", function() {
  111905. _this3.setupEme_();
  111906. });
  111907. this.on(this.masterPlaylistController_, "progress", function() {
  111908. this.tech_.trigger("progress");
  111909. });
  111910. this.on(this.masterPlaylistController_, "firstplay", function() {
  111911. this.ignoreNextSeekingEvent_ = true;
  111912. });
  111913. this.setupQualityLevels_();
  111914. if (!this.tech_.el()) {
  111915. return;
  111916. }
  111917. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.masterPlaylistController_.mediaSource);
  111918. this.tech_.src(this.mediaSourceUrl_);
  111919. };
  111920. _proto.createKeySessions_ = function createKeySessions_() {
  111921. var _this4 = this;
  111922. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111923. this.logger_("waiting for EME key session creation");
  111924. waitForKeySessionCreation({
  111925. player: this.player_,
  111926. sourceKeySystems: this.source_.keySystems,
  111927. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  111928. mainPlaylists: this.playlists.master.playlists
  111929. }).then(function() {
  111930. _this4.logger_("created EME key session");
  111931. _this4.masterPlaylistController_.sourceUpdater_.initializedEme();
  111932. })["catch"](function(err) {
  111933. _this4.logger_("error while creating EME key session", err);
  111934. _this4.player_.error({
  111935. message: "Failed to initialize media keys for EME",
  111936. code: 3
  111937. });
  111938. });
  111939. };
  111940. _proto.handleWaitingForKey_ = function handleWaitingForKey_() {
  111941. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  111942. this.createKeySessions_();
  111943. };
  111944. _proto.setupEme_ = function setupEme_() {
  111945. var _this5 = this;
  111946. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111947. var didSetupEmeOptions = setupEmeOptions({
  111948. player: this.player_,
  111949. sourceKeySystems: this.source_.keySystems,
  111950. media: this.playlists.media(),
  111951. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  111952. });
  111953. this.player_.tech_.on("keystatuschange", function(e) {
  111954. if (e.status !== "output-restricted") {
  111955. return;
  111956. }
  111957. var masterPlaylist = _this5.masterPlaylistController_.master();
  111958. if (!masterPlaylist || !masterPlaylist.playlists) {
  111959. return;
  111960. }
  111961. var excludedHDPlaylists = [];
  111962. masterPlaylist.playlists.forEach(function(playlist) {
  111963. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  111964. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  111965. playlist.excludeUntil = Infinity;
  111966. excludedHDPlaylists.push(playlist);
  111967. }
  111968. }
  111969. });
  111970. if (excludedHDPlaylists.length) {
  111971. var _videojs$log;
  111972. (_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));
  111973. _this5.masterPlaylistController_.fastQualityChange_();
  111974. }
  111975. });
  111976. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  111977. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  111978. if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  111979. this.masterPlaylistController_.sourceUpdater_.initializedEme();
  111980. return;
  111981. }
  111982. this.createKeySessions_();
  111983. };
  111984. _proto.setupQualityLevels_ = function setupQualityLevels_() {
  111985. var _this6 = this;
  111986. var player = videojs.players[this.tech_.options_.playerId];
  111987. if (!player || !player.qualityLevels || this.qualityLevels_) {
  111988. return;
  111989. }
  111990. this.qualityLevels_ = player.qualityLevels();
  111991. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  111992. handleVhsLoadedMetadata(_this6.qualityLevels_, _this6);
  111993. });
  111994. this.playlists.on("mediachange", function() {
  111995. handleVhsMediaChange(_this6.qualityLevels_, _this6.playlists);
  111996. });
  111997. };
  111998. VhsHandler2.version = function version$52() {
  111999. return {
  112000. "@videojs/http-streaming": version$4,
  112001. "mux.js": version$3,
  112002. "mpd-parser": version$2,
  112003. "m3u8-parser": version$1$1,
  112004. "aes-decrypter": version$6
  112005. };
  112006. };
  112007. _proto.version = function version2() {
  112008. return this.constructor.version();
  112009. };
  112010. _proto.canChangeType = function canChangeType() {
  112011. return SourceUpdater.canChangeType();
  112012. };
  112013. _proto.play = function play() {
  112014. this.masterPlaylistController_.play();
  112015. };
  112016. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  112017. this.masterPlaylistController_.setCurrentTime(currentTime);
  112018. };
  112019. _proto.duration = function duration5() {
  112020. return this.masterPlaylistController_.duration();
  112021. };
  112022. _proto.seekable = function seekable3() {
  112023. return this.masterPlaylistController_.seekable();
  112024. };
  112025. _proto.dispose = function dispose() {
  112026. if (this.playbackWatcher_) {
  112027. this.playbackWatcher_.dispose();
  112028. }
  112029. if (this.masterPlaylistController_) {
  112030. this.masterPlaylistController_.dispose();
  112031. }
  112032. if (this.qualityLevels_) {
  112033. this.qualityLevels_.dispose();
  112034. }
  112035. if (this.player_) {
  112036. delete this.player_.vhs;
  112037. delete this.player_.dash;
  112038. delete this.player_.hls;
  112039. }
  112040. if (this.tech_ && this.tech_.vhs) {
  112041. delete this.tech_.vhs;
  112042. }
  112043. if (this.tech_) {
  112044. delete this.tech_.hls;
  112045. }
  112046. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  112047. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  112048. this.mediaSourceUrl_ = null;
  112049. }
  112050. if (this.tech_) {
  112051. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  112052. }
  112053. _Component.prototype.dispose.call(this);
  112054. };
  112055. _proto.convertToProgramTime = function convertToProgramTime(time, callback2) {
  112056. return getProgramTime({
  112057. playlist: this.masterPlaylistController_.media(),
  112058. time,
  112059. callback: callback2
  112060. });
  112061. };
  112062. _proto.seekToProgramTime = function seekToProgramTime$12(programTime, callback2, pauseAfterSeek, retryCount) {
  112063. if (pauseAfterSeek === void 0) {
  112064. pauseAfterSeek = true;
  112065. }
  112066. if (retryCount === void 0) {
  112067. retryCount = 2;
  112068. }
  112069. return seekToProgramTime({
  112070. programTime,
  112071. playlist: this.masterPlaylistController_.media(),
  112072. retryCount,
  112073. pauseAfterSeek,
  112074. seekTo: this.options_.seekTo,
  112075. tech: this.options_.tech,
  112076. callback: callback2
  112077. });
  112078. };
  112079. return VhsHandler2;
  112080. }(Component);
  112081. var VhsSourceHandler = {
  112082. name: "videojs-http-streaming",
  112083. VERSION: version$4,
  112084. canHandleSource: function canHandleSource(srcObj, options2) {
  112085. if (options2 === void 0) {
  112086. options2 = {};
  112087. }
  112088. var localOptions = videojs.mergeOptions(videojs.options, options2);
  112089. return VhsSourceHandler.canPlayType(srcObj.type, localOptions);
  112090. },
  112091. handleSource: function handleSource(source, tech, options2) {
  112092. if (options2 === void 0) {
  112093. options2 = {};
  112094. }
  112095. var localOptions = videojs.mergeOptions(videojs.options, options2);
  112096. tech.vhs = new VhsHandler(source, tech, localOptions);
  112097. if (!videojs.hasOwnProperty("hls")) {
  112098. Object.defineProperty(tech, "hls", {
  112099. get: function get7() {
  112100. videojs.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead.");
  112101. return tech.vhs;
  112102. },
  112103. configurable: true
  112104. });
  112105. }
  112106. tech.vhs.xhr = xhrFactory();
  112107. tech.vhs.src(source.src, source.type);
  112108. return tech.vhs;
  112109. },
  112110. canPlayType: function canPlayType2(type2, options2) {
  112111. var simpleType = simpleTypeFromSourceType2(type2);
  112112. if (!simpleType) {
  112113. return "";
  112114. }
  112115. var overrideNative = VhsSourceHandler.getOverrideNative(options2);
  112116. var supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);
  112117. var canUseMsePlayback = !supportsTypeNatively || overrideNative;
  112118. return canUseMsePlayback ? "maybe" : "";
  112119. },
  112120. getOverrideNative: function getOverrideNative(options2) {
  112121. if (options2 === void 0) {
  112122. options2 = {};
  112123. }
  112124. 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;
  112125. var defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);
  112126. var _vhs$overrideNative = vhs.overrideNative, overrideNative = _vhs$overrideNative === void 0 ? defaultOverrideNative : _vhs$overrideNative;
  112127. var _hls$overrideNative = hls.overrideNative, legacyOverrideNative = _hls$overrideNative === void 0 ? false : _hls$overrideNative;
  112128. return legacyOverrideNative || overrideNative;
  112129. }
  112130. };
  112131. var supportsNativeMediaSources = function supportsNativeMediaSources2() {
  112132. return browserSupportsCodec2("avc1.4d400d,mp4a.40.2");
  112133. };
  112134. if (supportsNativeMediaSources()) {
  112135. videojs.getTech("Html5").registerSourceHandler(VhsSourceHandler, 0);
  112136. }
  112137. videojs.VhsHandler = VhsHandler;
  112138. Object.defineProperty(videojs, "HlsHandler", {
  112139. get: function get4() {
  112140. videojs.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.");
  112141. return VhsHandler;
  112142. },
  112143. configurable: true
  112144. });
  112145. videojs.VhsSourceHandler = VhsSourceHandler;
  112146. Object.defineProperty(videojs, "HlsSourceHandler", {
  112147. get: function get5() {
  112148. videojs.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead.");
  112149. return VhsSourceHandler;
  112150. },
  112151. configurable: true
  112152. });
  112153. videojs.Vhs = Vhs;
  112154. Object.defineProperty(videojs, "Hls", {
  112155. get: function get6() {
  112156. videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead.");
  112157. return Vhs;
  112158. },
  112159. configurable: true
  112160. });
  112161. if (!videojs.use) {
  112162. videojs.registerComponent("Hls", Vhs);
  112163. videojs.registerComponent("Vhs", Vhs);
  112164. }
  112165. videojs.options.vhs = videojs.options.vhs || {};
  112166. videojs.options.hls = videojs.options.hls || {};
  112167. if (!videojs.getPlugin || !videojs.getPlugin("reloadSourceOnError")) {
  112168. var registerPlugin = videojs.registerPlugin || videojs.plugin;
  112169. registerPlugin("reloadSourceOnError", reloadSourceOnError);
  112170. }
  112171. const version = "5.4.2";
  112172. var version$1 = "2.2.1";
  112173. function FlashRtmpDecorator(Flash2) {
  112174. Flash2.streamingFormats = {
  112175. "rtmp/mp4": "MP4",
  112176. "rtmp/flv": "FLV"
  112177. };
  112178. Flash2.streamFromParts = function(connection, stream) {
  112179. return connection + "&" + stream;
  112180. };
  112181. Flash2.streamToParts = function(src) {
  112182. var parts = {
  112183. connection: "",
  112184. stream: ""
  112185. };
  112186. if (!src) {
  112187. return parts;
  112188. }
  112189. var connEnd = src.search(/&(?![\w-]+=)/);
  112190. var streamBegin = void 0;
  112191. if (connEnd !== -1) {
  112192. streamBegin = connEnd + 1;
  112193. } else {
  112194. connEnd = streamBegin = src.lastIndexOf("/") + 1;
  112195. if (connEnd === 0) {
  112196. connEnd = streamBegin = src.length;
  112197. }
  112198. }
  112199. parts.connection = src.substring(0, connEnd);
  112200. parts.stream = src.substring(streamBegin, src.length);
  112201. return parts;
  112202. };
  112203. Flash2.isStreamingType = function(srcType) {
  112204. return srcType in Flash2.streamingFormats;
  112205. };
  112206. Flash2.RTMP_RE = /^rtmp[set]?:\/\//i;
  112207. Flash2.isStreamingSrc = function(src) {
  112208. return Flash2.RTMP_RE.test(src);
  112209. };
  112210. Flash2.rtmpSourceHandler = {};
  112211. Flash2.rtmpSourceHandler.canPlayType = function(type2) {
  112212. if (Flash2.isStreamingType(type2)) {
  112213. return "maybe";
  112214. }
  112215. return "";
  112216. };
  112217. Flash2.rtmpSourceHandler.canHandleSource = function(source, options2) {
  112218. var can = Flash2.rtmpSourceHandler.canPlayType(source.type);
  112219. if (can) {
  112220. return can;
  112221. }
  112222. if (Flash2.isStreamingSrc(source.src)) {
  112223. return "maybe";
  112224. }
  112225. return "";
  112226. };
  112227. Flash2.rtmpSourceHandler.handleSource = function(source, tech, options2) {
  112228. var srcParts = Flash2.streamToParts(source.src);
  112229. tech.setRtmpConnection(srcParts.connection);
  112230. tech.setRtmpStream(srcParts.stream);
  112231. };
  112232. Flash2.registerSourceHandler(Flash2.rtmpSourceHandler);
  112233. return Flash2;
  112234. }
  112235. var classCallCheck = function(instance, Constructor) {
  112236. if (!(instance instanceof Constructor)) {
  112237. throw new TypeError("Cannot call a class as a function");
  112238. }
  112239. };
  112240. var inherits = function(subClass, superClass) {
  112241. if (typeof superClass !== "function" && superClass !== null) {
  112242. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  112243. }
  112244. subClass.prototype = Object.create(superClass && superClass.prototype, {
  112245. constructor: {
  112246. value: subClass,
  112247. enumerable: false,
  112248. writable: true,
  112249. configurable: true
  112250. }
  112251. });
  112252. if (superClass)
  112253. Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  112254. };
  112255. var possibleConstructorReturn = function(self2, call) {
  112256. if (!self2) {
  112257. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  112258. }
  112259. return call && (typeof call === "object" || typeof call === "function") ? call : self2;
  112260. };
  112261. var Tech = videojs.getComponent("Tech");
  112262. var Dom = videojs.dom;
  112263. var Url = videojs.url;
  112264. var createTimeRange = videojs.createTimeRange;
  112265. var mergeOptions$1 = videojs.mergeOptions;
  112266. var navigator$1 = window_1 && window_1.navigator || {};
  112267. var Flash = function(_Tech) {
  112268. inherits(Flash2, _Tech);
  112269. function Flash2(options2, ready) {
  112270. classCallCheck(this, Flash2);
  112271. var _this = possibleConstructorReturn(this, _Tech.call(this, options2, ready));
  112272. if (options2.source) {
  112273. _this.ready(function() {
  112274. this.setSource(options2.source);
  112275. }, true);
  112276. }
  112277. if (options2.startTime) {
  112278. _this.ready(function() {
  112279. this.load();
  112280. this.play();
  112281. this.currentTime(options2.startTime);
  112282. }, true);
  112283. }
  112284. window_1.videojs = window_1.videojs || {};
  112285. window_1.videojs.Flash = window_1.videojs.Flash || {};
  112286. window_1.videojs.Flash.onReady = Flash2.onReady;
  112287. window_1.videojs.Flash.onEvent = Flash2.onEvent;
  112288. window_1.videojs.Flash.onError = Flash2.onError;
  112289. _this.on("seeked", function() {
  112290. this.lastSeekTarget_ = void 0;
  112291. });
  112292. return _this;
  112293. }
  112294. Flash2.prototype.createEl = function createEl2() {
  112295. var options2 = this.options_;
  112296. if (!options2.swf) {
  112297. options2.swf = "https://vjs.zencdn.net/swf/" + version + "/video-js.swf";
  112298. }
  112299. var objId = options2.techId;
  112300. var flashVars = mergeOptions$1({
  112301. readyFunction: "videojs.Flash.onReady",
  112302. eventProxyFunction: "videojs.Flash.onEvent",
  112303. errorEventProxyFunction: "videojs.Flash.onError",
  112304. autoplay: options2.autoplay,
  112305. preload: options2.preload,
  112306. loop: options2.loop,
  112307. muted: options2.muted
  112308. }, options2.flashVars);
  112309. var params = mergeOptions$1({
  112310. wmode: "opaque",
  112311. bgcolor: "#000000"
  112312. }, options2.params);
  112313. var attributes = mergeOptions$1({
  112314. id: objId,
  112315. name: objId,
  112316. "class": "vjs-tech"
  112317. }, options2.attributes);
  112318. this.el_ = Flash2.embed(options2.swf, flashVars, params, attributes);
  112319. this.el_.tech = this;
  112320. return this.el_;
  112321. };
  112322. Flash2.prototype.play = function play() {
  112323. if (this.ended()) {
  112324. this.setCurrentTime(0);
  112325. }
  112326. this.el_.vjs_play();
  112327. };
  112328. Flash2.prototype.pause = function pause() {
  112329. this.el_.vjs_pause();
  112330. };
  112331. Flash2.prototype.src = function src(_src) {
  112332. if (_src === void 0) {
  112333. return this.currentSrc();
  112334. }
  112335. return this.setSrc(_src);
  112336. };
  112337. Flash2.prototype.setSrc = function setSrc(src) {
  112338. var _this2 = this;
  112339. src = Url.getAbsoluteURL(src);
  112340. this.el_.vjs_src(src);
  112341. if (this.autoplay()) {
  112342. this.setTimeout(function() {
  112343. return _this2.play();
  112344. }, 0);
  112345. }
  112346. };
  112347. Flash2.prototype.seeking = function seeking() {
  112348. return this.lastSeekTarget_ !== void 0;
  112349. };
  112350. Flash2.prototype.setCurrentTime = function setCurrentTime(time) {
  112351. var seekable3 = this.seekable();
  112352. if (seekable3.length) {
  112353. time = time > seekable3.start(0) ? time : seekable3.start(0);
  112354. time = time < seekable3.end(seekable3.length - 1) ? time : seekable3.end(seekable3.length - 1);
  112355. this.lastSeekTarget_ = time;
  112356. this.trigger("seeking");
  112357. this.el_.vjs_setProperty("currentTime", time);
  112358. _Tech.prototype.setCurrentTime.call(this);
  112359. }
  112360. };
  112361. Flash2.prototype.currentTime = function currentTime() {
  112362. if (this.seeking()) {
  112363. return this.lastSeekTarget_ || 0;
  112364. }
  112365. return this.el_.vjs_getProperty("currentTime");
  112366. };
  112367. Flash2.prototype.currentSrc = function currentSrc() {
  112368. if (this.currentSource_) {
  112369. return this.currentSource_.src;
  112370. }
  112371. return this.el_.vjs_getProperty("currentSrc");
  112372. };
  112373. Flash2.prototype.duration = function duration5() {
  112374. if (this.readyState() === 0) {
  112375. return NaN;
  112376. }
  112377. var duration6 = this.el_.vjs_getProperty("duration");
  112378. return duration6 >= 0 ? duration6 : Infinity;
  112379. };
  112380. Flash2.prototype.load = function load() {
  112381. this.el_.vjs_load();
  112382. };
  112383. Flash2.prototype.poster = function poster() {
  112384. this.el_.vjs_getProperty("poster");
  112385. };
  112386. Flash2.prototype.setPoster = function setPoster() {
  112387. };
  112388. Flash2.prototype.seekable = function seekable3() {
  112389. var duration5 = this.duration();
  112390. if (duration5 === 0) {
  112391. return createTimeRange();
  112392. }
  112393. return createTimeRange(0, duration5);
  112394. };
  112395. Flash2.prototype.buffered = function buffered() {
  112396. var ranges = this.el_.vjs_getProperty("buffered");
  112397. if (ranges.length === 0) {
  112398. return createTimeRange();
  112399. }
  112400. return createTimeRange(ranges[0][0], ranges[0][1]);
  112401. };
  112402. Flash2.prototype.supportsFullScreen = function supportsFullScreen() {
  112403. return false;
  112404. };
  112405. Flash2.prototype.enterFullScreen = function enterFullScreen() {
  112406. return false;
  112407. };
  112408. Flash2.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  112409. var videoPlaybackQuality = this.el_.vjs_getProperty("getVideoPlaybackQuality");
  112410. if (window_1.performance && typeof window_1.performance.now === "function") {
  112411. videoPlaybackQuality.creationTime = window_1.performance.now();
  112412. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  112413. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  112414. }
  112415. return videoPlaybackQuality;
  112416. };
  112417. return Flash2;
  112418. }(Tech);
  112419. var _readWrite = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "loop", "controls", "volume", "muted", "defaultMuted"];
  112420. var _readOnly = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth", "videoHeight"];
  112421. var _api = Flash.prototype;
  112422. function _createSetter(attr) {
  112423. var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
  112424. _api["set" + attrUpper] = function(val) {
  112425. return this.el_.vjs_setProperty(attr, val);
  112426. };
  112427. }
  112428. function _createGetter(attr) {
  112429. _api[attr] = function() {
  112430. return this.el_.vjs_getProperty(attr);
  112431. };
  112432. }
  112433. for (var i$1 = 0; i$1 < _readWrite.length; i$1++) {
  112434. _createGetter(_readWrite[i$1]);
  112435. _createSetter(_readWrite[i$1]);
  112436. }
  112437. for (var _i = 0; _i < _readOnly.length; _i++) {
  112438. _createGetter(_readOnly[_i]);
  112439. }
  112440. Flash.isSupported = function() {
  112441. 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) {
  112442. return true;
  112443. }
  112444. return Flash.version()[0] >= 10;
  112445. };
  112446. Tech.withSourceHandlers(Flash);
  112447. Flash.nativeSourceHandler = {};
  112448. Flash.nativeSourceHandler.canPlayType = function(type2) {
  112449. if (type2 in Flash.formats) {
  112450. return "maybe";
  112451. }
  112452. return "";
  112453. };
  112454. Flash.nativeSourceHandler.canHandleSource = function(source, options2) {
  112455. var type2 = void 0;
  112456. function guessMimeType(src) {
  112457. var ext = Url.getFileExtension(src);
  112458. if (ext) {
  112459. return "video/" + ext;
  112460. }
  112461. return "";
  112462. }
  112463. if (!source.type) {
  112464. type2 = guessMimeType(source.src);
  112465. } else {
  112466. type2 = source.type.replace(/;.*/, "").toLowerCase();
  112467. }
  112468. return Flash.nativeSourceHandler.canPlayType(type2);
  112469. };
  112470. Flash.nativeSourceHandler.handleSource = function(source, tech, options2) {
  112471. tech.setSrc(source.src);
  112472. };
  112473. Flash.nativeSourceHandler.dispose = function() {
  112474. };
  112475. Flash.registerSourceHandler(Flash.nativeSourceHandler);
  112476. Flash.formats = {
  112477. "video/flv": "FLV",
  112478. "video/x-flv": "FLV",
  112479. "video/mp4": "MP4",
  112480. "video/m4v": "MP4"
  112481. };
  112482. Flash.onReady = function(currSwf) {
  112483. var el = Dom.$("#" + currSwf);
  112484. var tech = el && el.tech;
  112485. if (tech && tech.el()) {
  112486. Flash.checkReady(tech);
  112487. }
  112488. };
  112489. Flash.checkReady = function(tech) {
  112490. if (!tech.el()) {
  112491. return;
  112492. }
  112493. if (tech.el().vjs_getProperty) {
  112494. tech.triggerReady();
  112495. } else {
  112496. this.setTimeout(function() {
  112497. Flash.checkReady(tech);
  112498. }, 50);
  112499. }
  112500. };
  112501. Flash.onEvent = function(swfID, eventName) {
  112502. var tech = Dom.$("#" + swfID).tech;
  112503. var args = Array.prototype.slice.call(arguments, 2);
  112504. tech.setTimeout(function() {
  112505. tech.trigger(eventName, args);
  112506. }, 1);
  112507. };
  112508. Flash.onError = function(swfID, err) {
  112509. var tech = Dom.$("#" + swfID).tech;
  112510. if (err === "srcnotfound") {
  112511. return tech.error(4);
  112512. }
  112513. if (typeof err === "string") {
  112514. tech.error("FLASH: " + err);
  112515. } else {
  112516. err.origin = "flash";
  112517. tech.error(err);
  112518. }
  112519. };
  112520. Flash.version = function() {
  112521. var version$$1 = "0,0,0";
  112522. try {
  112523. version$$1 = new window_1.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112524. } catch (e) {
  112525. try {
  112526. if (navigator$1.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
  112527. version$$1 = (navigator$1.plugins["Shockwave Flash 2.0"] || navigator$1.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112528. }
  112529. } catch (err) {
  112530. }
  112531. }
  112532. return version$$1.split(",");
  112533. };
  112534. Flash.embed = function(swf, flashVars, params, attributes) {
  112535. var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
  112536. var obj = Dom.createEl("div", { innerHTML: code }).childNodes[0];
  112537. return obj;
  112538. };
  112539. Flash.getEmbedCode = function(swf, flashVars, params, attributes) {
  112540. var objTag = '<object type="application/x-shockwave-flash" ';
  112541. var flashVarsString = "";
  112542. var paramsString = "";
  112543. var attrsString = "";
  112544. if (flashVars) {
  112545. Object.getOwnPropertyNames(flashVars).forEach(function(key) {
  112546. flashVarsString += key + "=" + flashVars[key] + "&amp;";
  112547. });
  112548. }
  112549. params = mergeOptions$1({
  112550. movie: swf,
  112551. flashvars: flashVarsString,
  112552. allowScriptAccess: "always",
  112553. allowNetworking: "all"
  112554. }, params);
  112555. Object.getOwnPropertyNames(params).forEach(function(key) {
  112556. paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
  112557. });
  112558. attributes = mergeOptions$1({
  112559. data: swf,
  112560. width: "100%",
  112561. height: "100%"
  112562. }, attributes);
  112563. Object.getOwnPropertyNames(attributes).forEach(function(key) {
  112564. attrsString += key + '="' + attributes[key] + '" ';
  112565. });
  112566. return "" + objTag + attrsString + ">" + paramsString + "</object>";
  112567. };
  112568. FlashRtmpDecorator(Flash);
  112569. if (Tech.getTech("Flash")) {
  112570. videojs.log.warn("Not using videojs-flash as it appears to already be registered");
  112571. videojs.log.warn("videojs-flash should only be used with video.js@6 and above");
  112572. } else {
  112573. videojs.registerTech("Flash", Flash);
  112574. }
  112575. Flash.VERSION = version$1;
  112576. var flv = { exports: {} };
  112577. (function(module2, exports2) {
  112578. (function webpackUniversalModuleDefinition(root2, factory3) {
  112579. module2.exports = factory3();
  112580. })(self, function() {
  112581. return function() {
  112582. var __webpack_modules__ = {
  112583. "./node_modules/es6-promise/dist/es6-promise.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  112584. /*!
  112585. * @overview es6-promise - a tiny implementation of Promises/A+.
  112586. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  112587. * @license Licensed under MIT license
  112588. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  112589. * @version v4.2.8+1e68dce6
  112590. */
  112591. (function(global2, factory3) {
  112592. module3.exports = factory3();
  112593. })(this, function() {
  112594. function objectOrFunction(x) {
  112595. var type2 = typeof x;
  112596. return x !== null && (type2 === "object" || type2 === "function");
  112597. }
  112598. function isFunction2(x) {
  112599. return typeof x === "function";
  112600. }
  112601. var _isArray = void 0;
  112602. if (Array.isArray) {
  112603. _isArray = Array.isArray;
  112604. } else {
  112605. _isArray = function(x) {
  112606. return Object.prototype.toString.call(x) === "[object Array]";
  112607. };
  112608. }
  112609. var isArray2 = _isArray;
  112610. var len = 0;
  112611. var vertxNext = void 0;
  112612. var customSchedulerFn = void 0;
  112613. var asap = function asap2(callback2, arg) {
  112614. queue[len] = callback2;
  112615. queue[len + 1] = arg;
  112616. len += 2;
  112617. if (len === 2) {
  112618. if (customSchedulerFn) {
  112619. customSchedulerFn(flush);
  112620. } else {
  112621. scheduleFlush();
  112622. }
  112623. }
  112624. };
  112625. function setScheduler(scheduleFn) {
  112626. customSchedulerFn = scheduleFn;
  112627. }
  112628. function setAsap(asapFn) {
  112629. asap = asapFn;
  112630. }
  112631. var browserWindow = typeof window !== "undefined" ? window : void 0;
  112632. var browserGlobal = browserWindow || {};
  112633. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  112634. var isNode = typeof self === "undefined" && typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
  112635. var isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined";
  112636. function useNextTick() {
  112637. return function() {
  112638. return process.nextTick(flush);
  112639. };
  112640. }
  112641. function useVertxTimer() {
  112642. if (typeof vertxNext !== "undefined") {
  112643. return function() {
  112644. vertxNext(flush);
  112645. };
  112646. }
  112647. return useSetTimeout();
  112648. }
  112649. function useMutationObserver() {
  112650. var iterations = 0;
  112651. var observer = new BrowserMutationObserver(flush);
  112652. var node = document.createTextNode("");
  112653. observer.observe(node, { characterData: true });
  112654. return function() {
  112655. node.data = iterations = ++iterations % 2;
  112656. };
  112657. }
  112658. function useMessageChannel() {
  112659. var channel = new MessageChannel();
  112660. channel.port1.onmessage = flush;
  112661. return function() {
  112662. return channel.port2.postMessage(0);
  112663. };
  112664. }
  112665. function useSetTimeout() {
  112666. var globalSetTimeout = setTimeout;
  112667. return function() {
  112668. return globalSetTimeout(flush, 1);
  112669. };
  112670. }
  112671. var queue = new Array(1e3);
  112672. function flush() {
  112673. for (var i2 = 0; i2 < len; i2 += 2) {
  112674. var callback2 = queue[i2];
  112675. var arg = queue[i2 + 1];
  112676. callback2(arg);
  112677. queue[i2] = void 0;
  112678. queue[i2 + 1] = void 0;
  112679. }
  112680. len = 0;
  112681. }
  112682. function attemptVertx() {
  112683. try {
  112684. var vertx = Function("return this")().require("vertx");
  112685. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  112686. return useVertxTimer();
  112687. } catch (e) {
  112688. return useSetTimeout();
  112689. }
  112690. }
  112691. var scheduleFlush = void 0;
  112692. if (isNode) {
  112693. scheduleFlush = useNextTick();
  112694. } else if (BrowserMutationObserver) {
  112695. scheduleFlush = useMutationObserver();
  112696. } else if (isWorker) {
  112697. scheduleFlush = useMessageChannel();
  112698. } else if (browserWindow === void 0 && true) {
  112699. scheduleFlush = attemptVertx();
  112700. } else {
  112701. scheduleFlush = useSetTimeout();
  112702. }
  112703. function then(onFulfillment, onRejection) {
  112704. var parent = this;
  112705. var child = new this.constructor(noop2);
  112706. if (child[PROMISE_ID] === void 0) {
  112707. makePromise(child);
  112708. }
  112709. var _state = parent._state;
  112710. if (_state) {
  112711. var callback2 = arguments[_state - 1];
  112712. asap(function() {
  112713. return invokeCallback(_state, child, callback2, parent._result);
  112714. });
  112715. } else {
  112716. subscribe(parent, child, onFulfillment, onRejection);
  112717. }
  112718. return child;
  112719. }
  112720. function resolve$1(object) {
  112721. var Constructor = this;
  112722. if (object && typeof object === "object" && object.constructor === Constructor) {
  112723. return object;
  112724. }
  112725. var promise = new Constructor(noop2);
  112726. resolve2(promise, object);
  112727. return promise;
  112728. }
  112729. var PROMISE_ID = Math.random().toString(36).substring(2);
  112730. function noop2() {
  112731. }
  112732. var PENDING = void 0;
  112733. var FULFILLED = 1;
  112734. var REJECTED = 2;
  112735. function selfFulfillment() {
  112736. return new TypeError("You cannot resolve a promise with itself");
  112737. }
  112738. function cannotReturnOwn() {
  112739. return new TypeError("A promises callback cannot return that same promise.");
  112740. }
  112741. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  112742. try {
  112743. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  112744. } catch (e) {
  112745. return e;
  112746. }
  112747. }
  112748. function handleForeignThenable(promise, thenable, then$$1) {
  112749. asap(function(promise2) {
  112750. var sealed = false;
  112751. var error = tryThen(then$$1, thenable, function(value) {
  112752. if (sealed) {
  112753. return;
  112754. }
  112755. sealed = true;
  112756. if (thenable !== value) {
  112757. resolve2(promise2, value);
  112758. } else {
  112759. fulfill(promise2, value);
  112760. }
  112761. }, function(reason) {
  112762. if (sealed) {
  112763. return;
  112764. }
  112765. sealed = true;
  112766. reject2(promise2, reason);
  112767. }, "Settle: " + (promise2._label || " unknown promise"));
  112768. if (!sealed && error) {
  112769. sealed = true;
  112770. reject2(promise2, error);
  112771. }
  112772. }, promise);
  112773. }
  112774. function handleOwnThenable(promise, thenable) {
  112775. if (thenable._state === FULFILLED) {
  112776. fulfill(promise, thenable._result);
  112777. } else if (thenable._state === REJECTED) {
  112778. reject2(promise, thenable._result);
  112779. } else {
  112780. subscribe(thenable, void 0, function(value) {
  112781. return resolve2(promise, value);
  112782. }, function(reason) {
  112783. return reject2(promise, reason);
  112784. });
  112785. }
  112786. }
  112787. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  112788. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  112789. handleOwnThenable(promise, maybeThenable);
  112790. } else {
  112791. if (then$$1 === void 0) {
  112792. fulfill(promise, maybeThenable);
  112793. } else if (isFunction2(then$$1)) {
  112794. handleForeignThenable(promise, maybeThenable, then$$1);
  112795. } else {
  112796. fulfill(promise, maybeThenable);
  112797. }
  112798. }
  112799. }
  112800. function resolve2(promise, value) {
  112801. if (promise === value) {
  112802. reject2(promise, selfFulfillment());
  112803. } else if (objectOrFunction(value)) {
  112804. var then$$1 = void 0;
  112805. try {
  112806. then$$1 = value.then;
  112807. } catch (error) {
  112808. reject2(promise, error);
  112809. return;
  112810. }
  112811. handleMaybeThenable(promise, value, then$$1);
  112812. } else {
  112813. fulfill(promise, value);
  112814. }
  112815. }
  112816. function publishRejection(promise) {
  112817. if (promise._onerror) {
  112818. promise._onerror(promise._result);
  112819. }
  112820. publish(promise);
  112821. }
  112822. function fulfill(promise, value) {
  112823. if (promise._state !== PENDING) {
  112824. return;
  112825. }
  112826. promise._result = value;
  112827. promise._state = FULFILLED;
  112828. if (promise._subscribers.length !== 0) {
  112829. asap(publish, promise);
  112830. }
  112831. }
  112832. function reject2(promise, reason) {
  112833. if (promise._state !== PENDING) {
  112834. return;
  112835. }
  112836. promise._state = REJECTED;
  112837. promise._result = reason;
  112838. asap(publishRejection, promise);
  112839. }
  112840. function subscribe(parent, child, onFulfillment, onRejection) {
  112841. var _subscribers = parent._subscribers;
  112842. var length = _subscribers.length;
  112843. parent._onerror = null;
  112844. _subscribers[length] = child;
  112845. _subscribers[length + FULFILLED] = onFulfillment;
  112846. _subscribers[length + REJECTED] = onRejection;
  112847. if (length === 0 && parent._state) {
  112848. asap(publish, parent);
  112849. }
  112850. }
  112851. function publish(promise) {
  112852. var subscribers = promise._subscribers;
  112853. var settled = promise._state;
  112854. if (subscribers.length === 0) {
  112855. return;
  112856. }
  112857. var child = void 0, callback2 = void 0, detail = promise._result;
  112858. for (var i2 = 0; i2 < subscribers.length; i2 += 3) {
  112859. child = subscribers[i2];
  112860. callback2 = subscribers[i2 + settled];
  112861. if (child) {
  112862. invokeCallback(settled, child, callback2, detail);
  112863. } else {
  112864. callback2(detail);
  112865. }
  112866. }
  112867. promise._subscribers.length = 0;
  112868. }
  112869. function invokeCallback(settled, promise, callback2, detail) {
  112870. var hasCallback = isFunction2(callback2), value = void 0, error = void 0, succeeded = true;
  112871. if (hasCallback) {
  112872. try {
  112873. value = callback2(detail);
  112874. } catch (e) {
  112875. succeeded = false;
  112876. error = e;
  112877. }
  112878. if (promise === value) {
  112879. reject2(promise, cannotReturnOwn());
  112880. return;
  112881. }
  112882. } else {
  112883. value = detail;
  112884. }
  112885. if (promise._state !== PENDING)
  112886. ;
  112887. else if (hasCallback && succeeded) {
  112888. resolve2(promise, value);
  112889. } else if (succeeded === false) {
  112890. reject2(promise, error);
  112891. } else if (settled === FULFILLED) {
  112892. fulfill(promise, value);
  112893. } else if (settled === REJECTED) {
  112894. reject2(promise, value);
  112895. }
  112896. }
  112897. function initializePromise(promise, resolver) {
  112898. try {
  112899. resolver(function resolvePromise(value) {
  112900. resolve2(promise, value);
  112901. }, function rejectPromise(reason) {
  112902. reject2(promise, reason);
  112903. });
  112904. } catch (e) {
  112905. reject2(promise, e);
  112906. }
  112907. }
  112908. var id = 0;
  112909. function nextId() {
  112910. return id++;
  112911. }
  112912. function makePromise(promise) {
  112913. promise[PROMISE_ID] = id++;
  112914. promise._state = void 0;
  112915. promise._result = void 0;
  112916. promise._subscribers = [];
  112917. }
  112918. function validationError() {
  112919. return new Error("Array Methods must be provided an Array");
  112920. }
  112921. var Enumerator = function() {
  112922. function Enumerator2(Constructor, input) {
  112923. this._instanceConstructor = Constructor;
  112924. this.promise = new Constructor(noop2);
  112925. if (!this.promise[PROMISE_ID]) {
  112926. makePromise(this.promise);
  112927. }
  112928. if (isArray2(input)) {
  112929. this.length = input.length;
  112930. this._remaining = input.length;
  112931. this._result = new Array(this.length);
  112932. if (this.length === 0) {
  112933. fulfill(this.promise, this._result);
  112934. } else {
  112935. this.length = this.length || 0;
  112936. this._enumerate(input);
  112937. if (this._remaining === 0) {
  112938. fulfill(this.promise, this._result);
  112939. }
  112940. }
  112941. } else {
  112942. reject2(this.promise, validationError());
  112943. }
  112944. }
  112945. Enumerator2.prototype._enumerate = function _enumerate(input) {
  112946. for (var i2 = 0; this._state === PENDING && i2 < input.length; i2++) {
  112947. this._eachEntry(input[i2], i2);
  112948. }
  112949. };
  112950. Enumerator2.prototype._eachEntry = function _eachEntry(entry, i2) {
  112951. var c = this._instanceConstructor;
  112952. var resolve$$1 = c.resolve;
  112953. if (resolve$$1 === resolve$1) {
  112954. var _then = void 0;
  112955. var error = void 0;
  112956. var didError = false;
  112957. try {
  112958. _then = entry.then;
  112959. } catch (e) {
  112960. didError = true;
  112961. error = e;
  112962. }
  112963. if (_then === then && entry._state !== PENDING) {
  112964. this._settledAt(entry._state, i2, entry._result);
  112965. } else if (typeof _then !== "function") {
  112966. this._remaining--;
  112967. this._result[i2] = entry;
  112968. } else if (c === Promise$12) {
  112969. var promise = new c(noop2);
  112970. if (didError) {
  112971. reject2(promise, error);
  112972. } else {
  112973. handleMaybeThenable(promise, entry, _then);
  112974. }
  112975. this._willSettleAt(promise, i2);
  112976. } else {
  112977. this._willSettleAt(new c(function(resolve$$12) {
  112978. return resolve$$12(entry);
  112979. }), i2);
  112980. }
  112981. } else {
  112982. this._willSettleAt(resolve$$1(entry), i2);
  112983. }
  112984. };
  112985. Enumerator2.prototype._settledAt = function _settledAt(state, i2, value) {
  112986. var promise = this.promise;
  112987. if (promise._state === PENDING) {
  112988. this._remaining--;
  112989. if (state === REJECTED) {
  112990. reject2(promise, value);
  112991. } else {
  112992. this._result[i2] = value;
  112993. }
  112994. }
  112995. if (this._remaining === 0) {
  112996. fulfill(promise, this._result);
  112997. }
  112998. };
  112999. Enumerator2.prototype._willSettleAt = function _willSettleAt(promise, i2) {
  113000. var enumerator = this;
  113001. subscribe(promise, void 0, function(value) {
  113002. return enumerator._settledAt(FULFILLED, i2, value);
  113003. }, function(reason) {
  113004. return enumerator._settledAt(REJECTED, i2, reason);
  113005. });
  113006. };
  113007. return Enumerator2;
  113008. }();
  113009. function all(entries) {
  113010. return new Enumerator(this, entries).promise;
  113011. }
  113012. function race(entries) {
  113013. var Constructor = this;
  113014. if (!isArray2(entries)) {
  113015. return new Constructor(function(_, reject3) {
  113016. return reject3(new TypeError("You must pass an array to race."));
  113017. });
  113018. } else {
  113019. return new Constructor(function(resolve3, reject3) {
  113020. var length = entries.length;
  113021. for (var i2 = 0; i2 < length; i2++) {
  113022. Constructor.resolve(entries[i2]).then(resolve3, reject3);
  113023. }
  113024. });
  113025. }
  113026. }
  113027. function reject$1(reason) {
  113028. var Constructor = this;
  113029. var promise = new Constructor(noop2);
  113030. reject2(promise, reason);
  113031. return promise;
  113032. }
  113033. function needsResolver() {
  113034. throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
  113035. }
  113036. function needsNew() {
  113037. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  113038. }
  113039. var Promise$12 = function() {
  113040. function Promise2(resolver) {
  113041. this[PROMISE_ID] = nextId();
  113042. this._result = this._state = void 0;
  113043. this._subscribers = [];
  113044. if (noop2 !== resolver) {
  113045. typeof resolver !== "function" && needsResolver();
  113046. this instanceof Promise2 ? initializePromise(this, resolver) : needsNew();
  113047. }
  113048. }
  113049. Promise2.prototype.catch = function _catch(onRejection) {
  113050. return this.then(null, onRejection);
  113051. };
  113052. Promise2.prototype.finally = function _finally(callback2) {
  113053. var promise = this;
  113054. var constructor = promise.constructor;
  113055. if (isFunction2(callback2)) {
  113056. return promise.then(function(value) {
  113057. return constructor.resolve(callback2()).then(function() {
  113058. return value;
  113059. });
  113060. }, function(reason) {
  113061. return constructor.resolve(callback2()).then(function() {
  113062. throw reason;
  113063. });
  113064. });
  113065. }
  113066. return promise.then(callback2, callback2);
  113067. };
  113068. return Promise2;
  113069. }();
  113070. Promise$12.prototype.then = then;
  113071. Promise$12.all = all;
  113072. Promise$12.race = race;
  113073. Promise$12.resolve = resolve$1;
  113074. Promise$12.reject = reject$1;
  113075. Promise$12._setScheduler = setScheduler;
  113076. Promise$12._setAsap = setAsap;
  113077. Promise$12._asap = asap;
  113078. function polyfill() {
  113079. var local = void 0;
  113080. if (typeof __webpack_require__2.g !== "undefined") {
  113081. local = __webpack_require__2.g;
  113082. } else if (typeof self !== "undefined") {
  113083. local = self;
  113084. } else {
  113085. try {
  113086. local = Function("return this")();
  113087. } catch (e) {
  113088. throw new Error("polyfill failed because global object is unavailable in this environment");
  113089. }
  113090. }
  113091. var P2 = local.Promise;
  113092. if (P2) {
  113093. var promiseToString = null;
  113094. try {
  113095. promiseToString = Object.prototype.toString.call(P2.resolve());
  113096. } catch (e) {
  113097. }
  113098. if (promiseToString === "[object Promise]" && !P2.cast) {
  113099. return;
  113100. }
  113101. }
  113102. local.Promise = Promise$12;
  113103. }
  113104. Promise$12.polyfill = polyfill;
  113105. Promise$12.Promise = Promise$12;
  113106. return Promise$12;
  113107. });
  113108. },
  113109. "./node_modules/events/events.js": function(module3) {
  113110. var R2 = typeof Reflect === "object" ? Reflect : null;
  113111. var ReflectApply = R2 && typeof R2.apply === "function" ? R2.apply : function ReflectApply2(target, receiver, args) {
  113112. return Function.prototype.apply.call(target, receiver, args);
  113113. };
  113114. var ReflectOwnKeys;
  113115. if (R2 && typeof R2.ownKeys === "function") {
  113116. ReflectOwnKeys = R2.ownKeys;
  113117. } else if (Object.getOwnPropertySymbols) {
  113118. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113119. return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
  113120. };
  113121. } else {
  113122. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113123. return Object.getOwnPropertyNames(target);
  113124. };
  113125. }
  113126. function ProcessEmitWarning(warning) {
  113127. if (console && console.warn)
  113128. console.warn(warning);
  113129. }
  113130. var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
  113131. return value !== value;
  113132. };
  113133. function EventEmitter() {
  113134. EventEmitter.init.call(this);
  113135. }
  113136. module3.exports = EventEmitter;
  113137. module3.exports.once = once;
  113138. EventEmitter.EventEmitter = EventEmitter;
  113139. EventEmitter.prototype._events = void 0;
  113140. EventEmitter.prototype._eventsCount = 0;
  113141. EventEmitter.prototype._maxListeners = void 0;
  113142. var defaultMaxListeners = 10;
  113143. function checkListener(listener) {
  113144. if (typeof listener !== "function") {
  113145. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  113146. }
  113147. }
  113148. Object.defineProperty(EventEmitter, "defaultMaxListeners", {
  113149. enumerable: true,
  113150. get: function() {
  113151. return defaultMaxListeners;
  113152. },
  113153. set: function(arg) {
  113154. if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
  113155. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
  113156. }
  113157. defaultMaxListeners = arg;
  113158. }
  113159. });
  113160. EventEmitter.init = function() {
  113161. if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
  113162. this._events = /* @__PURE__ */ Object.create(null);
  113163. this._eventsCount = 0;
  113164. }
  113165. this._maxListeners = this._maxListeners || void 0;
  113166. };
  113167. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  113168. if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
  113169. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
  113170. }
  113171. this._maxListeners = n;
  113172. return this;
  113173. };
  113174. function _getMaxListeners(that) {
  113175. if (that._maxListeners === void 0)
  113176. return EventEmitter.defaultMaxListeners;
  113177. return that._maxListeners;
  113178. }
  113179. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  113180. return _getMaxListeners(this);
  113181. };
  113182. EventEmitter.prototype.emit = function emit(type2) {
  113183. var args = [];
  113184. for (var i2 = 1; i2 < arguments.length; i2++)
  113185. args.push(arguments[i2]);
  113186. var doError = type2 === "error";
  113187. var events = this._events;
  113188. if (events !== void 0)
  113189. doError = doError && events.error === void 0;
  113190. else if (!doError)
  113191. return false;
  113192. if (doError) {
  113193. var er;
  113194. if (args.length > 0)
  113195. er = args[0];
  113196. if (er instanceof Error) {
  113197. throw er;
  113198. }
  113199. var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
  113200. err.context = er;
  113201. throw err;
  113202. }
  113203. var handler = events[type2];
  113204. if (handler === void 0)
  113205. return false;
  113206. if (typeof handler === "function") {
  113207. ReflectApply(handler, this, args);
  113208. } else {
  113209. var len = handler.length;
  113210. var listeners = arrayClone(handler, len);
  113211. for (var i2 = 0; i2 < len; ++i2)
  113212. ReflectApply(listeners[i2], this, args);
  113213. }
  113214. return true;
  113215. };
  113216. function _addListener(target, type2, listener, prepend) {
  113217. var m;
  113218. var events;
  113219. var existing;
  113220. checkListener(listener);
  113221. events = target._events;
  113222. if (events === void 0) {
  113223. events = target._events = /* @__PURE__ */ Object.create(null);
  113224. target._eventsCount = 0;
  113225. } else {
  113226. if (events.newListener !== void 0) {
  113227. target.emit("newListener", type2, listener.listener ? listener.listener : listener);
  113228. events = target._events;
  113229. }
  113230. existing = events[type2];
  113231. }
  113232. if (existing === void 0) {
  113233. existing = events[type2] = listener;
  113234. ++target._eventsCount;
  113235. } else {
  113236. if (typeof existing === "function") {
  113237. existing = events[type2] = prepend ? [listener, existing] : [existing, listener];
  113238. } else if (prepend) {
  113239. existing.unshift(listener);
  113240. } else {
  113241. existing.push(listener);
  113242. }
  113243. m = _getMaxListeners(target);
  113244. if (m > 0 && existing.length > m && !existing.warned) {
  113245. existing.warned = true;
  113246. var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
  113247. w.name = "MaxListenersExceededWarning";
  113248. w.emitter = target;
  113249. w.type = type2;
  113250. w.count = existing.length;
  113251. ProcessEmitWarning(w);
  113252. }
  113253. }
  113254. return target;
  113255. }
  113256. EventEmitter.prototype.addListener = function addListener(type2, listener) {
  113257. return _addListener(this, type2, listener, false);
  113258. };
  113259. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  113260. EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
  113261. return _addListener(this, type2, listener, true);
  113262. };
  113263. function onceWrapper() {
  113264. if (!this.fired) {
  113265. this.target.removeListener(this.type, this.wrapFn);
  113266. this.fired = true;
  113267. if (arguments.length === 0)
  113268. return this.listener.call(this.target);
  113269. return this.listener.apply(this.target, arguments);
  113270. }
  113271. }
  113272. function _onceWrap(target, type2, listener) {
  113273. var state = { fired: false, wrapFn: void 0, target, type: type2, listener };
  113274. var wrapped = onceWrapper.bind(state);
  113275. wrapped.listener = listener;
  113276. state.wrapFn = wrapped;
  113277. return wrapped;
  113278. }
  113279. EventEmitter.prototype.once = function once2(type2, listener) {
  113280. checkListener(listener);
  113281. this.on(type2, _onceWrap(this, type2, listener));
  113282. return this;
  113283. };
  113284. EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
  113285. checkListener(listener);
  113286. this.prependListener(type2, _onceWrap(this, type2, listener));
  113287. return this;
  113288. };
  113289. EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
  113290. var list, events, position2, i2, originalListener;
  113291. checkListener(listener);
  113292. events = this._events;
  113293. if (events === void 0)
  113294. return this;
  113295. list = events[type2];
  113296. if (list === void 0)
  113297. return this;
  113298. if (list === listener || list.listener === listener) {
  113299. if (--this._eventsCount === 0)
  113300. this._events = /* @__PURE__ */ Object.create(null);
  113301. else {
  113302. delete events[type2];
  113303. if (events.removeListener)
  113304. this.emit("removeListener", type2, list.listener || listener);
  113305. }
  113306. } else if (typeof list !== "function") {
  113307. position2 = -1;
  113308. for (i2 = list.length - 1; i2 >= 0; i2--) {
  113309. if (list[i2] === listener || list[i2].listener === listener) {
  113310. originalListener = list[i2].listener;
  113311. position2 = i2;
  113312. break;
  113313. }
  113314. }
  113315. if (position2 < 0)
  113316. return this;
  113317. if (position2 === 0)
  113318. list.shift();
  113319. else {
  113320. spliceOne(list, position2);
  113321. }
  113322. if (list.length === 1)
  113323. events[type2] = list[0];
  113324. if (events.removeListener !== void 0)
  113325. this.emit("removeListener", type2, originalListener || listener);
  113326. }
  113327. return this;
  113328. };
  113329. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  113330. EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
  113331. var listeners, events, i2;
  113332. events = this._events;
  113333. if (events === void 0)
  113334. return this;
  113335. if (events.removeListener === void 0) {
  113336. if (arguments.length === 0) {
  113337. this._events = /* @__PURE__ */ Object.create(null);
  113338. this._eventsCount = 0;
  113339. } else if (events[type2] !== void 0) {
  113340. if (--this._eventsCount === 0)
  113341. this._events = /* @__PURE__ */ Object.create(null);
  113342. else
  113343. delete events[type2];
  113344. }
  113345. return this;
  113346. }
  113347. if (arguments.length === 0) {
  113348. var keys3 = Object.keys(events);
  113349. var key;
  113350. for (i2 = 0; i2 < keys3.length; ++i2) {
  113351. key = keys3[i2];
  113352. if (key === "removeListener")
  113353. continue;
  113354. this.removeAllListeners(key);
  113355. }
  113356. this.removeAllListeners("removeListener");
  113357. this._events = /* @__PURE__ */ Object.create(null);
  113358. this._eventsCount = 0;
  113359. return this;
  113360. }
  113361. listeners = events[type2];
  113362. if (typeof listeners === "function") {
  113363. this.removeListener(type2, listeners);
  113364. } else if (listeners !== void 0) {
  113365. for (i2 = listeners.length - 1; i2 >= 0; i2--) {
  113366. this.removeListener(type2, listeners[i2]);
  113367. }
  113368. }
  113369. return this;
  113370. };
  113371. function _listeners(target, type2, unwrap) {
  113372. var events = target._events;
  113373. if (events === void 0)
  113374. return [];
  113375. var evlistener = events[type2];
  113376. if (evlistener === void 0)
  113377. return [];
  113378. if (typeof evlistener === "function")
  113379. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  113380. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  113381. }
  113382. EventEmitter.prototype.listeners = function listeners(type2) {
  113383. return _listeners(this, type2, true);
  113384. };
  113385. EventEmitter.prototype.rawListeners = function rawListeners(type2) {
  113386. return _listeners(this, type2, false);
  113387. };
  113388. EventEmitter.listenerCount = function(emitter, type2) {
  113389. if (typeof emitter.listenerCount === "function") {
  113390. return emitter.listenerCount(type2);
  113391. } else {
  113392. return listenerCount.call(emitter, type2);
  113393. }
  113394. };
  113395. EventEmitter.prototype.listenerCount = listenerCount;
  113396. function listenerCount(type2) {
  113397. var events = this._events;
  113398. if (events !== void 0) {
  113399. var evlistener = events[type2];
  113400. if (typeof evlistener === "function") {
  113401. return 1;
  113402. } else if (evlistener !== void 0) {
  113403. return evlistener.length;
  113404. }
  113405. }
  113406. return 0;
  113407. }
  113408. EventEmitter.prototype.eventNames = function eventNames() {
  113409. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  113410. };
  113411. function arrayClone(arr, n) {
  113412. var copy2 = new Array(n);
  113413. for (var i2 = 0; i2 < n; ++i2)
  113414. copy2[i2] = arr[i2];
  113415. return copy2;
  113416. }
  113417. function spliceOne(list, index2) {
  113418. for (; index2 + 1 < list.length; index2++)
  113419. list[index2] = list[index2 + 1];
  113420. list.pop();
  113421. }
  113422. function unwrapListeners(arr) {
  113423. var ret = new Array(arr.length);
  113424. for (var i2 = 0; i2 < ret.length; ++i2) {
  113425. ret[i2] = arr[i2].listener || arr[i2];
  113426. }
  113427. return ret;
  113428. }
  113429. function once(emitter, name) {
  113430. return new Promise(function(resolve2, reject2) {
  113431. function errorListener(err) {
  113432. emitter.removeListener(name, resolver);
  113433. reject2(err);
  113434. }
  113435. function resolver() {
  113436. if (typeof emitter.removeListener === "function") {
  113437. emitter.removeListener("error", errorListener);
  113438. }
  113439. resolve2([].slice.call(arguments));
  113440. }
  113441. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  113442. if (name !== "error") {
  113443. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  113444. }
  113445. });
  113446. }
  113447. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  113448. if (typeof emitter.on === "function") {
  113449. eventTargetAgnosticAddListener(emitter, "error", handler, flags);
  113450. }
  113451. }
  113452. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  113453. if (typeof emitter.on === "function") {
  113454. if (flags.once) {
  113455. emitter.once(name, listener);
  113456. } else {
  113457. emitter.on(name, listener);
  113458. }
  113459. } else if (typeof emitter.addEventListener === "function") {
  113460. emitter.addEventListener(name, function wrapListener(arg) {
  113461. if (flags.once) {
  113462. emitter.removeEventListener(name, wrapListener);
  113463. }
  113464. listener(arg);
  113465. });
  113466. } else {
  113467. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  113468. }
  113469. }
  113470. },
  113471. "./node_modules/webworkify-webpack/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  113472. function webpackBootstrapFunc(modules) {
  113473. var installedModules = {};
  113474. function __nested_webpack_require_164__(moduleId) {
  113475. if (installedModules[moduleId])
  113476. return installedModules[moduleId].exports;
  113477. var module4 = installedModules[moduleId] = {
  113478. i: moduleId,
  113479. l: false,
  113480. exports: {}
  113481. };
  113482. modules[moduleId].call(module4.exports, module4, module4.exports, __nested_webpack_require_164__);
  113483. module4.l = true;
  113484. return module4.exports;
  113485. }
  113486. __nested_webpack_require_164__.m = modules;
  113487. __nested_webpack_require_164__.c = installedModules;
  113488. __nested_webpack_require_164__.i = function(value) {
  113489. return value;
  113490. };
  113491. __nested_webpack_require_164__.d = function(exports3, name, getter) {
  113492. if (!__nested_webpack_require_164__.o(exports3, name)) {
  113493. Object.defineProperty(exports3, name, {
  113494. configurable: false,
  113495. enumerable: true,
  113496. get: getter
  113497. });
  113498. }
  113499. };
  113500. __nested_webpack_require_164__.r = function(exports3) {
  113501. Object.defineProperty(exports3, "__esModule", { value: true });
  113502. };
  113503. __nested_webpack_require_164__.n = function(module4) {
  113504. var getter = module4 && module4.__esModule ? function getDefault() {
  113505. return module4["default"];
  113506. } : function getModuleExports() {
  113507. return module4;
  113508. };
  113509. __nested_webpack_require_164__.d(getter, "a", getter);
  113510. return getter;
  113511. };
  113512. __nested_webpack_require_164__.o = function(object, property) {
  113513. return Object.prototype.hasOwnProperty.call(object, property);
  113514. };
  113515. __nested_webpack_require_164__.p = "/";
  113516. __nested_webpack_require_164__.oe = function(err) {
  113517. console.error(err);
  113518. throw err;
  113519. };
  113520. var f = __nested_webpack_require_164__(__nested_webpack_require_164__.s = ENTRY_MODULE);
  113521. return f.default || f;
  113522. }
  113523. var moduleNameReqExp = "[\\.|\\-|\\+|\\w|/|@]+";
  113524. var dependencyRegExp = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + moduleNameReqExp + ").*?\\)";
  113525. function quoteRegExp(str) {
  113526. return (str + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
  113527. }
  113528. function isNumeric(n) {
  113529. return !isNaN(1 * n);
  113530. }
  113531. function getModuleDependencies(sources, module4, queueName) {
  113532. var retval = {};
  113533. retval[queueName] = [];
  113534. var fnString = module4.toString();
  113535. var wrapperSignature = fnString.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
  113536. if (!wrapperSignature)
  113537. return retval;
  113538. var webpackRequireName = wrapperSignature[1];
  113539. var re = new RegExp("(\\\\n|\\W)" + quoteRegExp(webpackRequireName) + dependencyRegExp, "g");
  113540. var match;
  113541. while (match = re.exec(fnString)) {
  113542. if (match[3] === "dll-reference")
  113543. continue;
  113544. retval[queueName].push(match[3]);
  113545. }
  113546. re = new RegExp("\\(" + quoteRegExp(webpackRequireName) + '\\("(dll-reference\\s(' + moduleNameReqExp + '))"\\)\\)' + dependencyRegExp, "g");
  113547. while (match = re.exec(fnString)) {
  113548. if (!sources[match[2]]) {
  113549. retval[queueName].push(match[1]);
  113550. sources[match[2]] = __webpack_require__2(match[1]).m;
  113551. }
  113552. retval[match[2]] = retval[match[2]] || [];
  113553. retval[match[2]].push(match[4]);
  113554. }
  113555. var keys3 = Object.keys(retval);
  113556. for (var i2 = 0; i2 < keys3.length; i2++) {
  113557. for (var j = 0; j < retval[keys3[i2]].length; j++) {
  113558. if (isNumeric(retval[keys3[i2]][j])) {
  113559. retval[keys3[i2]][j] = 1 * retval[keys3[i2]][j];
  113560. }
  113561. }
  113562. }
  113563. return retval;
  113564. }
  113565. function hasValuesInQueues(queues) {
  113566. var keys3 = Object.keys(queues);
  113567. return keys3.reduce(function(hasValues, key) {
  113568. return hasValues || queues[key].length > 0;
  113569. }, false);
  113570. }
  113571. function getRequiredModules(sources, moduleId) {
  113572. var modulesQueue = {
  113573. main: [moduleId]
  113574. };
  113575. var requiredModules = {
  113576. main: []
  113577. };
  113578. var seenModules = {
  113579. main: {}
  113580. };
  113581. while (hasValuesInQueues(modulesQueue)) {
  113582. var queues = Object.keys(modulesQueue);
  113583. for (var i2 = 0; i2 < queues.length; i2++) {
  113584. var queueName = queues[i2];
  113585. var queue = modulesQueue[queueName];
  113586. var moduleToCheck = queue.pop();
  113587. seenModules[queueName] = seenModules[queueName] || {};
  113588. if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck])
  113589. continue;
  113590. seenModules[queueName][moduleToCheck] = true;
  113591. requiredModules[queueName] = requiredModules[queueName] || [];
  113592. requiredModules[queueName].push(moduleToCheck);
  113593. var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName);
  113594. var newModulesKeys = Object.keys(newModules);
  113595. for (var j = 0; j < newModulesKeys.length; j++) {
  113596. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || [];
  113597. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]]);
  113598. }
  113599. }
  113600. }
  113601. return requiredModules;
  113602. }
  113603. module3.exports = function(moduleId, options2) {
  113604. options2 = options2 || {};
  113605. var sources = {
  113606. main: __webpack_require__2.m
  113607. };
  113608. var requiredModules = options2.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId);
  113609. var src = "";
  113610. Object.keys(requiredModules).filter(function(m) {
  113611. return m !== "main";
  113612. }).forEach(function(module4) {
  113613. var entryModule = 0;
  113614. while (requiredModules[module4][entryModule]) {
  113615. entryModule++;
  113616. }
  113617. requiredModules[module4].push(entryModule);
  113618. sources[module4][entryModule] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })";
  113619. src = src + "var " + module4 + " = (" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(entryModule)) + ")({" + requiredModules[module4].map(function(id) {
  113620. return "" + JSON.stringify(id) + ": " + sources[module4][id].toString();
  113621. }).join(",") + "});\n";
  113622. });
  113623. src = src + "new ((" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(moduleId)) + ")({" + requiredModules.main.map(function(id) {
  113624. return "" + JSON.stringify(id) + ": " + sources.main[id].toString();
  113625. }).join(",") + "}))(self);";
  113626. var blob = new window.Blob([src], { type: "text/javascript" });
  113627. if (options2.bare) {
  113628. return blob;
  113629. }
  113630. var URL2 = window.URL || window.webkitURL || window.mozURL || window.msURL;
  113631. var workerUrl = URL2.createObjectURL(blob);
  113632. var worker = new window.Worker(workerUrl);
  113633. worker.objectURL = workerUrl;
  113634. return worker;
  113635. };
  113636. },
  113637. "./src/config.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113638. __webpack_require__2.r(__webpack_exports__2);
  113639. __webpack_require__2.d(__webpack_exports__2, {
  113640. "defaultConfig": function() {
  113641. return defaultConfig;
  113642. },
  113643. "createDefaultConfig": function() {
  113644. return createDefaultConfig;
  113645. }
  113646. });
  113647. var defaultConfig = {
  113648. enableWorker: false,
  113649. enableStashBuffer: true,
  113650. stashInitialSize: void 0,
  113651. isLive: false,
  113652. lazyLoad: true,
  113653. lazyLoadMaxDuration: 3 * 60,
  113654. lazyLoadRecoverDuration: 30,
  113655. deferLoadAfterSourceOpen: true,
  113656. autoCleanupMaxBackwardDuration: 3 * 60,
  113657. autoCleanupMinBackwardDuration: 2 * 60,
  113658. statisticsInfoReportInterval: 600,
  113659. fixAudioTimestampGap: true,
  113660. accurateSeek: false,
  113661. seekType: "range",
  113662. seekParamStart: "bstart",
  113663. seekParamEnd: "bend",
  113664. rangeLoadZeroStart: false,
  113665. customSeekHandler: void 0,
  113666. reuseRedirectedURL: false,
  113667. headers: void 0,
  113668. customLoader: void 0
  113669. };
  113670. function createDefaultConfig() {
  113671. return Object.assign({}, defaultConfig);
  113672. }
  113673. },
  113674. "./src/core/features.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113675. __webpack_require__2.r(__webpack_exports__2);
  113676. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/io-controller.js");
  113677. var _config_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/config.js");
  113678. var Features = function() {
  113679. function Features2() {
  113680. }
  113681. Features2.supportMSEH264Playback = function() {
  113682. return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
  113683. };
  113684. Features2.supportNetworkStreamIO = function() {
  113685. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113686. var loaderType = ioctl.loaderType;
  113687. ioctl.destroy();
  113688. return loaderType == "fetch-stream-loader" || loaderType == "xhr-moz-chunked-loader";
  113689. };
  113690. Features2.getNetworkLoaderTypeName = function() {
  113691. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113692. var loaderType = ioctl.loaderType;
  113693. ioctl.destroy();
  113694. return loaderType;
  113695. };
  113696. Features2.supportNativeMediaPlayback = function(mimeType) {
  113697. if (Features2.videoElement == void 0) {
  113698. Features2.videoElement = window.document.createElement("video");
  113699. }
  113700. var canPlay = Features2.videoElement.canPlayType(mimeType);
  113701. return canPlay === "probably" || canPlay == "maybe";
  113702. };
  113703. Features2.getFeatureList = function() {
  113704. var features = {
  113705. mseFlvPlayback: false,
  113706. mseLiveFlvPlayback: false,
  113707. networkStreamIO: false,
  113708. networkLoaderName: "",
  113709. nativeMP4H264Playback: false,
  113710. nativeWebmVP8Playback: false,
  113711. nativeWebmVP9Playback: false
  113712. };
  113713. features.mseFlvPlayback = Features2.supportMSEH264Playback();
  113714. features.networkStreamIO = Features2.supportNetworkStreamIO();
  113715. features.networkLoaderName = Features2.getNetworkLoaderTypeName();
  113716. features.mseLiveFlvPlayback = features.mseFlvPlayback && features.networkStreamIO;
  113717. features.nativeMP4H264Playback = Features2.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"');
  113718. features.nativeWebmVP8Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"');
  113719. features.nativeWebmVP9Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp9"');
  113720. return features;
  113721. };
  113722. return Features2;
  113723. }();
  113724. __webpack_exports__2["default"] = Features;
  113725. },
  113726. "./src/core/media-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113727. __webpack_require__2.r(__webpack_exports__2);
  113728. var MediaInfo = function() {
  113729. function MediaInfo2() {
  113730. this.mimeType = null;
  113731. this.duration = null;
  113732. this.hasAudio = null;
  113733. this.hasVideo = null;
  113734. this.audioCodec = null;
  113735. this.videoCodec = null;
  113736. this.audioDataRate = null;
  113737. this.videoDataRate = null;
  113738. this.audioSampleRate = null;
  113739. this.audioChannelCount = null;
  113740. this.width = null;
  113741. this.height = null;
  113742. this.fps = null;
  113743. this.profile = null;
  113744. this.level = null;
  113745. this.refFrames = null;
  113746. this.chromaFormat = null;
  113747. this.sarNum = null;
  113748. this.sarDen = null;
  113749. this.metadata = null;
  113750. this.segments = null;
  113751. this.segmentCount = null;
  113752. this.hasKeyframesIndex = null;
  113753. this.keyframesIndex = null;
  113754. }
  113755. MediaInfo2.prototype.isComplete = function() {
  113756. var audioInfoComplete = this.hasAudio === false || this.hasAudio === true && this.audioCodec != null && this.audioSampleRate != null && this.audioChannelCount != null;
  113757. 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;
  113758. return this.mimeType != null && this.duration != null && this.metadata != null && this.hasKeyframesIndex != null && audioInfoComplete && videoInfoComplete;
  113759. };
  113760. MediaInfo2.prototype.isSeekable = function() {
  113761. return this.hasKeyframesIndex === true;
  113762. };
  113763. MediaInfo2.prototype.getNearestKeyframe = function(milliseconds) {
  113764. if (this.keyframesIndex == null) {
  113765. return null;
  113766. }
  113767. var table = this.keyframesIndex;
  113768. var keyframeIdx = this._search(table.times, milliseconds);
  113769. return {
  113770. index: keyframeIdx,
  113771. milliseconds: table.times[keyframeIdx],
  113772. fileposition: table.filepositions[keyframeIdx]
  113773. };
  113774. };
  113775. MediaInfo2.prototype._search = function(list, value) {
  113776. var idx = 0;
  113777. var last = list.length - 1;
  113778. var mid = 0;
  113779. var lbound = 0;
  113780. var ubound = last;
  113781. if (value < list[0]) {
  113782. idx = 0;
  113783. lbound = ubound + 1;
  113784. }
  113785. while (lbound <= ubound) {
  113786. mid = lbound + Math.floor((ubound - lbound) / 2);
  113787. if (mid === last || value >= list[mid] && value < list[mid + 1]) {
  113788. idx = mid;
  113789. break;
  113790. } else if (list[mid] < value) {
  113791. lbound = mid + 1;
  113792. } else {
  113793. ubound = mid - 1;
  113794. }
  113795. }
  113796. return idx;
  113797. };
  113798. return MediaInfo2;
  113799. }();
  113800. __webpack_exports__2["default"] = MediaInfo;
  113801. },
  113802. "./src/core/media-segment-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113803. __webpack_require__2.r(__webpack_exports__2);
  113804. __webpack_require__2.d(__webpack_exports__2, {
  113805. "SampleInfo": function() {
  113806. return SampleInfo;
  113807. },
  113808. "MediaSegmentInfo": function() {
  113809. return MediaSegmentInfo;
  113810. },
  113811. "IDRSampleList": function() {
  113812. return IDRSampleList;
  113813. },
  113814. "MediaSegmentInfoList": function() {
  113815. return MediaSegmentInfoList;
  113816. }
  113817. });
  113818. var SampleInfo = function() {
  113819. function SampleInfo2(dts, pts, duration5, originalDts, isSync) {
  113820. this.dts = dts;
  113821. this.pts = pts;
  113822. this.duration = duration5;
  113823. this.originalDts = originalDts;
  113824. this.isSyncPoint = isSync;
  113825. this.fileposition = null;
  113826. }
  113827. return SampleInfo2;
  113828. }();
  113829. var MediaSegmentInfo = function() {
  113830. function MediaSegmentInfo2() {
  113831. this.beginDts = 0;
  113832. this.endDts = 0;
  113833. this.beginPts = 0;
  113834. this.endPts = 0;
  113835. this.originalBeginDts = 0;
  113836. this.originalEndDts = 0;
  113837. this.syncPoints = [];
  113838. this.firstSample = null;
  113839. this.lastSample = null;
  113840. }
  113841. MediaSegmentInfo2.prototype.appendSyncPoint = function(sampleInfo) {
  113842. sampleInfo.isSyncPoint = true;
  113843. this.syncPoints.push(sampleInfo);
  113844. };
  113845. return MediaSegmentInfo2;
  113846. }();
  113847. var IDRSampleList = function() {
  113848. function IDRSampleList2() {
  113849. this._list = [];
  113850. }
  113851. IDRSampleList2.prototype.clear = function() {
  113852. this._list = [];
  113853. };
  113854. IDRSampleList2.prototype.appendArray = function(syncPoints) {
  113855. var list = this._list;
  113856. if (syncPoints.length === 0) {
  113857. return;
  113858. }
  113859. if (list.length > 0 && syncPoints[0].originalDts < list[list.length - 1].originalDts) {
  113860. this.clear();
  113861. }
  113862. Array.prototype.push.apply(list, syncPoints);
  113863. };
  113864. IDRSampleList2.prototype.getLastSyncPointBeforeDts = function(dts) {
  113865. if (this._list.length == 0) {
  113866. return null;
  113867. }
  113868. var list = this._list;
  113869. var idx = 0;
  113870. var last = list.length - 1;
  113871. var mid = 0;
  113872. var lbound = 0;
  113873. var ubound = last;
  113874. if (dts < list[0].dts) {
  113875. idx = 0;
  113876. lbound = ubound + 1;
  113877. }
  113878. while (lbound <= ubound) {
  113879. mid = lbound + Math.floor((ubound - lbound) / 2);
  113880. if (mid === last || dts >= list[mid].dts && dts < list[mid + 1].dts) {
  113881. idx = mid;
  113882. break;
  113883. } else if (list[mid].dts < dts) {
  113884. lbound = mid + 1;
  113885. } else {
  113886. ubound = mid - 1;
  113887. }
  113888. }
  113889. return this._list[idx];
  113890. };
  113891. return IDRSampleList2;
  113892. }();
  113893. var MediaSegmentInfoList = function() {
  113894. function MediaSegmentInfoList2(type2) {
  113895. this._type = type2;
  113896. this._list = [];
  113897. this._lastAppendLocation = -1;
  113898. }
  113899. Object.defineProperty(MediaSegmentInfoList2.prototype, "type", {
  113900. get: function() {
  113901. return this._type;
  113902. },
  113903. enumerable: false,
  113904. configurable: true
  113905. });
  113906. Object.defineProperty(MediaSegmentInfoList2.prototype, "length", {
  113907. get: function() {
  113908. return this._list.length;
  113909. },
  113910. enumerable: false,
  113911. configurable: true
  113912. });
  113913. MediaSegmentInfoList2.prototype.isEmpty = function() {
  113914. return this._list.length === 0;
  113915. };
  113916. MediaSegmentInfoList2.prototype.clear = function() {
  113917. this._list = [];
  113918. this._lastAppendLocation = -1;
  113919. };
  113920. MediaSegmentInfoList2.prototype._searchNearestSegmentBefore = function(originalBeginDts) {
  113921. var list = this._list;
  113922. if (list.length === 0) {
  113923. return -2;
  113924. }
  113925. var last = list.length - 1;
  113926. var mid = 0;
  113927. var lbound = 0;
  113928. var ubound = last;
  113929. var idx = 0;
  113930. if (originalBeginDts < list[0].originalBeginDts) {
  113931. idx = -1;
  113932. return idx;
  113933. }
  113934. while (lbound <= ubound) {
  113935. mid = lbound + Math.floor((ubound - lbound) / 2);
  113936. if (mid === last || originalBeginDts > list[mid].lastSample.originalDts && originalBeginDts < list[mid + 1].originalBeginDts) {
  113937. idx = mid;
  113938. break;
  113939. } else if (list[mid].originalBeginDts < originalBeginDts) {
  113940. lbound = mid + 1;
  113941. } else {
  113942. ubound = mid - 1;
  113943. }
  113944. }
  113945. return idx;
  113946. };
  113947. MediaSegmentInfoList2.prototype._searchNearestSegmentAfter = function(originalBeginDts) {
  113948. return this._searchNearestSegmentBefore(originalBeginDts) + 1;
  113949. };
  113950. MediaSegmentInfoList2.prototype.append = function(mediaSegmentInfo) {
  113951. var list = this._list;
  113952. var msi = mediaSegmentInfo;
  113953. var lastAppendIdx = this._lastAppendLocation;
  113954. var insertIdx = 0;
  113955. 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)) {
  113956. insertIdx = lastAppendIdx + 1;
  113957. } else {
  113958. if (list.length > 0) {
  113959. insertIdx = this._searchNearestSegmentBefore(msi.originalBeginDts) + 1;
  113960. }
  113961. }
  113962. this._lastAppendLocation = insertIdx;
  113963. this._list.splice(insertIdx, 0, msi);
  113964. };
  113965. MediaSegmentInfoList2.prototype.getLastSegmentBefore = function(originalBeginDts) {
  113966. var idx = this._searchNearestSegmentBefore(originalBeginDts);
  113967. if (idx >= 0) {
  113968. return this._list[idx];
  113969. } else {
  113970. return null;
  113971. }
  113972. };
  113973. MediaSegmentInfoList2.prototype.getLastSampleBefore = function(originalBeginDts) {
  113974. var segment = this.getLastSegmentBefore(originalBeginDts);
  113975. if (segment != null) {
  113976. return segment.lastSample;
  113977. } else {
  113978. return null;
  113979. }
  113980. };
  113981. MediaSegmentInfoList2.prototype.getLastSyncPointBefore = function(originalBeginDts) {
  113982. var segmentIdx = this._searchNearestSegmentBefore(originalBeginDts);
  113983. var syncPoints = this._list[segmentIdx].syncPoints;
  113984. while (syncPoints.length === 0 && segmentIdx > 0) {
  113985. segmentIdx--;
  113986. syncPoints = this._list[segmentIdx].syncPoints;
  113987. }
  113988. if (syncPoints.length > 0) {
  113989. return syncPoints[syncPoints.length - 1];
  113990. } else {
  113991. return null;
  113992. }
  113993. };
  113994. return MediaSegmentInfoList2;
  113995. }();
  113996. },
  113997. "./src/core/mse-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113998. __webpack_require__2.r(__webpack_exports__2);
  113999. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114000. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114001. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  114002. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  114003. var _mse_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/mse-events.js");
  114004. var _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  114005. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  114006. var MSEController = function() {
  114007. function MSEController2(config) {
  114008. this.TAG = "MSEController";
  114009. this._config = config;
  114010. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114011. if (this._config.isLive && this._config.autoCleanupSourceBuffer == void 0) {
  114012. this._config.autoCleanupSourceBuffer = true;
  114013. }
  114014. this.e = {
  114015. onSourceOpen: this._onSourceOpen.bind(this),
  114016. onSourceEnded: this._onSourceEnded.bind(this),
  114017. onSourceClose: this._onSourceClose.bind(this),
  114018. onSourceBufferError: this._onSourceBufferError.bind(this),
  114019. onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
  114020. };
  114021. this._mediaSource = null;
  114022. this._mediaSourceObjectURL = null;
  114023. this._mediaElement = null;
  114024. this._isBufferFull = false;
  114025. this._hasPendingEos = false;
  114026. this._requireSetMediaDuration = false;
  114027. this._pendingMediaDuration = 0;
  114028. this._pendingSourceBufferInit = [];
  114029. this._mimeTypes = {
  114030. video: null,
  114031. audio: null
  114032. };
  114033. this._sourceBuffers = {
  114034. video: null,
  114035. audio: null
  114036. };
  114037. this._lastInitSegments = {
  114038. video: null,
  114039. audio: null
  114040. };
  114041. this._pendingSegments = {
  114042. video: [],
  114043. audio: []
  114044. };
  114045. this._pendingRemoveRanges = {
  114046. video: [],
  114047. audio: []
  114048. };
  114049. this._idrList = new _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.IDRSampleList();
  114050. }
  114051. MSEController2.prototype.destroy = function() {
  114052. if (this._mediaElement || this._mediaSource) {
  114053. this.detachMediaElement();
  114054. }
  114055. this.e = null;
  114056. this._emitter.removeAllListeners();
  114057. this._emitter = null;
  114058. };
  114059. MSEController2.prototype.on = function(event2, listener) {
  114060. this._emitter.addListener(event2, listener);
  114061. };
  114062. MSEController2.prototype.off = function(event2, listener) {
  114063. this._emitter.removeListener(event2, listener);
  114064. };
  114065. MSEController2.prototype.attachMediaElement = function(mediaElement) {
  114066. if (this._mediaSource) {
  114067. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");
  114068. }
  114069. var ms = this._mediaSource = new window.MediaSource();
  114070. ms.addEventListener("sourceopen", this.e.onSourceOpen);
  114071. ms.addEventListener("sourceended", this.e.onSourceEnded);
  114072. ms.addEventListener("sourceclose", this.e.onSourceClose);
  114073. this._mediaElement = mediaElement;
  114074. this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource);
  114075. mediaElement.src = this._mediaSourceObjectURL;
  114076. };
  114077. MSEController2.prototype.detachMediaElement = function() {
  114078. if (this._mediaSource) {
  114079. var ms = this._mediaSource;
  114080. for (var type2 in this._sourceBuffers) {
  114081. var ps = this._pendingSegments[type2];
  114082. ps.splice(0, ps.length);
  114083. this._pendingSegments[type2] = null;
  114084. this._pendingRemoveRanges[type2] = null;
  114085. this._lastInitSegments[type2] = null;
  114086. var sb = this._sourceBuffers[type2];
  114087. if (sb) {
  114088. if (ms.readyState !== "closed") {
  114089. try {
  114090. ms.removeSourceBuffer(sb);
  114091. } catch (error) {
  114092. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114093. }
  114094. sb.removeEventListener("error", this.e.onSourceBufferError);
  114095. sb.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114096. }
  114097. this._mimeTypes[type2] = null;
  114098. this._sourceBuffers[type2] = null;
  114099. }
  114100. }
  114101. if (ms.readyState === "open") {
  114102. try {
  114103. ms.endOfStream();
  114104. } catch (error) {
  114105. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114106. }
  114107. }
  114108. ms.removeEventListener("sourceopen", this.e.onSourceOpen);
  114109. ms.removeEventListener("sourceended", this.e.onSourceEnded);
  114110. ms.removeEventListener("sourceclose", this.e.onSourceClose);
  114111. this._pendingSourceBufferInit = [];
  114112. this._isBufferFull = false;
  114113. this._idrList.clear();
  114114. this._mediaSource = null;
  114115. }
  114116. if (this._mediaElement) {
  114117. this._mediaElement.src = "";
  114118. this._mediaElement.removeAttribute("src");
  114119. this._mediaElement = null;
  114120. }
  114121. if (this._mediaSourceObjectURL) {
  114122. window.URL.revokeObjectURL(this._mediaSourceObjectURL);
  114123. this._mediaSourceObjectURL = null;
  114124. }
  114125. };
  114126. MSEController2.prototype.appendInitSegment = function(initSegment, deferred) {
  114127. if (!this._mediaSource || this._mediaSource.readyState !== "open") {
  114128. this._pendingSourceBufferInit.push(initSegment);
  114129. this._pendingSegments[initSegment.type].push(initSegment);
  114130. return;
  114131. }
  114132. var is = initSegment;
  114133. var mimeType = "" + is.container;
  114134. if (is.codec && is.codec.length > 0) {
  114135. mimeType += ";codecs=" + is.codec;
  114136. }
  114137. var firstInitSegment = false;
  114138. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Received Initialization Segment, mimeType: " + mimeType);
  114139. this._lastInitSegments[is.type] = is;
  114140. if (mimeType !== this._mimeTypes[is.type]) {
  114141. if (!this._mimeTypes[is.type]) {
  114142. firstInitSegment = true;
  114143. try {
  114144. var sb = this._sourceBuffers[is.type] = this._mediaSource.addSourceBuffer(mimeType);
  114145. sb.addEventListener("error", this.e.onSourceBufferError);
  114146. sb.addEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114147. } catch (error) {
  114148. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114149. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114150. return;
  114151. }
  114152. } else {
  114153. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Notice: " + is.type + " mimeType changed, origin: " + this._mimeTypes[is.type] + ", target: " + mimeType);
  114154. }
  114155. this._mimeTypes[is.type] = mimeType;
  114156. }
  114157. if (!deferred) {
  114158. this._pendingSegments[is.type].push(is);
  114159. }
  114160. if (!firstInitSegment) {
  114161. if (this._sourceBuffers[is.type] && !this._sourceBuffers[is.type].updating) {
  114162. this._doAppendSegments();
  114163. }
  114164. }
  114165. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && is.container === "audio/mpeg" && is.mediaDuration > 0) {
  114166. this._requireSetMediaDuration = true;
  114167. this._pendingMediaDuration = is.mediaDuration / 1e3;
  114168. this._updateMediaSourceDuration();
  114169. }
  114170. };
  114171. MSEController2.prototype.appendMediaSegment = function(mediaSegment) {
  114172. var ms = mediaSegment;
  114173. this._pendingSegments[ms.type].push(ms);
  114174. if (this._config.autoCleanupSourceBuffer && this._needCleanupSourceBuffer()) {
  114175. this._doCleanupSourceBuffer();
  114176. }
  114177. var sb = this._sourceBuffers[ms.type];
  114178. if (sb && !sb.updating && !this._hasPendingRemoveRanges()) {
  114179. this._doAppendSegments();
  114180. }
  114181. };
  114182. MSEController2.prototype.seek = function(seconds) {
  114183. for (var type2 in this._sourceBuffers) {
  114184. if (!this._sourceBuffers[type2]) {
  114185. continue;
  114186. }
  114187. var sb = this._sourceBuffers[type2];
  114188. if (this._mediaSource.readyState === "open") {
  114189. try {
  114190. sb.abort();
  114191. } catch (error) {
  114192. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114193. }
  114194. }
  114195. this._idrList.clear();
  114196. var ps = this._pendingSegments[type2];
  114197. ps.splice(0, ps.length);
  114198. if (this._mediaSource.readyState === "closed") {
  114199. continue;
  114200. }
  114201. for (var i2 = 0; i2 < sb.buffered.length; i2++) {
  114202. var start2 = sb.buffered.start(i2);
  114203. var end = sb.buffered.end(i2);
  114204. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114205. }
  114206. if (!sb.updating) {
  114207. this._doRemoveRanges();
  114208. }
  114209. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  114210. var lastInitSegment = this._lastInitSegments[type2];
  114211. if (lastInitSegment) {
  114212. this._pendingSegments[type2].push(lastInitSegment);
  114213. if (!sb.updating) {
  114214. this._doAppendSegments();
  114215. }
  114216. }
  114217. }
  114218. }
  114219. };
  114220. MSEController2.prototype.endOfStream = function() {
  114221. var ms = this._mediaSource;
  114222. var sb = this._sourceBuffers;
  114223. if (!ms || ms.readyState !== "open") {
  114224. if (ms && ms.readyState === "closed" && this._hasPendingSegments()) {
  114225. this._hasPendingEos = true;
  114226. }
  114227. return;
  114228. }
  114229. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114230. this._hasPendingEos = true;
  114231. } else {
  114232. this._hasPendingEos = false;
  114233. ms.endOfStream();
  114234. }
  114235. };
  114236. MSEController2.prototype.getNearestKeyframe = function(dts) {
  114237. return this._idrList.getLastSyncPointBeforeDts(dts);
  114238. };
  114239. MSEController2.prototype._needCleanupSourceBuffer = function() {
  114240. if (!this._config.autoCleanupSourceBuffer) {
  114241. return false;
  114242. }
  114243. var currentTime = this._mediaElement.currentTime;
  114244. for (var type2 in this._sourceBuffers) {
  114245. var sb = this._sourceBuffers[type2];
  114246. if (sb) {
  114247. var buffered = sb.buffered;
  114248. if (buffered.length >= 1) {
  114249. if (currentTime - buffered.start(0) >= this._config.autoCleanupMaxBackwardDuration) {
  114250. return true;
  114251. }
  114252. }
  114253. }
  114254. }
  114255. return false;
  114256. };
  114257. MSEController2.prototype._doCleanupSourceBuffer = function() {
  114258. var currentTime = this._mediaElement.currentTime;
  114259. for (var type2 in this._sourceBuffers) {
  114260. var sb = this._sourceBuffers[type2];
  114261. if (sb) {
  114262. var buffered = sb.buffered;
  114263. var doRemove = false;
  114264. for (var i2 = 0; i2 < buffered.length; i2++) {
  114265. var start2 = buffered.start(i2);
  114266. var end = buffered.end(i2);
  114267. if (start2 <= currentTime && currentTime < end + 3) {
  114268. if (currentTime - start2 >= this._config.autoCleanupMaxBackwardDuration) {
  114269. doRemove = true;
  114270. var removeEnd = currentTime - this._config.autoCleanupMinBackwardDuration;
  114271. this._pendingRemoveRanges[type2].push({ start: start2, end: removeEnd });
  114272. }
  114273. } else if (end < currentTime) {
  114274. doRemove = true;
  114275. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114276. }
  114277. }
  114278. if (doRemove && !sb.updating) {
  114279. this._doRemoveRanges();
  114280. }
  114281. }
  114282. }
  114283. };
  114284. MSEController2.prototype._updateMediaSourceDuration = function() {
  114285. var sb = this._sourceBuffers;
  114286. if (this._mediaElement.readyState === 0 || this._mediaSource.readyState !== "open") {
  114287. return;
  114288. }
  114289. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114290. return;
  114291. }
  114292. var current = this._mediaSource.duration;
  114293. var target = this._pendingMediaDuration;
  114294. if (target > 0 && (isNaN(current) || target > current)) {
  114295. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MediaSource duration from " + current + " to " + target);
  114296. this._mediaSource.duration = target;
  114297. }
  114298. this._requireSetMediaDuration = false;
  114299. this._pendingMediaDuration = 0;
  114300. };
  114301. MSEController2.prototype._doRemoveRanges = function() {
  114302. for (var type2 in this._pendingRemoveRanges) {
  114303. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114304. continue;
  114305. }
  114306. var sb = this._sourceBuffers[type2];
  114307. var ranges = this._pendingRemoveRanges[type2];
  114308. while (ranges.length && !sb.updating) {
  114309. var range3 = ranges.shift();
  114310. sb.remove(range3.start, range3.end);
  114311. }
  114312. }
  114313. };
  114314. MSEController2.prototype._doAppendSegments = function() {
  114315. var pendingSegments = this._pendingSegments;
  114316. for (var type2 in pendingSegments) {
  114317. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114318. continue;
  114319. }
  114320. if (pendingSegments[type2].length > 0) {
  114321. var segment = pendingSegments[type2].shift();
  114322. if (segment.timestampOffset) {
  114323. var currentOffset = this._sourceBuffers[type2].timestampOffset;
  114324. var targetOffset = segment.timestampOffset / 1e3;
  114325. var delta = Math.abs(currentOffset - targetOffset);
  114326. if (delta > 0.1) {
  114327. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MPEG audio timestampOffset from " + currentOffset + " to " + targetOffset);
  114328. this._sourceBuffers[type2].timestampOffset = targetOffset;
  114329. }
  114330. delete segment.timestampOffset;
  114331. }
  114332. if (!segment.data || segment.data.byteLength === 0) {
  114333. continue;
  114334. }
  114335. try {
  114336. this._sourceBuffers[type2].appendBuffer(segment.data);
  114337. this._isBufferFull = false;
  114338. if (type2 === "video" && segment.hasOwnProperty("info")) {
  114339. this._idrList.appendArray(segment.info.syncPoints);
  114340. }
  114341. } catch (error) {
  114342. this._pendingSegments[type2].unshift(segment);
  114343. if (error.code === 22) {
  114344. if (!this._isBufferFull) {
  114345. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.BUFFER_FULL);
  114346. }
  114347. this._isBufferFull = true;
  114348. } else {
  114349. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114350. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114351. }
  114352. }
  114353. }
  114354. }
  114355. };
  114356. MSEController2.prototype._onSourceOpen = function() {
  114357. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceOpen");
  114358. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114359. if (this._pendingSourceBufferInit.length > 0) {
  114360. var pendings = this._pendingSourceBufferInit;
  114361. while (pendings.length) {
  114362. var segment = pendings.shift();
  114363. this.appendInitSegment(segment, true);
  114364. }
  114365. }
  114366. if (this._hasPendingSegments()) {
  114367. this._doAppendSegments();
  114368. }
  114369. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SOURCE_OPEN);
  114370. };
  114371. MSEController2.prototype._onSourceEnded = function() {
  114372. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceEnded");
  114373. };
  114374. MSEController2.prototype._onSourceClose = function() {
  114375. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceClose");
  114376. if (this._mediaSource && this.e != null) {
  114377. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114378. this._mediaSource.removeEventListener("sourceended", this.e.onSourceEnded);
  114379. this._mediaSource.removeEventListener("sourceclose", this.e.onSourceClose);
  114380. }
  114381. };
  114382. MSEController2.prototype._hasPendingSegments = function() {
  114383. var ps = this._pendingSegments;
  114384. return ps.video.length > 0 || ps.audio.length > 0;
  114385. };
  114386. MSEController2.prototype._hasPendingRemoveRanges = function() {
  114387. var prr = this._pendingRemoveRanges;
  114388. return prr.video.length > 0 || prr.audio.length > 0;
  114389. };
  114390. MSEController2.prototype._onSourceBufferUpdateEnd = function() {
  114391. if (this._requireSetMediaDuration) {
  114392. this._updateMediaSourceDuration();
  114393. } else if (this._hasPendingRemoveRanges()) {
  114394. this._doRemoveRanges();
  114395. } else if (this._hasPendingSegments()) {
  114396. this._doAppendSegments();
  114397. } else if (this._hasPendingEos) {
  114398. this.endOfStream();
  114399. }
  114400. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.UPDATE_END);
  114401. };
  114402. MSEController2.prototype._onSourceBufferError = function(e) {
  114403. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "SourceBuffer Error: " + e);
  114404. };
  114405. return MSEController2;
  114406. }();
  114407. __webpack_exports__2["default"] = MSEController;
  114408. },
  114409. "./src/core/mse-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114410. __webpack_require__2.r(__webpack_exports__2);
  114411. var MSEEvents = {
  114412. ERROR: "error",
  114413. SOURCE_OPEN: "source_open",
  114414. UPDATE_END: "update_end",
  114415. BUFFER_FULL: "buffer_full"
  114416. };
  114417. __webpack_exports__2["default"] = MSEEvents;
  114418. },
  114419. "./src/core/transmuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114420. __webpack_require__2.r(__webpack_exports__2);
  114421. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114422. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114423. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./node_modules/webworkify-webpack/index.js");
  114424. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default = /* @__PURE__ */ __webpack_require__2.n(webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__);
  114425. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/logger.js");
  114426. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/logging-control.js");
  114427. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  114428. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114429. var _media_info_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/media-info.js");
  114430. var Transmuxer = function() {
  114431. function Transmuxer2(mediaDataSource, config) {
  114432. this.TAG = "Transmuxer";
  114433. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114434. if (config.enableWorker && typeof Worker !== "undefined") {
  114435. try {
  114436. this._worker = webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default()("./src/core/transmuxing-worker.js");
  114437. this._workerDestroying = false;
  114438. this._worker.addEventListener("message", this._onWorkerMessage.bind(this));
  114439. this._worker.postMessage({ cmd: "init", param: [mediaDataSource, config] });
  114440. this.e = {
  114441. onLoggingConfigChanged: this._onLoggingConfigChanged.bind(this)
  114442. };
  114443. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.registerListener(this.e.onLoggingConfigChanged);
  114444. this._worker.postMessage({ cmd: "logging_config", param: _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.getConfig() });
  114445. } catch (error) {
  114446. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.e(this.TAG, "Error while initialize transmuxing worker, fallback to inline transmuxing");
  114447. this._worker = null;
  114448. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114449. }
  114450. } else {
  114451. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114452. }
  114453. if (this._controller) {
  114454. var ctl = this._controller;
  114455. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, this._onIOError.bind(this));
  114456. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, this._onDemuxError.bind(this));
  114457. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, this._onInitSegment.bind(this));
  114458. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, this._onMediaSegment.bind(this));
  114459. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, this._onLoadingComplete.bind(this));
  114460. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this));
  114461. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, this._onMediaInfo.bind(this));
  114462. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, this._onMetaDataArrived.bind(this));
  114463. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this));
  114464. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, this._onStatisticsInfo.bind(this));
  114465. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this));
  114466. }
  114467. }
  114468. Transmuxer2.prototype.destroy = function() {
  114469. if (this._worker) {
  114470. if (!this._workerDestroying) {
  114471. this._workerDestroying = true;
  114472. this._worker.postMessage({ cmd: "destroy" });
  114473. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.removeListener(this.e.onLoggingConfigChanged);
  114474. this.e = null;
  114475. }
  114476. } else {
  114477. this._controller.destroy();
  114478. this._controller = null;
  114479. }
  114480. this._emitter.removeAllListeners();
  114481. this._emitter = null;
  114482. };
  114483. Transmuxer2.prototype.on = function(event2, listener) {
  114484. this._emitter.addListener(event2, listener);
  114485. };
  114486. Transmuxer2.prototype.off = function(event2, listener) {
  114487. this._emitter.removeListener(event2, listener);
  114488. };
  114489. Transmuxer2.prototype.hasWorker = function() {
  114490. return this._worker != null;
  114491. };
  114492. Transmuxer2.prototype.open = function() {
  114493. if (this._worker) {
  114494. this._worker.postMessage({ cmd: "start" });
  114495. } else {
  114496. this._controller.start();
  114497. }
  114498. };
  114499. Transmuxer2.prototype.close = function() {
  114500. if (this._worker) {
  114501. this._worker.postMessage({ cmd: "stop" });
  114502. } else {
  114503. this._controller.stop();
  114504. }
  114505. };
  114506. Transmuxer2.prototype.seek = function(milliseconds) {
  114507. if (this._worker) {
  114508. this._worker.postMessage({ cmd: "seek", param: milliseconds });
  114509. } else {
  114510. this._controller.seek(milliseconds);
  114511. }
  114512. };
  114513. Transmuxer2.prototype.pause = function() {
  114514. if (this._worker) {
  114515. this._worker.postMessage({ cmd: "pause" });
  114516. } else {
  114517. this._controller.pause();
  114518. }
  114519. };
  114520. Transmuxer2.prototype.resume = function() {
  114521. if (this._worker) {
  114522. this._worker.postMessage({ cmd: "resume" });
  114523. } else {
  114524. this._controller.resume();
  114525. }
  114526. };
  114527. Transmuxer2.prototype._onInitSegment = function(type2, initSegment) {
  114528. var _this = this;
  114529. Promise.resolve().then(function() {
  114530. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, type2, initSegment);
  114531. });
  114532. };
  114533. Transmuxer2.prototype._onMediaSegment = function(type2, mediaSegment) {
  114534. var _this = this;
  114535. Promise.resolve().then(function() {
  114536. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114537. });
  114538. };
  114539. Transmuxer2.prototype._onLoadingComplete = function() {
  114540. var _this = this;
  114541. Promise.resolve().then(function() {
  114542. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE);
  114543. });
  114544. };
  114545. Transmuxer2.prototype._onRecoveredEarlyEof = function() {
  114546. var _this = this;
  114547. Promise.resolve().then(function() {
  114548. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF);
  114549. });
  114550. };
  114551. Transmuxer2.prototype._onMediaInfo = function(mediaInfo) {
  114552. var _this = this;
  114553. Promise.resolve().then(function() {
  114554. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, mediaInfo);
  114555. });
  114556. };
  114557. Transmuxer2.prototype._onMetaDataArrived = function(metadata) {
  114558. var _this = this;
  114559. Promise.resolve().then(function() {
  114560. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, metadata);
  114561. });
  114562. };
  114563. Transmuxer2.prototype._onScriptDataArrived = function(data) {
  114564. var _this = this;
  114565. Promise.resolve().then(function() {
  114566. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, data);
  114567. });
  114568. };
  114569. Transmuxer2.prototype._onStatisticsInfo = function(statisticsInfo) {
  114570. var _this = this;
  114571. Promise.resolve().then(function() {
  114572. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, statisticsInfo);
  114573. });
  114574. };
  114575. Transmuxer2.prototype._onIOError = function(type2, info) {
  114576. var _this = this;
  114577. Promise.resolve().then(function() {
  114578. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, type2, info);
  114579. });
  114580. };
  114581. Transmuxer2.prototype._onDemuxError = function(type2, info) {
  114582. var _this = this;
  114583. Promise.resolve().then(function() {
  114584. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, type2, info);
  114585. });
  114586. };
  114587. Transmuxer2.prototype._onRecommendSeekpoint = function(milliseconds) {
  114588. var _this = this;
  114589. Promise.resolve().then(function() {
  114590. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, milliseconds);
  114591. });
  114592. };
  114593. Transmuxer2.prototype._onLoggingConfigChanged = function(config) {
  114594. if (this._worker) {
  114595. this._worker.postMessage({ cmd: "logging_config", param: config });
  114596. }
  114597. };
  114598. Transmuxer2.prototype._onWorkerMessage = function(e) {
  114599. var message = e.data;
  114600. var data = message.data;
  114601. if (message.msg === "destroyed" || this._workerDestroying) {
  114602. this._workerDestroying = false;
  114603. this._worker.terminate();
  114604. this._worker = null;
  114605. return;
  114606. }
  114607. switch (message.msg) {
  114608. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT:
  114609. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT:
  114610. this._emitter.emit(message.msg, data.type, data.data);
  114611. break;
  114612. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE:
  114613. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF:
  114614. this._emitter.emit(message.msg);
  114615. break;
  114616. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO:
  114617. Object.setPrototypeOf(data, _media_info_js__WEBPACK_IMPORTED_MODULE_6__.default.prototype);
  114618. this._emitter.emit(message.msg, data);
  114619. break;
  114620. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED:
  114621. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED:
  114622. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO:
  114623. this._emitter.emit(message.msg, data);
  114624. break;
  114625. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR:
  114626. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR:
  114627. this._emitter.emit(message.msg, data.type, data.info);
  114628. break;
  114629. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT:
  114630. this._emitter.emit(message.msg, data);
  114631. break;
  114632. case "logcat_callback":
  114633. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.emitter.emit("log", data.type, data.logcat);
  114634. break;
  114635. }
  114636. };
  114637. return Transmuxer2;
  114638. }();
  114639. __webpack_exports__2["default"] = Transmuxer;
  114640. },
  114641. "./src/core/transmuxing-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114642. __webpack_require__2.r(__webpack_exports__2);
  114643. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114644. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114645. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  114646. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  114647. var _media_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/media-info.js");
  114648. var _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/demux/flv-demuxer.js");
  114649. var _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/remux/mp4-remuxer.js");
  114650. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/demux/demux-errors.js");
  114651. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/io-controller.js");
  114652. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114653. var TransmuxingController = function() {
  114654. function TransmuxingController2(mediaDataSource, config) {
  114655. this.TAG = "TransmuxingController";
  114656. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114657. this._config = config;
  114658. if (!mediaDataSource.segments) {
  114659. mediaDataSource.segments = [{
  114660. duration: mediaDataSource.duration,
  114661. filesize: mediaDataSource.filesize,
  114662. url: mediaDataSource.url
  114663. }];
  114664. }
  114665. if (typeof mediaDataSource.cors !== "boolean") {
  114666. mediaDataSource.cors = true;
  114667. }
  114668. if (typeof mediaDataSource.withCredentials !== "boolean") {
  114669. mediaDataSource.withCredentials = false;
  114670. }
  114671. this._mediaDataSource = mediaDataSource;
  114672. this._currentSegmentIndex = 0;
  114673. var totalDuration = 0;
  114674. this._mediaDataSource.segments.forEach(function(segment) {
  114675. segment.timestampBase = totalDuration;
  114676. totalDuration += segment.duration;
  114677. segment.cors = mediaDataSource.cors;
  114678. segment.withCredentials = mediaDataSource.withCredentials;
  114679. if (config.referrerPolicy) {
  114680. segment.referrerPolicy = config.referrerPolicy;
  114681. }
  114682. });
  114683. if (!isNaN(totalDuration) && this._mediaDataSource.duration !== totalDuration) {
  114684. this._mediaDataSource.duration = totalDuration;
  114685. }
  114686. this._mediaInfo = null;
  114687. this._demuxer = null;
  114688. this._remuxer = null;
  114689. this._ioctl = null;
  114690. this._pendingSeekTime = null;
  114691. this._pendingResolveSeekPoint = null;
  114692. this._statisticsReporter = null;
  114693. }
  114694. TransmuxingController2.prototype.destroy = function() {
  114695. this._mediaInfo = null;
  114696. this._mediaDataSource = null;
  114697. if (this._statisticsReporter) {
  114698. this._disableStatisticsReporter();
  114699. }
  114700. if (this._ioctl) {
  114701. this._ioctl.destroy();
  114702. this._ioctl = null;
  114703. }
  114704. if (this._demuxer) {
  114705. this._demuxer.destroy();
  114706. this._demuxer = null;
  114707. }
  114708. if (this._remuxer) {
  114709. this._remuxer.destroy();
  114710. this._remuxer = null;
  114711. }
  114712. this._emitter.removeAllListeners();
  114713. this._emitter = null;
  114714. };
  114715. TransmuxingController2.prototype.on = function(event2, listener) {
  114716. this._emitter.addListener(event2, listener);
  114717. };
  114718. TransmuxingController2.prototype.off = function(event2, listener) {
  114719. this._emitter.removeListener(event2, listener);
  114720. };
  114721. TransmuxingController2.prototype.start = function() {
  114722. this._loadSegment(0);
  114723. this._enableStatisticsReporter();
  114724. };
  114725. TransmuxingController2.prototype._loadSegment = function(segmentIndex, optionalFrom) {
  114726. this._currentSegmentIndex = segmentIndex;
  114727. var dataSource = this._mediaDataSource.segments[segmentIndex];
  114728. var ioctl = this._ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__.default(dataSource, this._config, segmentIndex);
  114729. ioctl.onError = this._onIOException.bind(this);
  114730. ioctl.onSeeked = this._onIOSeeked.bind(this);
  114731. ioctl.onComplete = this._onIOComplete.bind(this);
  114732. ioctl.onRedirect = this._onIORedirect.bind(this);
  114733. ioctl.onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this);
  114734. if (optionalFrom) {
  114735. this._demuxer.bindDataSource(this._ioctl);
  114736. } else {
  114737. ioctl.onDataArrival = this._onInitChunkArrival.bind(this);
  114738. }
  114739. ioctl.open(optionalFrom);
  114740. };
  114741. TransmuxingController2.prototype.stop = function() {
  114742. this._internalAbort();
  114743. this._disableStatisticsReporter();
  114744. };
  114745. TransmuxingController2.prototype._internalAbort = function() {
  114746. if (this._ioctl) {
  114747. this._ioctl.destroy();
  114748. this._ioctl = null;
  114749. }
  114750. };
  114751. TransmuxingController2.prototype.pause = function() {
  114752. if (this._ioctl && this._ioctl.isWorking()) {
  114753. this._ioctl.pause();
  114754. this._disableStatisticsReporter();
  114755. }
  114756. };
  114757. TransmuxingController2.prototype.resume = function() {
  114758. if (this._ioctl && this._ioctl.isPaused()) {
  114759. this._ioctl.resume();
  114760. this._enableStatisticsReporter();
  114761. }
  114762. };
  114763. TransmuxingController2.prototype.seek = function(milliseconds) {
  114764. if (this._mediaInfo == null || !this._mediaInfo.isSeekable()) {
  114765. return;
  114766. }
  114767. var targetSegmentIndex = this._searchSegmentIndexContains(milliseconds);
  114768. if (targetSegmentIndex === this._currentSegmentIndex) {
  114769. var segmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114770. if (segmentInfo == void 0) {
  114771. this._pendingSeekTime = milliseconds;
  114772. } else {
  114773. var keyframe = segmentInfo.getNearestKeyframe(milliseconds);
  114774. this._remuxer.seek(keyframe.milliseconds);
  114775. this._ioctl.seek(keyframe.fileposition);
  114776. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114777. }
  114778. } else {
  114779. var targetSegmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114780. if (targetSegmentInfo == void 0) {
  114781. this._pendingSeekTime = milliseconds;
  114782. this._internalAbort();
  114783. this._remuxer.seek();
  114784. this._remuxer.insertDiscontinuity();
  114785. this._loadSegment(targetSegmentIndex);
  114786. } else {
  114787. var keyframe = targetSegmentInfo.getNearestKeyframe(milliseconds);
  114788. this._internalAbort();
  114789. this._remuxer.seek(milliseconds);
  114790. this._remuxer.insertDiscontinuity();
  114791. this._demuxer.resetMediaInfo();
  114792. this._demuxer.timestampBase = this._mediaDataSource.segments[targetSegmentIndex].timestampBase;
  114793. this._loadSegment(targetSegmentIndex, keyframe.fileposition);
  114794. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114795. this._reportSegmentMediaInfo(targetSegmentIndex);
  114796. }
  114797. }
  114798. this._enableStatisticsReporter();
  114799. };
  114800. TransmuxingController2.prototype._searchSegmentIndexContains = function(milliseconds) {
  114801. var segments = this._mediaDataSource.segments;
  114802. var idx = segments.length - 1;
  114803. for (var i2 = 0; i2 < segments.length; i2++) {
  114804. if (milliseconds < segments[i2].timestampBase) {
  114805. idx = i2 - 1;
  114806. break;
  114807. }
  114808. }
  114809. return idx;
  114810. };
  114811. TransmuxingController2.prototype._onInitChunkArrival = function(data, byteStart) {
  114812. var _this = this;
  114813. var probeData = null;
  114814. var consumed = 0;
  114815. if (byteStart > 0) {
  114816. this._demuxer.bindDataSource(this._ioctl);
  114817. this._demuxer.timestampBase = this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase;
  114818. consumed = this._demuxer.parseChunks(data, byteStart);
  114819. } else if ((probeData = _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default.probe(data)).match) {
  114820. this._demuxer = new _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(probeData, this._config);
  114821. if (!this._remuxer) {
  114822. this._remuxer = new _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__.default(this._config);
  114823. }
  114824. var mds = this._mediaDataSource;
  114825. if (mds.duration != void 0 && !isNaN(mds.duration)) {
  114826. this._demuxer.overridedDuration = mds.duration;
  114827. }
  114828. if (typeof mds.hasAudio === "boolean") {
  114829. this._demuxer.overridedHasAudio = mds.hasAudio;
  114830. }
  114831. if (typeof mds.hasVideo === "boolean") {
  114832. this._demuxer.overridedHasVideo = mds.hasVideo;
  114833. }
  114834. this._demuxer.timestampBase = mds.segments[this._currentSegmentIndex].timestampBase;
  114835. this._demuxer.onError = this._onDemuxException.bind(this);
  114836. this._demuxer.onMediaInfo = this._onMediaInfo.bind(this);
  114837. this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this);
  114838. this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this);
  114839. this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl));
  114840. this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this);
  114841. this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this);
  114842. consumed = this._demuxer.parseChunks(data, byteStart);
  114843. } else {
  114844. probeData = null;
  114845. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "Non-FLV, Unsupported media type!");
  114846. Promise.resolve().then(function() {
  114847. _this._internalAbort();
  114848. });
  114849. 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");
  114850. consumed = 0;
  114851. }
  114852. return consumed;
  114853. };
  114854. TransmuxingController2.prototype._onMediaInfo = function(mediaInfo) {
  114855. var _this = this;
  114856. if (this._mediaInfo == null) {
  114857. this._mediaInfo = Object.assign({}, mediaInfo);
  114858. this._mediaInfo.keyframesIndex = null;
  114859. this._mediaInfo.segments = [];
  114860. this._mediaInfo.segmentCount = this._mediaDataSource.segments.length;
  114861. Object.setPrototypeOf(this._mediaInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114862. }
  114863. var segmentInfo = Object.assign({}, mediaInfo);
  114864. Object.setPrototypeOf(segmentInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114865. this._mediaInfo.segments[this._currentSegmentIndex] = segmentInfo;
  114866. this._reportSegmentMediaInfo(this._currentSegmentIndex);
  114867. if (this._pendingSeekTime != null) {
  114868. Promise.resolve().then(function() {
  114869. var target = _this._pendingSeekTime;
  114870. _this._pendingSeekTime = null;
  114871. _this.seek(target);
  114872. });
  114873. }
  114874. };
  114875. TransmuxingController2.prototype._onMetaDataArrived = function(metadata) {
  114876. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.METADATA_ARRIVED, metadata);
  114877. };
  114878. TransmuxingController2.prototype._onScriptDataArrived = function(data) {
  114879. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.SCRIPTDATA_ARRIVED, data);
  114880. };
  114881. TransmuxingController2.prototype._onIOSeeked = function() {
  114882. this._remuxer.insertDiscontinuity();
  114883. };
  114884. TransmuxingController2.prototype._onIOComplete = function(extraData) {
  114885. var segmentIndex = extraData;
  114886. var nextSegmentIndex = segmentIndex + 1;
  114887. if (nextSegmentIndex < this._mediaDataSource.segments.length) {
  114888. this._internalAbort();
  114889. this._remuxer.flushStashedSamples();
  114890. this._loadSegment(nextSegmentIndex);
  114891. } else {
  114892. this._remuxer.flushStashedSamples();
  114893. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.LOADING_COMPLETE);
  114894. this._disableStatisticsReporter();
  114895. }
  114896. };
  114897. TransmuxingController2.prototype._onIORedirect = function(redirectedURL) {
  114898. var segmentIndex = this._ioctl.extraData;
  114899. this._mediaDataSource.segments[segmentIndex].redirectedURL = redirectedURL;
  114900. };
  114901. TransmuxingController2.prototype._onIORecoveredEarlyEof = function() {
  114902. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOVERED_EARLY_EOF);
  114903. };
  114904. TransmuxingController2.prototype._onIOException = function(type2, info) {
  114905. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "IOException: type = " + type2 + ", code = " + info.code + ", msg = " + info.msg);
  114906. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.IO_ERROR, type2, info);
  114907. this._disableStatisticsReporter();
  114908. };
  114909. TransmuxingController2.prototype._onDemuxException = function(type2, info) {
  114910. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "DemuxException: type = " + type2 + ", info = " + info);
  114911. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.DEMUX_ERROR, type2, info);
  114912. };
  114913. TransmuxingController2.prototype._onRemuxerInitSegmentArrival = function(type2, initSegment) {
  114914. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.INIT_SEGMENT, type2, initSegment);
  114915. };
  114916. TransmuxingController2.prototype._onRemuxerMediaSegmentArrival = function(type2, mediaSegment) {
  114917. if (this._pendingSeekTime != null) {
  114918. return;
  114919. }
  114920. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114921. if (this._pendingResolveSeekPoint != null && type2 === "video") {
  114922. var syncPoints = mediaSegment.info.syncPoints;
  114923. var seekpoint = this._pendingResolveSeekPoint;
  114924. this._pendingResolveSeekPoint = null;
  114925. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && syncPoints.length > 0 && syncPoints[0].originalDts === seekpoint) {
  114926. seekpoint = syncPoints[0].pts;
  114927. }
  114928. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOMMEND_SEEKPOINT, seekpoint);
  114929. }
  114930. };
  114931. TransmuxingController2.prototype._enableStatisticsReporter = function() {
  114932. if (this._statisticsReporter == null) {
  114933. this._statisticsReporter = self.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  114934. }
  114935. };
  114936. TransmuxingController2.prototype._disableStatisticsReporter = function() {
  114937. if (this._statisticsReporter) {
  114938. self.clearInterval(this._statisticsReporter);
  114939. this._statisticsReporter = null;
  114940. }
  114941. };
  114942. TransmuxingController2.prototype._reportSegmentMediaInfo = function(segmentIndex) {
  114943. var segmentInfo = this._mediaInfo.segments[segmentIndex];
  114944. var exportInfo = Object.assign({}, segmentInfo);
  114945. exportInfo.duration = this._mediaInfo.duration;
  114946. exportInfo.segmentCount = this._mediaInfo.segmentCount;
  114947. delete exportInfo.segments;
  114948. delete exportInfo.keyframesIndex;
  114949. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_INFO, exportInfo);
  114950. };
  114951. TransmuxingController2.prototype._reportStatisticsInfo = function() {
  114952. var info = {};
  114953. info.url = this._ioctl.currentURL;
  114954. info.hasRedirect = this._ioctl.hasRedirect;
  114955. if (info.hasRedirect) {
  114956. info.redirectedURL = this._ioctl.currentRedirectedURL;
  114957. }
  114958. info.speed = this._ioctl.currentSpeed;
  114959. info.loaderType = this._ioctl.loaderType;
  114960. info.currentSegmentIndex = this._currentSegmentIndex;
  114961. info.totalSegmentCount = this._mediaDataSource.segments.length;
  114962. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.STATISTICS_INFO, info);
  114963. };
  114964. return TransmuxingController2;
  114965. }();
  114966. __webpack_exports__2["default"] = TransmuxingController;
  114967. },
  114968. "./src/core/transmuxing-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114969. __webpack_require__2.r(__webpack_exports__2);
  114970. var TransmuxingEvents = {
  114971. IO_ERROR: "io_error",
  114972. DEMUX_ERROR: "demux_error",
  114973. INIT_SEGMENT: "init_segment",
  114974. MEDIA_SEGMENT: "media_segment",
  114975. LOADING_COMPLETE: "loading_complete",
  114976. RECOVERED_EARLY_EOF: "recovered_early_eof",
  114977. MEDIA_INFO: "media_info",
  114978. METADATA_ARRIVED: "metadata_arrived",
  114979. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  114980. STATISTICS_INFO: "statistics_info",
  114981. RECOMMEND_SEEKPOINT: "recommend_seekpoint"
  114982. };
  114983. __webpack_exports__2["default"] = TransmuxingEvents;
  114984. },
  114985. "./src/core/transmuxing-worker.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114986. __webpack_require__2.r(__webpack_exports__2);
  114987. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logging-control.js");
  114988. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/polyfill.js");
  114989. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  114990. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114991. var TransmuxingWorker = function(self2) {
  114992. var controller = null;
  114993. var logcatListener = onLogcatCallback.bind(this);
  114994. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__.default.install();
  114995. self2.addEventListener("message", function(e) {
  114996. switch (e.data.cmd) {
  114997. case "init":
  114998. controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__.default(e.data.param[0], e.data.param[1]);
  114999. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR, onIOError.bind(this));
  115000. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR, onDemuxError.bind(this));
  115001. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT, onInitSegment.bind(this));
  115002. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT, onMediaSegment.bind(this));
  115003. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE, onLoadingComplete.bind(this));
  115004. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF, onRecoveredEarlyEof.bind(this));
  115005. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, onMediaInfo.bind(this));
  115006. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, onMetaDataArrived.bind(this));
  115007. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, onScriptDataArrived.bind(this));
  115008. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, onStatisticsInfo.bind(this));
  115009. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT, onRecommendSeekpoint.bind(this));
  115010. break;
  115011. case "destroy":
  115012. if (controller) {
  115013. controller.destroy();
  115014. controller = null;
  115015. }
  115016. self2.postMessage({ msg: "destroyed" });
  115017. break;
  115018. case "start":
  115019. controller.start();
  115020. break;
  115021. case "stop":
  115022. controller.stop();
  115023. break;
  115024. case "seek":
  115025. controller.seek(e.data.param);
  115026. break;
  115027. case "pause":
  115028. controller.pause();
  115029. break;
  115030. case "resume":
  115031. controller.resume();
  115032. break;
  115033. case "logging_config": {
  115034. var config = e.data.param;
  115035. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.applyConfig(config);
  115036. if (config.enableCallback === true) {
  115037. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.addLogListener(logcatListener);
  115038. } else {
  115039. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.removeLogListener(logcatListener);
  115040. }
  115041. break;
  115042. }
  115043. }
  115044. });
  115045. function onInitSegment(type2, initSegment) {
  115046. var obj = {
  115047. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT,
  115048. data: {
  115049. type: type2,
  115050. data: initSegment
  115051. }
  115052. };
  115053. self2.postMessage(obj, [initSegment.data]);
  115054. }
  115055. function onMediaSegment(type2, mediaSegment) {
  115056. var obj = {
  115057. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT,
  115058. data: {
  115059. type: type2,
  115060. data: mediaSegment
  115061. }
  115062. };
  115063. self2.postMessage(obj, [mediaSegment.data]);
  115064. }
  115065. function onLoadingComplete() {
  115066. var obj = {
  115067. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE
  115068. };
  115069. self2.postMessage(obj);
  115070. }
  115071. function onRecoveredEarlyEof() {
  115072. var obj = {
  115073. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF
  115074. };
  115075. self2.postMessage(obj);
  115076. }
  115077. function onMediaInfo(mediaInfo) {
  115078. var obj = {
  115079. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO,
  115080. data: mediaInfo
  115081. };
  115082. self2.postMessage(obj);
  115083. }
  115084. function onMetaDataArrived(metadata) {
  115085. var obj = {
  115086. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED,
  115087. data: metadata
  115088. };
  115089. self2.postMessage(obj);
  115090. }
  115091. function onScriptDataArrived(data) {
  115092. var obj = {
  115093. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED,
  115094. data
  115095. };
  115096. self2.postMessage(obj);
  115097. }
  115098. function onStatisticsInfo(statInfo) {
  115099. var obj = {
  115100. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO,
  115101. data: statInfo
  115102. };
  115103. self2.postMessage(obj);
  115104. }
  115105. function onIOError(type2, info) {
  115106. self2.postMessage({
  115107. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR,
  115108. data: {
  115109. type: type2,
  115110. info
  115111. }
  115112. });
  115113. }
  115114. function onDemuxError(type2, info) {
  115115. self2.postMessage({
  115116. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR,
  115117. data: {
  115118. type: type2,
  115119. info
  115120. }
  115121. });
  115122. }
  115123. function onRecommendSeekpoint(milliseconds) {
  115124. self2.postMessage({
  115125. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT,
  115126. data: milliseconds
  115127. });
  115128. }
  115129. function onLogcatCallback(type2, str) {
  115130. self2.postMessage({
  115131. msg: "logcat_callback",
  115132. data: {
  115133. type: type2,
  115134. logcat: str
  115135. }
  115136. });
  115137. }
  115138. };
  115139. __webpack_exports__2["default"] = TransmuxingWorker;
  115140. },
  115141. "./src/demux/amf-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115142. __webpack_require__2.r(__webpack_exports__2);
  115143. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115144. var _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/utf8-conv.js");
  115145. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  115146. var le = function() {
  115147. var buf = new ArrayBuffer(2);
  115148. new DataView(buf).setInt16(0, 256, true);
  115149. return new Int16Array(buf)[0] === 256;
  115150. }();
  115151. var AMF = function() {
  115152. function AMF2() {
  115153. }
  115154. AMF2.parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115155. var data = {};
  115156. try {
  115157. var name_1 = AMF2.parseValue(arrayBuffer, dataOffset, dataSize);
  115158. var value = AMF2.parseValue(arrayBuffer, dataOffset + name_1.size, dataSize - name_1.size);
  115159. data[name_1.data] = value.data;
  115160. } catch (e) {
  115161. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115162. }
  115163. return data;
  115164. };
  115165. AMF2.parseObject = function(arrayBuffer, dataOffset, dataSize) {
  115166. if (dataSize < 3) {
  115167. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse ScriptDataObject");
  115168. }
  115169. var name = AMF2.parseString(arrayBuffer, dataOffset, dataSize);
  115170. var value = AMF2.parseValue(arrayBuffer, dataOffset + name.size, dataSize - name.size);
  115171. var isObjectEnd = value.objectEnd;
  115172. return {
  115173. data: {
  115174. name: name.data,
  115175. value: value.data
  115176. },
  115177. size: name.size + value.size,
  115178. objectEnd: isObjectEnd
  115179. };
  115180. };
  115181. AMF2.parseVariable = function(arrayBuffer, dataOffset, dataSize) {
  115182. return AMF2.parseObject(arrayBuffer, dataOffset, dataSize);
  115183. };
  115184. AMF2.parseString = function(arrayBuffer, dataOffset, dataSize) {
  115185. if (dataSize < 2) {
  115186. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse String");
  115187. }
  115188. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115189. var length = v.getUint16(0, !le);
  115190. var str;
  115191. if (length > 0) {
  115192. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 2, length));
  115193. } else {
  115194. str = "";
  115195. }
  115196. return {
  115197. data: str,
  115198. size: 2 + length
  115199. };
  115200. };
  115201. AMF2.parseLongString = function(arrayBuffer, dataOffset, dataSize) {
  115202. if (dataSize < 4) {
  115203. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse LongString");
  115204. }
  115205. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115206. var length = v.getUint32(0, !le);
  115207. var str;
  115208. if (length > 0) {
  115209. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 4, length));
  115210. } else {
  115211. str = "";
  115212. }
  115213. return {
  115214. data: str,
  115215. size: 4 + length
  115216. };
  115217. };
  115218. AMF2.parseDate = function(arrayBuffer, dataOffset, dataSize) {
  115219. if (dataSize < 10) {
  115220. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data size invalid when parse Date");
  115221. }
  115222. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115223. var timestamp = v.getFloat64(0, !le);
  115224. var localTimeOffset = v.getInt16(8, !le);
  115225. timestamp += localTimeOffset * 60 * 1e3;
  115226. return {
  115227. data: new Date(timestamp),
  115228. size: 8 + 2
  115229. };
  115230. };
  115231. AMF2.parseValue = function(arrayBuffer, dataOffset, dataSize) {
  115232. if (dataSize < 1) {
  115233. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse Value");
  115234. }
  115235. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115236. var offset = 1;
  115237. var type2 = v.getUint8(0);
  115238. var value;
  115239. var objectEnd = false;
  115240. try {
  115241. switch (type2) {
  115242. case 0:
  115243. value = v.getFloat64(1, !le);
  115244. offset += 8;
  115245. break;
  115246. case 1: {
  115247. var b = v.getUint8(1);
  115248. value = b ? true : false;
  115249. offset += 1;
  115250. break;
  115251. }
  115252. case 2: {
  115253. var amfstr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115254. value = amfstr.data;
  115255. offset += amfstr.size;
  115256. break;
  115257. }
  115258. case 3: {
  115259. value = {};
  115260. var terminal = 0;
  115261. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115262. terminal = 3;
  115263. }
  115264. while (offset < dataSize - 4) {
  115265. var amfobj = AMF2.parseObject(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115266. if (amfobj.objectEnd)
  115267. break;
  115268. value[amfobj.data.name] = amfobj.data.value;
  115269. offset += amfobj.size;
  115270. }
  115271. if (offset <= dataSize - 3) {
  115272. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115273. if (marker === 9) {
  115274. offset += 3;
  115275. }
  115276. }
  115277. break;
  115278. }
  115279. case 8: {
  115280. value = {};
  115281. offset += 4;
  115282. var terminal = 0;
  115283. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115284. terminal = 3;
  115285. }
  115286. while (offset < dataSize - 8) {
  115287. var amfvar = AMF2.parseVariable(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115288. if (amfvar.objectEnd)
  115289. break;
  115290. value[amfvar.data.name] = amfvar.data.value;
  115291. offset += amfvar.size;
  115292. }
  115293. if (offset <= dataSize - 3) {
  115294. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115295. if (marker === 9) {
  115296. offset += 3;
  115297. }
  115298. }
  115299. break;
  115300. }
  115301. case 9:
  115302. value = void 0;
  115303. offset = 1;
  115304. objectEnd = true;
  115305. break;
  115306. case 10: {
  115307. value = [];
  115308. var strictArrayLength = v.getUint32(1, !le);
  115309. offset += 4;
  115310. for (var i2 = 0; i2 < strictArrayLength; i2++) {
  115311. var val = AMF2.parseValue(arrayBuffer, dataOffset + offset, dataSize - offset);
  115312. value.push(val.data);
  115313. offset += val.size;
  115314. }
  115315. break;
  115316. }
  115317. case 11: {
  115318. var date = AMF2.parseDate(arrayBuffer, dataOffset + 1, dataSize - 1);
  115319. value = date.data;
  115320. offset += date.size;
  115321. break;
  115322. }
  115323. case 12: {
  115324. var amfLongStr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115325. value = amfLongStr.data;
  115326. offset += amfLongStr.size;
  115327. break;
  115328. }
  115329. default:
  115330. offset = dataSize;
  115331. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("AMF", "Unsupported AMF value type " + type2);
  115332. }
  115333. } catch (e) {
  115334. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115335. }
  115336. return {
  115337. data: value,
  115338. size: offset,
  115339. objectEnd
  115340. };
  115341. };
  115342. return AMF2;
  115343. }();
  115344. __webpack_exports__2["default"] = AMF;
  115345. },
  115346. "./src/demux/demux-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115347. __webpack_require__2.r(__webpack_exports__2);
  115348. var DemuxErrors = {
  115349. OK: "OK",
  115350. FORMAT_ERROR: "FormatError",
  115351. FORMAT_UNSUPPORTED: "FormatUnsupported",
  115352. CODEC_UNSUPPORTED: "CodecUnsupported"
  115353. };
  115354. __webpack_exports__2["default"] = DemuxErrors;
  115355. },
  115356. "./src/demux/exp-golomb.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115357. __webpack_require__2.r(__webpack_exports__2);
  115358. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  115359. var ExpGolomb = function() {
  115360. function ExpGolomb2(uint8array) {
  115361. this.TAG = "ExpGolomb";
  115362. this._buffer = uint8array;
  115363. this._buffer_index = 0;
  115364. this._total_bytes = uint8array.byteLength;
  115365. this._total_bits = uint8array.byteLength * 8;
  115366. this._current_word = 0;
  115367. this._current_word_bits_left = 0;
  115368. }
  115369. ExpGolomb2.prototype.destroy = function() {
  115370. this._buffer = null;
  115371. };
  115372. ExpGolomb2.prototype._fillCurrentWord = function() {
  115373. var buffer_bytes_left = this._total_bytes - this._buffer_index;
  115374. if (buffer_bytes_left <= 0)
  115375. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");
  115376. var bytes_read = Math.min(4, buffer_bytes_left);
  115377. var word = new Uint8Array(4);
  115378. word.set(this._buffer.subarray(this._buffer_index, this._buffer_index + bytes_read));
  115379. this._current_word = new DataView(word.buffer).getUint32(0, false);
  115380. this._buffer_index += bytes_read;
  115381. this._current_word_bits_left = bytes_read * 8;
  115382. };
  115383. ExpGolomb2.prototype.readBits = function(bits) {
  115384. if (bits > 32)
  115385. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");
  115386. if (bits <= this._current_word_bits_left) {
  115387. var result_1 = this._current_word >>> 32 - bits;
  115388. this._current_word <<= bits;
  115389. this._current_word_bits_left -= bits;
  115390. return result_1;
  115391. }
  115392. var result = this._current_word_bits_left ? this._current_word : 0;
  115393. result = result >>> 32 - this._current_word_bits_left;
  115394. var bits_need_left = bits - this._current_word_bits_left;
  115395. this._fillCurrentWord();
  115396. var bits_read_next = Math.min(bits_need_left, this._current_word_bits_left);
  115397. var result2 = this._current_word >>> 32 - bits_read_next;
  115398. this._current_word <<= bits_read_next;
  115399. this._current_word_bits_left -= bits_read_next;
  115400. result = result << bits_read_next | result2;
  115401. return result;
  115402. };
  115403. ExpGolomb2.prototype.readBool = function() {
  115404. return this.readBits(1) === 1;
  115405. };
  115406. ExpGolomb2.prototype.readByte = function() {
  115407. return this.readBits(8);
  115408. };
  115409. ExpGolomb2.prototype._skipLeadingZero = function() {
  115410. var zero_count;
  115411. for (zero_count = 0; zero_count < this._current_word_bits_left; zero_count++) {
  115412. if (0 !== (this._current_word & 2147483648 >>> zero_count)) {
  115413. this._current_word <<= zero_count;
  115414. this._current_word_bits_left -= zero_count;
  115415. return zero_count;
  115416. }
  115417. }
  115418. this._fillCurrentWord();
  115419. return zero_count + this._skipLeadingZero();
  115420. };
  115421. ExpGolomb2.prototype.readUEG = function() {
  115422. var leading_zeros = this._skipLeadingZero();
  115423. return this.readBits(leading_zeros + 1) - 1;
  115424. };
  115425. ExpGolomb2.prototype.readSEG = function() {
  115426. var value = this.readUEG();
  115427. if (value & 1) {
  115428. return value + 1 >>> 1;
  115429. } else {
  115430. return -1 * (value >>> 1);
  115431. }
  115432. };
  115433. return ExpGolomb2;
  115434. }();
  115435. __webpack_exports__2["default"] = ExpGolomb;
  115436. },
  115437. "./src/demux/flv-demuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115438. __webpack_require__2.r(__webpack_exports__2);
  115439. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115440. var _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/amf-parser.js");
  115441. var _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/demux/sps-parser.js");
  115442. var _demux_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/demux/demux-errors.js");
  115443. var _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-info.js");
  115444. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  115445. function ReadBig32(array, index2) {
  115446. return array[index2] << 24 | array[index2 + 1] << 16 | array[index2 + 2] << 8 | array[index2 + 3];
  115447. }
  115448. var FLVDemuxer = function() {
  115449. function FLVDemuxer2(probeData, config) {
  115450. this.TAG = "FLVDemuxer";
  115451. this._config = config;
  115452. this._onError = null;
  115453. this._onMediaInfo = null;
  115454. this._onMetaDataArrived = null;
  115455. this._onScriptDataArrived = null;
  115456. this._onTrackMetadata = null;
  115457. this._onDataAvailable = null;
  115458. this._dataOffset = probeData.dataOffset;
  115459. this._firstParse = true;
  115460. this._dispatch = false;
  115461. this._hasAudio = probeData.hasAudioTrack;
  115462. this._hasVideo = probeData.hasVideoTrack;
  115463. this._hasAudioFlagOverrided = false;
  115464. this._hasVideoFlagOverrided = false;
  115465. this._audioInitialMetadataDispatched = false;
  115466. this._videoInitialMetadataDispatched = false;
  115467. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115468. this._mediaInfo.hasAudio = this._hasAudio;
  115469. this._mediaInfo.hasVideo = this._hasVideo;
  115470. this._metadata = null;
  115471. this._audioMetadata = null;
  115472. this._videoMetadata = null;
  115473. this._naluLengthSize = 4;
  115474. this._timestampBase = 0;
  115475. this._timescale = 1e3;
  115476. this._duration = 0;
  115477. this._durationOverrided = false;
  115478. this._referenceFrameRate = {
  115479. fixed: true,
  115480. fps: 23.976,
  115481. fps_num: 23976,
  115482. fps_den: 1e3
  115483. };
  115484. this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3];
  115485. this._mpegSamplingRates = [
  115486. 96e3,
  115487. 88200,
  115488. 64e3,
  115489. 48e3,
  115490. 44100,
  115491. 32e3,
  115492. 24e3,
  115493. 22050,
  115494. 16e3,
  115495. 12e3,
  115496. 11025,
  115497. 8e3,
  115498. 7350
  115499. ];
  115500. this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0];
  115501. this._mpegAudioV20SampleRateTable = [22050, 24e3, 16e3, 0];
  115502. this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0];
  115503. this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1];
  115504. this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1];
  115505. this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1];
  115506. this._videoTrack = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 };
  115507. this._audioTrack = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 };
  115508. this._littleEndian = function() {
  115509. var buf = new ArrayBuffer(2);
  115510. new DataView(buf).setInt16(0, 256, true);
  115511. return new Int16Array(buf)[0] === 256;
  115512. }();
  115513. }
  115514. FLVDemuxer2.prototype.destroy = function() {
  115515. this._mediaInfo = null;
  115516. this._metadata = null;
  115517. this._audioMetadata = null;
  115518. this._videoMetadata = null;
  115519. this._videoTrack = null;
  115520. this._audioTrack = null;
  115521. this._onError = null;
  115522. this._onMediaInfo = null;
  115523. this._onMetaDataArrived = null;
  115524. this._onScriptDataArrived = null;
  115525. this._onTrackMetadata = null;
  115526. this._onDataAvailable = null;
  115527. };
  115528. FLVDemuxer2.probe = function(buffer) {
  115529. var data = new Uint8Array(buffer);
  115530. var mismatch = { match: false };
  115531. if (data[0] !== 70 || data[1] !== 76 || data[2] !== 86 || data[3] !== 1) {
  115532. return mismatch;
  115533. }
  115534. var hasAudio = (data[4] & 4) >>> 2 !== 0;
  115535. var hasVideo = (data[4] & 1) !== 0;
  115536. var offset = ReadBig32(data, 5);
  115537. if (offset < 9) {
  115538. return mismatch;
  115539. }
  115540. return {
  115541. match: true,
  115542. consumed: offset,
  115543. dataOffset: offset,
  115544. hasAudioTrack: hasAudio,
  115545. hasVideoTrack: hasVideo
  115546. };
  115547. };
  115548. FLVDemuxer2.prototype.bindDataSource = function(loader) {
  115549. loader.onDataArrival = this.parseChunks.bind(this);
  115550. return this;
  115551. };
  115552. Object.defineProperty(FLVDemuxer2.prototype, "onTrackMetadata", {
  115553. get: function() {
  115554. return this._onTrackMetadata;
  115555. },
  115556. set: function(callback2) {
  115557. this._onTrackMetadata = callback2;
  115558. },
  115559. enumerable: false,
  115560. configurable: true
  115561. });
  115562. Object.defineProperty(FLVDemuxer2.prototype, "onMediaInfo", {
  115563. get: function() {
  115564. return this._onMediaInfo;
  115565. },
  115566. set: function(callback2) {
  115567. this._onMediaInfo = callback2;
  115568. },
  115569. enumerable: false,
  115570. configurable: true
  115571. });
  115572. Object.defineProperty(FLVDemuxer2.prototype, "onMetaDataArrived", {
  115573. get: function() {
  115574. return this._onMetaDataArrived;
  115575. },
  115576. set: function(callback2) {
  115577. this._onMetaDataArrived = callback2;
  115578. },
  115579. enumerable: false,
  115580. configurable: true
  115581. });
  115582. Object.defineProperty(FLVDemuxer2.prototype, "onScriptDataArrived", {
  115583. get: function() {
  115584. return this._onScriptDataArrived;
  115585. },
  115586. set: function(callback2) {
  115587. this._onScriptDataArrived = callback2;
  115588. },
  115589. enumerable: false,
  115590. configurable: true
  115591. });
  115592. Object.defineProperty(FLVDemuxer2.prototype, "onError", {
  115593. get: function() {
  115594. return this._onError;
  115595. },
  115596. set: function(callback2) {
  115597. this._onError = callback2;
  115598. },
  115599. enumerable: false,
  115600. configurable: true
  115601. });
  115602. Object.defineProperty(FLVDemuxer2.prototype, "onDataAvailable", {
  115603. get: function() {
  115604. return this._onDataAvailable;
  115605. },
  115606. set: function(callback2) {
  115607. this._onDataAvailable = callback2;
  115608. },
  115609. enumerable: false,
  115610. configurable: true
  115611. });
  115612. Object.defineProperty(FLVDemuxer2.prototype, "timestampBase", {
  115613. get: function() {
  115614. return this._timestampBase;
  115615. },
  115616. set: function(base2) {
  115617. this._timestampBase = base2;
  115618. },
  115619. enumerable: false,
  115620. configurable: true
  115621. });
  115622. Object.defineProperty(FLVDemuxer2.prototype, "overridedDuration", {
  115623. get: function() {
  115624. return this._duration;
  115625. },
  115626. set: function(duration5) {
  115627. this._durationOverrided = true;
  115628. this._duration = duration5;
  115629. this._mediaInfo.duration = duration5;
  115630. },
  115631. enumerable: false,
  115632. configurable: true
  115633. });
  115634. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasAudio", {
  115635. set: function(hasAudio) {
  115636. this._hasAudioFlagOverrided = true;
  115637. this._hasAudio = hasAudio;
  115638. this._mediaInfo.hasAudio = hasAudio;
  115639. },
  115640. enumerable: false,
  115641. configurable: true
  115642. });
  115643. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasVideo", {
  115644. set: function(hasVideo) {
  115645. this._hasVideoFlagOverrided = true;
  115646. this._hasVideo = hasVideo;
  115647. this._mediaInfo.hasVideo = hasVideo;
  115648. },
  115649. enumerable: false,
  115650. configurable: true
  115651. });
  115652. FLVDemuxer2.prototype.resetMediaInfo = function() {
  115653. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115654. };
  115655. FLVDemuxer2.prototype._isInitialMetadataDispatched = function() {
  115656. if (this._hasAudio && this._hasVideo) {
  115657. return this._audioInitialMetadataDispatched && this._videoInitialMetadataDispatched;
  115658. }
  115659. if (this._hasAudio && !this._hasVideo) {
  115660. return this._audioInitialMetadataDispatched;
  115661. }
  115662. if (!this._hasAudio && this._hasVideo) {
  115663. return this._videoInitialMetadataDispatched;
  115664. }
  115665. return false;
  115666. };
  115667. FLVDemuxer2.prototype.parseChunks = function(chunk, byteStart) {
  115668. if (!this._onError || !this._onMediaInfo || !this._onTrackMetadata || !this._onDataAvailable) {
  115669. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
  115670. }
  115671. var offset = 0;
  115672. var le = this._littleEndian;
  115673. if (byteStart === 0) {
  115674. if (chunk.byteLength > 13) {
  115675. var probeData = FLVDemuxer2.probe(chunk);
  115676. offset = probeData.dataOffset;
  115677. } else {
  115678. return 0;
  115679. }
  115680. }
  115681. if (this._firstParse) {
  115682. this._firstParse = false;
  115683. if (byteStart + offset !== this._dataOffset) {
  115684. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "First time parsing but chunk byteStart invalid!");
  115685. }
  115686. var v = new DataView(chunk, offset);
  115687. var prevTagSize0 = v.getUint32(0, !le);
  115688. if (prevTagSize0 !== 0) {
  115689. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "PrevTagSize0 !== 0 !!!");
  115690. }
  115691. offset += 4;
  115692. }
  115693. while (offset < chunk.byteLength) {
  115694. this._dispatch = true;
  115695. var v = new DataView(chunk, offset);
  115696. if (offset + 11 + 4 > chunk.byteLength) {
  115697. break;
  115698. }
  115699. var tagType = v.getUint8(0);
  115700. var dataSize = v.getUint32(0, !le) & 16777215;
  115701. if (offset + 11 + dataSize + 4 > chunk.byteLength) {
  115702. break;
  115703. }
  115704. if (tagType !== 8 && tagType !== 9 && tagType !== 18) {
  115705. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Unsupported tag type " + tagType + ", skipped");
  115706. offset += 11 + dataSize + 4;
  115707. continue;
  115708. }
  115709. var ts22 = v.getUint8(4);
  115710. var ts1 = v.getUint8(5);
  115711. var ts0 = v.getUint8(6);
  115712. var ts3 = v.getUint8(7);
  115713. var timestamp = ts0 | ts1 << 8 | ts22 << 16 | ts3 << 24;
  115714. var streamId = v.getUint32(7, !le) & 16777215;
  115715. if (streamId !== 0) {
  115716. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Meet tag which has StreamID != 0!");
  115717. }
  115718. var dataOffset = offset + 11;
  115719. switch (tagType) {
  115720. case 8:
  115721. this._parseAudioData(chunk, dataOffset, dataSize, timestamp);
  115722. break;
  115723. case 9:
  115724. this._parseVideoData(chunk, dataOffset, dataSize, timestamp, byteStart + offset);
  115725. break;
  115726. case 18:
  115727. this._parseScriptData(chunk, dataOffset, dataSize);
  115728. break;
  115729. }
  115730. var prevTagSize = v.getUint32(11 + dataSize, !le);
  115731. if (prevTagSize !== 11 + dataSize) {
  115732. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid PrevTagSize " + prevTagSize);
  115733. }
  115734. offset += 11 + dataSize + 4;
  115735. }
  115736. if (this._isInitialMetadataDispatched()) {
  115737. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115738. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115739. }
  115740. }
  115741. return offset;
  115742. };
  115743. FLVDemuxer2.prototype._parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115744. var scriptData = _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__.default.parseScriptData(arrayBuffer, dataOffset, dataSize);
  115745. if (scriptData.hasOwnProperty("onMetaData")) {
  115746. if (scriptData.onMetaData == null || typeof scriptData.onMetaData !== "object") {
  115747. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid onMetaData structure!");
  115748. return;
  115749. }
  115750. if (this._metadata) {
  115751. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another onMetaData tag!");
  115752. }
  115753. this._metadata = scriptData;
  115754. var onMetaData = this._metadata.onMetaData;
  115755. if (this._onMetaDataArrived) {
  115756. this._onMetaDataArrived(Object.assign({}, onMetaData));
  115757. }
  115758. if (typeof onMetaData.hasAudio === "boolean") {
  115759. if (this._hasAudioFlagOverrided === false) {
  115760. this._hasAudio = onMetaData.hasAudio;
  115761. this._mediaInfo.hasAudio = this._hasAudio;
  115762. }
  115763. }
  115764. if (typeof onMetaData.hasVideo === "boolean") {
  115765. if (this._hasVideoFlagOverrided === false) {
  115766. this._hasVideo = onMetaData.hasVideo;
  115767. this._mediaInfo.hasVideo = this._hasVideo;
  115768. }
  115769. }
  115770. if (typeof onMetaData.audiodatarate === "number") {
  115771. this._mediaInfo.audioDataRate = onMetaData.audiodatarate;
  115772. }
  115773. if (typeof onMetaData.videodatarate === "number") {
  115774. this._mediaInfo.videoDataRate = onMetaData.videodatarate;
  115775. }
  115776. if (typeof onMetaData.width === "number") {
  115777. this._mediaInfo.width = onMetaData.width;
  115778. }
  115779. if (typeof onMetaData.height === "number") {
  115780. this._mediaInfo.height = onMetaData.height;
  115781. }
  115782. if (typeof onMetaData.duration === "number") {
  115783. if (!this._durationOverrided) {
  115784. var duration5 = Math.floor(onMetaData.duration * this._timescale);
  115785. this._duration = duration5;
  115786. this._mediaInfo.duration = duration5;
  115787. }
  115788. } else {
  115789. this._mediaInfo.duration = 0;
  115790. }
  115791. if (typeof onMetaData.framerate === "number") {
  115792. var fps_num = Math.floor(onMetaData.framerate * 1e3);
  115793. if (fps_num > 0) {
  115794. var fps = fps_num / 1e3;
  115795. this._referenceFrameRate.fixed = true;
  115796. this._referenceFrameRate.fps = fps;
  115797. this._referenceFrameRate.fps_num = fps_num;
  115798. this._referenceFrameRate.fps_den = 1e3;
  115799. this._mediaInfo.fps = fps;
  115800. }
  115801. }
  115802. if (typeof onMetaData.keyframes === "object") {
  115803. this._mediaInfo.hasKeyframesIndex = true;
  115804. var keyframes = onMetaData.keyframes;
  115805. this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(keyframes);
  115806. onMetaData.keyframes = null;
  115807. } else {
  115808. this._mediaInfo.hasKeyframesIndex = false;
  115809. }
  115810. this._dispatch = false;
  115811. this._mediaInfo.metadata = onMetaData;
  115812. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed onMetaData");
  115813. if (this._mediaInfo.isComplete()) {
  115814. this._onMediaInfo(this._mediaInfo);
  115815. }
  115816. }
  115817. if (Object.keys(scriptData).length > 0) {
  115818. if (this._onScriptDataArrived) {
  115819. this._onScriptDataArrived(Object.assign({}, scriptData));
  115820. }
  115821. }
  115822. };
  115823. FLVDemuxer2.prototype._parseKeyframesIndex = function(keyframes) {
  115824. var times = [];
  115825. var filepositions = [];
  115826. for (var i2 = 1; i2 < keyframes.times.length; i2++) {
  115827. var time = this._timestampBase + Math.floor(keyframes.times[i2] * 1e3);
  115828. times.push(time);
  115829. filepositions.push(keyframes.filepositions[i2]);
  115830. }
  115831. return {
  115832. times,
  115833. filepositions
  115834. };
  115835. };
  115836. FLVDemuxer2.prototype._parseAudioData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp) {
  115837. if (dataSize <= 1) {
  115838. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!");
  115839. return;
  115840. }
  115841. if (this._hasAudioFlagOverrided === true && this._hasAudio === false) {
  115842. return;
  115843. }
  115844. this._littleEndian;
  115845. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115846. var soundSpec = v.getUint8(0);
  115847. var soundFormat = soundSpec >>> 4;
  115848. if (soundFormat !== 2 && soundFormat !== 10) {
  115849. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + soundFormat);
  115850. return;
  115851. }
  115852. var soundRate = 0;
  115853. var soundRateIndex = (soundSpec & 12) >>> 2;
  115854. if (soundRateIndex >= 0 && soundRateIndex <= 4) {
  115855. soundRate = this._flvSoundRateTable[soundRateIndex];
  115856. } else {
  115857. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + soundRateIndex);
  115858. return;
  115859. }
  115860. var soundType = soundSpec & 1;
  115861. var meta2 = this._audioMetadata;
  115862. var track = this._audioTrack;
  115863. if (!meta2) {
  115864. if (this._hasAudio === false && this._hasAudioFlagOverrided === false) {
  115865. this._hasAudio = true;
  115866. this._mediaInfo.hasAudio = true;
  115867. }
  115868. meta2 = this._audioMetadata = {};
  115869. meta2.type = "audio";
  115870. meta2.id = track.id;
  115871. meta2.timescale = this._timescale;
  115872. meta2.duration = this._duration;
  115873. meta2.audioSampleRate = soundRate;
  115874. meta2.channelCount = soundType === 0 ? 1 : 2;
  115875. }
  115876. if (soundFormat === 10) {
  115877. var aacData = this._parseAACAudioData(arrayBuffer, dataOffset + 1, dataSize - 1);
  115878. if (aacData == void 0) {
  115879. return;
  115880. }
  115881. if (aacData.packetType === 0) {
  115882. if (meta2.config) {
  115883. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AudioSpecificConfig!");
  115884. }
  115885. var misc = aacData.data;
  115886. meta2.audioSampleRate = misc.samplingRate;
  115887. meta2.channelCount = misc.channelCount;
  115888. meta2.codec = misc.codec;
  115889. meta2.originalCodec = misc.originalCodec;
  115890. meta2.config = misc.config;
  115891. meta2.refSampleDuration = 1024 / meta2.audioSampleRate * meta2.timescale;
  115892. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AudioSpecificConfig");
  115893. if (this._isInitialMetadataDispatched()) {
  115894. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115895. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115896. }
  115897. } else {
  115898. this._audioInitialMetadataDispatched = true;
  115899. }
  115900. this._dispatch = false;
  115901. this._onTrackMetadata("audio", meta2);
  115902. var mi = this._mediaInfo;
  115903. mi.audioCodec = meta2.originalCodec;
  115904. mi.audioSampleRate = meta2.audioSampleRate;
  115905. mi.audioChannelCount = meta2.channelCount;
  115906. if (mi.hasVideo) {
  115907. if (mi.videoCodec != null) {
  115908. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115909. }
  115910. } else {
  115911. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115912. }
  115913. if (mi.isComplete()) {
  115914. this._onMediaInfo(mi);
  115915. }
  115916. } else if (aacData.packetType === 1) {
  115917. var dts = this._timestampBase + tagTimestamp;
  115918. var aacSample = { unit: aacData.data, length: aacData.data.byteLength, dts, pts: dts };
  115919. track.samples.push(aacSample);
  115920. track.length += aacData.data.length;
  115921. } else {
  115922. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Flv: Unsupported AAC data type " + aacData.packetType);
  115923. }
  115924. } else if (soundFormat === 2) {
  115925. if (!meta2.codec) {
  115926. var misc = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, true);
  115927. if (misc == void 0) {
  115928. return;
  115929. }
  115930. meta2.audioSampleRate = misc.samplingRate;
  115931. meta2.channelCount = misc.channelCount;
  115932. meta2.codec = misc.codec;
  115933. meta2.originalCodec = misc.originalCodec;
  115934. meta2.refSampleDuration = 1152 / meta2.audioSampleRate * meta2.timescale;
  115935. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed MPEG Audio Frame Header");
  115936. this._audioInitialMetadataDispatched = true;
  115937. this._onTrackMetadata("audio", meta2);
  115938. var mi = this._mediaInfo;
  115939. mi.audioCodec = meta2.codec;
  115940. mi.audioSampleRate = meta2.audioSampleRate;
  115941. mi.audioChannelCount = meta2.channelCount;
  115942. mi.audioDataRate = misc.bitRate;
  115943. if (mi.hasVideo) {
  115944. if (mi.videoCodec != null) {
  115945. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115946. }
  115947. } else {
  115948. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115949. }
  115950. if (mi.isComplete()) {
  115951. this._onMediaInfo(mi);
  115952. }
  115953. }
  115954. var data = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, false);
  115955. if (data == void 0) {
  115956. return;
  115957. }
  115958. var dts = this._timestampBase + tagTimestamp;
  115959. var mp3Sample = { unit: data, length: data.byteLength, dts, pts: dts };
  115960. track.samples.push(mp3Sample);
  115961. track.length += data.length;
  115962. }
  115963. };
  115964. FLVDemuxer2.prototype._parseAACAudioData = function(arrayBuffer, dataOffset, dataSize) {
  115965. if (dataSize <= 1) {
  115966. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!");
  115967. return;
  115968. }
  115969. var result = {};
  115970. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115971. result.packetType = array[0];
  115972. if (array[0] === 0) {
  115973. result.data = this._parseAACAudioSpecificConfig(arrayBuffer, dataOffset + 1, dataSize - 1);
  115974. } else {
  115975. result.data = array.subarray(1);
  115976. }
  115977. return result;
  115978. };
  115979. FLVDemuxer2.prototype._parseAACAudioSpecificConfig = function(arrayBuffer, dataOffset, dataSize) {
  115980. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115981. var config = null;
  115982. var audioObjectType = 0;
  115983. var originalAudioObjectType = 0;
  115984. var samplingIndex = 0;
  115985. var extensionSamplingIndex = null;
  115986. audioObjectType = originalAudioObjectType = array[0] >>> 3;
  115987. samplingIndex = (array[0] & 7) << 1 | array[1] >>> 7;
  115988. if (samplingIndex < 0 || samplingIndex >= this._mpegSamplingRates.length) {
  115989. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
  115990. return;
  115991. }
  115992. var samplingFrequence = this._mpegSamplingRates[samplingIndex];
  115993. var channelConfig = (array[1] & 120) >>> 3;
  115994. if (channelConfig < 0 || channelConfig >= 8) {
  115995. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid channel configuration");
  115996. return;
  115997. }
  115998. if (audioObjectType === 5) {
  115999. extensionSamplingIndex = (array[1] & 7) << 1 | array[2] >>> 7;
  116000. (array[2] & 124) >>> 2;
  116001. }
  116002. var userAgent = self.navigator.userAgent.toLowerCase();
  116003. if (userAgent.indexOf("firefox") !== -1) {
  116004. if (samplingIndex >= 6) {
  116005. audioObjectType = 5;
  116006. config = new Array(4);
  116007. extensionSamplingIndex = samplingIndex - 3;
  116008. } else {
  116009. audioObjectType = 2;
  116010. config = new Array(2);
  116011. extensionSamplingIndex = samplingIndex;
  116012. }
  116013. } else if (userAgent.indexOf("android") !== -1) {
  116014. audioObjectType = 2;
  116015. config = new Array(2);
  116016. extensionSamplingIndex = samplingIndex;
  116017. } else {
  116018. audioObjectType = 5;
  116019. extensionSamplingIndex = samplingIndex;
  116020. config = new Array(4);
  116021. if (samplingIndex >= 6) {
  116022. extensionSamplingIndex = samplingIndex - 3;
  116023. } else if (channelConfig === 1) {
  116024. audioObjectType = 2;
  116025. config = new Array(2);
  116026. extensionSamplingIndex = samplingIndex;
  116027. }
  116028. }
  116029. config[0] = audioObjectType << 3;
  116030. config[0] |= (samplingIndex & 15) >>> 1;
  116031. config[1] = (samplingIndex & 15) << 7;
  116032. config[1] |= (channelConfig & 15) << 3;
  116033. if (audioObjectType === 5) {
  116034. config[1] |= (extensionSamplingIndex & 15) >>> 1;
  116035. config[2] = (extensionSamplingIndex & 1) << 7;
  116036. config[2] |= 2 << 2;
  116037. config[3] = 0;
  116038. }
  116039. return {
  116040. config,
  116041. samplingRate: samplingFrequence,
  116042. channelCount: channelConfig,
  116043. codec: "mp4a.40." + audioObjectType,
  116044. originalCodec: "mp4a.40." + originalAudioObjectType
  116045. };
  116046. };
  116047. FLVDemuxer2.prototype._parseMP3AudioData = function(arrayBuffer, dataOffset, dataSize, requestHeader) {
  116048. if (dataSize < 4) {
  116049. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid MP3 packet, header missing!");
  116050. return;
  116051. }
  116052. this._littleEndian;
  116053. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  116054. var result = null;
  116055. if (requestHeader) {
  116056. if (array[0] !== 255) {
  116057. return;
  116058. }
  116059. var ver = array[1] >>> 3 & 3;
  116060. var layer = (array[1] & 6) >> 1;
  116061. var bitrate_index = (array[2] & 240) >>> 4;
  116062. var sampling_freq_index = (array[2] & 12) >>> 2;
  116063. var channel_mode = array[3] >>> 6 & 3;
  116064. var channel_count = channel_mode !== 3 ? 2 : 1;
  116065. var sample_rate = 0;
  116066. var bit_rate = 0;
  116067. var codec = "mp3";
  116068. switch (ver) {
  116069. case 0:
  116070. sample_rate = this._mpegAudioV25SampleRateTable[sampling_freq_index];
  116071. break;
  116072. case 2:
  116073. sample_rate = this._mpegAudioV20SampleRateTable[sampling_freq_index];
  116074. break;
  116075. case 3:
  116076. sample_rate = this._mpegAudioV10SampleRateTable[sampling_freq_index];
  116077. break;
  116078. }
  116079. switch (layer) {
  116080. case 1:
  116081. if (bitrate_index < this._mpegAudioL3BitRateTable.length) {
  116082. bit_rate = this._mpegAudioL3BitRateTable[bitrate_index];
  116083. }
  116084. break;
  116085. case 2:
  116086. if (bitrate_index < this._mpegAudioL2BitRateTable.length) {
  116087. bit_rate = this._mpegAudioL2BitRateTable[bitrate_index];
  116088. }
  116089. break;
  116090. case 3:
  116091. if (bitrate_index < this._mpegAudioL1BitRateTable.length) {
  116092. bit_rate = this._mpegAudioL1BitRateTable[bitrate_index];
  116093. }
  116094. break;
  116095. }
  116096. result = {
  116097. bitRate: bit_rate,
  116098. samplingRate: sample_rate,
  116099. channelCount: channel_count,
  116100. codec,
  116101. originalCodec: codec
  116102. };
  116103. } else {
  116104. result = array;
  116105. }
  116106. return result;
  116107. };
  116108. FLVDemuxer2.prototype._parseVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition) {
  116109. if (dataSize <= 1) {
  116110. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
  116111. return;
  116112. }
  116113. if (this._hasVideoFlagOverrided === true && this._hasVideo === false) {
  116114. return;
  116115. }
  116116. var spec = new Uint8Array(arrayBuffer, dataOffset, dataSize)[0];
  116117. var frameType = (spec & 240) >>> 4;
  116118. var codecId = spec & 15;
  116119. if (codecId !== 7) {
  116120. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + codecId);
  116121. return;
  116122. }
  116123. this._parseAVCVideoPacket(arrayBuffer, dataOffset + 1, dataSize - 1, tagTimestamp, tagPosition, frameType);
  116124. };
  116125. FLVDemuxer2.prototype._parseAVCVideoPacket = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType) {
  116126. if (dataSize < 4) {
  116127. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
  116128. return;
  116129. }
  116130. var le = this._littleEndian;
  116131. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116132. var packetType = v.getUint8(0);
  116133. var cts_unsigned = v.getUint32(0, !le) & 16777215;
  116134. var cts = cts_unsigned << 8 >> 8;
  116135. if (packetType === 0) {
  116136. this._parseAVCDecoderConfigurationRecord(arrayBuffer, dataOffset + 4, dataSize - 4);
  116137. } else if (packetType === 1) {
  116138. this._parseAVCVideoData(arrayBuffer, dataOffset + 4, dataSize - 4, tagTimestamp, tagPosition, frameType, cts);
  116139. } else if (packetType === 2)
  116140. ;
  116141. else {
  116142. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid video packet type " + packetType);
  116143. return;
  116144. }
  116145. };
  116146. FLVDemuxer2.prototype._parseAVCDecoderConfigurationRecord = function(arrayBuffer, dataOffset, dataSize) {
  116147. if (dataSize < 7) {
  116148. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
  116149. return;
  116150. }
  116151. var meta2 = this._videoMetadata;
  116152. var track = this._videoTrack;
  116153. var le = this._littleEndian;
  116154. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116155. if (!meta2) {
  116156. if (this._hasVideo === false && this._hasVideoFlagOverrided === false) {
  116157. this._hasVideo = true;
  116158. this._mediaInfo.hasVideo = true;
  116159. }
  116160. meta2 = this._videoMetadata = {};
  116161. meta2.type = "video";
  116162. meta2.id = track.id;
  116163. meta2.timescale = this._timescale;
  116164. meta2.duration = this._duration;
  116165. } else {
  116166. if (typeof meta2.avcc !== "undefined") {
  116167. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AVCDecoderConfigurationRecord!");
  116168. }
  116169. }
  116170. var version2 = v.getUint8(0);
  116171. var avcProfile = v.getUint8(1);
  116172. v.getUint8(2);
  116173. v.getUint8(3);
  116174. if (version2 !== 1 || avcProfile === 0) {
  116175. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord");
  116176. return;
  116177. }
  116178. this._naluLengthSize = (v.getUint8(4) & 3) + 1;
  116179. if (this._naluLengthSize !== 3 && this._naluLengthSize !== 4) {
  116180. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
  116181. return;
  116182. }
  116183. var spsCount = v.getUint8(5) & 31;
  116184. if (spsCount === 0) {
  116185. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS");
  116186. return;
  116187. } else if (spsCount > 1) {
  116188. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + spsCount);
  116189. }
  116190. var offset = 6;
  116191. for (var i2 = 0; i2 < spsCount; i2++) {
  116192. var len = v.getUint16(offset, !le);
  116193. offset += 2;
  116194. if (len === 0) {
  116195. continue;
  116196. }
  116197. var sps = new Uint8Array(arrayBuffer, dataOffset + offset, len);
  116198. offset += len;
  116199. var config = _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__.default.parseSPS(sps);
  116200. if (i2 !== 0) {
  116201. continue;
  116202. }
  116203. meta2.codecWidth = config.codec_size.width;
  116204. meta2.codecHeight = config.codec_size.height;
  116205. meta2.presentWidth = config.present_size.width;
  116206. meta2.presentHeight = config.present_size.height;
  116207. meta2.profile = config.profile_string;
  116208. meta2.level = config.level_string;
  116209. meta2.bitDepth = config.bit_depth;
  116210. meta2.chromaFormat = config.chroma_format;
  116211. meta2.sarRatio = config.sar_ratio;
  116212. meta2.frameRate = config.frame_rate;
  116213. if (config.frame_rate.fixed === false || config.frame_rate.fps_num === 0 || config.frame_rate.fps_den === 0) {
  116214. meta2.frameRate = this._referenceFrameRate;
  116215. }
  116216. var fps_den = meta2.frameRate.fps_den;
  116217. var fps_num = meta2.frameRate.fps_num;
  116218. meta2.refSampleDuration = meta2.timescale * (fps_den / fps_num);
  116219. var codecArray = sps.subarray(1, 4);
  116220. var codecString = "avc1.";
  116221. for (var j = 0; j < 3; j++) {
  116222. var h2 = codecArray[j].toString(16);
  116223. if (h2.length < 2) {
  116224. h2 = "0" + h2;
  116225. }
  116226. codecString += h2;
  116227. }
  116228. meta2.codec = codecString;
  116229. var mi = this._mediaInfo;
  116230. mi.width = meta2.codecWidth;
  116231. mi.height = meta2.codecHeight;
  116232. mi.fps = meta2.frameRate.fps;
  116233. mi.profile = meta2.profile;
  116234. mi.level = meta2.level;
  116235. mi.refFrames = config.ref_frames;
  116236. mi.chromaFormat = config.chroma_format_string;
  116237. mi.sarNum = meta2.sarRatio.width;
  116238. mi.sarDen = meta2.sarRatio.height;
  116239. mi.videoCodec = codecString;
  116240. if (mi.hasAudio) {
  116241. if (mi.audioCodec != null) {
  116242. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  116243. }
  116244. } else {
  116245. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + '"';
  116246. }
  116247. if (mi.isComplete()) {
  116248. this._onMediaInfo(mi);
  116249. }
  116250. }
  116251. var ppsCount = v.getUint8(offset);
  116252. if (ppsCount === 0) {
  116253. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS");
  116254. return;
  116255. } else if (ppsCount > 1) {
  116256. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + ppsCount);
  116257. }
  116258. offset++;
  116259. for (var i2 = 0; i2 < ppsCount; i2++) {
  116260. var len = v.getUint16(offset, !le);
  116261. offset += 2;
  116262. if (len === 0) {
  116263. continue;
  116264. }
  116265. offset += len;
  116266. }
  116267. meta2.avcc = new Uint8Array(dataSize);
  116268. meta2.avcc.set(new Uint8Array(arrayBuffer, dataOffset, dataSize), 0);
  116269. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AVCDecoderConfigurationRecord");
  116270. if (this._isInitialMetadataDispatched()) {
  116271. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  116272. this._onDataAvailable(this._audioTrack, this._videoTrack);
  116273. }
  116274. } else {
  116275. this._videoInitialMetadataDispatched = true;
  116276. }
  116277. this._dispatch = false;
  116278. this._onTrackMetadata("video", meta2);
  116279. };
  116280. FLVDemuxer2.prototype._parseAVCVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType, cts) {
  116281. var le = this._littleEndian;
  116282. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116283. var units = [], length = 0;
  116284. var offset = 0;
  116285. var lengthSize = this._naluLengthSize;
  116286. var dts = this._timestampBase + tagTimestamp;
  116287. var keyframe = frameType === 1;
  116288. while (offset < dataSize) {
  116289. if (offset + 4 >= dataSize) {
  116290. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalu near timestamp " + dts + ", offset = " + offset + ", dataSize = " + dataSize);
  116291. break;
  116292. }
  116293. var naluSize = v.getUint32(offset, !le);
  116294. if (lengthSize === 3) {
  116295. naluSize >>>= 8;
  116296. }
  116297. if (naluSize > dataSize - lengthSize) {
  116298. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalus near timestamp " + dts + ", NaluSize > DataSize!");
  116299. return;
  116300. }
  116301. var unitType = v.getUint8(offset + lengthSize) & 31;
  116302. if (unitType === 5) {
  116303. keyframe = true;
  116304. }
  116305. var data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize);
  116306. var unit = { type: unitType, data };
  116307. units.push(unit);
  116308. length += data.byteLength;
  116309. offset += lengthSize + naluSize;
  116310. }
  116311. if (units.length) {
  116312. var track = this._videoTrack;
  116313. var avcSample = {
  116314. units,
  116315. length,
  116316. isKeyframe: keyframe,
  116317. dts,
  116318. cts,
  116319. pts: dts + cts
  116320. };
  116321. if (keyframe) {
  116322. avcSample.fileposition = tagPosition;
  116323. }
  116324. track.samples.push(avcSample);
  116325. track.length += length;
  116326. }
  116327. };
  116328. return FLVDemuxer2;
  116329. }();
  116330. __webpack_exports__2["default"] = FLVDemuxer;
  116331. },
  116332. "./src/demux/sps-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116333. __webpack_require__2.r(__webpack_exports__2);
  116334. var _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/demux/exp-golomb.js");
  116335. var SPSParser = function() {
  116336. function SPSParser2() {
  116337. }
  116338. SPSParser2._ebsp2rbsp = function(uint8array) {
  116339. var src = uint8array;
  116340. var src_length = src.byteLength;
  116341. var dst = new Uint8Array(src_length);
  116342. var dst_idx = 0;
  116343. for (var i2 = 0; i2 < src_length; i2++) {
  116344. if (i2 >= 2) {
  116345. if (src[i2] === 3 && src[i2 - 1] === 0 && src[i2 - 2] === 0) {
  116346. continue;
  116347. }
  116348. }
  116349. dst[dst_idx] = src[i2];
  116350. dst_idx++;
  116351. }
  116352. return new Uint8Array(dst.buffer, 0, dst_idx);
  116353. };
  116354. SPSParser2.parseSPS = function(uint8array) {
  116355. var rbsp = SPSParser2._ebsp2rbsp(uint8array);
  116356. var gb = new _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__.default(rbsp);
  116357. gb.readByte();
  116358. var profile_idc = gb.readByte();
  116359. gb.readByte();
  116360. var level_idc = gb.readByte();
  116361. gb.readUEG();
  116362. var profile_string = SPSParser2.getProfileString(profile_idc);
  116363. var level_string = SPSParser2.getLevelString(level_idc);
  116364. var chroma_format_idc = 1;
  116365. var chroma_format = 420;
  116366. var chroma_format_table = [0, 420, 422, 444];
  116367. var bit_depth = 8;
  116368. 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) {
  116369. chroma_format_idc = gb.readUEG();
  116370. if (chroma_format_idc === 3) {
  116371. gb.readBits(1);
  116372. }
  116373. if (chroma_format_idc <= 3) {
  116374. chroma_format = chroma_format_table[chroma_format_idc];
  116375. }
  116376. bit_depth = gb.readUEG() + 8;
  116377. gb.readUEG();
  116378. gb.readBits(1);
  116379. if (gb.readBool()) {
  116380. var scaling_list_count = chroma_format_idc !== 3 ? 8 : 12;
  116381. for (var i2 = 0; i2 < scaling_list_count; i2++) {
  116382. if (gb.readBool()) {
  116383. if (i2 < 6) {
  116384. SPSParser2._skipScalingList(gb, 16);
  116385. } else {
  116386. SPSParser2._skipScalingList(gb, 64);
  116387. }
  116388. }
  116389. }
  116390. }
  116391. }
  116392. gb.readUEG();
  116393. var pic_order_cnt_type = gb.readUEG();
  116394. if (pic_order_cnt_type === 0) {
  116395. gb.readUEG();
  116396. } else if (pic_order_cnt_type === 1) {
  116397. gb.readBits(1);
  116398. gb.readSEG();
  116399. gb.readSEG();
  116400. var num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG();
  116401. for (var i2 = 0; i2 < num_ref_frames_in_pic_order_cnt_cycle; i2++) {
  116402. gb.readSEG();
  116403. }
  116404. }
  116405. var ref_frames = gb.readUEG();
  116406. gb.readBits(1);
  116407. var pic_width_in_mbs_minus1 = gb.readUEG();
  116408. var pic_height_in_map_units_minus1 = gb.readUEG();
  116409. var frame_mbs_only_flag = gb.readBits(1);
  116410. if (frame_mbs_only_flag === 0) {
  116411. gb.readBits(1);
  116412. }
  116413. gb.readBits(1);
  116414. var frame_crop_left_offset = 0;
  116415. var frame_crop_right_offset = 0;
  116416. var frame_crop_top_offset = 0;
  116417. var frame_crop_bottom_offset = 0;
  116418. var frame_cropping_flag = gb.readBool();
  116419. if (frame_cropping_flag) {
  116420. frame_crop_left_offset = gb.readUEG();
  116421. frame_crop_right_offset = gb.readUEG();
  116422. frame_crop_top_offset = gb.readUEG();
  116423. frame_crop_bottom_offset = gb.readUEG();
  116424. }
  116425. var sar_width = 1, sar_height = 1;
  116426. var fps = 0, fps_fixed = true, fps_num = 0, fps_den = 0;
  116427. var vui_parameters_present_flag = gb.readBool();
  116428. if (vui_parameters_present_flag) {
  116429. if (gb.readBool()) {
  116430. var aspect_ratio_idc = gb.readByte();
  116431. var sar_w_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];
  116432. var sar_h_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
  116433. if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {
  116434. sar_width = sar_w_table[aspect_ratio_idc - 1];
  116435. sar_height = sar_h_table[aspect_ratio_idc - 1];
  116436. } else if (aspect_ratio_idc === 255) {
  116437. sar_width = gb.readByte() << 8 | gb.readByte();
  116438. sar_height = gb.readByte() << 8 | gb.readByte();
  116439. }
  116440. }
  116441. if (gb.readBool()) {
  116442. gb.readBool();
  116443. }
  116444. if (gb.readBool()) {
  116445. gb.readBits(4);
  116446. if (gb.readBool()) {
  116447. gb.readBits(24);
  116448. }
  116449. }
  116450. if (gb.readBool()) {
  116451. gb.readUEG();
  116452. gb.readUEG();
  116453. }
  116454. if (gb.readBool()) {
  116455. var num_units_in_tick = gb.readBits(32);
  116456. var time_scale = gb.readBits(32);
  116457. fps_fixed = gb.readBool();
  116458. fps_num = time_scale;
  116459. fps_den = num_units_in_tick * 2;
  116460. fps = fps_num / fps_den;
  116461. }
  116462. }
  116463. var sarScale = 1;
  116464. if (sar_width !== 1 || sar_height !== 1) {
  116465. sarScale = sar_width / sar_height;
  116466. }
  116467. var crop_unit_x = 0, crop_unit_y = 0;
  116468. if (chroma_format_idc === 0) {
  116469. crop_unit_x = 1;
  116470. crop_unit_y = 2 - frame_mbs_only_flag;
  116471. } else {
  116472. var sub_wc = chroma_format_idc === 3 ? 1 : 2;
  116473. var sub_hc = chroma_format_idc === 1 ? 2 : 1;
  116474. crop_unit_x = sub_wc;
  116475. crop_unit_y = sub_hc * (2 - frame_mbs_only_flag);
  116476. }
  116477. var codec_width = (pic_width_in_mbs_minus1 + 1) * 16;
  116478. var codec_height = (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16);
  116479. codec_width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;
  116480. codec_height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;
  116481. var present_width = Math.ceil(codec_width * sarScale);
  116482. gb.destroy();
  116483. gb = null;
  116484. return {
  116485. profile_string,
  116486. level_string,
  116487. bit_depth,
  116488. ref_frames,
  116489. chroma_format,
  116490. chroma_format_string: SPSParser2.getChromaFormatString(chroma_format),
  116491. frame_rate: {
  116492. fixed: fps_fixed,
  116493. fps,
  116494. fps_den,
  116495. fps_num
  116496. },
  116497. sar_ratio: {
  116498. width: sar_width,
  116499. height: sar_height
  116500. },
  116501. codec_size: {
  116502. width: codec_width,
  116503. height: codec_height
  116504. },
  116505. present_size: {
  116506. width: present_width,
  116507. height: codec_height
  116508. }
  116509. };
  116510. };
  116511. SPSParser2._skipScalingList = function(gb, count) {
  116512. var last_scale = 8, next_scale = 8;
  116513. var delta_scale = 0;
  116514. for (var i2 = 0; i2 < count; i2++) {
  116515. if (next_scale !== 0) {
  116516. delta_scale = gb.readSEG();
  116517. next_scale = (last_scale + delta_scale + 256) % 256;
  116518. }
  116519. last_scale = next_scale === 0 ? last_scale : next_scale;
  116520. }
  116521. };
  116522. SPSParser2.getProfileString = function(profile_idc) {
  116523. switch (profile_idc) {
  116524. case 66:
  116525. return "Baseline";
  116526. case 77:
  116527. return "Main";
  116528. case 88:
  116529. return "Extended";
  116530. case 100:
  116531. return "High";
  116532. case 110:
  116533. return "High10";
  116534. case 122:
  116535. return "High422";
  116536. case 244:
  116537. return "High444";
  116538. default:
  116539. return "Unknown";
  116540. }
  116541. };
  116542. SPSParser2.getLevelString = function(level_idc) {
  116543. return (level_idc / 10).toFixed(1);
  116544. };
  116545. SPSParser2.getChromaFormatString = function(chroma) {
  116546. switch (chroma) {
  116547. case 420:
  116548. return "4:2:0";
  116549. case 422:
  116550. return "4:2:2";
  116551. case 444:
  116552. return "4:4:4";
  116553. default:
  116554. return "Unknown";
  116555. }
  116556. };
  116557. return SPSParser2;
  116558. }();
  116559. __webpack_exports__2["default"] = SPSParser;
  116560. },
  116561. "./src/flv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116562. __webpack_require__2.r(__webpack_exports__2);
  116563. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/polyfill.js");
  116564. var _core_features_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/core/features.js");
  116565. var _io_loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116566. var _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/flv-player.js");
  116567. var _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/player/native-player.js");
  116568. var _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/player/player-events.js");
  116569. var _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/player/player-errors.js");
  116570. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/utils/logging-control.js");
  116571. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/utils/exception.js");
  116572. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__.default.install();
  116573. function createPlayer(mediaDataSource, optionalConfig) {
  116574. var mds = mediaDataSource;
  116575. if (mds == null || typeof mds !== "object") {
  116576. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must be an javascript object!");
  116577. }
  116578. if (!mds.hasOwnProperty("type")) {
  116579. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");
  116580. }
  116581. switch (mds.type) {
  116582. case "flv":
  116583. return new _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default(mds, optionalConfig);
  116584. default:
  116585. return new _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default(mds, optionalConfig);
  116586. }
  116587. }
  116588. function isSupported() {
  116589. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.supportMSEH264Playback();
  116590. }
  116591. function getFeatureList() {
  116592. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.getFeatureList();
  116593. }
  116594. var flvjs2 = {};
  116595. flvjs2.createPlayer = createPlayer;
  116596. flvjs2.isSupported = isSupported;
  116597. flvjs2.getFeatureList = getFeatureList;
  116598. flvjs2.BaseLoader = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader;
  116599. flvjs2.LoaderStatus = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus;
  116600. flvjs2.LoaderErrors = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors;
  116601. flvjs2.Events = _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__.default;
  116602. flvjs2.ErrorTypes = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorTypes;
  116603. flvjs2.ErrorDetails = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorDetails;
  116604. flvjs2.FlvPlayer = _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default;
  116605. flvjs2.NativePlayer = _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default;
  116606. flvjs2.LoggingControl = _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__.default;
  116607. Object.defineProperty(flvjs2, "version", {
  116608. enumerable: true,
  116609. get: function() {
  116610. return "1.6.2";
  116611. }
  116612. });
  116613. __webpack_exports__2["default"] = flvjs2;
  116614. },
  116615. "./src/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  116616. module3.exports = __webpack_require__2("./src/flv.js").default;
  116617. },
  116618. "./src/io/fetch-stream-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116619. __webpack_require__2.r(__webpack_exports__2);
  116620. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/browser.js");
  116621. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  116622. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  116623. var __extends = function() {
  116624. var extendStatics = function(d2, b) {
  116625. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  116626. d3.__proto__ = b2;
  116627. } || function(d3, b2) {
  116628. for (var p in b2)
  116629. if (Object.prototype.hasOwnProperty.call(b2, p))
  116630. d3[p] = b2[p];
  116631. };
  116632. return extendStatics(d2, b);
  116633. };
  116634. return function(d2, b) {
  116635. if (typeof b !== "function" && b !== null)
  116636. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  116637. extendStatics(d2, b);
  116638. function __() {
  116639. this.constructor = d2;
  116640. }
  116641. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  116642. };
  116643. }();
  116644. var FetchStreamLoader = function(_super) {
  116645. __extends(FetchStreamLoader2, _super);
  116646. function FetchStreamLoader2(seekHandler, config) {
  116647. var _this = _super.call(this, "fetch-stream-loader") || this;
  116648. _this.TAG = "FetchStreamLoader";
  116649. _this._seekHandler = seekHandler;
  116650. _this._config = config;
  116651. _this._needStash = true;
  116652. _this._requestAbort = false;
  116653. _this._contentLength = null;
  116654. _this._receivedLength = 0;
  116655. return _this;
  116656. }
  116657. FetchStreamLoader2.isSupported = function() {
  116658. try {
  116659. var isWorkWellEdge = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.version.minor >= 15048;
  116660. var browserNotBlacklisted = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge ? isWorkWellEdge : true;
  116661. return self.fetch && self.ReadableStream && browserNotBlacklisted;
  116662. } catch (e) {
  116663. return false;
  116664. }
  116665. };
  116666. FetchStreamLoader2.prototype.destroy = function() {
  116667. if (this.isWorking()) {
  116668. this.abort();
  116669. }
  116670. _super.prototype.destroy.call(this);
  116671. };
  116672. FetchStreamLoader2.prototype.open = function(dataSource, range3) {
  116673. var _this = this;
  116674. this._dataSource = dataSource;
  116675. this._range = range3;
  116676. var sourceURL = dataSource.url;
  116677. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  116678. sourceURL = dataSource.redirectedURL;
  116679. }
  116680. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  116681. var headers = new self.Headers();
  116682. if (typeof seekConfig.headers === "object") {
  116683. var configHeaders = seekConfig.headers;
  116684. for (var key in configHeaders) {
  116685. if (configHeaders.hasOwnProperty(key)) {
  116686. headers.append(key, configHeaders[key]);
  116687. }
  116688. }
  116689. }
  116690. var params = {
  116691. method: "GET",
  116692. headers,
  116693. mode: "cors",
  116694. cache: "default",
  116695. referrerPolicy: "no-referrer-when-downgrade"
  116696. };
  116697. if (typeof this._config.headers === "object") {
  116698. for (var key in this._config.headers) {
  116699. headers.append(key, this._config.headers[key]);
  116700. }
  116701. }
  116702. if (dataSource.cors === false) {
  116703. params.mode = "same-origin";
  116704. }
  116705. if (dataSource.withCredentials) {
  116706. params.credentials = "include";
  116707. }
  116708. if (dataSource.referrerPolicy) {
  116709. params.referrerPolicy = dataSource.referrerPolicy;
  116710. }
  116711. if (self.AbortController) {
  116712. this._abortController = new self.AbortController();
  116713. params.signal = this._abortController.signal;
  116714. }
  116715. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  116716. self.fetch(seekConfig.url, params).then(function(res) {
  116717. if (_this._requestAbort) {
  116718. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kIdle;
  116719. res.body.cancel();
  116720. return;
  116721. }
  116722. if (res.ok && (res.status >= 200 && res.status <= 299)) {
  116723. if (res.url !== seekConfig.url) {
  116724. if (_this._onURLRedirect) {
  116725. var redirectedURL = _this._seekHandler.removeURLParameters(res.url);
  116726. _this._onURLRedirect(redirectedURL);
  116727. }
  116728. }
  116729. var lengthHeader = res.headers.get("Content-Length");
  116730. if (lengthHeader != null) {
  116731. _this._contentLength = parseInt(lengthHeader);
  116732. if (_this._contentLength !== 0) {
  116733. if (_this._onContentLengthKnown) {
  116734. _this._onContentLengthKnown(_this._contentLength);
  116735. }
  116736. }
  116737. }
  116738. return _this._pump.call(_this, res.body.getReader());
  116739. } else {
  116740. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116741. if (_this._onError) {
  116742. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: res.status, msg: res.statusText });
  116743. } else {
  116744. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("FetchStreamLoader: Http code invalid, " + res.status + " " + res.statusText);
  116745. }
  116746. }
  116747. }).catch(function(e) {
  116748. if (_this._abortController && _this._abortController.signal.aborted) {
  116749. return;
  116750. }
  116751. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116752. if (_this._onError) {
  116753. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION, { code: -1, msg: e.message });
  116754. } else {
  116755. throw e;
  116756. }
  116757. });
  116758. };
  116759. FetchStreamLoader2.prototype.abort = function() {
  116760. this._requestAbort = true;
  116761. if (this._status !== _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering || !_utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.chrome) {
  116762. if (this._abortController) {
  116763. try {
  116764. this._abortController.abort();
  116765. } catch (e) {
  116766. }
  116767. }
  116768. }
  116769. };
  116770. FetchStreamLoader2.prototype._pump = function(reader) {
  116771. var _this = this;
  116772. return reader.read().then(function(result) {
  116773. if (result.done) {
  116774. if (_this._contentLength !== null && _this._receivedLength < _this._contentLength) {
  116775. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116776. var type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116777. var info = { code: -1, msg: "Fetch stream meet Early-EOF" };
  116778. if (_this._onError) {
  116779. _this._onError(type2, info);
  116780. } else {
  116781. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116782. }
  116783. } else {
  116784. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116785. if (_this._onComplete) {
  116786. _this._onComplete(_this._range.from, _this._range.from + _this._receivedLength - 1);
  116787. }
  116788. }
  116789. } else {
  116790. if (_this._abortController && _this._abortController.signal.aborted) {
  116791. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116792. return;
  116793. } else if (_this._requestAbort === true) {
  116794. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116795. return reader.cancel();
  116796. }
  116797. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  116798. var chunk = result.value.buffer;
  116799. var byteStart = _this._range.from + _this._receivedLength;
  116800. _this._receivedLength += chunk.byteLength;
  116801. if (_this._onDataArrival) {
  116802. _this._onDataArrival(chunk, byteStart, _this._receivedLength);
  116803. }
  116804. _this._pump(reader);
  116805. }
  116806. }).catch(function(e) {
  116807. if (_this._abortController && _this._abortController.signal.aborted) {
  116808. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116809. return;
  116810. }
  116811. if (e.code === 11 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge) {
  116812. return;
  116813. }
  116814. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116815. var type2 = 0;
  116816. var info = null;
  116817. if ((e.code === 19 || e.message === "network error") && (_this._contentLength === null || _this._contentLength !== null && _this._receivedLength < _this._contentLength)) {
  116818. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116819. info = { code: e.code, msg: "Fetch stream meet Early-EOF" };
  116820. } else {
  116821. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  116822. info = { code: e.code, msg: e.message };
  116823. }
  116824. if (_this._onError) {
  116825. _this._onError(type2, info);
  116826. } else {
  116827. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116828. }
  116829. });
  116830. };
  116831. return FetchStreamLoader2;
  116832. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  116833. __webpack_exports__2["default"] = FetchStreamLoader;
  116834. },
  116835. "./src/io/io-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116836. __webpack_require__2.r(__webpack_exports__2);
  116837. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  116838. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  116839. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116840. var _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/io/fetch-stream-loader.js");
  116841. var _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/io/xhr-moz-chunked-loader.js");
  116842. var _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/io/xhr-range-loader.js");
  116843. var _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/io/websocket-loader.js");
  116844. var _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/range-seek-handler.js");
  116845. var _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/io/param-seek-handler.js");
  116846. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/utils/exception.js");
  116847. var IOController = function() {
  116848. function IOController2(dataSource, config, extraData) {
  116849. this.TAG = "IOController";
  116850. this._config = config;
  116851. this._extraData = extraData;
  116852. this._stashInitialSize = 1024 * 384;
  116853. if (config.stashInitialSize != void 0 && config.stashInitialSize > 0) {
  116854. this._stashInitialSize = config.stashInitialSize;
  116855. }
  116856. this._stashUsed = 0;
  116857. this._stashSize = this._stashInitialSize;
  116858. this._bufferSize = 1024 * 1024 * 3;
  116859. this._stashBuffer = new ArrayBuffer(this._bufferSize);
  116860. this._stashByteStart = 0;
  116861. this._enableStash = true;
  116862. if (config.enableStashBuffer === false) {
  116863. this._enableStash = false;
  116864. }
  116865. this._loader = null;
  116866. this._loaderClass = null;
  116867. this._seekHandler = null;
  116868. this._dataSource = dataSource;
  116869. this._isWebSocketURL = /wss?:\/\/(.+?)/.test(dataSource.url);
  116870. this._refTotalLength = dataSource.filesize ? dataSource.filesize : null;
  116871. this._totalLength = this._refTotalLength;
  116872. this._fullRequestFlag = false;
  116873. this._currentRange = null;
  116874. this._redirectedURL = null;
  116875. this._speedNormalized = 0;
  116876. this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  116877. this._speedNormalizeList = [64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096];
  116878. this._isEarlyEofReconnecting = false;
  116879. this._paused = false;
  116880. this._resumeFrom = 0;
  116881. this._onDataArrival = null;
  116882. this._onSeeked = null;
  116883. this._onError = null;
  116884. this._onComplete = null;
  116885. this._onRedirect = null;
  116886. this._onRecoveredEarlyEof = null;
  116887. this._selectSeekHandler();
  116888. this._selectLoader();
  116889. this._createLoader();
  116890. }
  116891. IOController2.prototype.destroy = function() {
  116892. if (this._loader.isWorking()) {
  116893. this._loader.abort();
  116894. }
  116895. this._loader.destroy();
  116896. this._loader = null;
  116897. this._loaderClass = null;
  116898. this._dataSource = null;
  116899. this._stashBuffer = null;
  116900. this._stashUsed = this._stashSize = this._bufferSize = this._stashByteStart = 0;
  116901. this._currentRange = null;
  116902. this._speedSampler = null;
  116903. this._isEarlyEofReconnecting = false;
  116904. this._onDataArrival = null;
  116905. this._onSeeked = null;
  116906. this._onError = null;
  116907. this._onComplete = null;
  116908. this._onRedirect = null;
  116909. this._onRecoveredEarlyEof = null;
  116910. this._extraData = null;
  116911. };
  116912. IOController2.prototype.isWorking = function() {
  116913. return this._loader && this._loader.isWorking() && !this._paused;
  116914. };
  116915. IOController2.prototype.isPaused = function() {
  116916. return this._paused;
  116917. };
  116918. Object.defineProperty(IOController2.prototype, "status", {
  116919. get: function() {
  116920. return this._loader.status;
  116921. },
  116922. enumerable: false,
  116923. configurable: true
  116924. });
  116925. Object.defineProperty(IOController2.prototype, "extraData", {
  116926. get: function() {
  116927. return this._extraData;
  116928. },
  116929. set: function(data) {
  116930. this._extraData = data;
  116931. },
  116932. enumerable: false,
  116933. configurable: true
  116934. });
  116935. Object.defineProperty(IOController2.prototype, "onDataArrival", {
  116936. get: function() {
  116937. return this._onDataArrival;
  116938. },
  116939. set: function(callback2) {
  116940. this._onDataArrival = callback2;
  116941. },
  116942. enumerable: false,
  116943. configurable: true
  116944. });
  116945. Object.defineProperty(IOController2.prototype, "onSeeked", {
  116946. get: function() {
  116947. return this._onSeeked;
  116948. },
  116949. set: function(callback2) {
  116950. this._onSeeked = callback2;
  116951. },
  116952. enumerable: false,
  116953. configurable: true
  116954. });
  116955. Object.defineProperty(IOController2.prototype, "onError", {
  116956. get: function() {
  116957. return this._onError;
  116958. },
  116959. set: function(callback2) {
  116960. this._onError = callback2;
  116961. },
  116962. enumerable: false,
  116963. configurable: true
  116964. });
  116965. Object.defineProperty(IOController2.prototype, "onComplete", {
  116966. get: function() {
  116967. return this._onComplete;
  116968. },
  116969. set: function(callback2) {
  116970. this._onComplete = callback2;
  116971. },
  116972. enumerable: false,
  116973. configurable: true
  116974. });
  116975. Object.defineProperty(IOController2.prototype, "onRedirect", {
  116976. get: function() {
  116977. return this._onRedirect;
  116978. },
  116979. set: function(callback2) {
  116980. this._onRedirect = callback2;
  116981. },
  116982. enumerable: false,
  116983. configurable: true
  116984. });
  116985. Object.defineProperty(IOController2.prototype, "onRecoveredEarlyEof", {
  116986. get: function() {
  116987. return this._onRecoveredEarlyEof;
  116988. },
  116989. set: function(callback2) {
  116990. this._onRecoveredEarlyEof = callback2;
  116991. },
  116992. enumerable: false,
  116993. configurable: true
  116994. });
  116995. Object.defineProperty(IOController2.prototype, "currentURL", {
  116996. get: function() {
  116997. return this._dataSource.url;
  116998. },
  116999. enumerable: false,
  117000. configurable: true
  117001. });
  117002. Object.defineProperty(IOController2.prototype, "hasRedirect", {
  117003. get: function() {
  117004. return this._redirectedURL != null || this._dataSource.redirectedURL != void 0;
  117005. },
  117006. enumerable: false,
  117007. configurable: true
  117008. });
  117009. Object.defineProperty(IOController2.prototype, "currentRedirectedURL", {
  117010. get: function() {
  117011. return this._redirectedURL || this._dataSource.redirectedURL;
  117012. },
  117013. enumerable: false,
  117014. configurable: true
  117015. });
  117016. Object.defineProperty(IOController2.prototype, "currentSpeed", {
  117017. get: function() {
  117018. if (this._loaderClass === _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default) {
  117019. return this._loader.currentSpeed;
  117020. }
  117021. return this._speedSampler.lastSecondKBps;
  117022. },
  117023. enumerable: false,
  117024. configurable: true
  117025. });
  117026. Object.defineProperty(IOController2.prototype, "loaderType", {
  117027. get: function() {
  117028. return this._loader.type;
  117029. },
  117030. enumerable: false,
  117031. configurable: true
  117032. });
  117033. IOController2.prototype._selectSeekHandler = function() {
  117034. var config = this._config;
  117035. if (config.seekType === "range") {
  117036. this._seekHandler = new _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__.default(this._config.rangeLoadZeroStart);
  117037. } else if (config.seekType === "param") {
  117038. var paramStart = config.seekParamStart || "bstart";
  117039. var paramEnd = config.seekParamEnd || "bend";
  117040. this._seekHandler = new _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__.default(paramStart, paramEnd);
  117041. } else if (config.seekType === "custom") {
  117042. if (typeof config.customSeekHandler !== "function") {
  117043. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");
  117044. }
  117045. this._seekHandler = new config.customSeekHandler();
  117046. } else {
  117047. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Invalid seekType in config: " + config.seekType);
  117048. }
  117049. };
  117050. IOController2.prototype._selectLoader = function() {
  117051. if (this._config.customLoader != null) {
  117052. this._loaderClass = this._config.customLoader;
  117053. } else if (this._isWebSocketURL) {
  117054. this._loaderClass = _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__.default;
  117055. } else if (_fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default.isSupported()) {
  117056. this._loaderClass = _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default;
  117057. } else if (_xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default.isSupported()) {
  117058. this._loaderClass = _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default;
  117059. } else if (_xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default.isSupported()) {
  117060. this._loaderClass = _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default;
  117061. } else {
  117062. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");
  117063. }
  117064. };
  117065. IOController2.prototype._createLoader = function() {
  117066. this._loader = new this._loaderClass(this._seekHandler, this._config);
  117067. if (this._loader.needStashBuffer === false) {
  117068. this._enableStash = false;
  117069. }
  117070. this._loader.onContentLengthKnown = this._onContentLengthKnown.bind(this);
  117071. this._loader.onURLRedirect = this._onURLRedirect.bind(this);
  117072. this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this);
  117073. this._loader.onComplete = this._onLoaderComplete.bind(this);
  117074. this._loader.onError = this._onLoaderError.bind(this);
  117075. };
  117076. IOController2.prototype.open = function(optionalFrom) {
  117077. this._currentRange = { from: 0, to: -1 };
  117078. if (optionalFrom) {
  117079. this._currentRange.from = optionalFrom;
  117080. }
  117081. this._speedSampler.reset();
  117082. if (!optionalFrom) {
  117083. this._fullRequestFlag = true;
  117084. }
  117085. this._loader.open(this._dataSource, Object.assign({}, this._currentRange));
  117086. };
  117087. IOController2.prototype.abort = function() {
  117088. this._loader.abort();
  117089. if (this._paused) {
  117090. this._paused = false;
  117091. this._resumeFrom = 0;
  117092. }
  117093. };
  117094. IOController2.prototype.pause = function() {
  117095. if (this.isWorking()) {
  117096. this._loader.abort();
  117097. if (this._stashUsed !== 0) {
  117098. this._resumeFrom = this._stashByteStart;
  117099. this._currentRange.to = this._stashByteStart - 1;
  117100. } else {
  117101. this._resumeFrom = this._currentRange.to + 1;
  117102. }
  117103. this._stashUsed = 0;
  117104. this._stashByteStart = 0;
  117105. this._paused = true;
  117106. }
  117107. };
  117108. IOController2.prototype.resume = function() {
  117109. if (this._paused) {
  117110. this._paused = false;
  117111. var bytes = this._resumeFrom;
  117112. this._resumeFrom = 0;
  117113. this._internalSeek(bytes, true);
  117114. }
  117115. };
  117116. IOController2.prototype.seek = function(bytes) {
  117117. this._paused = false;
  117118. this._stashUsed = 0;
  117119. this._stashByteStart = 0;
  117120. this._internalSeek(bytes, true);
  117121. };
  117122. IOController2.prototype._internalSeek = function(bytes, dropUnconsumed) {
  117123. if (this._loader.isWorking()) {
  117124. this._loader.abort();
  117125. }
  117126. this._flushStashBuffer(dropUnconsumed);
  117127. this._loader.destroy();
  117128. this._loader = null;
  117129. var requestRange = { from: bytes, to: -1 };
  117130. this._currentRange = { from: requestRange.from, to: -1 };
  117131. this._speedSampler.reset();
  117132. this._stashSize = this._stashInitialSize;
  117133. this._createLoader();
  117134. this._loader.open(this._dataSource, requestRange);
  117135. if (this._onSeeked) {
  117136. this._onSeeked();
  117137. }
  117138. };
  117139. IOController2.prototype.updateUrl = function(url) {
  117140. if (!url || typeof url !== "string" || url.length === 0) {
  117141. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Url must be a non-empty string!");
  117142. }
  117143. this._dataSource.url = url;
  117144. };
  117145. IOController2.prototype._expandBuffer = function(expectedBytes) {
  117146. var bufferNewSize = this._stashSize;
  117147. while (bufferNewSize + 1024 * 1024 * 1 < expectedBytes) {
  117148. bufferNewSize *= 2;
  117149. }
  117150. bufferNewSize += 1024 * 1024 * 1;
  117151. if (bufferNewSize === this._bufferSize) {
  117152. return;
  117153. }
  117154. var newBuffer = new ArrayBuffer(bufferNewSize);
  117155. if (this._stashUsed > 0) {
  117156. var stashOldArray = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
  117157. var stashNewArray = new Uint8Array(newBuffer, 0, bufferNewSize);
  117158. stashNewArray.set(stashOldArray, 0);
  117159. }
  117160. this._stashBuffer = newBuffer;
  117161. this._bufferSize = bufferNewSize;
  117162. };
  117163. IOController2.prototype._normalizeSpeed = function(input) {
  117164. var list = this._speedNormalizeList;
  117165. var last = list.length - 1;
  117166. var mid = 0;
  117167. var lbound = 0;
  117168. var ubound = last;
  117169. if (input < list[0]) {
  117170. return list[0];
  117171. }
  117172. while (lbound <= ubound) {
  117173. mid = lbound + Math.floor((ubound - lbound) / 2);
  117174. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  117175. return list[mid];
  117176. } else if (list[mid] < input) {
  117177. lbound = mid + 1;
  117178. } else {
  117179. ubound = mid - 1;
  117180. }
  117181. }
  117182. };
  117183. IOController2.prototype._adjustStashSize = function(normalized) {
  117184. var stashSizeKB = 0;
  117185. if (this._config.isLive) {
  117186. stashSizeKB = normalized;
  117187. } else {
  117188. if (normalized < 512) {
  117189. stashSizeKB = normalized;
  117190. } else if (normalized >= 512 && normalized <= 1024) {
  117191. stashSizeKB = Math.floor(normalized * 1.5);
  117192. } else {
  117193. stashSizeKB = normalized * 2;
  117194. }
  117195. }
  117196. if (stashSizeKB > 8192) {
  117197. stashSizeKB = 8192;
  117198. }
  117199. var bufferSize = stashSizeKB * 1024 + 1024 * 1024 * 1;
  117200. if (this._bufferSize < bufferSize) {
  117201. this._expandBuffer(bufferSize);
  117202. }
  117203. this._stashSize = stashSizeKB * 1024;
  117204. };
  117205. IOController2.prototype._dispatchChunks = function(chunks, byteStart) {
  117206. this._currentRange.to = byteStart + chunks.byteLength - 1;
  117207. return this._onDataArrival(chunks, byteStart);
  117208. };
  117209. IOController2.prototype._onURLRedirect = function(redirectedURL) {
  117210. this._redirectedURL = redirectedURL;
  117211. if (this._onRedirect) {
  117212. this._onRedirect(redirectedURL);
  117213. }
  117214. };
  117215. IOController2.prototype._onContentLengthKnown = function(contentLength) {
  117216. if (contentLength && this._fullRequestFlag) {
  117217. this._totalLength = contentLength;
  117218. this._fullRequestFlag = false;
  117219. }
  117220. };
  117221. IOController2.prototype._onLoaderChunkArrival = function(chunk, byteStart, receivedLength) {
  117222. if (!this._onDataArrival) {
  117223. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");
  117224. }
  117225. if (this._paused) {
  117226. return;
  117227. }
  117228. if (this._isEarlyEofReconnecting) {
  117229. this._isEarlyEofReconnecting = false;
  117230. if (this._onRecoveredEarlyEof) {
  117231. this._onRecoveredEarlyEof();
  117232. }
  117233. }
  117234. this._speedSampler.addBytes(chunk.byteLength);
  117235. var KBps = this._speedSampler.lastSecondKBps;
  117236. if (KBps !== 0) {
  117237. var normalized = this._normalizeSpeed(KBps);
  117238. if (this._speedNormalized !== normalized) {
  117239. this._speedNormalized = normalized;
  117240. this._adjustStashSize(normalized);
  117241. }
  117242. }
  117243. if (!this._enableStash) {
  117244. if (this._stashUsed === 0) {
  117245. var consumed = this._dispatchChunks(chunk, byteStart);
  117246. if (consumed < chunk.byteLength) {
  117247. var remain = chunk.byteLength - consumed;
  117248. if (remain > this._bufferSize) {
  117249. this._expandBuffer(remain);
  117250. }
  117251. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117252. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117253. this._stashUsed += remain;
  117254. this._stashByteStart = byteStart + consumed;
  117255. }
  117256. } else {
  117257. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117258. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117259. }
  117260. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117261. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117262. this._stashUsed += chunk.byteLength;
  117263. var consumed = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart);
  117264. if (consumed < this._stashUsed && consumed > 0) {
  117265. var remainArray = new Uint8Array(this._stashBuffer, consumed);
  117266. stashArray.set(remainArray, 0);
  117267. }
  117268. this._stashUsed -= consumed;
  117269. this._stashByteStart += consumed;
  117270. }
  117271. } else {
  117272. if (this._stashUsed === 0 && this._stashByteStart === 0) {
  117273. this._stashByteStart = byteStart;
  117274. }
  117275. if (this._stashUsed + chunk.byteLength <= this._stashSize) {
  117276. var stashArray = new Uint8Array(this._stashBuffer, 0, this._stashSize);
  117277. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117278. this._stashUsed += chunk.byteLength;
  117279. } else {
  117280. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117281. if (this._stashUsed > 0) {
  117282. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117283. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117284. if (consumed < buffer.byteLength) {
  117285. if (consumed > 0) {
  117286. var remainArray = new Uint8Array(buffer, consumed);
  117287. stashArray.set(remainArray, 0);
  117288. this._stashUsed = remainArray.byteLength;
  117289. this._stashByteStart += consumed;
  117290. }
  117291. } else {
  117292. this._stashUsed = 0;
  117293. this._stashByteStart += consumed;
  117294. }
  117295. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117296. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117297. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117298. }
  117299. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117300. this._stashUsed += chunk.byteLength;
  117301. } else {
  117302. var consumed = this._dispatchChunks(chunk, byteStart);
  117303. if (consumed < chunk.byteLength) {
  117304. var remain = chunk.byteLength - consumed;
  117305. if (remain > this._bufferSize) {
  117306. this._expandBuffer(remain);
  117307. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117308. }
  117309. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117310. this._stashUsed += remain;
  117311. this._stashByteStart = byteStart + consumed;
  117312. }
  117313. }
  117314. }
  117315. }
  117316. };
  117317. IOController2.prototype._flushStashBuffer = function(dropUnconsumed) {
  117318. if (this._stashUsed > 0) {
  117319. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117320. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117321. var remain = buffer.byteLength - consumed;
  117322. if (consumed < buffer.byteLength) {
  117323. if (dropUnconsumed) {
  117324. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, remain + " bytes unconsumed data remain when flush buffer, dropped");
  117325. } else {
  117326. if (consumed > 0) {
  117327. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117328. var remainArray = new Uint8Array(buffer, consumed);
  117329. stashArray.set(remainArray, 0);
  117330. this._stashUsed = remainArray.byteLength;
  117331. this._stashByteStart += consumed;
  117332. }
  117333. return 0;
  117334. }
  117335. }
  117336. this._stashUsed = 0;
  117337. this._stashByteStart = 0;
  117338. return remain;
  117339. }
  117340. return 0;
  117341. };
  117342. IOController2.prototype._onLoaderComplete = function(from3, to) {
  117343. this._flushStashBuffer(true);
  117344. if (this._onComplete) {
  117345. this._onComplete(this._extraData);
  117346. }
  117347. };
  117348. IOController2.prototype._onLoaderError = function(type2, data) {
  117349. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Loader error, code = " + data.code + ", msg = " + data.msg);
  117350. this._flushStashBuffer(false);
  117351. if (this._isEarlyEofReconnecting) {
  117352. this._isEarlyEofReconnecting = false;
  117353. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117354. }
  117355. switch (type2) {
  117356. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF: {
  117357. if (!this._config.isLive) {
  117358. if (this._totalLength) {
  117359. var nextFrom = this._currentRange.to + 1;
  117360. if (nextFrom < this._totalLength) {
  117361. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Connection lost, trying reconnect...");
  117362. this._isEarlyEofReconnecting = true;
  117363. this._internalSeek(nextFrom, false);
  117364. }
  117365. return;
  117366. }
  117367. }
  117368. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117369. break;
  117370. }
  117371. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF:
  117372. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.CONNECTING_TIMEOUT:
  117373. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID:
  117374. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION:
  117375. break;
  117376. }
  117377. if (this._onError) {
  117378. this._onError(type2, data);
  117379. } else {
  117380. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("IOException: " + data.msg);
  117381. }
  117382. };
  117383. return IOController2;
  117384. }();
  117385. __webpack_exports__2["default"] = IOController;
  117386. },
  117387. "./src/io/loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117388. __webpack_require__2.r(__webpack_exports__2);
  117389. __webpack_require__2.d(__webpack_exports__2, {
  117390. "LoaderStatus": function() {
  117391. return LoaderStatus;
  117392. },
  117393. "LoaderErrors": function() {
  117394. return LoaderErrors;
  117395. },
  117396. "BaseLoader": function() {
  117397. return BaseLoader;
  117398. }
  117399. });
  117400. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  117401. var LoaderStatus = {
  117402. kIdle: 0,
  117403. kConnecting: 1,
  117404. kBuffering: 2,
  117405. kError: 3,
  117406. kComplete: 4
  117407. };
  117408. var LoaderErrors = {
  117409. OK: "OK",
  117410. EXCEPTION: "Exception",
  117411. HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
  117412. CONNECTING_TIMEOUT: "ConnectingTimeout",
  117413. EARLY_EOF: "EarlyEof",
  117414. UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
  117415. };
  117416. var BaseLoader = function() {
  117417. function BaseLoader2(typeName) {
  117418. this._type = typeName || "undefined";
  117419. this._status = LoaderStatus.kIdle;
  117420. this._needStash = false;
  117421. this._onContentLengthKnown = null;
  117422. this._onURLRedirect = null;
  117423. this._onDataArrival = null;
  117424. this._onError = null;
  117425. this._onComplete = null;
  117426. }
  117427. BaseLoader2.prototype.destroy = function() {
  117428. this._status = LoaderStatus.kIdle;
  117429. this._onContentLengthKnown = null;
  117430. this._onURLRedirect = null;
  117431. this._onDataArrival = null;
  117432. this._onError = null;
  117433. this._onComplete = null;
  117434. };
  117435. BaseLoader2.prototype.isWorking = function() {
  117436. return this._status === LoaderStatus.kConnecting || this._status === LoaderStatus.kBuffering;
  117437. };
  117438. Object.defineProperty(BaseLoader2.prototype, "type", {
  117439. get: function() {
  117440. return this._type;
  117441. },
  117442. enumerable: false,
  117443. configurable: true
  117444. });
  117445. Object.defineProperty(BaseLoader2.prototype, "status", {
  117446. get: function() {
  117447. return this._status;
  117448. },
  117449. enumerable: false,
  117450. configurable: true
  117451. });
  117452. Object.defineProperty(BaseLoader2.prototype, "needStashBuffer", {
  117453. get: function() {
  117454. return this._needStash;
  117455. },
  117456. enumerable: false,
  117457. configurable: true
  117458. });
  117459. Object.defineProperty(BaseLoader2.prototype, "onContentLengthKnown", {
  117460. get: function() {
  117461. return this._onContentLengthKnown;
  117462. },
  117463. set: function(callback2) {
  117464. this._onContentLengthKnown = callback2;
  117465. },
  117466. enumerable: false,
  117467. configurable: true
  117468. });
  117469. Object.defineProperty(BaseLoader2.prototype, "onURLRedirect", {
  117470. get: function() {
  117471. return this._onURLRedirect;
  117472. },
  117473. set: function(callback2) {
  117474. this._onURLRedirect = callback2;
  117475. },
  117476. enumerable: false,
  117477. configurable: true
  117478. });
  117479. Object.defineProperty(BaseLoader2.prototype, "onDataArrival", {
  117480. get: function() {
  117481. return this._onDataArrival;
  117482. },
  117483. set: function(callback2) {
  117484. this._onDataArrival = callback2;
  117485. },
  117486. enumerable: false,
  117487. configurable: true
  117488. });
  117489. Object.defineProperty(BaseLoader2.prototype, "onError", {
  117490. get: function() {
  117491. return this._onError;
  117492. },
  117493. set: function(callback2) {
  117494. this._onError = callback2;
  117495. },
  117496. enumerable: false,
  117497. configurable: true
  117498. });
  117499. Object.defineProperty(BaseLoader2.prototype, "onComplete", {
  117500. get: function() {
  117501. return this._onComplete;
  117502. },
  117503. set: function(callback2) {
  117504. this._onComplete = callback2;
  117505. },
  117506. enumerable: false,
  117507. configurable: true
  117508. });
  117509. BaseLoader2.prototype.open = function(dataSource, range3) {
  117510. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117511. };
  117512. BaseLoader2.prototype.abort = function() {
  117513. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117514. };
  117515. return BaseLoader2;
  117516. }();
  117517. },
  117518. "./src/io/param-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117519. __webpack_require__2.r(__webpack_exports__2);
  117520. var ParamSeekHandler = function() {
  117521. function ParamSeekHandler2(paramStart, paramEnd) {
  117522. this._startName = paramStart;
  117523. this._endName = paramEnd;
  117524. }
  117525. ParamSeekHandler2.prototype.getConfig = function(baseUrl, range3) {
  117526. var url = baseUrl;
  117527. if (range3.from !== 0 || range3.to !== -1) {
  117528. var needAnd = true;
  117529. if (url.indexOf("?") === -1) {
  117530. url += "?";
  117531. needAnd = false;
  117532. }
  117533. if (needAnd) {
  117534. url += "&";
  117535. }
  117536. url += this._startName + "=" + range3.from.toString();
  117537. if (range3.to !== -1) {
  117538. url += "&" + this._endName + "=" + range3.to.toString();
  117539. }
  117540. }
  117541. return {
  117542. url,
  117543. headers: {}
  117544. };
  117545. };
  117546. ParamSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117547. var baseURL = seekedURL.split("?")[0];
  117548. var params = void 0;
  117549. var queryIndex = seekedURL.indexOf("?");
  117550. if (queryIndex !== -1) {
  117551. params = seekedURL.substring(queryIndex + 1);
  117552. }
  117553. var resultParams = "";
  117554. if (params != void 0 && params.length > 0) {
  117555. var pairs = params.split("&");
  117556. for (var i2 = 0; i2 < pairs.length; i2++) {
  117557. var pair = pairs[i2].split("=");
  117558. var requireAnd = i2 > 0;
  117559. if (pair[0] !== this._startName && pair[0] !== this._endName) {
  117560. if (requireAnd) {
  117561. resultParams += "&";
  117562. }
  117563. resultParams += pairs[i2];
  117564. }
  117565. }
  117566. }
  117567. return resultParams.length === 0 ? baseURL : baseURL + "?" + resultParams;
  117568. };
  117569. return ParamSeekHandler2;
  117570. }();
  117571. __webpack_exports__2["default"] = ParamSeekHandler;
  117572. },
  117573. "./src/io/range-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117574. __webpack_require__2.r(__webpack_exports__2);
  117575. var RangeSeekHandler = function() {
  117576. function RangeSeekHandler2(zeroStart) {
  117577. this._zeroStart = zeroStart || false;
  117578. }
  117579. RangeSeekHandler2.prototype.getConfig = function(url, range3) {
  117580. var headers = {};
  117581. if (range3.from !== 0 || range3.to !== -1) {
  117582. var param = void 0;
  117583. if (range3.to !== -1) {
  117584. param = "bytes=" + range3.from.toString() + "-" + range3.to.toString();
  117585. } else {
  117586. param = "bytes=" + range3.from.toString() + "-";
  117587. }
  117588. headers["Range"] = param;
  117589. } else if (this._zeroStart) {
  117590. headers["Range"] = "bytes=0-";
  117591. }
  117592. return {
  117593. url,
  117594. headers
  117595. };
  117596. };
  117597. RangeSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117598. return seekedURL;
  117599. };
  117600. return RangeSeekHandler2;
  117601. }();
  117602. __webpack_exports__2["default"] = RangeSeekHandler;
  117603. },
  117604. "./src/io/speed-sampler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117605. __webpack_require__2.r(__webpack_exports__2);
  117606. var SpeedSampler = function() {
  117607. function SpeedSampler2() {
  117608. this._firstCheckpoint = 0;
  117609. this._lastCheckpoint = 0;
  117610. this._intervalBytes = 0;
  117611. this._totalBytes = 0;
  117612. this._lastSecondBytes = 0;
  117613. if (self.performance && self.performance.now) {
  117614. this._now = self.performance.now.bind(self.performance);
  117615. } else {
  117616. this._now = Date.now;
  117617. }
  117618. }
  117619. SpeedSampler2.prototype.reset = function() {
  117620. this._firstCheckpoint = this._lastCheckpoint = 0;
  117621. this._totalBytes = this._intervalBytes = 0;
  117622. this._lastSecondBytes = 0;
  117623. };
  117624. SpeedSampler2.prototype.addBytes = function(bytes) {
  117625. if (this._firstCheckpoint === 0) {
  117626. this._firstCheckpoint = this._now();
  117627. this._lastCheckpoint = this._firstCheckpoint;
  117628. this._intervalBytes += bytes;
  117629. this._totalBytes += bytes;
  117630. } else if (this._now() - this._lastCheckpoint < 1e3) {
  117631. this._intervalBytes += bytes;
  117632. this._totalBytes += bytes;
  117633. } else {
  117634. this._lastSecondBytes = this._intervalBytes;
  117635. this._intervalBytes = bytes;
  117636. this._totalBytes += bytes;
  117637. this._lastCheckpoint = this._now();
  117638. }
  117639. };
  117640. Object.defineProperty(SpeedSampler2.prototype, "currentKBps", {
  117641. get: function() {
  117642. this.addBytes(0);
  117643. var durationSeconds = (this._now() - this._lastCheckpoint) / 1e3;
  117644. if (durationSeconds == 0)
  117645. durationSeconds = 1;
  117646. return this._intervalBytes / durationSeconds / 1024;
  117647. },
  117648. enumerable: false,
  117649. configurable: true
  117650. });
  117651. Object.defineProperty(SpeedSampler2.prototype, "lastSecondKBps", {
  117652. get: function() {
  117653. this.addBytes(0);
  117654. if (this._lastSecondBytes !== 0) {
  117655. return this._lastSecondBytes / 1024;
  117656. } else {
  117657. if (this._now() - this._lastCheckpoint >= 500) {
  117658. return this.currentKBps;
  117659. } else {
  117660. return 0;
  117661. }
  117662. }
  117663. },
  117664. enumerable: false,
  117665. configurable: true
  117666. });
  117667. Object.defineProperty(SpeedSampler2.prototype, "averageKBps", {
  117668. get: function() {
  117669. var durationSeconds = (this._now() - this._firstCheckpoint) / 1e3;
  117670. return this._totalBytes / durationSeconds / 1024;
  117671. },
  117672. enumerable: false,
  117673. configurable: true
  117674. });
  117675. return SpeedSampler2;
  117676. }();
  117677. __webpack_exports__2["default"] = SpeedSampler;
  117678. },
  117679. "./src/io/websocket-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117680. __webpack_require__2.r(__webpack_exports__2);
  117681. var _loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  117682. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/exception.js");
  117683. var __extends = function() {
  117684. var extendStatics = function(d2, b) {
  117685. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117686. d3.__proto__ = b2;
  117687. } || function(d3, b2) {
  117688. for (var p in b2)
  117689. if (Object.prototype.hasOwnProperty.call(b2, p))
  117690. d3[p] = b2[p];
  117691. };
  117692. return extendStatics(d2, b);
  117693. };
  117694. return function(d2, b) {
  117695. if (typeof b !== "function" && b !== null)
  117696. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117697. extendStatics(d2, b);
  117698. function __() {
  117699. this.constructor = d2;
  117700. }
  117701. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117702. };
  117703. }();
  117704. var WebSocketLoader = function(_super) {
  117705. __extends(WebSocketLoader2, _super);
  117706. function WebSocketLoader2() {
  117707. var _this = _super.call(this, "websocket-loader") || this;
  117708. _this.TAG = "WebSocketLoader";
  117709. _this._needStash = true;
  117710. _this._ws = null;
  117711. _this._requestAbort = false;
  117712. _this._receivedLength = 0;
  117713. return _this;
  117714. }
  117715. WebSocketLoader2.isSupported = function() {
  117716. try {
  117717. return typeof self.WebSocket !== "undefined";
  117718. } catch (e) {
  117719. return false;
  117720. }
  117721. };
  117722. WebSocketLoader2.prototype.destroy = function() {
  117723. if (this._ws) {
  117724. this.abort();
  117725. }
  117726. _super.prototype.destroy.call(this);
  117727. };
  117728. WebSocketLoader2.prototype.open = function(dataSource) {
  117729. try {
  117730. var ws = this._ws = new self.WebSocket(dataSource.url);
  117731. ws.binaryType = "arraybuffer";
  117732. ws.onopen = this._onWebSocketOpen.bind(this);
  117733. ws.onclose = this._onWebSocketClose.bind(this);
  117734. ws.onmessage = this._onWebSocketMessage.bind(this);
  117735. ws.onerror = this._onWebSocketError.bind(this);
  117736. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kConnecting;
  117737. } catch (e) {
  117738. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117739. var info = { code: e.code, msg: e.message };
  117740. if (this._onError) {
  117741. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117742. } else {
  117743. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117744. }
  117745. }
  117746. };
  117747. WebSocketLoader2.prototype.abort = function() {
  117748. var ws = this._ws;
  117749. if (ws && (ws.readyState === 0 || ws.readyState === 1)) {
  117750. this._requestAbort = true;
  117751. ws.close();
  117752. }
  117753. this._ws = null;
  117754. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117755. };
  117756. WebSocketLoader2.prototype._onWebSocketOpen = function(e) {
  117757. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kBuffering;
  117758. };
  117759. WebSocketLoader2.prototype._onWebSocketClose = function(e) {
  117760. if (this._requestAbort === true) {
  117761. this._requestAbort = false;
  117762. return;
  117763. }
  117764. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117765. if (this._onComplete) {
  117766. this._onComplete(0, this._receivedLength - 1);
  117767. }
  117768. };
  117769. WebSocketLoader2.prototype._onWebSocketMessage = function(e) {
  117770. var _this = this;
  117771. if (e.data instanceof ArrayBuffer) {
  117772. this._dispatchArrayBuffer(e.data);
  117773. } else if (e.data instanceof Blob) {
  117774. var reader_1 = new FileReader();
  117775. reader_1.onload = function() {
  117776. _this._dispatchArrayBuffer(reader_1.result);
  117777. };
  117778. reader_1.readAsArrayBuffer(e.data);
  117779. } else {
  117780. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117781. var info = { code: -1, msg: "Unsupported WebSocket message type: " + e.data.constructor.name };
  117782. if (this._onError) {
  117783. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117784. } else {
  117785. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117786. }
  117787. }
  117788. };
  117789. WebSocketLoader2.prototype._dispatchArrayBuffer = function(arraybuffer) {
  117790. var chunk = arraybuffer;
  117791. var byteStart = this._receivedLength;
  117792. this._receivedLength += chunk.byteLength;
  117793. if (this._onDataArrival) {
  117794. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117795. }
  117796. };
  117797. WebSocketLoader2.prototype._onWebSocketError = function(e) {
  117798. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117799. var info = {
  117800. code: e.code,
  117801. msg: e.message
  117802. };
  117803. if (this._onError) {
  117804. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117805. } else {
  117806. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117807. }
  117808. };
  117809. return WebSocketLoader2;
  117810. }(_loader_js__WEBPACK_IMPORTED_MODULE_0__.BaseLoader);
  117811. __webpack_exports__2["default"] = WebSocketLoader;
  117812. },
  117813. "./src/io/xhr-moz-chunked-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117814. __webpack_require__2.r(__webpack_exports__2);
  117815. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  117816. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  117817. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  117818. var __extends = function() {
  117819. var extendStatics = function(d2, b) {
  117820. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117821. d3.__proto__ = b2;
  117822. } || function(d3, b2) {
  117823. for (var p in b2)
  117824. if (Object.prototype.hasOwnProperty.call(b2, p))
  117825. d3[p] = b2[p];
  117826. };
  117827. return extendStatics(d2, b);
  117828. };
  117829. return function(d2, b) {
  117830. if (typeof b !== "function" && b !== null)
  117831. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117832. extendStatics(d2, b);
  117833. function __() {
  117834. this.constructor = d2;
  117835. }
  117836. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117837. };
  117838. }();
  117839. var MozChunkedLoader = function(_super) {
  117840. __extends(MozChunkedLoader2, _super);
  117841. function MozChunkedLoader2(seekHandler, config) {
  117842. var _this = _super.call(this, "xhr-moz-chunked-loader") || this;
  117843. _this.TAG = "MozChunkedLoader";
  117844. _this._seekHandler = seekHandler;
  117845. _this._config = config;
  117846. _this._needStash = true;
  117847. _this._xhr = null;
  117848. _this._requestAbort = false;
  117849. _this._contentLength = null;
  117850. _this._receivedLength = 0;
  117851. return _this;
  117852. }
  117853. MozChunkedLoader2.isSupported = function() {
  117854. try {
  117855. var xhr = new XMLHttpRequest();
  117856. xhr.open("GET", "https://example.com", true);
  117857. xhr.responseType = "moz-chunked-arraybuffer";
  117858. return xhr.responseType === "moz-chunked-arraybuffer";
  117859. } catch (e) {
  117860. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("MozChunkedLoader", e.message);
  117861. return false;
  117862. }
  117863. };
  117864. MozChunkedLoader2.prototype.destroy = function() {
  117865. if (this.isWorking()) {
  117866. this.abort();
  117867. }
  117868. if (this._xhr) {
  117869. this._xhr.onreadystatechange = null;
  117870. this._xhr.onprogress = null;
  117871. this._xhr.onloadend = null;
  117872. this._xhr.onerror = null;
  117873. this._xhr = null;
  117874. }
  117875. _super.prototype.destroy.call(this);
  117876. };
  117877. MozChunkedLoader2.prototype.open = function(dataSource, range3) {
  117878. this._dataSource = dataSource;
  117879. this._range = range3;
  117880. var sourceURL = dataSource.url;
  117881. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  117882. sourceURL = dataSource.redirectedURL;
  117883. }
  117884. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  117885. this._requestURL = seekConfig.url;
  117886. var xhr = this._xhr = new XMLHttpRequest();
  117887. xhr.open("GET", seekConfig.url, true);
  117888. xhr.responseType = "moz-chunked-arraybuffer";
  117889. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  117890. xhr.onprogress = this._onProgress.bind(this);
  117891. xhr.onloadend = this._onLoadEnd.bind(this);
  117892. xhr.onerror = this._onXhrError.bind(this);
  117893. if (dataSource.withCredentials) {
  117894. xhr.withCredentials = true;
  117895. }
  117896. if (typeof seekConfig.headers === "object") {
  117897. var headers = seekConfig.headers;
  117898. for (var key in headers) {
  117899. if (headers.hasOwnProperty(key)) {
  117900. xhr.setRequestHeader(key, headers[key]);
  117901. }
  117902. }
  117903. }
  117904. if (typeof this._config.headers === "object") {
  117905. var headers = this._config.headers;
  117906. for (var key in headers) {
  117907. if (headers.hasOwnProperty(key)) {
  117908. xhr.setRequestHeader(key, headers[key]);
  117909. }
  117910. }
  117911. }
  117912. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  117913. xhr.send();
  117914. };
  117915. MozChunkedLoader2.prototype.abort = function() {
  117916. this._requestAbort = true;
  117917. if (this._xhr) {
  117918. this._xhr.abort();
  117919. }
  117920. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117921. };
  117922. MozChunkedLoader2.prototype._onReadyStateChange = function(e) {
  117923. var xhr = e.target;
  117924. if (xhr.readyState === 2) {
  117925. if (xhr.responseURL != void 0 && xhr.responseURL !== this._requestURL) {
  117926. if (this._onURLRedirect) {
  117927. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  117928. this._onURLRedirect(redirectedURL);
  117929. }
  117930. }
  117931. if (xhr.status !== 0 && (xhr.status < 200 || xhr.status > 299)) {
  117932. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117933. if (this._onError) {
  117934. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  117935. } else {
  117936. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("MozChunkedLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  117937. }
  117938. } else {
  117939. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  117940. }
  117941. }
  117942. };
  117943. MozChunkedLoader2.prototype._onProgress = function(e) {
  117944. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117945. return;
  117946. }
  117947. if (this._contentLength === null) {
  117948. if (e.total !== null && e.total !== 0) {
  117949. this._contentLength = e.total;
  117950. if (this._onContentLengthKnown) {
  117951. this._onContentLengthKnown(this._contentLength);
  117952. }
  117953. }
  117954. }
  117955. var chunk = e.target.response;
  117956. var byteStart = this._range.from + this._receivedLength;
  117957. this._receivedLength += chunk.byteLength;
  117958. if (this._onDataArrival) {
  117959. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117960. }
  117961. };
  117962. MozChunkedLoader2.prototype._onLoadEnd = function(e) {
  117963. if (this._requestAbort === true) {
  117964. this._requestAbort = false;
  117965. return;
  117966. } else if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117967. return;
  117968. }
  117969. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117970. if (this._onComplete) {
  117971. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  117972. }
  117973. };
  117974. MozChunkedLoader2.prototype._onXhrError = function(e) {
  117975. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117976. var type2 = 0;
  117977. var info = null;
  117978. if (this._contentLength && e.loaded < this._contentLength) {
  117979. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  117980. info = { code: -1, msg: "Moz-Chunked stream meet Early-Eof" };
  117981. } else {
  117982. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  117983. info = { code: -1, msg: e.constructor.name + " " + e.type };
  117984. }
  117985. if (this._onError) {
  117986. this._onError(type2, info);
  117987. } else {
  117988. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  117989. }
  117990. };
  117991. return MozChunkedLoader2;
  117992. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  117993. __webpack_exports__2["default"] = MozChunkedLoader;
  117994. },
  117995. "./src/io/xhr-range-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117996. __webpack_require__2.r(__webpack_exports__2);
  117997. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  117998. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  117999. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  118000. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  118001. var __extends = function() {
  118002. var extendStatics = function(d2, b) {
  118003. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  118004. d3.__proto__ = b2;
  118005. } || function(d3, b2) {
  118006. for (var p in b2)
  118007. if (Object.prototype.hasOwnProperty.call(b2, p))
  118008. d3[p] = b2[p];
  118009. };
  118010. return extendStatics(d2, b);
  118011. };
  118012. return function(d2, b) {
  118013. if (typeof b !== "function" && b !== null)
  118014. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  118015. extendStatics(d2, b);
  118016. function __() {
  118017. this.constructor = d2;
  118018. }
  118019. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  118020. };
  118021. }();
  118022. var RangeLoader = function(_super) {
  118023. __extends(RangeLoader2, _super);
  118024. function RangeLoader2(seekHandler, config) {
  118025. var _this = _super.call(this, "xhr-range-loader") || this;
  118026. _this.TAG = "RangeLoader";
  118027. _this._seekHandler = seekHandler;
  118028. _this._config = config;
  118029. _this._needStash = false;
  118030. _this._chunkSizeKBList = [
  118031. 128,
  118032. 256,
  118033. 384,
  118034. 512,
  118035. 768,
  118036. 1024,
  118037. 1536,
  118038. 2048,
  118039. 3072,
  118040. 4096,
  118041. 5120,
  118042. 6144,
  118043. 7168,
  118044. 8192
  118045. ];
  118046. _this._currentChunkSizeKB = 384;
  118047. _this._currentSpeedNormalized = 0;
  118048. _this._zeroSpeedChunkCount = 0;
  118049. _this._xhr = null;
  118050. _this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  118051. _this._requestAbort = false;
  118052. _this._waitForTotalLength = false;
  118053. _this._totalLengthReceived = false;
  118054. _this._currentRequestURL = null;
  118055. _this._currentRedirectedURL = null;
  118056. _this._currentRequestRange = null;
  118057. _this._totalLength = null;
  118058. _this._contentLength = null;
  118059. _this._receivedLength = 0;
  118060. _this._lastTimeLoaded = 0;
  118061. return _this;
  118062. }
  118063. RangeLoader2.isSupported = function() {
  118064. try {
  118065. var xhr = new XMLHttpRequest();
  118066. xhr.open("GET", "https://example.com", true);
  118067. xhr.responseType = "arraybuffer";
  118068. return xhr.responseType === "arraybuffer";
  118069. } catch (e) {
  118070. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("RangeLoader", e.message);
  118071. return false;
  118072. }
  118073. };
  118074. RangeLoader2.prototype.destroy = function() {
  118075. if (this.isWorking()) {
  118076. this.abort();
  118077. }
  118078. if (this._xhr) {
  118079. this._xhr.onreadystatechange = null;
  118080. this._xhr.onprogress = null;
  118081. this._xhr.onload = null;
  118082. this._xhr.onerror = null;
  118083. this._xhr = null;
  118084. }
  118085. _super.prototype.destroy.call(this);
  118086. };
  118087. Object.defineProperty(RangeLoader2.prototype, "currentSpeed", {
  118088. get: function() {
  118089. return this._speedSampler.lastSecondKBps;
  118090. },
  118091. enumerable: false,
  118092. configurable: true
  118093. });
  118094. RangeLoader2.prototype.open = function(dataSource, range3) {
  118095. this._dataSource = dataSource;
  118096. this._range = range3;
  118097. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kConnecting;
  118098. var useRefTotalLength = false;
  118099. if (this._dataSource.filesize != void 0 && this._dataSource.filesize !== 0) {
  118100. useRefTotalLength = true;
  118101. this._totalLength = this._dataSource.filesize;
  118102. }
  118103. if (!this._totalLengthReceived && !useRefTotalLength) {
  118104. this._waitForTotalLength = true;
  118105. this._internalOpen(this._dataSource, { from: 0, to: -1 });
  118106. } else {
  118107. this._openSubRange();
  118108. }
  118109. };
  118110. RangeLoader2.prototype._openSubRange = function() {
  118111. var chunkSize = this._currentChunkSizeKB * 1024;
  118112. var from3 = this._range.from + this._receivedLength;
  118113. var to = from3 + chunkSize;
  118114. if (this._contentLength != null) {
  118115. if (to - this._range.from >= this._contentLength) {
  118116. to = this._range.from + this._contentLength - 1;
  118117. }
  118118. }
  118119. this._currentRequestRange = { from: from3, to };
  118120. this._internalOpen(this._dataSource, this._currentRequestRange);
  118121. };
  118122. RangeLoader2.prototype._internalOpen = function(dataSource, range3) {
  118123. this._lastTimeLoaded = 0;
  118124. var sourceURL = dataSource.url;
  118125. if (this._config.reuseRedirectedURL) {
  118126. if (this._currentRedirectedURL != void 0) {
  118127. sourceURL = this._currentRedirectedURL;
  118128. } else if (dataSource.redirectedURL != void 0) {
  118129. sourceURL = dataSource.redirectedURL;
  118130. }
  118131. }
  118132. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  118133. this._currentRequestURL = seekConfig.url;
  118134. var xhr = this._xhr = new XMLHttpRequest();
  118135. xhr.open("GET", seekConfig.url, true);
  118136. xhr.responseType = "arraybuffer";
  118137. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  118138. xhr.onprogress = this._onProgress.bind(this);
  118139. xhr.onload = this._onLoad.bind(this);
  118140. xhr.onerror = this._onXhrError.bind(this);
  118141. if (dataSource.withCredentials) {
  118142. xhr.withCredentials = true;
  118143. }
  118144. if (typeof seekConfig.headers === "object") {
  118145. var headers = seekConfig.headers;
  118146. for (var key in headers) {
  118147. if (headers.hasOwnProperty(key)) {
  118148. xhr.setRequestHeader(key, headers[key]);
  118149. }
  118150. }
  118151. }
  118152. if (typeof this._config.headers === "object") {
  118153. var headers = this._config.headers;
  118154. for (var key in headers) {
  118155. if (headers.hasOwnProperty(key)) {
  118156. xhr.setRequestHeader(key, headers[key]);
  118157. }
  118158. }
  118159. }
  118160. xhr.send();
  118161. };
  118162. RangeLoader2.prototype.abort = function() {
  118163. this._requestAbort = true;
  118164. this._internalAbort();
  118165. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118166. };
  118167. RangeLoader2.prototype._internalAbort = function() {
  118168. if (this._xhr) {
  118169. this._xhr.onreadystatechange = null;
  118170. this._xhr.onprogress = null;
  118171. this._xhr.onload = null;
  118172. this._xhr.onerror = null;
  118173. this._xhr.abort();
  118174. this._xhr = null;
  118175. }
  118176. };
  118177. RangeLoader2.prototype._onReadyStateChange = function(e) {
  118178. var xhr = e.target;
  118179. if (xhr.readyState === 2) {
  118180. if (xhr.responseURL != void 0) {
  118181. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  118182. if (xhr.responseURL !== this._currentRequestURL && redirectedURL !== this._currentRedirectedURL) {
  118183. this._currentRedirectedURL = redirectedURL;
  118184. if (this._onURLRedirect) {
  118185. this._onURLRedirect(redirectedURL);
  118186. }
  118187. }
  118188. }
  118189. if (xhr.status >= 200 && xhr.status <= 299) {
  118190. if (this._waitForTotalLength) {
  118191. return;
  118192. }
  118193. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kBuffering;
  118194. } else {
  118195. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118196. if (this._onError) {
  118197. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  118198. } else {
  118199. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException("RangeLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  118200. }
  118201. }
  118202. }
  118203. };
  118204. RangeLoader2.prototype._onProgress = function(e) {
  118205. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118206. return;
  118207. }
  118208. if (this._contentLength === null) {
  118209. var openNextRange = false;
  118210. if (this._waitForTotalLength) {
  118211. this._waitForTotalLength = false;
  118212. this._totalLengthReceived = true;
  118213. openNextRange = true;
  118214. var total = e.total;
  118215. this._internalAbort();
  118216. if (total != null & total !== 0) {
  118217. this._totalLength = total;
  118218. }
  118219. }
  118220. if (this._range.to === -1) {
  118221. this._contentLength = this._totalLength - this._range.from;
  118222. } else {
  118223. this._contentLength = this._range.to - this._range.from + 1;
  118224. }
  118225. if (openNextRange) {
  118226. this._openSubRange();
  118227. return;
  118228. }
  118229. if (this._onContentLengthKnown) {
  118230. this._onContentLengthKnown(this._contentLength);
  118231. }
  118232. }
  118233. var delta = e.loaded - this._lastTimeLoaded;
  118234. this._lastTimeLoaded = e.loaded;
  118235. this._speedSampler.addBytes(delta);
  118236. };
  118237. RangeLoader2.prototype._normalizeSpeed = function(input) {
  118238. var list = this._chunkSizeKBList;
  118239. var last = list.length - 1;
  118240. var mid = 0;
  118241. var lbound = 0;
  118242. var ubound = last;
  118243. if (input < list[0]) {
  118244. return list[0];
  118245. }
  118246. while (lbound <= ubound) {
  118247. mid = lbound + Math.floor((ubound - lbound) / 2);
  118248. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  118249. return list[mid];
  118250. } else if (list[mid] < input) {
  118251. lbound = mid + 1;
  118252. } else {
  118253. ubound = mid - 1;
  118254. }
  118255. }
  118256. };
  118257. RangeLoader2.prototype._onLoad = function(e) {
  118258. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118259. return;
  118260. }
  118261. if (this._waitForTotalLength) {
  118262. this._waitForTotalLength = false;
  118263. return;
  118264. }
  118265. this._lastTimeLoaded = 0;
  118266. var KBps = this._speedSampler.lastSecondKBps;
  118267. if (KBps === 0) {
  118268. this._zeroSpeedChunkCount++;
  118269. if (this._zeroSpeedChunkCount >= 3) {
  118270. KBps = this._speedSampler.currentKBps;
  118271. }
  118272. }
  118273. if (KBps !== 0) {
  118274. var normalized = this._normalizeSpeed(KBps);
  118275. if (this._currentSpeedNormalized !== normalized) {
  118276. this._currentSpeedNormalized = normalized;
  118277. this._currentChunkSizeKB = normalized;
  118278. }
  118279. }
  118280. var chunk = e.target.response;
  118281. var byteStart = this._range.from + this._receivedLength;
  118282. this._receivedLength += chunk.byteLength;
  118283. var reportComplete = false;
  118284. if (this._contentLength != null && this._receivedLength < this._contentLength) {
  118285. this._openSubRange();
  118286. } else {
  118287. reportComplete = true;
  118288. }
  118289. if (this._onDataArrival) {
  118290. this._onDataArrival(chunk, byteStart, this._receivedLength);
  118291. }
  118292. if (reportComplete) {
  118293. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118294. if (this._onComplete) {
  118295. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  118296. }
  118297. }
  118298. };
  118299. RangeLoader2.prototype._onXhrError = function(e) {
  118300. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118301. var type2 = 0;
  118302. var info = null;
  118303. if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength) {
  118304. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF;
  118305. info = { code: -1, msg: "RangeLoader meet Early-Eof" };
  118306. } else {
  118307. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION;
  118308. info = { code: -1, msg: e.constructor.name + " " + e.type };
  118309. }
  118310. if (this._onError) {
  118311. this._onError(type2, info);
  118312. } else {
  118313. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException(info.msg);
  118314. }
  118315. };
  118316. return RangeLoader2;
  118317. }(_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader);
  118318. __webpack_exports__2["default"] = RangeLoader;
  118319. },
  118320. "./src/player/flv-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118321. __webpack_require__2.r(__webpack_exports__2);
  118322. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118323. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118324. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  118325. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  118326. var _player_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/player-events.js");
  118327. var _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxer.js");
  118328. var _core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  118329. var _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/mse-controller.js");
  118330. var _core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/core/mse-events.js");
  118331. var _player_errors_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/player/player-errors.js");
  118332. var _config_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/config.js");
  118333. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__2("./src/utils/exception.js");
  118334. var FlvPlayer = function() {
  118335. function FlvPlayer2(mediaDataSource, config) {
  118336. this.TAG = "FlvPlayer";
  118337. this._type = "FlvPlayer";
  118338. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118339. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_9__.createDefaultConfig)();
  118340. if (typeof config === "object") {
  118341. Object.assign(this._config, config);
  118342. }
  118343. if (mediaDataSource.type.toLowerCase() !== "flv") {
  118344. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");
  118345. }
  118346. if (mediaDataSource.isLive === true) {
  118347. this._config.isLive = true;
  118348. }
  118349. this.e = {
  118350. onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
  118351. onvSeeking: this._onvSeeking.bind(this),
  118352. onvCanPlay: this._onvCanPlay.bind(this),
  118353. onvStalled: this._onvStalled.bind(this),
  118354. onvProgress: this._onvProgress.bind(this)
  118355. };
  118356. if (self.performance && self.performance.now) {
  118357. this._now = self.performance.now.bind(self.performance);
  118358. } else {
  118359. this._now = Date.now;
  118360. }
  118361. this._pendingSeekTime = null;
  118362. this._requestSetTime = false;
  118363. this._seekpointRecord = null;
  118364. this._progressChecker = null;
  118365. this._mediaDataSource = mediaDataSource;
  118366. this._mediaElement = null;
  118367. this._msectl = null;
  118368. this._transmuxer = null;
  118369. this._mseSourceOpened = false;
  118370. this._hasPendingLoad = false;
  118371. this._receivedCanPlay = false;
  118372. this._mediaInfo = null;
  118373. this._statisticsInfo = null;
  118374. 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);
  118375. this._alwaysSeekKeyframe = chromeNeedIDRFix || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msie ? true : false;
  118376. if (this._alwaysSeekKeyframe) {
  118377. this._config.accurateSeek = false;
  118378. }
  118379. }
  118380. FlvPlayer2.prototype.destroy = function() {
  118381. if (this._progressChecker != null) {
  118382. window.clearInterval(this._progressChecker);
  118383. this._progressChecker = null;
  118384. }
  118385. if (this._transmuxer) {
  118386. this.unload();
  118387. }
  118388. if (this._mediaElement) {
  118389. this.detachMediaElement();
  118390. }
  118391. this.e = null;
  118392. this._mediaDataSource = null;
  118393. this._emitter.removeAllListeners();
  118394. this._emitter = null;
  118395. };
  118396. FlvPlayer2.prototype.on = function(event2, listener) {
  118397. var _this = this;
  118398. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO) {
  118399. if (this._mediaInfo != null) {
  118400. Promise.resolve().then(function() {
  118401. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, _this.mediaInfo);
  118402. });
  118403. }
  118404. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO) {
  118405. if (this._statisticsInfo != null) {
  118406. Promise.resolve().then(function() {
  118407. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, _this.statisticsInfo);
  118408. });
  118409. }
  118410. }
  118411. this._emitter.addListener(event2, listener);
  118412. };
  118413. FlvPlayer2.prototype.off = function(event2, listener) {
  118414. this._emitter.removeListener(event2, listener);
  118415. };
  118416. FlvPlayer2.prototype.attachMediaElement = function(mediaElement) {
  118417. var _this = this;
  118418. this._mediaElement = mediaElement;
  118419. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118420. mediaElement.addEventListener("seeking", this.e.onvSeeking);
  118421. mediaElement.addEventListener("canplay", this.e.onvCanPlay);
  118422. mediaElement.addEventListener("stalled", this.e.onvStalled);
  118423. mediaElement.addEventListener("progress", this.e.onvProgress);
  118424. this._msectl = new _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__.default(this._config);
  118425. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.UPDATE_END, this._onmseUpdateEnd.bind(this));
  118426. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.BUFFER_FULL, this._onmseBufferFull.bind(this));
  118427. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.SOURCE_OPEN, function() {
  118428. _this._mseSourceOpened = true;
  118429. if (_this._hasPendingLoad) {
  118430. _this._hasPendingLoad = false;
  118431. _this.load();
  118432. }
  118433. });
  118434. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.ERROR, function(info) {
  118435. _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);
  118436. });
  118437. this._msectl.attachMediaElement(mediaElement);
  118438. if (this._pendingSeekTime != null) {
  118439. try {
  118440. mediaElement.currentTime = this._pendingSeekTime;
  118441. this._pendingSeekTime = null;
  118442. } catch (e) {
  118443. }
  118444. }
  118445. };
  118446. FlvPlayer2.prototype.detachMediaElement = function() {
  118447. if (this._mediaElement) {
  118448. this._msectl.detachMediaElement();
  118449. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118450. this._mediaElement.removeEventListener("seeking", this.e.onvSeeking);
  118451. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118452. this._mediaElement.removeEventListener("stalled", this.e.onvStalled);
  118453. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118454. this._mediaElement = null;
  118455. }
  118456. if (this._msectl) {
  118457. this._msectl.destroy();
  118458. this._msectl = null;
  118459. }
  118460. };
  118461. FlvPlayer2.prototype.load = function() {
  118462. var _this = this;
  118463. if (!this._mediaElement) {
  118464. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118465. }
  118466. if (this._transmuxer) {
  118467. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");
  118468. }
  118469. if (this._hasPendingLoad) {
  118470. return;
  118471. }
  118472. if (this._config.deferLoadAfterSourceOpen && this._mseSourceOpened === false) {
  118473. this._hasPendingLoad = true;
  118474. return;
  118475. }
  118476. if (this._mediaElement.readyState > 0) {
  118477. this._requestSetTime = true;
  118478. this._mediaElement.currentTime = 0;
  118479. }
  118480. this._transmuxer = new _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(this._mediaDataSource, this._config);
  118481. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, function(type2, is) {
  118482. _this._msectl.appendInitSegment(is);
  118483. });
  118484. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, function(type2, ms) {
  118485. _this._msectl.appendMediaSegment(ms);
  118486. if (_this._config.lazyLoad && !_this._config.isLive) {
  118487. var currentTime = _this._mediaElement.currentTime;
  118488. if (ms.info.endDts >= (currentTime + _this._config.lazyLoadMaxDuration) * 1e3) {
  118489. if (_this._progressChecker == null) {
  118490. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(_this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118491. _this._suspendTransmuxer();
  118492. }
  118493. }
  118494. }
  118495. });
  118496. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, function() {
  118497. _this._msectl.endOfStream();
  118498. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE);
  118499. });
  118500. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, function() {
  118501. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF);
  118502. });
  118503. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, function(detail, info) {
  118504. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.NETWORK_ERROR, detail, info);
  118505. });
  118506. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, function(detail, info) {
  118507. _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 });
  118508. });
  118509. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, function(mediaInfo) {
  118510. _this._mediaInfo = mediaInfo;
  118511. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, Object.assign({}, mediaInfo));
  118512. });
  118513. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, function(metadata) {
  118514. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, metadata);
  118515. });
  118516. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, function(data) {
  118517. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, data);
  118518. });
  118519. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, function(statInfo) {
  118520. _this._statisticsInfo = _this._fillStatisticsInfo(statInfo);
  118521. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, Object.assign({}, _this._statisticsInfo));
  118522. });
  118523. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, function(milliseconds) {
  118524. if (_this._mediaElement && !_this._config.accurateSeek) {
  118525. _this._requestSetTime = true;
  118526. _this._mediaElement.currentTime = milliseconds / 1e3;
  118527. }
  118528. });
  118529. this._transmuxer.open();
  118530. };
  118531. FlvPlayer2.prototype.unload = function() {
  118532. if (this._mediaElement) {
  118533. this._mediaElement.pause();
  118534. }
  118535. if (this._msectl) {
  118536. this._msectl.seek(0);
  118537. }
  118538. if (this._transmuxer) {
  118539. this._transmuxer.close();
  118540. this._transmuxer.destroy();
  118541. this._transmuxer = null;
  118542. }
  118543. };
  118544. FlvPlayer2.prototype.play = function() {
  118545. return this._mediaElement.play();
  118546. };
  118547. FlvPlayer2.prototype.pause = function() {
  118548. this._mediaElement.pause();
  118549. };
  118550. Object.defineProperty(FlvPlayer2.prototype, "type", {
  118551. get: function() {
  118552. return this._type;
  118553. },
  118554. enumerable: false,
  118555. configurable: true
  118556. });
  118557. Object.defineProperty(FlvPlayer2.prototype, "buffered", {
  118558. get: function() {
  118559. return this._mediaElement.buffered;
  118560. },
  118561. enumerable: false,
  118562. configurable: true
  118563. });
  118564. Object.defineProperty(FlvPlayer2.prototype, "duration", {
  118565. get: function() {
  118566. return this._mediaElement.duration;
  118567. },
  118568. enumerable: false,
  118569. configurable: true
  118570. });
  118571. Object.defineProperty(FlvPlayer2.prototype, "volume", {
  118572. get: function() {
  118573. return this._mediaElement.volume;
  118574. },
  118575. set: function(value) {
  118576. this._mediaElement.volume = value;
  118577. },
  118578. enumerable: false,
  118579. configurable: true
  118580. });
  118581. Object.defineProperty(FlvPlayer2.prototype, "muted", {
  118582. get: function() {
  118583. return this._mediaElement.muted;
  118584. },
  118585. set: function(muted) {
  118586. this._mediaElement.muted = muted;
  118587. },
  118588. enumerable: false,
  118589. configurable: true
  118590. });
  118591. Object.defineProperty(FlvPlayer2.prototype, "currentTime", {
  118592. get: function() {
  118593. if (this._mediaElement) {
  118594. return this._mediaElement.currentTime;
  118595. }
  118596. return 0;
  118597. },
  118598. set: function(seconds) {
  118599. if (this._mediaElement) {
  118600. this._internalSeek(seconds);
  118601. } else {
  118602. this._pendingSeekTime = seconds;
  118603. }
  118604. },
  118605. enumerable: false,
  118606. configurable: true
  118607. });
  118608. Object.defineProperty(FlvPlayer2.prototype, "mediaInfo", {
  118609. get: function() {
  118610. return Object.assign({}, this._mediaInfo);
  118611. },
  118612. enumerable: false,
  118613. configurable: true
  118614. });
  118615. Object.defineProperty(FlvPlayer2.prototype, "statisticsInfo", {
  118616. get: function() {
  118617. if (this._statisticsInfo == null) {
  118618. this._statisticsInfo = {};
  118619. }
  118620. this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo);
  118621. return Object.assign({}, this._statisticsInfo);
  118622. },
  118623. enumerable: false,
  118624. configurable: true
  118625. });
  118626. FlvPlayer2.prototype._fillStatisticsInfo = function(statInfo) {
  118627. statInfo.playerType = this._type;
  118628. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  118629. return statInfo;
  118630. }
  118631. var hasQualityInfo = true;
  118632. var decoded = 0;
  118633. var dropped = 0;
  118634. if (this._mediaElement.getVideoPlaybackQuality) {
  118635. var quality = this._mediaElement.getVideoPlaybackQuality();
  118636. decoded = quality.totalVideoFrames;
  118637. dropped = quality.droppedVideoFrames;
  118638. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  118639. decoded = this._mediaElement.webkitDecodedFrameCount;
  118640. dropped = this._mediaElement.webkitDroppedFrameCount;
  118641. } else {
  118642. hasQualityInfo = false;
  118643. }
  118644. if (hasQualityInfo) {
  118645. statInfo.decodedFrames = decoded;
  118646. statInfo.droppedFrames = dropped;
  118647. }
  118648. return statInfo;
  118649. };
  118650. FlvPlayer2.prototype._onmseUpdateEnd = function() {
  118651. if (!this._config.lazyLoad || this._config.isLive) {
  118652. return;
  118653. }
  118654. var buffered = this._mediaElement.buffered;
  118655. var currentTime = this._mediaElement.currentTime;
  118656. var currentRangeEnd = 0;
  118657. for (var i2 = 0; i2 < buffered.length; i2++) {
  118658. var start2 = buffered.start(i2);
  118659. var end = buffered.end(i2);
  118660. if (start2 <= currentTime && currentTime < end) {
  118661. currentRangeEnd = end;
  118662. break;
  118663. }
  118664. }
  118665. if (currentRangeEnd >= currentTime + this._config.lazyLoadMaxDuration && this._progressChecker == null) {
  118666. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118667. this._suspendTransmuxer();
  118668. }
  118669. };
  118670. FlvPlayer2.prototype._onmseBufferFull = function() {
  118671. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task");
  118672. if (this._progressChecker == null) {
  118673. this._suspendTransmuxer();
  118674. }
  118675. };
  118676. FlvPlayer2.prototype._suspendTransmuxer = function() {
  118677. if (this._transmuxer) {
  118678. this._transmuxer.pause();
  118679. if (this._progressChecker == null) {
  118680. this._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3);
  118681. }
  118682. }
  118683. };
  118684. FlvPlayer2.prototype._checkProgressAndResume = function() {
  118685. var currentTime = this._mediaElement.currentTime;
  118686. var buffered = this._mediaElement.buffered;
  118687. var needResume = false;
  118688. for (var i2 = 0; i2 < buffered.length; i2++) {
  118689. var from3 = buffered.start(i2);
  118690. var to = buffered.end(i2);
  118691. if (currentTime >= from3 && currentTime < to) {
  118692. if (currentTime >= to - this._config.lazyLoadRecoverDuration) {
  118693. needResume = true;
  118694. }
  118695. break;
  118696. }
  118697. }
  118698. if (needResume) {
  118699. window.clearInterval(this._progressChecker);
  118700. this._progressChecker = null;
  118701. if (needResume) {
  118702. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Continue loading from paused position");
  118703. this._transmuxer.resume();
  118704. }
  118705. }
  118706. };
  118707. FlvPlayer2.prototype._isTimepointBuffered = function(seconds) {
  118708. var buffered = this._mediaElement.buffered;
  118709. for (var i2 = 0; i2 < buffered.length; i2++) {
  118710. var from3 = buffered.start(i2);
  118711. var to = buffered.end(i2);
  118712. if (seconds >= from3 && seconds < to) {
  118713. return true;
  118714. }
  118715. }
  118716. return false;
  118717. };
  118718. FlvPlayer2.prototype._internalSeek = function(seconds) {
  118719. var directSeek = this._isTimepointBuffered(seconds);
  118720. var directSeekBegin = false;
  118721. var directSeekBeginTime = 0;
  118722. if (seconds < 1 && this._mediaElement.buffered.length > 0) {
  118723. var videoBeginTime = this._mediaElement.buffered.start(0);
  118724. if (videoBeginTime < 1 && seconds < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118725. directSeekBegin = true;
  118726. directSeekBeginTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118727. }
  118728. }
  118729. if (directSeekBegin) {
  118730. this._requestSetTime = true;
  118731. this._mediaElement.currentTime = directSeekBeginTime;
  118732. } else if (directSeek) {
  118733. if (!this._alwaysSeekKeyframe) {
  118734. this._requestSetTime = true;
  118735. this._mediaElement.currentTime = seconds;
  118736. } else {
  118737. var idr = this._msectl.getNearestKeyframe(Math.floor(seconds * 1e3));
  118738. this._requestSetTime = true;
  118739. if (idr != null) {
  118740. this._mediaElement.currentTime = idr.dts / 1e3;
  118741. } else {
  118742. this._mediaElement.currentTime = seconds;
  118743. }
  118744. }
  118745. if (this._progressChecker != null) {
  118746. this._checkProgressAndResume();
  118747. }
  118748. } else {
  118749. if (this._progressChecker != null) {
  118750. window.clearInterval(this._progressChecker);
  118751. this._progressChecker = null;
  118752. }
  118753. this._msectl.seek(seconds);
  118754. this._transmuxer.seek(Math.floor(seconds * 1e3));
  118755. if (this._config.accurateSeek) {
  118756. this._requestSetTime = true;
  118757. this._mediaElement.currentTime = seconds;
  118758. }
  118759. }
  118760. };
  118761. FlvPlayer2.prototype._checkAndApplyUnbufferedSeekpoint = function() {
  118762. if (this._seekpointRecord) {
  118763. if (this._seekpointRecord.recordTime <= this._now() - 100) {
  118764. var target = this._mediaElement.currentTime;
  118765. this._seekpointRecord = null;
  118766. if (!this._isTimepointBuffered(target)) {
  118767. if (this._progressChecker != null) {
  118768. window.clearTimeout(this._progressChecker);
  118769. this._progressChecker = null;
  118770. }
  118771. this._msectl.seek(target);
  118772. this._transmuxer.seek(Math.floor(target * 1e3));
  118773. if (this._config.accurateSeek) {
  118774. this._requestSetTime = true;
  118775. this._mediaElement.currentTime = target;
  118776. }
  118777. }
  118778. } else {
  118779. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118780. }
  118781. }
  118782. };
  118783. FlvPlayer2.prototype._checkAndResumeStuckPlayback = function(stalled) {
  118784. var media = this._mediaElement;
  118785. if (stalled || !this._receivedCanPlay || media.readyState < 2) {
  118786. var buffered = media.buffered;
  118787. if (buffered.length > 0 && media.currentTime < buffered.start(0)) {
  118788. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.w(this.TAG, "Playback seems stuck at " + media.currentTime + ", seek to " + buffered.start(0));
  118789. this._requestSetTime = true;
  118790. this._mediaElement.currentTime = buffered.start(0);
  118791. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118792. }
  118793. } else {
  118794. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118795. }
  118796. };
  118797. FlvPlayer2.prototype._onvLoadedMetadata = function(e) {
  118798. if (this._pendingSeekTime != null) {
  118799. this._mediaElement.currentTime = this._pendingSeekTime;
  118800. this._pendingSeekTime = null;
  118801. }
  118802. };
  118803. FlvPlayer2.prototype._onvSeeking = function(e) {
  118804. var target = this._mediaElement.currentTime;
  118805. var buffered = this._mediaElement.buffered;
  118806. if (this._requestSetTime) {
  118807. this._requestSetTime = false;
  118808. return;
  118809. }
  118810. if (target < 1 && buffered.length > 0) {
  118811. var videoBeginTime = buffered.start(0);
  118812. if (videoBeginTime < 1 && target < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118813. this._requestSetTime = true;
  118814. this._mediaElement.currentTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118815. return;
  118816. }
  118817. }
  118818. if (this._isTimepointBuffered(target)) {
  118819. if (this._alwaysSeekKeyframe) {
  118820. var idr = this._msectl.getNearestKeyframe(Math.floor(target * 1e3));
  118821. if (idr != null) {
  118822. this._requestSetTime = true;
  118823. this._mediaElement.currentTime = idr.dts / 1e3;
  118824. }
  118825. }
  118826. if (this._progressChecker != null) {
  118827. this._checkProgressAndResume();
  118828. }
  118829. return;
  118830. }
  118831. this._seekpointRecord = {
  118832. seekPoint: target,
  118833. recordTime: this._now()
  118834. };
  118835. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118836. };
  118837. FlvPlayer2.prototype._onvCanPlay = function(e) {
  118838. this._receivedCanPlay = true;
  118839. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118840. };
  118841. FlvPlayer2.prototype._onvStalled = function(e) {
  118842. this._checkAndResumeStuckPlayback(true);
  118843. };
  118844. FlvPlayer2.prototype._onvProgress = function(e) {
  118845. this._checkAndResumeStuckPlayback();
  118846. };
  118847. return FlvPlayer2;
  118848. }();
  118849. __webpack_exports__2["default"] = FlvPlayer;
  118850. },
  118851. "./src/player/native-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118852. __webpack_require__2.r(__webpack_exports__2);
  118853. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118854. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118855. var _player_events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/player/player-events.js");
  118856. var _config_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/config.js");
  118857. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  118858. var NativePlayer = function() {
  118859. function NativePlayer2(mediaDataSource, config) {
  118860. this.TAG = "NativePlayer";
  118861. this._type = "NativePlayer";
  118862. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118863. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_2__.createDefaultConfig)();
  118864. if (typeof config === "object") {
  118865. Object.assign(this._config, config);
  118866. }
  118867. if (mediaDataSource.type.toLowerCase() === "flv") {
  118868. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");
  118869. }
  118870. if (mediaDataSource.hasOwnProperty("segments")) {
  118871. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer(" + mediaDataSource.type + ") doesn't support multipart playback!");
  118872. }
  118873. this.e = {
  118874. onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
  118875. };
  118876. this._pendingSeekTime = null;
  118877. this._statisticsReporter = null;
  118878. this._mediaDataSource = mediaDataSource;
  118879. this._mediaElement = null;
  118880. }
  118881. NativePlayer2.prototype.destroy = function() {
  118882. if (this._mediaElement) {
  118883. this.unload();
  118884. this.detachMediaElement();
  118885. }
  118886. this.e = null;
  118887. this._mediaDataSource = null;
  118888. this._emitter.removeAllListeners();
  118889. this._emitter = null;
  118890. };
  118891. NativePlayer2.prototype.on = function(event2, listener) {
  118892. var _this = this;
  118893. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO) {
  118894. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118895. Promise.resolve().then(function() {
  118896. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, _this.mediaInfo);
  118897. });
  118898. }
  118899. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO) {
  118900. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118901. Promise.resolve().then(function() {
  118902. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, _this.statisticsInfo);
  118903. });
  118904. }
  118905. }
  118906. this._emitter.addListener(event2, listener);
  118907. };
  118908. NativePlayer2.prototype.off = function(event2, listener) {
  118909. this._emitter.removeListener(event2, listener);
  118910. };
  118911. NativePlayer2.prototype.attachMediaElement = function(mediaElement) {
  118912. this._mediaElement = mediaElement;
  118913. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118914. if (this._pendingSeekTime != null) {
  118915. try {
  118916. mediaElement.currentTime = this._pendingSeekTime;
  118917. this._pendingSeekTime = null;
  118918. } catch (e) {
  118919. }
  118920. }
  118921. };
  118922. NativePlayer2.prototype.detachMediaElement = function() {
  118923. if (this._mediaElement) {
  118924. this._mediaElement.src = "";
  118925. this._mediaElement.removeAttribute("src");
  118926. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118927. this._mediaElement = null;
  118928. }
  118929. if (this._statisticsReporter != null) {
  118930. window.clearInterval(this._statisticsReporter);
  118931. this._statisticsReporter = null;
  118932. }
  118933. };
  118934. NativePlayer2.prototype.load = function() {
  118935. if (!this._mediaElement) {
  118936. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118937. }
  118938. this._mediaElement.src = this._mediaDataSource.url;
  118939. if (this._mediaElement.readyState > 0) {
  118940. this._mediaElement.currentTime = 0;
  118941. }
  118942. this._mediaElement.preload = "auto";
  118943. this._mediaElement.load();
  118944. this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  118945. };
  118946. NativePlayer2.prototype.unload = function() {
  118947. if (this._mediaElement) {
  118948. this._mediaElement.src = "";
  118949. this._mediaElement.removeAttribute("src");
  118950. }
  118951. if (this._statisticsReporter != null) {
  118952. window.clearInterval(this._statisticsReporter);
  118953. this._statisticsReporter = null;
  118954. }
  118955. };
  118956. NativePlayer2.prototype.play = function() {
  118957. return this._mediaElement.play();
  118958. };
  118959. NativePlayer2.prototype.pause = function() {
  118960. this._mediaElement.pause();
  118961. };
  118962. Object.defineProperty(NativePlayer2.prototype, "type", {
  118963. get: function() {
  118964. return this._type;
  118965. },
  118966. enumerable: false,
  118967. configurable: true
  118968. });
  118969. Object.defineProperty(NativePlayer2.prototype, "buffered", {
  118970. get: function() {
  118971. return this._mediaElement.buffered;
  118972. },
  118973. enumerable: false,
  118974. configurable: true
  118975. });
  118976. Object.defineProperty(NativePlayer2.prototype, "duration", {
  118977. get: function() {
  118978. return this._mediaElement.duration;
  118979. },
  118980. enumerable: false,
  118981. configurable: true
  118982. });
  118983. Object.defineProperty(NativePlayer2.prototype, "volume", {
  118984. get: function() {
  118985. return this._mediaElement.volume;
  118986. },
  118987. set: function(value) {
  118988. this._mediaElement.volume = value;
  118989. },
  118990. enumerable: false,
  118991. configurable: true
  118992. });
  118993. Object.defineProperty(NativePlayer2.prototype, "muted", {
  118994. get: function() {
  118995. return this._mediaElement.muted;
  118996. },
  118997. set: function(muted) {
  118998. this._mediaElement.muted = muted;
  118999. },
  119000. enumerable: false,
  119001. configurable: true
  119002. });
  119003. Object.defineProperty(NativePlayer2.prototype, "currentTime", {
  119004. get: function() {
  119005. if (this._mediaElement) {
  119006. return this._mediaElement.currentTime;
  119007. }
  119008. return 0;
  119009. },
  119010. set: function(seconds) {
  119011. if (this._mediaElement) {
  119012. this._mediaElement.currentTime = seconds;
  119013. } else {
  119014. this._pendingSeekTime = seconds;
  119015. }
  119016. },
  119017. enumerable: false,
  119018. configurable: true
  119019. });
  119020. Object.defineProperty(NativePlayer2.prototype, "mediaInfo", {
  119021. get: function() {
  119022. var mediaPrefix = this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/";
  119023. var info = {
  119024. mimeType: mediaPrefix + this._mediaDataSource.type
  119025. };
  119026. if (this._mediaElement) {
  119027. info.duration = Math.floor(this._mediaElement.duration * 1e3);
  119028. if (this._mediaElement instanceof HTMLVideoElement) {
  119029. info.width = this._mediaElement.videoWidth;
  119030. info.height = this._mediaElement.videoHeight;
  119031. }
  119032. }
  119033. return info;
  119034. },
  119035. enumerable: false,
  119036. configurable: true
  119037. });
  119038. Object.defineProperty(NativePlayer2.prototype, "statisticsInfo", {
  119039. get: function() {
  119040. var info = {
  119041. playerType: this._type,
  119042. url: this._mediaDataSource.url
  119043. };
  119044. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  119045. return info;
  119046. }
  119047. var hasQualityInfo = true;
  119048. var decoded = 0;
  119049. var dropped = 0;
  119050. if (this._mediaElement.getVideoPlaybackQuality) {
  119051. var quality = this._mediaElement.getVideoPlaybackQuality();
  119052. decoded = quality.totalVideoFrames;
  119053. dropped = quality.droppedVideoFrames;
  119054. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  119055. decoded = this._mediaElement.webkitDecodedFrameCount;
  119056. dropped = this._mediaElement.webkitDroppedFrameCount;
  119057. } else {
  119058. hasQualityInfo = false;
  119059. }
  119060. if (hasQualityInfo) {
  119061. info.decodedFrames = decoded;
  119062. info.droppedFrames = dropped;
  119063. }
  119064. return info;
  119065. },
  119066. enumerable: false,
  119067. configurable: true
  119068. });
  119069. NativePlayer2.prototype._onvLoadedMetadata = function(e) {
  119070. if (this._pendingSeekTime != null) {
  119071. this._mediaElement.currentTime = this._pendingSeekTime;
  119072. this._pendingSeekTime = null;
  119073. }
  119074. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, this.mediaInfo);
  119075. };
  119076. NativePlayer2.prototype._reportStatisticsInfo = function() {
  119077. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, this.statisticsInfo);
  119078. };
  119079. return NativePlayer2;
  119080. }();
  119081. __webpack_exports__2["default"] = NativePlayer;
  119082. },
  119083. "./src/player/player-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119084. __webpack_require__2.r(__webpack_exports__2);
  119085. __webpack_require__2.d(__webpack_exports__2, {
  119086. "ErrorTypes": function() {
  119087. return ErrorTypes;
  119088. },
  119089. "ErrorDetails": function() {
  119090. return ErrorDetails;
  119091. }
  119092. });
  119093. var _io_loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  119094. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/demux-errors.js");
  119095. var ErrorTypes = {
  119096. NETWORK_ERROR: "NetworkError",
  119097. MEDIA_ERROR: "MediaError",
  119098. OTHER_ERROR: "OtherError"
  119099. };
  119100. var ErrorDetails = {
  119101. NETWORK_EXCEPTION: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION,
  119102. NETWORK_STATUS_CODE_INVALID: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.HTTP_STATUS_CODE_INVALID,
  119103. NETWORK_TIMEOUT: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.CONNECTING_TIMEOUT,
  119104. NETWORK_UNRECOVERABLE_EARLY_EOF: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.UNRECOVERABLE_EARLY_EOF,
  119105. MEDIA_MSE_ERROR: "MediaMSEError",
  119106. MEDIA_FORMAT_ERROR: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_ERROR,
  119107. MEDIA_FORMAT_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_UNSUPPORTED,
  119108. MEDIA_CODEC_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.CODEC_UNSUPPORTED
  119109. };
  119110. },
  119111. "./src/player/player-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119112. __webpack_require__2.r(__webpack_exports__2);
  119113. var PlayerEvents = {
  119114. ERROR: "error",
  119115. LOADING_COMPLETE: "loading_complete",
  119116. RECOVERED_EARLY_EOF: "recovered_early_eof",
  119117. MEDIA_INFO: "media_info",
  119118. METADATA_ARRIVED: "metadata_arrived",
  119119. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  119120. STATISTICS_INFO: "statistics_info"
  119121. };
  119122. __webpack_exports__2["default"] = PlayerEvents;
  119123. },
  119124. "./src/remux/aac-silent.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119125. __webpack_require__2.r(__webpack_exports__2);
  119126. var AAC = function() {
  119127. function AAC2() {
  119128. }
  119129. AAC2.getSilentFrame = function(codec, channelCount) {
  119130. if (codec === "mp4a.40.2") {
  119131. if (channelCount === 1) {
  119132. return new Uint8Array([0, 200, 0, 128, 35, 128]);
  119133. } else if (channelCount === 2) {
  119134. return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
  119135. } else if (channelCount === 3) {
  119136. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
  119137. } else if (channelCount === 4) {
  119138. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
  119139. } else if (channelCount === 5) {
  119140. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
  119141. } else if (channelCount === 6) {
  119142. 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]);
  119143. }
  119144. } else {
  119145. if (channelCount === 1) {
  119146. 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]);
  119147. } else if (channelCount === 2) {
  119148. 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]);
  119149. } else if (channelCount === 3) {
  119150. 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]);
  119151. }
  119152. }
  119153. return null;
  119154. };
  119155. return AAC2;
  119156. }();
  119157. __webpack_exports__2["default"] = AAC;
  119158. },
  119159. "./src/remux/mp4-generator.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119160. __webpack_require__2.r(__webpack_exports__2);
  119161. var MP4 = function() {
  119162. function MP42() {
  119163. }
  119164. MP42.init = function() {
  119165. MP42.types = {
  119166. avc1: [],
  119167. avcC: [],
  119168. btrt: [],
  119169. dinf: [],
  119170. dref: [],
  119171. esds: [],
  119172. ftyp: [],
  119173. hdlr: [],
  119174. mdat: [],
  119175. mdhd: [],
  119176. mdia: [],
  119177. mfhd: [],
  119178. minf: [],
  119179. moof: [],
  119180. moov: [],
  119181. mp4a: [],
  119182. mvex: [],
  119183. mvhd: [],
  119184. sdtp: [],
  119185. stbl: [],
  119186. stco: [],
  119187. stsc: [],
  119188. stsd: [],
  119189. stsz: [],
  119190. stts: [],
  119191. tfdt: [],
  119192. tfhd: [],
  119193. traf: [],
  119194. trak: [],
  119195. trun: [],
  119196. trex: [],
  119197. tkhd: [],
  119198. vmhd: [],
  119199. smhd: [],
  119200. ".mp3": []
  119201. };
  119202. for (var name_1 in MP42.types) {
  119203. if (MP42.types.hasOwnProperty(name_1)) {
  119204. MP42.types[name_1] = [
  119205. name_1.charCodeAt(0),
  119206. name_1.charCodeAt(1),
  119207. name_1.charCodeAt(2),
  119208. name_1.charCodeAt(3)
  119209. ];
  119210. }
  119211. }
  119212. var constants = MP42.constants = {};
  119213. constants.FTYP = new Uint8Array([
  119214. 105,
  119215. 115,
  119216. 111,
  119217. 109,
  119218. 0,
  119219. 0,
  119220. 0,
  119221. 1,
  119222. 105,
  119223. 115,
  119224. 111,
  119225. 109,
  119226. 97,
  119227. 118,
  119228. 99,
  119229. 49
  119230. ]);
  119231. constants.STSD_PREFIX = new Uint8Array([
  119232. 0,
  119233. 0,
  119234. 0,
  119235. 0,
  119236. 0,
  119237. 0,
  119238. 0,
  119239. 1
  119240. ]);
  119241. constants.STTS = new Uint8Array([
  119242. 0,
  119243. 0,
  119244. 0,
  119245. 0,
  119246. 0,
  119247. 0,
  119248. 0,
  119249. 0
  119250. ]);
  119251. constants.STSC = constants.STCO = constants.STTS;
  119252. constants.STSZ = new Uint8Array([
  119253. 0,
  119254. 0,
  119255. 0,
  119256. 0,
  119257. 0,
  119258. 0,
  119259. 0,
  119260. 0,
  119261. 0,
  119262. 0,
  119263. 0,
  119264. 0
  119265. ]);
  119266. constants.HDLR_VIDEO = new Uint8Array([
  119267. 0,
  119268. 0,
  119269. 0,
  119270. 0,
  119271. 0,
  119272. 0,
  119273. 0,
  119274. 0,
  119275. 118,
  119276. 105,
  119277. 100,
  119278. 101,
  119279. 0,
  119280. 0,
  119281. 0,
  119282. 0,
  119283. 0,
  119284. 0,
  119285. 0,
  119286. 0,
  119287. 0,
  119288. 0,
  119289. 0,
  119290. 0,
  119291. 86,
  119292. 105,
  119293. 100,
  119294. 101,
  119295. 111,
  119296. 72,
  119297. 97,
  119298. 110,
  119299. 100,
  119300. 108,
  119301. 101,
  119302. 114,
  119303. 0
  119304. ]);
  119305. constants.HDLR_AUDIO = new Uint8Array([
  119306. 0,
  119307. 0,
  119308. 0,
  119309. 0,
  119310. 0,
  119311. 0,
  119312. 0,
  119313. 0,
  119314. 115,
  119315. 111,
  119316. 117,
  119317. 110,
  119318. 0,
  119319. 0,
  119320. 0,
  119321. 0,
  119322. 0,
  119323. 0,
  119324. 0,
  119325. 0,
  119326. 0,
  119327. 0,
  119328. 0,
  119329. 0,
  119330. 83,
  119331. 111,
  119332. 117,
  119333. 110,
  119334. 100,
  119335. 72,
  119336. 97,
  119337. 110,
  119338. 100,
  119339. 108,
  119340. 101,
  119341. 114,
  119342. 0
  119343. ]);
  119344. constants.DREF = new Uint8Array([
  119345. 0,
  119346. 0,
  119347. 0,
  119348. 0,
  119349. 0,
  119350. 0,
  119351. 0,
  119352. 1,
  119353. 0,
  119354. 0,
  119355. 0,
  119356. 12,
  119357. 117,
  119358. 114,
  119359. 108,
  119360. 32,
  119361. 0,
  119362. 0,
  119363. 0,
  119364. 1
  119365. ]);
  119366. constants.SMHD = new Uint8Array([
  119367. 0,
  119368. 0,
  119369. 0,
  119370. 0,
  119371. 0,
  119372. 0,
  119373. 0,
  119374. 0
  119375. ]);
  119376. constants.VMHD = new Uint8Array([
  119377. 0,
  119378. 0,
  119379. 0,
  119380. 1,
  119381. 0,
  119382. 0,
  119383. 0,
  119384. 0,
  119385. 0,
  119386. 0,
  119387. 0,
  119388. 0
  119389. ]);
  119390. };
  119391. MP42.box = function(type2) {
  119392. var size = 8;
  119393. var result = null;
  119394. var datas = Array.prototype.slice.call(arguments, 1);
  119395. var arrayCount = datas.length;
  119396. for (var i2 = 0; i2 < arrayCount; i2++) {
  119397. size += datas[i2].byteLength;
  119398. }
  119399. result = new Uint8Array(size);
  119400. result[0] = size >>> 24 & 255;
  119401. result[1] = size >>> 16 & 255;
  119402. result[2] = size >>> 8 & 255;
  119403. result[3] = size & 255;
  119404. result.set(type2, 4);
  119405. var offset = 8;
  119406. for (var i2 = 0; i2 < arrayCount; i2++) {
  119407. result.set(datas[i2], offset);
  119408. offset += datas[i2].byteLength;
  119409. }
  119410. return result;
  119411. };
  119412. MP42.generateInitSegment = function(meta2) {
  119413. var ftyp = MP42.box(MP42.types.ftyp, MP42.constants.FTYP);
  119414. var moov = MP42.moov(meta2);
  119415. var result = new Uint8Array(ftyp.byteLength + moov.byteLength);
  119416. result.set(ftyp, 0);
  119417. result.set(moov, ftyp.byteLength);
  119418. return result;
  119419. };
  119420. MP42.moov = function(meta2) {
  119421. var mvhd = MP42.mvhd(meta2.timescale, meta2.duration);
  119422. var trak = MP42.trak(meta2);
  119423. var mvex = MP42.mvex(meta2);
  119424. return MP42.box(MP42.types.moov, mvhd, trak, mvex);
  119425. };
  119426. MP42.mvhd = function(timescale2, duration5) {
  119427. return MP42.box(MP42.types.mvhd, new Uint8Array([
  119428. 0,
  119429. 0,
  119430. 0,
  119431. 0,
  119432. 0,
  119433. 0,
  119434. 0,
  119435. 0,
  119436. 0,
  119437. 0,
  119438. 0,
  119439. 0,
  119440. timescale2 >>> 24 & 255,
  119441. timescale2 >>> 16 & 255,
  119442. timescale2 >>> 8 & 255,
  119443. timescale2 & 255,
  119444. duration5 >>> 24 & 255,
  119445. duration5 >>> 16 & 255,
  119446. duration5 >>> 8 & 255,
  119447. duration5 & 255,
  119448. 0,
  119449. 1,
  119450. 0,
  119451. 0,
  119452. 1,
  119453. 0,
  119454. 0,
  119455. 0,
  119456. 0,
  119457. 0,
  119458. 0,
  119459. 0,
  119460. 0,
  119461. 0,
  119462. 0,
  119463. 0,
  119464. 0,
  119465. 1,
  119466. 0,
  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. 1,
  119482. 0,
  119483. 0,
  119484. 0,
  119485. 0,
  119486. 0,
  119487. 0,
  119488. 0,
  119489. 0,
  119490. 0,
  119491. 0,
  119492. 0,
  119493. 0,
  119494. 0,
  119495. 0,
  119496. 64,
  119497. 0,
  119498. 0,
  119499. 0,
  119500. 0,
  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. 0,
  119516. 0,
  119517. 0,
  119518. 0,
  119519. 0,
  119520. 0,
  119521. 0,
  119522. 0,
  119523. 0,
  119524. 255,
  119525. 255,
  119526. 255,
  119527. 255
  119528. ]));
  119529. };
  119530. MP42.trak = function(meta2) {
  119531. return MP42.box(MP42.types.trak, MP42.tkhd(meta2), MP42.mdia(meta2));
  119532. };
  119533. MP42.tkhd = function(meta2) {
  119534. var trackId = meta2.id, duration5 = meta2.duration;
  119535. var width2 = meta2.presentWidth, height2 = meta2.presentHeight;
  119536. return MP42.box(MP42.types.tkhd, new Uint8Array([
  119537. 0,
  119538. 0,
  119539. 0,
  119540. 7,
  119541. 0,
  119542. 0,
  119543. 0,
  119544. 0,
  119545. 0,
  119546. 0,
  119547. 0,
  119548. 0,
  119549. trackId >>> 24 & 255,
  119550. trackId >>> 16 & 255,
  119551. trackId >>> 8 & 255,
  119552. trackId & 255,
  119553. 0,
  119554. 0,
  119555. 0,
  119556. 0,
  119557. duration5 >>> 24 & 255,
  119558. duration5 >>> 16 & 255,
  119559. duration5 >>> 8 & 255,
  119560. duration5 & 255,
  119561. 0,
  119562. 0,
  119563. 0,
  119564. 0,
  119565. 0,
  119566. 0,
  119567. 0,
  119568. 0,
  119569. 0,
  119570. 0,
  119571. 0,
  119572. 0,
  119573. 0,
  119574. 0,
  119575. 0,
  119576. 0,
  119577. 0,
  119578. 1,
  119579. 0,
  119580. 0,
  119581. 0,
  119582. 0,
  119583. 0,
  119584. 0,
  119585. 0,
  119586. 0,
  119587. 0,
  119588. 0,
  119589. 0,
  119590. 0,
  119591. 0,
  119592. 0,
  119593. 0,
  119594. 1,
  119595. 0,
  119596. 0,
  119597. 0,
  119598. 0,
  119599. 0,
  119600. 0,
  119601. 0,
  119602. 0,
  119603. 0,
  119604. 0,
  119605. 0,
  119606. 0,
  119607. 0,
  119608. 0,
  119609. 64,
  119610. 0,
  119611. 0,
  119612. 0,
  119613. width2 >>> 8 & 255,
  119614. width2 & 255,
  119615. 0,
  119616. 0,
  119617. height2 >>> 8 & 255,
  119618. height2 & 255,
  119619. 0,
  119620. 0
  119621. ]));
  119622. };
  119623. MP42.mdia = function(meta2) {
  119624. return MP42.box(MP42.types.mdia, MP42.mdhd(meta2), MP42.hdlr(meta2), MP42.minf(meta2));
  119625. };
  119626. MP42.mdhd = function(meta2) {
  119627. var timescale2 = meta2.timescale;
  119628. var duration5 = meta2.duration;
  119629. return MP42.box(MP42.types.mdhd, new Uint8Array([
  119630. 0,
  119631. 0,
  119632. 0,
  119633. 0,
  119634. 0,
  119635. 0,
  119636. 0,
  119637. 0,
  119638. 0,
  119639. 0,
  119640. 0,
  119641. 0,
  119642. timescale2 >>> 24 & 255,
  119643. timescale2 >>> 16 & 255,
  119644. timescale2 >>> 8 & 255,
  119645. timescale2 & 255,
  119646. duration5 >>> 24 & 255,
  119647. duration5 >>> 16 & 255,
  119648. duration5 >>> 8 & 255,
  119649. duration5 & 255,
  119650. 85,
  119651. 196,
  119652. 0,
  119653. 0
  119654. ]));
  119655. };
  119656. MP42.hdlr = function(meta2) {
  119657. var data = null;
  119658. if (meta2.type === "audio") {
  119659. data = MP42.constants.HDLR_AUDIO;
  119660. } else {
  119661. data = MP42.constants.HDLR_VIDEO;
  119662. }
  119663. return MP42.box(MP42.types.hdlr, data);
  119664. };
  119665. MP42.minf = function(meta2) {
  119666. var xmhd = null;
  119667. if (meta2.type === "audio") {
  119668. xmhd = MP42.box(MP42.types.smhd, MP42.constants.SMHD);
  119669. } else {
  119670. xmhd = MP42.box(MP42.types.vmhd, MP42.constants.VMHD);
  119671. }
  119672. return MP42.box(MP42.types.minf, xmhd, MP42.dinf(), MP42.stbl(meta2));
  119673. };
  119674. MP42.dinf = function() {
  119675. var result = MP42.box(MP42.types.dinf, MP42.box(MP42.types.dref, MP42.constants.DREF));
  119676. return result;
  119677. };
  119678. MP42.stbl = function(meta2) {
  119679. var result = MP42.box(
  119680. MP42.types.stbl,
  119681. MP42.stsd(meta2),
  119682. MP42.box(MP42.types.stts, MP42.constants.STTS),
  119683. MP42.box(MP42.types.stsc, MP42.constants.STSC),
  119684. MP42.box(MP42.types.stsz, MP42.constants.STSZ),
  119685. MP42.box(MP42.types.stco, MP42.constants.STCO)
  119686. );
  119687. return result;
  119688. };
  119689. MP42.stsd = function(meta2) {
  119690. if (meta2.type === "audio") {
  119691. if (meta2.codec === "mp3") {
  119692. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp3(meta2));
  119693. }
  119694. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp4a(meta2));
  119695. } else {
  119696. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.avc1(meta2));
  119697. }
  119698. };
  119699. MP42.mp3 = function(meta2) {
  119700. var channelCount = meta2.channelCount;
  119701. var sampleRate = meta2.audioSampleRate;
  119702. var data = new Uint8Array([
  119703. 0,
  119704. 0,
  119705. 0,
  119706. 0,
  119707. 0,
  119708. 0,
  119709. 0,
  119710. 1,
  119711. 0,
  119712. 0,
  119713. 0,
  119714. 0,
  119715. 0,
  119716. 0,
  119717. 0,
  119718. 0,
  119719. 0,
  119720. channelCount,
  119721. 0,
  119722. 16,
  119723. 0,
  119724. 0,
  119725. 0,
  119726. 0,
  119727. sampleRate >>> 8 & 255,
  119728. sampleRate & 255,
  119729. 0,
  119730. 0
  119731. ]);
  119732. return MP42.box(MP42.types[".mp3"], data);
  119733. };
  119734. MP42.mp4a = function(meta2) {
  119735. var channelCount = meta2.channelCount;
  119736. var sampleRate = meta2.audioSampleRate;
  119737. var data = new Uint8Array([
  119738. 0,
  119739. 0,
  119740. 0,
  119741. 0,
  119742. 0,
  119743. 0,
  119744. 0,
  119745. 1,
  119746. 0,
  119747. 0,
  119748. 0,
  119749. 0,
  119750. 0,
  119751. 0,
  119752. 0,
  119753. 0,
  119754. 0,
  119755. channelCount,
  119756. 0,
  119757. 16,
  119758. 0,
  119759. 0,
  119760. 0,
  119761. 0,
  119762. sampleRate >>> 8 & 255,
  119763. sampleRate & 255,
  119764. 0,
  119765. 0
  119766. ]);
  119767. return MP42.box(MP42.types.mp4a, data, MP42.esds(meta2));
  119768. };
  119769. MP42.esds = function(meta2) {
  119770. var config = meta2.config || [];
  119771. var configSize = config.length;
  119772. var data = new Uint8Array([
  119773. 0,
  119774. 0,
  119775. 0,
  119776. 0,
  119777. 3,
  119778. 23 + configSize,
  119779. 0,
  119780. 1,
  119781. 0,
  119782. 4,
  119783. 15 + configSize,
  119784. 64,
  119785. 21,
  119786. 0,
  119787. 0,
  119788. 0,
  119789. 0,
  119790. 0,
  119791. 0,
  119792. 0,
  119793. 0,
  119794. 0,
  119795. 0,
  119796. 0,
  119797. 5
  119798. ].concat([
  119799. configSize
  119800. ]).concat(config).concat([
  119801. 6,
  119802. 1,
  119803. 2
  119804. ]));
  119805. return MP42.box(MP42.types.esds, data);
  119806. };
  119807. MP42.avc1 = function(meta2) {
  119808. var avcc = meta2.avcc;
  119809. var width2 = meta2.codecWidth, height2 = meta2.codecHeight;
  119810. var data = new Uint8Array([
  119811. 0,
  119812. 0,
  119813. 0,
  119814. 0,
  119815. 0,
  119816. 0,
  119817. 0,
  119818. 1,
  119819. 0,
  119820. 0,
  119821. 0,
  119822. 0,
  119823. 0,
  119824. 0,
  119825. 0,
  119826. 0,
  119827. 0,
  119828. 0,
  119829. 0,
  119830. 0,
  119831. 0,
  119832. 0,
  119833. 0,
  119834. 0,
  119835. width2 >>> 8 & 255,
  119836. width2 & 255,
  119837. height2 >>> 8 & 255,
  119838. height2 & 255,
  119839. 0,
  119840. 72,
  119841. 0,
  119842. 0,
  119843. 0,
  119844. 72,
  119845. 0,
  119846. 0,
  119847. 0,
  119848. 0,
  119849. 0,
  119850. 0,
  119851. 0,
  119852. 1,
  119853. 10,
  119854. 120,
  119855. 113,
  119856. 113,
  119857. 47,
  119858. 102,
  119859. 108,
  119860. 118,
  119861. 46,
  119862. 106,
  119863. 115,
  119864. 0,
  119865. 0,
  119866. 0,
  119867. 0,
  119868. 0,
  119869. 0,
  119870. 0,
  119871. 0,
  119872. 0,
  119873. 0,
  119874. 0,
  119875. 0,
  119876. 0,
  119877. 0,
  119878. 0,
  119879. 0,
  119880. 0,
  119881. 0,
  119882. 0,
  119883. 0,
  119884. 0,
  119885. 0,
  119886. 24,
  119887. 255,
  119888. 255
  119889. ]);
  119890. return MP42.box(MP42.types.avc1, data, MP42.box(MP42.types.avcC, avcc));
  119891. };
  119892. MP42.mvex = function(meta2) {
  119893. return MP42.box(MP42.types.mvex, MP42.trex(meta2));
  119894. };
  119895. MP42.trex = function(meta2) {
  119896. var trackId = meta2.id;
  119897. var data = new Uint8Array([
  119898. 0,
  119899. 0,
  119900. 0,
  119901. 0,
  119902. trackId >>> 24 & 255,
  119903. trackId >>> 16 & 255,
  119904. trackId >>> 8 & 255,
  119905. trackId & 255,
  119906. 0,
  119907. 0,
  119908. 0,
  119909. 1,
  119910. 0,
  119911. 0,
  119912. 0,
  119913. 0,
  119914. 0,
  119915. 0,
  119916. 0,
  119917. 0,
  119918. 0,
  119919. 1,
  119920. 0,
  119921. 1
  119922. ]);
  119923. return MP42.box(MP42.types.trex, data);
  119924. };
  119925. MP42.moof = function(track, baseMediaDecodeTime) {
  119926. return MP42.box(MP42.types.moof, MP42.mfhd(track.sequenceNumber), MP42.traf(track, baseMediaDecodeTime));
  119927. };
  119928. MP42.mfhd = function(sequenceNumber) {
  119929. var data = new Uint8Array([
  119930. 0,
  119931. 0,
  119932. 0,
  119933. 0,
  119934. sequenceNumber >>> 24 & 255,
  119935. sequenceNumber >>> 16 & 255,
  119936. sequenceNumber >>> 8 & 255,
  119937. sequenceNumber & 255
  119938. ]);
  119939. return MP42.box(MP42.types.mfhd, data);
  119940. };
  119941. MP42.traf = function(track, baseMediaDecodeTime) {
  119942. var trackId = track.id;
  119943. var tfhd = MP42.box(MP42.types.tfhd, new Uint8Array([
  119944. 0,
  119945. 0,
  119946. 0,
  119947. 0,
  119948. trackId >>> 24 & 255,
  119949. trackId >>> 16 & 255,
  119950. trackId >>> 8 & 255,
  119951. trackId & 255
  119952. ]));
  119953. var tfdt = MP42.box(MP42.types.tfdt, new Uint8Array([
  119954. 0,
  119955. 0,
  119956. 0,
  119957. 0,
  119958. baseMediaDecodeTime >>> 24 & 255,
  119959. baseMediaDecodeTime >>> 16 & 255,
  119960. baseMediaDecodeTime >>> 8 & 255,
  119961. baseMediaDecodeTime & 255
  119962. ]));
  119963. var sdtp = MP42.sdtp(track);
  119964. var trun = MP42.trun(track, sdtp.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
  119965. return MP42.box(MP42.types.traf, tfhd, tfdt, trun, sdtp);
  119966. };
  119967. MP42.sdtp = function(track) {
  119968. var samples = track.samples || [];
  119969. var sampleCount = samples.length;
  119970. var data = new Uint8Array(4 + sampleCount);
  119971. for (var i2 = 0; i2 < sampleCount; i2++) {
  119972. var flags = samples[i2].flags;
  119973. data[i2 + 4] = flags.isLeading << 6 | flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  119974. }
  119975. return MP42.box(MP42.types.sdtp, data);
  119976. };
  119977. MP42.trun = function(track, offset) {
  119978. var samples = track.samples || [];
  119979. var sampleCount = samples.length;
  119980. var dataSize = 12 + 16 * sampleCount;
  119981. var data = new Uint8Array(dataSize);
  119982. offset += 8 + dataSize;
  119983. data.set([
  119984. 0,
  119985. 0,
  119986. 15,
  119987. 1,
  119988. sampleCount >>> 24 & 255,
  119989. sampleCount >>> 16 & 255,
  119990. sampleCount >>> 8 & 255,
  119991. sampleCount & 255,
  119992. offset >>> 24 & 255,
  119993. offset >>> 16 & 255,
  119994. offset >>> 8 & 255,
  119995. offset & 255
  119996. ], 0);
  119997. for (var i2 = 0; i2 < sampleCount; i2++) {
  119998. var duration5 = samples[i2].duration;
  119999. var size = samples[i2].size;
  120000. var flags = samples[i2].flags;
  120001. var cts = samples[i2].cts;
  120002. data.set([
  120003. duration5 >>> 24 & 255,
  120004. duration5 >>> 16 & 255,
  120005. duration5 >>> 8 & 255,
  120006. duration5 & 255,
  120007. size >>> 24 & 255,
  120008. size >>> 16 & 255,
  120009. size >>> 8 & 255,
  120010. size & 255,
  120011. flags.isLeading << 2 | flags.dependsOn,
  120012. flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.isNonSync,
  120013. 0,
  120014. 0,
  120015. cts >>> 24 & 255,
  120016. cts >>> 16 & 255,
  120017. cts >>> 8 & 255,
  120018. cts & 255
  120019. ], 12 + 16 * i2);
  120020. }
  120021. return MP42.box(MP42.types.trun, data);
  120022. };
  120023. MP42.mdat = function(data) {
  120024. return MP42.box(MP42.types.mdat, data);
  120025. };
  120026. return MP42;
  120027. }();
  120028. MP4.init();
  120029. __webpack_exports__2["default"] = MP4;
  120030. },
  120031. "./src/remux/mp4-remuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120032. __webpack_require__2.r(__webpack_exports__2);
  120033. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  120034. var _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/remux/mp4-generator.js");
  120035. var _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/remux/aac-silent.js");
  120036. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/browser.js");
  120037. var _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  120038. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  120039. var MP4Remuxer = function() {
  120040. function MP4Remuxer2(config) {
  120041. this.TAG = "MP4Remuxer";
  120042. this._config = config;
  120043. this._isLive = config.isLive === true ? true : false;
  120044. this._dtsBase = -1;
  120045. this._dtsBaseInited = false;
  120046. this._audioDtsBase = Infinity;
  120047. this._videoDtsBase = Infinity;
  120048. this._audioNextDts = void 0;
  120049. this._videoNextDts = void 0;
  120050. this._audioStashedLastSample = null;
  120051. this._videoStashedLastSample = null;
  120052. this._audioMeta = null;
  120053. this._videoMeta = null;
  120054. this._audioSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("audio");
  120055. this._videoSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("video");
  120056. this._onInitSegment = null;
  120057. this._onMediaSegment = null;
  120058. 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;
  120059. this._fillSilentAfterSeek = _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msie;
  120060. this._mp3UseMpegAudio = !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.firefox;
  120061. this._fillAudioTimestampGap = this._config.fixAudioTimestampGap;
  120062. }
  120063. MP4Remuxer2.prototype.destroy = function() {
  120064. this._dtsBase = -1;
  120065. this._dtsBaseInited = false;
  120066. this._audioMeta = null;
  120067. this._videoMeta = null;
  120068. this._audioSegmentInfoList.clear();
  120069. this._audioSegmentInfoList = null;
  120070. this._videoSegmentInfoList.clear();
  120071. this._videoSegmentInfoList = null;
  120072. this._onInitSegment = null;
  120073. this._onMediaSegment = null;
  120074. };
  120075. MP4Remuxer2.prototype.bindDataSource = function(producer) {
  120076. producer.onDataAvailable = this.remux.bind(this);
  120077. producer.onTrackMetadata = this._onTrackMetadataReceived.bind(this);
  120078. return this;
  120079. };
  120080. Object.defineProperty(MP4Remuxer2.prototype, "onInitSegment", {
  120081. get: function() {
  120082. return this._onInitSegment;
  120083. },
  120084. set: function(callback2) {
  120085. this._onInitSegment = callback2;
  120086. },
  120087. enumerable: false,
  120088. configurable: true
  120089. });
  120090. Object.defineProperty(MP4Remuxer2.prototype, "onMediaSegment", {
  120091. get: function() {
  120092. return this._onMediaSegment;
  120093. },
  120094. set: function(callback2) {
  120095. this._onMediaSegment = callback2;
  120096. },
  120097. enumerable: false,
  120098. configurable: true
  120099. });
  120100. MP4Remuxer2.prototype.insertDiscontinuity = function() {
  120101. this._audioNextDts = this._videoNextDts = void 0;
  120102. };
  120103. MP4Remuxer2.prototype.seek = function(originalDts) {
  120104. this._audioStashedLastSample = null;
  120105. this._videoStashedLastSample = null;
  120106. this._videoSegmentInfoList.clear();
  120107. this._audioSegmentInfoList.clear();
  120108. };
  120109. MP4Remuxer2.prototype.remux = function(audioTrack, videoTrack) {
  120110. if (!this._onMediaSegment) {
  120111. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");
  120112. }
  120113. if (!this._dtsBaseInited) {
  120114. this._calculateDtsBase(audioTrack, videoTrack);
  120115. }
  120116. this._remuxVideo(videoTrack);
  120117. this._remuxAudio(audioTrack);
  120118. };
  120119. MP4Remuxer2.prototype._onTrackMetadataReceived = function(type2, metadata) {
  120120. var metabox = null;
  120121. var container = "mp4";
  120122. var codec = metadata.codec;
  120123. if (type2 === "audio") {
  120124. this._audioMeta = metadata;
  120125. if (metadata.codec === "mp3" && this._mp3UseMpegAudio) {
  120126. container = "mpeg";
  120127. codec = "";
  120128. metabox = new Uint8Array();
  120129. } else {
  120130. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120131. }
  120132. } else if (type2 === "video") {
  120133. this._videoMeta = metadata;
  120134. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120135. } else {
  120136. return;
  120137. }
  120138. if (!this._onInitSegment) {
  120139. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");
  120140. }
  120141. this._onInitSegment(type2, {
  120142. type: type2,
  120143. data: metabox.buffer,
  120144. codec,
  120145. container: type2 + "/" + container,
  120146. mediaDuration: metadata.duration
  120147. });
  120148. };
  120149. MP4Remuxer2.prototype._calculateDtsBase = function(audioTrack, videoTrack) {
  120150. if (this._dtsBaseInited) {
  120151. return;
  120152. }
  120153. if (audioTrack.samples && audioTrack.samples.length) {
  120154. this._audioDtsBase = audioTrack.samples[0].dts;
  120155. }
  120156. if (videoTrack.samples && videoTrack.samples.length) {
  120157. this._videoDtsBase = videoTrack.samples[0].dts;
  120158. }
  120159. this._dtsBase = Math.min(this._audioDtsBase, this._videoDtsBase);
  120160. this._dtsBaseInited = true;
  120161. };
  120162. MP4Remuxer2.prototype.flushStashedSamples = function() {
  120163. var videoSample = this._videoStashedLastSample;
  120164. var audioSample = this._audioStashedLastSample;
  120165. var videoTrack = {
  120166. type: "video",
  120167. id: 1,
  120168. sequenceNumber: 0,
  120169. samples: [],
  120170. length: 0
  120171. };
  120172. if (videoSample != null) {
  120173. videoTrack.samples.push(videoSample);
  120174. videoTrack.length = videoSample.length;
  120175. }
  120176. var audioTrack = {
  120177. type: "audio",
  120178. id: 2,
  120179. sequenceNumber: 0,
  120180. samples: [],
  120181. length: 0
  120182. };
  120183. if (audioSample != null) {
  120184. audioTrack.samples.push(audioSample);
  120185. audioTrack.length = audioSample.length;
  120186. }
  120187. this._videoStashedLastSample = null;
  120188. this._audioStashedLastSample = null;
  120189. this._remuxVideo(videoTrack, true);
  120190. this._remuxAudio(audioTrack, true);
  120191. };
  120192. MP4Remuxer2.prototype._remuxAudio = function(audioTrack, force) {
  120193. if (this._audioMeta == null) {
  120194. return;
  120195. }
  120196. var track = audioTrack;
  120197. var samples = track.samples;
  120198. var dtsCorrection = void 0;
  120199. var firstDts = -1, lastDts = -1;
  120200. var refSampleDuration = this._audioMeta.refSampleDuration;
  120201. var mpegRawTrack = this._audioMeta.codec === "mp3" && this._mp3UseMpegAudio;
  120202. var firstSegmentAfterSeek = this._dtsBaseInited && this._audioNextDts === void 0;
  120203. var insertPrefixSilentFrame = false;
  120204. if (!samples || samples.length === 0) {
  120205. return;
  120206. }
  120207. if (samples.length === 1 && !force) {
  120208. return;
  120209. }
  120210. var offset = 0;
  120211. var mdatbox = null;
  120212. var mdatBytes = 0;
  120213. if (mpegRawTrack) {
  120214. offset = 0;
  120215. mdatBytes = track.length;
  120216. } else {
  120217. offset = 8;
  120218. mdatBytes = 8 + track.length;
  120219. }
  120220. var lastSample = null;
  120221. if (samples.length > 1) {
  120222. lastSample = samples.pop();
  120223. mdatBytes -= lastSample.length;
  120224. }
  120225. if (this._audioStashedLastSample != null) {
  120226. var sample = this._audioStashedLastSample;
  120227. this._audioStashedLastSample = null;
  120228. samples.unshift(sample);
  120229. mdatBytes += sample.length;
  120230. }
  120231. if (lastSample != null) {
  120232. this._audioStashedLastSample = lastSample;
  120233. }
  120234. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120235. if (this._audioNextDts) {
  120236. dtsCorrection = firstSampleOriginalDts - this._audioNextDts;
  120237. } else {
  120238. if (this._audioSegmentInfoList.isEmpty()) {
  120239. dtsCorrection = 0;
  120240. if (this._fillSilentAfterSeek && !this._videoSegmentInfoList.isEmpty()) {
  120241. if (this._audioMeta.originalCodec !== "mp3") {
  120242. insertPrefixSilentFrame = true;
  120243. }
  120244. }
  120245. } else {
  120246. var lastSample_1 = this._audioSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120247. if (lastSample_1 != null) {
  120248. var distance2 = firstSampleOriginalDts - (lastSample_1.originalDts + lastSample_1.duration);
  120249. if (distance2 <= 3) {
  120250. distance2 = 0;
  120251. }
  120252. var expectedDts = lastSample_1.dts + lastSample_1.duration + distance2;
  120253. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120254. } else {
  120255. dtsCorrection = 0;
  120256. }
  120257. }
  120258. }
  120259. if (insertPrefixSilentFrame) {
  120260. var firstSampleDts = firstSampleOriginalDts - dtsCorrection;
  120261. var videoSegment = this._videoSegmentInfoList.getLastSegmentBefore(firstSampleOriginalDts);
  120262. if (videoSegment != null && videoSegment.beginDts < firstSampleDts) {
  120263. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120264. if (silentUnit) {
  120265. var dts = videoSegment.beginDts;
  120266. var silentFrameDuration = firstSampleDts - videoSegment.beginDts;
  120267. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "InsertPrefixSilentAudio: dts: " + dts + ", duration: " + silentFrameDuration);
  120268. samples.unshift({ unit: silentUnit, dts, pts: dts });
  120269. mdatBytes += silentUnit.byteLength;
  120270. }
  120271. } else {
  120272. insertPrefixSilentFrame = false;
  120273. }
  120274. }
  120275. var mp4Samples = [];
  120276. for (var i2 = 0; i2 < samples.length; i2++) {
  120277. var sample = samples[i2];
  120278. var unit = sample.unit;
  120279. var originalDts = sample.dts - this._dtsBase;
  120280. var dts = originalDts;
  120281. var needFillSilentFrames = false;
  120282. var silentFrames = null;
  120283. var sampleDuration = 0;
  120284. if (originalDts < -1e-3) {
  120285. continue;
  120286. }
  120287. if (this._audioMeta.codec !== "mp3") {
  120288. var curRefDts = originalDts;
  120289. var maxAudioFramesDrift = 3;
  120290. if (this._audioNextDts) {
  120291. curRefDts = this._audioNextDts;
  120292. }
  120293. dtsCorrection = originalDts - curRefDts;
  120294. if (dtsCorrection <= -maxAudioFramesDrift * refSampleDuration) {
  120295. _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.");
  120296. continue;
  120297. } else if (dtsCorrection >= maxAudioFramesDrift * refSampleDuration && this._fillAudioTimestampGap && !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.safari) {
  120298. needFillSilentFrames = true;
  120299. var frameCount = Math.floor(dtsCorrection / refSampleDuration);
  120300. _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"));
  120301. dts = Math.floor(curRefDts);
  120302. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120303. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120304. if (silentUnit == null) {
  120305. _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"));
  120306. silentUnit = unit;
  120307. }
  120308. silentFrames = [];
  120309. for (var j = 0; j < frameCount; j++) {
  120310. curRefDts = curRefDts + refSampleDuration;
  120311. var intDts = Math.floor(curRefDts);
  120312. var intDuration = Math.floor(curRefDts + refSampleDuration) - intDts;
  120313. var frame = {
  120314. dts: intDts,
  120315. pts: intDts,
  120316. cts: 0,
  120317. unit: silentUnit,
  120318. size: silentUnit.byteLength,
  120319. duration: intDuration,
  120320. originalDts,
  120321. flags: {
  120322. isLeading: 0,
  120323. dependsOn: 1,
  120324. isDependedOn: 0,
  120325. hasRedundancy: 0
  120326. }
  120327. };
  120328. silentFrames.push(frame);
  120329. mdatBytes += frame.size;
  120330. }
  120331. this._audioNextDts = curRefDts + refSampleDuration;
  120332. } else {
  120333. dts = Math.floor(curRefDts);
  120334. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120335. this._audioNextDts = curRefDts + refSampleDuration;
  120336. }
  120337. } else {
  120338. dts = originalDts - dtsCorrection;
  120339. if (i2 !== samples.length - 1) {
  120340. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120341. sampleDuration = nextDts - dts;
  120342. } else {
  120343. if (lastSample != null) {
  120344. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120345. sampleDuration = nextDts - dts;
  120346. } else if (mp4Samples.length >= 1) {
  120347. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120348. } else {
  120349. sampleDuration = Math.floor(refSampleDuration);
  120350. }
  120351. }
  120352. this._audioNextDts = dts + sampleDuration;
  120353. }
  120354. if (firstDts === -1) {
  120355. firstDts = dts;
  120356. }
  120357. mp4Samples.push({
  120358. dts,
  120359. pts: dts,
  120360. cts: 0,
  120361. unit: sample.unit,
  120362. size: sample.unit.byteLength,
  120363. duration: sampleDuration,
  120364. originalDts,
  120365. flags: {
  120366. isLeading: 0,
  120367. dependsOn: 1,
  120368. isDependedOn: 0,
  120369. hasRedundancy: 0
  120370. }
  120371. });
  120372. if (needFillSilentFrames) {
  120373. mp4Samples.push.apply(mp4Samples, silentFrames);
  120374. }
  120375. }
  120376. if (mp4Samples.length === 0) {
  120377. track.samples = [];
  120378. track.length = 0;
  120379. return;
  120380. }
  120381. if (mpegRawTrack) {
  120382. mdatbox = new Uint8Array(mdatBytes);
  120383. } else {
  120384. mdatbox = new Uint8Array(mdatBytes);
  120385. mdatbox[0] = mdatBytes >>> 24 & 255;
  120386. mdatbox[1] = mdatBytes >>> 16 & 255;
  120387. mdatbox[2] = mdatBytes >>> 8 & 255;
  120388. mdatbox[3] = mdatBytes & 255;
  120389. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120390. }
  120391. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120392. var unit = mp4Samples[i2].unit;
  120393. mdatbox.set(unit, offset);
  120394. offset += unit.byteLength;
  120395. }
  120396. var latest = mp4Samples[mp4Samples.length - 1];
  120397. lastDts = latest.dts + latest.duration;
  120398. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120399. info.beginDts = firstDts;
  120400. info.endDts = lastDts;
  120401. info.beginPts = firstDts;
  120402. info.endPts = lastDts;
  120403. info.originalBeginDts = mp4Samples[0].originalDts;
  120404. info.originalEndDts = latest.originalDts + latest.duration;
  120405. 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);
  120406. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, false);
  120407. if (!this._isLive) {
  120408. this._audioSegmentInfoList.append(info);
  120409. }
  120410. track.samples = mp4Samples;
  120411. track.sequenceNumber++;
  120412. var moofbox = null;
  120413. if (mpegRawTrack) {
  120414. moofbox = new Uint8Array();
  120415. } else {
  120416. moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120417. }
  120418. track.samples = [];
  120419. track.length = 0;
  120420. var segment = {
  120421. type: "audio",
  120422. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120423. sampleCount: mp4Samples.length,
  120424. info
  120425. };
  120426. if (mpegRawTrack && firstSegmentAfterSeek) {
  120427. segment.timestampOffset = firstDts;
  120428. }
  120429. this._onMediaSegment("audio", segment);
  120430. };
  120431. MP4Remuxer2.prototype._remuxVideo = function(videoTrack, force) {
  120432. if (this._videoMeta == null) {
  120433. return;
  120434. }
  120435. var track = videoTrack;
  120436. var samples = track.samples;
  120437. var dtsCorrection = void 0;
  120438. var firstDts = -1, lastDts = -1;
  120439. var firstPts = -1, lastPts = -1;
  120440. if (!samples || samples.length === 0) {
  120441. return;
  120442. }
  120443. if (samples.length === 1 && !force) {
  120444. return;
  120445. }
  120446. var offset = 8;
  120447. var mdatbox = null;
  120448. var mdatBytes = 8 + videoTrack.length;
  120449. var lastSample = null;
  120450. if (samples.length > 1) {
  120451. lastSample = samples.pop();
  120452. mdatBytes -= lastSample.length;
  120453. }
  120454. if (this._videoStashedLastSample != null) {
  120455. var sample = this._videoStashedLastSample;
  120456. this._videoStashedLastSample = null;
  120457. samples.unshift(sample);
  120458. mdatBytes += sample.length;
  120459. }
  120460. if (lastSample != null) {
  120461. this._videoStashedLastSample = lastSample;
  120462. }
  120463. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120464. if (this._videoNextDts) {
  120465. dtsCorrection = firstSampleOriginalDts - this._videoNextDts;
  120466. } else {
  120467. if (this._videoSegmentInfoList.isEmpty()) {
  120468. dtsCorrection = 0;
  120469. } else {
  120470. var lastSample_2 = this._videoSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120471. if (lastSample_2 != null) {
  120472. var distance2 = firstSampleOriginalDts - (lastSample_2.originalDts + lastSample_2.duration);
  120473. if (distance2 <= 3) {
  120474. distance2 = 0;
  120475. }
  120476. var expectedDts = lastSample_2.dts + lastSample_2.duration + distance2;
  120477. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120478. } else {
  120479. dtsCorrection = 0;
  120480. }
  120481. }
  120482. }
  120483. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120484. var mp4Samples = [];
  120485. for (var i2 = 0; i2 < samples.length; i2++) {
  120486. var sample = samples[i2];
  120487. var originalDts = sample.dts - this._dtsBase;
  120488. var isKeyframe = sample.isKeyframe;
  120489. var dts = originalDts - dtsCorrection;
  120490. var cts = sample.cts;
  120491. var pts = dts + cts;
  120492. if (firstDts === -1) {
  120493. firstDts = dts;
  120494. firstPts = pts;
  120495. }
  120496. var sampleDuration = 0;
  120497. if (i2 !== samples.length - 1) {
  120498. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120499. sampleDuration = nextDts - dts;
  120500. } else {
  120501. if (lastSample != null) {
  120502. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120503. sampleDuration = nextDts - dts;
  120504. } else if (mp4Samples.length >= 1) {
  120505. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120506. } else {
  120507. sampleDuration = Math.floor(this._videoMeta.refSampleDuration);
  120508. }
  120509. }
  120510. if (isKeyframe) {
  120511. var syncPoint = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(dts, pts, sampleDuration, sample.dts, true);
  120512. syncPoint.fileposition = sample.fileposition;
  120513. info.appendSyncPoint(syncPoint);
  120514. }
  120515. mp4Samples.push({
  120516. dts,
  120517. pts,
  120518. cts,
  120519. units: sample.units,
  120520. size: sample.length,
  120521. isKeyframe,
  120522. duration: sampleDuration,
  120523. originalDts,
  120524. flags: {
  120525. isLeading: 0,
  120526. dependsOn: isKeyframe ? 2 : 1,
  120527. isDependedOn: isKeyframe ? 1 : 0,
  120528. hasRedundancy: 0,
  120529. isNonSync: isKeyframe ? 0 : 1
  120530. }
  120531. });
  120532. }
  120533. mdatbox = new Uint8Array(mdatBytes);
  120534. mdatbox[0] = mdatBytes >>> 24 & 255;
  120535. mdatbox[1] = mdatBytes >>> 16 & 255;
  120536. mdatbox[2] = mdatBytes >>> 8 & 255;
  120537. mdatbox[3] = mdatBytes & 255;
  120538. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120539. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120540. var units = mp4Samples[i2].units;
  120541. while (units.length) {
  120542. var unit = units.shift();
  120543. var data = unit.data;
  120544. mdatbox.set(data, offset);
  120545. offset += data.byteLength;
  120546. }
  120547. }
  120548. var latest = mp4Samples[mp4Samples.length - 1];
  120549. lastDts = latest.dts + latest.duration;
  120550. lastPts = latest.pts + latest.duration;
  120551. this._videoNextDts = lastDts;
  120552. info.beginDts = firstDts;
  120553. info.endDts = lastDts;
  120554. info.beginPts = firstPts;
  120555. info.endPts = lastPts;
  120556. info.originalBeginDts = mp4Samples[0].originalDts;
  120557. info.originalEndDts = latest.originalDts + latest.duration;
  120558. 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);
  120559. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, latest.isKeyframe);
  120560. if (!this._isLive) {
  120561. this._videoSegmentInfoList.append(info);
  120562. }
  120563. track.samples = mp4Samples;
  120564. track.sequenceNumber++;
  120565. if (this._forceFirstIDR) {
  120566. var flags = mp4Samples[0].flags;
  120567. flags.dependsOn = 2;
  120568. flags.isNonSync = 0;
  120569. }
  120570. var moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120571. track.samples = [];
  120572. track.length = 0;
  120573. this._onMediaSegment("video", {
  120574. type: "video",
  120575. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120576. sampleCount: mp4Samples.length,
  120577. info
  120578. });
  120579. };
  120580. MP4Remuxer2.prototype._mergeBoxes = function(moof, mdat) {
  120581. var result = new Uint8Array(moof.byteLength + mdat.byteLength);
  120582. result.set(moof, 0);
  120583. result.set(mdat, moof.byteLength);
  120584. return result;
  120585. };
  120586. return MP4Remuxer2;
  120587. }();
  120588. __webpack_exports__2["default"] = MP4Remuxer;
  120589. },
  120590. "./src/utils/browser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120591. __webpack_require__2.r(__webpack_exports__2);
  120592. var Browser = {};
  120593. function detect() {
  120594. var ua = self.navigator.userAgent.toLowerCase();
  120595. 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) || [];
  120596. 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) || [];
  120597. var matched = {
  120598. browser: match[5] || match[3] || match[1] || "",
  120599. version: match[2] || match[4] || "0",
  120600. majorVersion: match[4] || match[2] || "0",
  120601. platform: platform_match[0] || ""
  120602. };
  120603. var browser2 = {};
  120604. if (matched.browser) {
  120605. browser2[matched.browser] = true;
  120606. var versionArray = matched.majorVersion.split(".");
  120607. browser2.version = {
  120608. major: parseInt(matched.majorVersion, 10),
  120609. string: matched.version
  120610. };
  120611. if (versionArray.length > 1) {
  120612. browser2.version.minor = parseInt(versionArray[1], 10);
  120613. }
  120614. if (versionArray.length > 2) {
  120615. browser2.version.build = parseInt(versionArray[2], 10);
  120616. }
  120617. }
  120618. if (matched.platform) {
  120619. browser2[matched.platform] = true;
  120620. }
  120621. if (browser2.chrome || browser2.opr || browser2.safari) {
  120622. browser2.webkit = true;
  120623. }
  120624. if (browser2.rv || browser2.iemobile) {
  120625. if (browser2.rv) {
  120626. delete browser2.rv;
  120627. }
  120628. var msie = "msie";
  120629. matched.browser = msie;
  120630. browser2[msie] = true;
  120631. }
  120632. if (browser2.edge) {
  120633. delete browser2.edge;
  120634. var msedge = "msedge";
  120635. matched.browser = msedge;
  120636. browser2[msedge] = true;
  120637. }
  120638. if (browser2.opr) {
  120639. var opera = "opera";
  120640. matched.browser = opera;
  120641. browser2[opera] = true;
  120642. }
  120643. if (browser2.safari && browser2.android) {
  120644. var android = "android";
  120645. matched.browser = android;
  120646. browser2[android] = true;
  120647. }
  120648. browser2.name = matched.browser;
  120649. browser2.platform = matched.platform;
  120650. for (var key in Browser) {
  120651. if (Browser.hasOwnProperty(key)) {
  120652. delete Browser[key];
  120653. }
  120654. }
  120655. Object.assign(Browser, browser2);
  120656. }
  120657. detect();
  120658. __webpack_exports__2["default"] = Browser;
  120659. },
  120660. "./src/utils/exception.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120661. __webpack_require__2.r(__webpack_exports__2);
  120662. __webpack_require__2.d(__webpack_exports__2, {
  120663. "RuntimeException": function() {
  120664. return RuntimeException;
  120665. },
  120666. "IllegalStateException": function() {
  120667. return IllegalStateException;
  120668. },
  120669. "InvalidArgumentException": function() {
  120670. return InvalidArgumentException;
  120671. },
  120672. "NotImplementedException": function() {
  120673. return NotImplementedException;
  120674. }
  120675. });
  120676. var __extends = function() {
  120677. var extendStatics = function(d2, b) {
  120678. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  120679. d3.__proto__ = b2;
  120680. } || function(d3, b2) {
  120681. for (var p in b2)
  120682. if (Object.prototype.hasOwnProperty.call(b2, p))
  120683. d3[p] = b2[p];
  120684. };
  120685. return extendStatics(d2, b);
  120686. };
  120687. return function(d2, b) {
  120688. if (typeof b !== "function" && b !== null)
  120689. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  120690. extendStatics(d2, b);
  120691. function __() {
  120692. this.constructor = d2;
  120693. }
  120694. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  120695. };
  120696. }();
  120697. var RuntimeException = function() {
  120698. function RuntimeException2(message) {
  120699. this._message = message;
  120700. }
  120701. Object.defineProperty(RuntimeException2.prototype, "name", {
  120702. get: function() {
  120703. return "RuntimeException";
  120704. },
  120705. enumerable: false,
  120706. configurable: true
  120707. });
  120708. Object.defineProperty(RuntimeException2.prototype, "message", {
  120709. get: function() {
  120710. return this._message;
  120711. },
  120712. enumerable: false,
  120713. configurable: true
  120714. });
  120715. RuntimeException2.prototype.toString = function() {
  120716. return this.name + ": " + this.message;
  120717. };
  120718. return RuntimeException2;
  120719. }();
  120720. var IllegalStateException = function(_super) {
  120721. __extends(IllegalStateException2, _super);
  120722. function IllegalStateException2(message) {
  120723. return _super.call(this, message) || this;
  120724. }
  120725. Object.defineProperty(IllegalStateException2.prototype, "name", {
  120726. get: function() {
  120727. return "IllegalStateException";
  120728. },
  120729. enumerable: false,
  120730. configurable: true
  120731. });
  120732. return IllegalStateException2;
  120733. }(RuntimeException);
  120734. var InvalidArgumentException = function(_super) {
  120735. __extends(InvalidArgumentException2, _super);
  120736. function InvalidArgumentException2(message) {
  120737. return _super.call(this, message) || this;
  120738. }
  120739. Object.defineProperty(InvalidArgumentException2.prototype, "name", {
  120740. get: function() {
  120741. return "InvalidArgumentException";
  120742. },
  120743. enumerable: false,
  120744. configurable: true
  120745. });
  120746. return InvalidArgumentException2;
  120747. }(RuntimeException);
  120748. var NotImplementedException = function(_super) {
  120749. __extends(NotImplementedException2, _super);
  120750. function NotImplementedException2(message) {
  120751. return _super.call(this, message) || this;
  120752. }
  120753. Object.defineProperty(NotImplementedException2.prototype, "name", {
  120754. get: function() {
  120755. return "NotImplementedException";
  120756. },
  120757. enumerable: false,
  120758. configurable: true
  120759. });
  120760. return NotImplementedException2;
  120761. }(RuntimeException);
  120762. },
  120763. "./src/utils/logger.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120764. __webpack_require__2.r(__webpack_exports__2);
  120765. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120766. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120767. var Log = function() {
  120768. function Log2() {
  120769. }
  120770. Log2.e = function(tag, msg) {
  120771. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120772. tag = Log2.GLOBAL_TAG;
  120773. var str = "[" + tag + "] > " + msg;
  120774. if (Log2.ENABLE_CALLBACK) {
  120775. Log2.emitter.emit("log", "error", str);
  120776. }
  120777. if (!Log2.ENABLE_ERROR) {
  120778. return;
  120779. }
  120780. if (console.error) {
  120781. console.error(str);
  120782. } else if (console.warn) {
  120783. console.warn(str);
  120784. } else {
  120785. console.log(str);
  120786. }
  120787. };
  120788. Log2.i = function(tag, msg) {
  120789. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120790. tag = Log2.GLOBAL_TAG;
  120791. var str = "[" + tag + "] > " + msg;
  120792. if (Log2.ENABLE_CALLBACK) {
  120793. Log2.emitter.emit("log", "info", str);
  120794. }
  120795. if (!Log2.ENABLE_INFO) {
  120796. return;
  120797. }
  120798. if (console.info) {
  120799. console.info(str);
  120800. } else {
  120801. console.log(str);
  120802. }
  120803. };
  120804. Log2.w = function(tag, msg) {
  120805. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120806. tag = Log2.GLOBAL_TAG;
  120807. var str = "[" + tag + "] > " + msg;
  120808. if (Log2.ENABLE_CALLBACK) {
  120809. Log2.emitter.emit("log", "warn", str);
  120810. }
  120811. if (!Log2.ENABLE_WARN) {
  120812. return;
  120813. }
  120814. if (console.warn) {
  120815. console.warn(str);
  120816. } else {
  120817. console.log(str);
  120818. }
  120819. };
  120820. Log2.d = function(tag, msg) {
  120821. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120822. tag = Log2.GLOBAL_TAG;
  120823. var str = "[" + tag + "] > " + msg;
  120824. if (Log2.ENABLE_CALLBACK) {
  120825. Log2.emitter.emit("log", "debug", str);
  120826. }
  120827. if (!Log2.ENABLE_DEBUG) {
  120828. return;
  120829. }
  120830. if (console.debug) {
  120831. console.debug(str);
  120832. } else {
  120833. console.log(str);
  120834. }
  120835. };
  120836. Log2.v = function(tag, msg) {
  120837. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120838. tag = Log2.GLOBAL_TAG;
  120839. var str = "[" + tag + "] > " + msg;
  120840. if (Log2.ENABLE_CALLBACK) {
  120841. Log2.emitter.emit("log", "verbose", str);
  120842. }
  120843. if (!Log2.ENABLE_VERBOSE) {
  120844. return;
  120845. }
  120846. console.log(str);
  120847. };
  120848. return Log2;
  120849. }();
  120850. Log.GLOBAL_TAG = "flv.js";
  120851. Log.FORCE_GLOBAL_TAG = false;
  120852. Log.ENABLE_ERROR = true;
  120853. Log.ENABLE_INFO = true;
  120854. Log.ENABLE_WARN = true;
  120855. Log.ENABLE_DEBUG = true;
  120856. Log.ENABLE_VERBOSE = true;
  120857. Log.ENABLE_CALLBACK = false;
  120858. Log.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  120859. __webpack_exports__2["default"] = Log;
  120860. },
  120861. "./src/utils/logging-control.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120862. __webpack_require__2.r(__webpack_exports__2);
  120863. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120864. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120865. var _logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  120866. var LoggingControl = function() {
  120867. function LoggingControl2() {
  120868. }
  120869. Object.defineProperty(LoggingControl2, "forceGlobalTag", {
  120870. get: function() {
  120871. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG;
  120872. },
  120873. set: function(enable) {
  120874. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = enable;
  120875. LoggingControl2._notifyChange();
  120876. },
  120877. enumerable: false,
  120878. configurable: true
  120879. });
  120880. Object.defineProperty(LoggingControl2, "globalTag", {
  120881. get: function() {
  120882. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG;
  120883. },
  120884. set: function(tag) {
  120885. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = tag;
  120886. LoggingControl2._notifyChange();
  120887. },
  120888. enumerable: false,
  120889. configurable: true
  120890. });
  120891. Object.defineProperty(LoggingControl2, "enableAll", {
  120892. get: function() {
  120893. 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;
  120894. },
  120895. set: function(enable) {
  120896. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120897. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120898. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120899. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120900. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120901. LoggingControl2._notifyChange();
  120902. },
  120903. enumerable: false,
  120904. configurable: true
  120905. });
  120906. Object.defineProperty(LoggingControl2, "enableDebug", {
  120907. get: function() {
  120908. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG;
  120909. },
  120910. set: function(enable) {
  120911. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120912. LoggingControl2._notifyChange();
  120913. },
  120914. enumerable: false,
  120915. configurable: true
  120916. });
  120917. Object.defineProperty(LoggingControl2, "enableVerbose", {
  120918. get: function() {
  120919. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE;
  120920. },
  120921. set: function(enable) {
  120922. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120923. LoggingControl2._notifyChange();
  120924. },
  120925. enumerable: false,
  120926. configurable: true
  120927. });
  120928. Object.defineProperty(LoggingControl2, "enableInfo", {
  120929. get: function() {
  120930. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO;
  120931. },
  120932. set: function(enable) {
  120933. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120934. LoggingControl2._notifyChange();
  120935. },
  120936. enumerable: false,
  120937. configurable: true
  120938. });
  120939. Object.defineProperty(LoggingControl2, "enableWarn", {
  120940. get: function() {
  120941. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN;
  120942. },
  120943. set: function(enable) {
  120944. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120945. LoggingControl2._notifyChange();
  120946. },
  120947. enumerable: false,
  120948. configurable: true
  120949. });
  120950. Object.defineProperty(LoggingControl2, "enableError", {
  120951. get: function() {
  120952. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR;
  120953. },
  120954. set: function(enable) {
  120955. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120956. LoggingControl2._notifyChange();
  120957. },
  120958. enumerable: false,
  120959. configurable: true
  120960. });
  120961. LoggingControl2.getConfig = function() {
  120962. return {
  120963. globalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG,
  120964. forceGlobalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG,
  120965. enableVerbose: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE,
  120966. enableDebug: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG,
  120967. enableInfo: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO,
  120968. enableWarn: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN,
  120969. enableError: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR,
  120970. enableCallback: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK
  120971. };
  120972. };
  120973. LoggingControl2.applyConfig = function(config) {
  120974. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = config.globalTag;
  120975. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = config.forceGlobalTag;
  120976. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = config.enableVerbose;
  120977. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = config.enableDebug;
  120978. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = config.enableInfo;
  120979. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = config.enableWarn;
  120980. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = config.enableError;
  120981. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = config.enableCallback;
  120982. };
  120983. LoggingControl2._notifyChange = function() {
  120984. var emitter = LoggingControl2.emitter;
  120985. if (emitter.listenerCount("change") > 0) {
  120986. var config = LoggingControl2.getConfig();
  120987. emitter.emit("change", config);
  120988. }
  120989. };
  120990. LoggingControl2.registerListener = function(listener) {
  120991. LoggingControl2.emitter.addListener("change", listener);
  120992. };
  120993. LoggingControl2.removeListener = function(listener) {
  120994. LoggingControl2.emitter.removeListener("change", listener);
  120995. };
  120996. LoggingControl2.addLogListener = function(listener) {
  120997. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.addListener("log", listener);
  120998. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") > 0) {
  120999. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = true;
  121000. LoggingControl2._notifyChange();
  121001. }
  121002. };
  121003. LoggingControl2.removeLogListener = function(listener) {
  121004. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.removeListener("log", listener);
  121005. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") === 0) {
  121006. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = false;
  121007. LoggingControl2._notifyChange();
  121008. }
  121009. };
  121010. return LoggingControl2;
  121011. }();
  121012. LoggingControl.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  121013. __webpack_exports__2["default"] = LoggingControl;
  121014. },
  121015. "./src/utils/polyfill.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  121016. __webpack_require__2.r(__webpack_exports__2);
  121017. var Polyfill = function() {
  121018. function Polyfill2() {
  121019. }
  121020. Polyfill2.install = function() {
  121021. Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  121022. obj.__proto__ = proto;
  121023. return obj;
  121024. };
  121025. Object.assign = Object.assign || function(target) {
  121026. if (target === void 0 || target === null) {
  121027. throw new TypeError("Cannot convert undefined or null to object");
  121028. }
  121029. var output = Object(target);
  121030. for (var i2 = 1; i2 < arguments.length; i2++) {
  121031. var source = arguments[i2];
  121032. if (source !== void 0 && source !== null) {
  121033. for (var key in source) {
  121034. if (source.hasOwnProperty(key)) {
  121035. output[key] = source[key];
  121036. }
  121037. }
  121038. }
  121039. }
  121040. return output;
  121041. };
  121042. if (typeof self.Promise !== "function") {
  121043. __webpack_require__2("./node_modules/es6-promise/dist/es6-promise.js").polyfill();
  121044. }
  121045. };
  121046. return Polyfill2;
  121047. }();
  121048. Polyfill.install();
  121049. __webpack_exports__2["default"] = Polyfill;
  121050. },
  121051. "./src/utils/utf8-conv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  121052. __webpack_require__2.r(__webpack_exports__2);
  121053. function checkContinuation(uint8array, start2, checkLength) {
  121054. var array = uint8array;
  121055. if (start2 + checkLength < array.length) {
  121056. while (checkLength--) {
  121057. if ((array[++start2] & 192) !== 128)
  121058. return false;
  121059. }
  121060. return true;
  121061. } else {
  121062. return false;
  121063. }
  121064. }
  121065. function decodeUTF8(uint8array) {
  121066. var out = [];
  121067. var input = uint8array;
  121068. var i2 = 0;
  121069. var length = uint8array.length;
  121070. while (i2 < length) {
  121071. if (input[i2] < 128) {
  121072. out.push(String.fromCharCode(input[i2]));
  121073. ++i2;
  121074. continue;
  121075. } else if (input[i2] < 192)
  121076. ;
  121077. else if (input[i2] < 224) {
  121078. if (checkContinuation(input, i2, 1)) {
  121079. var ucs4 = (input[i2] & 31) << 6 | input[i2 + 1] & 63;
  121080. if (ucs4 >= 128) {
  121081. out.push(String.fromCharCode(ucs4 & 65535));
  121082. i2 += 2;
  121083. continue;
  121084. }
  121085. }
  121086. } else if (input[i2] < 240) {
  121087. if (checkContinuation(input, i2, 2)) {
  121088. var ucs4 = (input[i2] & 15) << 12 | (input[i2 + 1] & 63) << 6 | input[i2 + 2] & 63;
  121089. if (ucs4 >= 2048 && (ucs4 & 63488) !== 55296) {
  121090. out.push(String.fromCharCode(ucs4 & 65535));
  121091. i2 += 3;
  121092. continue;
  121093. }
  121094. }
  121095. } else if (input[i2] < 248) {
  121096. if (checkContinuation(input, i2, 3)) {
  121097. var ucs4 = (input[i2] & 7) << 18 | (input[i2 + 1] & 63) << 12 | (input[i2 + 2] & 63) << 6 | input[i2 + 3] & 63;
  121098. if (ucs4 > 65536 && ucs4 < 1114112) {
  121099. ucs4 -= 65536;
  121100. out.push(String.fromCharCode(ucs4 >>> 10 | 55296));
  121101. out.push(String.fromCharCode(ucs4 & 1023 | 56320));
  121102. i2 += 4;
  121103. continue;
  121104. }
  121105. }
  121106. }
  121107. out.push(String.fromCharCode(65533));
  121108. ++i2;
  121109. }
  121110. return out.join("");
  121111. }
  121112. __webpack_exports__2["default"] = decodeUTF8;
  121113. }
  121114. };
  121115. var __webpack_module_cache__ = {};
  121116. function __webpack_require__(moduleId) {
  121117. var cachedModule = __webpack_module_cache__[moduleId];
  121118. if (cachedModule !== void 0) {
  121119. return cachedModule.exports;
  121120. }
  121121. var module3 = __webpack_module_cache__[moduleId] = {
  121122. exports: {}
  121123. };
  121124. __webpack_modules__[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
  121125. return module3.exports;
  121126. }
  121127. __webpack_require__.m = __webpack_modules__;
  121128. !function() {
  121129. __webpack_require__.n = function(module3) {
  121130. var getter = module3 && module3.__esModule ? function() {
  121131. return module3["default"];
  121132. } : function() {
  121133. return module3;
  121134. };
  121135. __webpack_require__.d(getter, { a: getter });
  121136. return getter;
  121137. };
  121138. }();
  121139. !function() {
  121140. __webpack_require__.d = function(exports3, definition) {
  121141. for (var key in definition) {
  121142. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports3, key)) {
  121143. Object.defineProperty(exports3, key, { enumerable: true, get: definition[key] });
  121144. }
  121145. }
  121146. };
  121147. }();
  121148. !function() {
  121149. __webpack_require__.g = function() {
  121150. if (typeof globalThis === "object")
  121151. return globalThis;
  121152. try {
  121153. return this || new Function("return this")();
  121154. } catch (e) {
  121155. if (typeof window === "object")
  121156. return window;
  121157. }
  121158. }();
  121159. }();
  121160. !function() {
  121161. __webpack_require__.o = function(obj, prop) {
  121162. return Object.prototype.hasOwnProperty.call(obj, prop);
  121163. };
  121164. }();
  121165. !function() {
  121166. __webpack_require__.r = function(exports3) {
  121167. if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
  121168. Object.defineProperty(exports3, Symbol.toStringTag, { value: "Module" });
  121169. }
  121170. Object.defineProperty(exports3, "__esModule", { value: true });
  121171. };
  121172. }();
  121173. var __webpack_exports__ = __webpack_require__("./src/index.js");
  121174. return __webpack_exports__;
  121175. }();
  121176. });
  121177. })(flv);
  121178. var flvjs = /* @__PURE__ */ getDefaultExportFromCjs(flv.exports);
  121179. const Html5 = videojs$2.getTech("Html5");
  121180. const mergeOptions = videojs$2.mergeOptions || videojs$2.util.mergeOptions;
  121181. const defaults = {
  121182. mediaDataSource: {},
  121183. config: {}
  121184. };
  121185. class Flvjs extends Html5 {
  121186. constructor(options2, ready) {
  121187. options2 = mergeOptions(defaults, options2);
  121188. super(options2, ready);
  121189. }
  121190. setSrc(src) {
  121191. if (this.flvPlayer) {
  121192. this.flvPlayer.detachMediaElement();
  121193. this.flvPlayer.destroy();
  121194. }
  121195. const mediaDataSource = this.options_.mediaDataSource;
  121196. const config = this.options_.config;
  121197. mediaDataSource.type = mediaDataSource.type === void 0 ? "flv" : mediaDataSource.type;
  121198. mediaDataSource.url = src;
  121199. this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
  121200. this.flvPlayer.attachMediaElement(this.el_);
  121201. this.flvPlayer.load();
  121202. }
  121203. dispose() {
  121204. if (this.flvPlayer) {
  121205. this.flvPlayer.detachMediaElement();
  121206. this.flvPlayer.destroy();
  121207. }
  121208. super.dispose();
  121209. }
  121210. }
  121211. Flvjs.isSupported = function() {
  121212. return flvjs && flvjs.isSupported();
  121213. };
  121214. Flvjs.formats = {
  121215. "video/flv": "FLV",
  121216. "video/x-flv": "FLV"
  121217. };
  121218. Flvjs.canPlayType = function(type2) {
  121219. if (Flvjs.isSupported() && type2 in Flvjs.formats) {
  121220. return "maybe";
  121221. }
  121222. return "";
  121223. };
  121224. Flvjs.canPlaySource = function(srcObj, options2) {
  121225. return Flvjs.canPlayType(srcObj.type);
  121226. };
  121227. Flvjs.VERSION = "__VERSION__";
  121228. videojs$2.registerTech("Flvjs", Flvjs);
  121229. var VideoWindow$1 = "";
  121230. class VideoWindow {
  121231. constructor(viewer2, position2, videoInfo, offsetHeight) {
  121232. if (!viewer2)
  121233. throw new Cesium.DeveloperError("no viewer object!");
  121234. if (!position2)
  121235. throw new Cesium.DeveloperError("no position object!");
  121236. this.viewer = viewer2;
  121237. this.position = position2;
  121238. this.offsetHeight = offsetHeight;
  121239. if (position2 instanceof Cesium.Cartesian3) {
  121240. this.position = position2;
  121241. } else {
  121242. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121243. }
  121244. if (document.getElementsByClassName("popup-video").length > 0) {
  121245. document.getElementsByClassName("popup-video")[0].remove();
  121246. viewer2.entities.remove(viewer2.entities.getById("videoPopupPoint"));
  121247. }
  121248. this.id = "popup_video_" + getGuid();
  121249. this.popupDiv = document.createElement("div");
  121250. this.popupDiv.classList.add("popup-video");
  121251. this.popupDiv.id = this.id;
  121252. this.viewer.container.append(this.popupDiv);
  121253. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121254. switch (videoInfo.type) {
  121255. case "hls":
  121256. this.videotype = "application/x-mpegURL";
  121257. break;
  121258. case "rtmp":
  121259. this.videotype = "rtmp/flv";
  121260. break;
  121261. case "flv":
  121262. this.videotype = "video/x-flv";
  121263. break;
  121264. case "mp4":
  121265. this.videotype = "video/mp4";
  121266. break;
  121267. }
  121268. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121269. controls: true,
  121270. autoplay: "muted",
  121271. loop: true,
  121272. muted: false,
  121273. fluid: true,
  121274. aspectRatio: "16:9",
  121275. reload: "auto",
  121276. fullscreen: {
  121277. options: {
  121278. navigationUI: "hide"
  121279. }
  121280. },
  121281. sources: [{
  121282. src: videoInfo.url,
  121283. type: this.videotype
  121284. }]
  121285. }, function onPlayerReady() {
  121286. console.log("onPlayerReady", this);
  121287. });
  121288. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121289. this.initPoint();
  121290. document.getElementsByClassName("popup-video1-close-button")[0].onclick = () => {
  121291. this.close();
  121292. };
  121293. }
  121294. postRender() {
  121295. this.viewer.scene.canvas.height;
  121296. const windowPosition = new Cesium.Cartesian2();
  121297. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121298. this.viewer.scene,
  121299. this.position,
  121300. windowPosition
  121301. );
  121302. let elWidth = this.popupDiv.offsetWidth;
  121303. let elHeight = this.popupDiv.offsetHeight;
  121304. if (!!this.offsetHeight) {
  121305. elHeight += this.offsetHeight;
  121306. }
  121307. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121308. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121309. const camerPosition = this.viewer.camera.position;
  121310. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121311. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121312. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121313. this.popupDiv.style.display = "block";
  121314. } else {
  121315. this.popupDiv.style.display = "none";
  121316. }
  121317. }
  121318. _createHtml(videoInfo) {
  121319. let html = `
  121320. <div class="popup-video-header">
  121321. ${videoInfo.name}
  121322. <span class="popup-video1-close-button">\xD7</span>
  121323. </div>
  121324. <div class="popup-video-content">
  121325. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121326. </div>
  121327. <div class="popup-video-tip">
  121328. </div>
  121329. `;
  121330. return html;
  121331. }
  121332. initPoint() {
  121333. this.billboard = new Cesium.Entity({
  121334. id: "videoPopupPoint",
  121335. name: "popupPoint",
  121336. position: this.position,
  121337. billboard: {
  121338. image: "jt3dSDK/imgs/point/point.png",
  121339. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121340. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121341. scale: 1,
  121342. pixelOffset: new Cesium.Cartesian2(0, 0),
  121343. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121344. }
  121345. });
  121346. this.viewer.entities.add(this.billboard);
  121347. }
  121348. }
  121349. Object.assign(VideoWindow.prototype, {
  121350. close() {
  121351. this.popupDiv.remove();
  121352. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121353. this.viewer.entities.remove(this.billboard);
  121354. videojs$2("myvideo").dispose();
  121355. this.videoPlayer.dispose();
  121356. }
  121357. });
  121358. var VideoWindow2$1 = "";
  121359. class VideoWindow2 {
  121360. constructor(viewer2, position2, videoInfo) {
  121361. if (!viewer2)
  121362. throw new Cesium.DeveloperError("no viewer object!");
  121363. if (!position2)
  121364. throw new Cesium.DeveloperError("no position object!");
  121365. this.viewer = viewer2;
  121366. this.position = position2;
  121367. if (position2 instanceof Cesium.Cartesian3) {
  121368. this.position = position2;
  121369. } else {
  121370. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121371. }
  121372. if (document.getElementsByClassName("popup-video2").length > 0) {
  121373. document.getElementsByClassName("popup-video2")[0].remove();
  121374. }
  121375. this.id = "popup_video_" + getGuid();
  121376. this.popupDiv = document.createElement("div");
  121377. this.popupDiv.classList.add("popup-video2");
  121378. this.popupDiv.id = this.id;
  121379. this.viewer.container.append(this.popupDiv);
  121380. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121381. switch (videoInfo.type) {
  121382. case "hls":
  121383. this.videotype = "application/x-mpegURL";
  121384. break;
  121385. case "rtmp":
  121386. this.videotype = "rtmp/flv";
  121387. break;
  121388. case "flv":
  121389. this.videotype = "video/x-flv";
  121390. break;
  121391. case "mp4":
  121392. this.videotype = "video/mp4";
  121393. break;
  121394. }
  121395. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121396. controls: true,
  121397. autoplay: "muted",
  121398. loop: true,
  121399. muted: false,
  121400. fluid: true,
  121401. aspectRatio: "16:9",
  121402. reload: "auto",
  121403. fullscreen: {
  121404. options: {
  121405. navigationUI: "hide"
  121406. }
  121407. },
  121408. sources: [{
  121409. src: videoInfo.url,
  121410. type: this.videotype
  121411. }]
  121412. }, function onPlayerReady() {
  121413. console.log("onPlayerReady", this);
  121414. });
  121415. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121416. document.getElementsByClassName("popup-video2-close-button")[0].onclick = () => {
  121417. this.close();
  121418. };
  121419. }
  121420. postRender() {
  121421. this.viewer.scene.canvas.height;
  121422. const windowPosition = new Cesium.Cartesian2();
  121423. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121424. this.viewer.scene,
  121425. this.position,
  121426. windowPosition
  121427. );
  121428. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121429. this.popupDiv.style.top = windowPosition.y + "px";
  121430. const camerPosition = this.viewer.camera.position;
  121431. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121432. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121433. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121434. this.popupDiv.style.display = "block";
  121435. } else {
  121436. this.popupDiv.style.display = "none";
  121437. }
  121438. }
  121439. _createHtml(videoInfo) {
  121440. let html = `
  121441. <div class="rightLine-1"></div>
  121442. <div class="rightLine-2"></div>
  121443. <div class="rightLine-3"></div>
  121444. <div class="popup-header">
  121445. <span class="popup-title" >${videoInfo.name}</span>
  121446. <span class="popup-video2-close-button" title="\u5173\u95ED" >\xD7</span>
  121447. </div>
  121448. <div class="popup-content">
  121449. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121450. </div>
  121451. `;
  121452. return html;
  121453. }
  121454. }
  121455. Object.assign(VideoWindow2.prototype, {
  121456. close() {
  121457. this.popupDiv.remove();
  121458. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121459. }
  121460. });
  121461. var VideoWindow3$1 = "";
  121462. class VideoWindow3 {
  121463. constructor(viewer2, position2, videoInfo) {
  121464. if (!viewer2)
  121465. throw new Cesium.DeveloperError("no viewer object!");
  121466. if (!position2)
  121467. throw new Cesium.DeveloperError("no position object!");
  121468. this.viewer = viewer2;
  121469. this.position = position2;
  121470. if (position2 instanceof Cesium.Cartesian3) {
  121471. this.position = position2;
  121472. } else {
  121473. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121474. }
  121475. if (document.getElementsByClassName("popup-video3").length > 0) {
  121476. document.getElementsByClassName("popup-video3")[0].remove();
  121477. }
  121478. this.id = "popup_video_" + getGuid();
  121479. this.popupDiv = document.createElement("div");
  121480. this.popupDiv.classList.add("popup-video3");
  121481. this.popupDiv.id = this.id;
  121482. this.viewer.container.append(this.popupDiv);
  121483. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121484. switch (videoInfo.type) {
  121485. case "hls":
  121486. this.videotype = "application/x-mpegURL";
  121487. break;
  121488. case "rtmp":
  121489. this.videotype = "rtmp/flv";
  121490. break;
  121491. case "flv":
  121492. this.videotype = "video/x-flv";
  121493. break;
  121494. case "mp4":
  121495. this.videotype = "video/mp4";
  121496. break;
  121497. }
  121498. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121499. controls: true,
  121500. autoplay: "muted",
  121501. loop: true,
  121502. muted: false,
  121503. fluid: true,
  121504. aspectRatio: "16:9",
  121505. reload: "auto",
  121506. fullscreen: {
  121507. options: {
  121508. navigationUI: "hide"
  121509. }
  121510. },
  121511. sources: [{
  121512. src: videoInfo.url,
  121513. type: this.videotype
  121514. }]
  121515. }, function onPlayerReady() {
  121516. console.log("onPlayerReady", this);
  121517. });
  121518. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121519. document.getElementsByClassName("popup-video3-close-button")[0].onclick = () => {
  121520. this.close();
  121521. };
  121522. }
  121523. postRender() {
  121524. this.viewer.scene.canvas.height;
  121525. const windowPosition = new Cesium.Cartesian2();
  121526. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121527. this.viewer.scene,
  121528. this.position,
  121529. windowPosition
  121530. );
  121531. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121532. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121533. const camerPosition = this.viewer.camera.position;
  121534. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121535. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121536. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121537. this.popupDiv.style.display = "block";
  121538. } else {
  121539. this.popupDiv.style.display = "none";
  121540. }
  121541. }
  121542. _createHtml(videoInfo) {
  121543. let html = `
  121544. <div class="leftLine-1"></div>
  121545. <div class="leftLine-2"></div>
  121546. <div class="popup-header">
  121547. <span class="popup-title" >${videoInfo.name}</span>
  121548. <span class="popup-video3-close-button" title="\u5173\u95ED" >\xD7</span>
  121549. </div>
  121550. <div class="popup-content">
  121551. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121552. </div>
  121553. `;
  121554. return html;
  121555. }
  121556. }
  121557. Object.assign(VideoWindow3.prototype, {
  121558. close() {
  121559. this.popupDiv.remove();
  121560. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121561. }
  121562. });
  121563. var HtmlWindow1 = "";
  121564. class HtmlWindow {
  121565. constructor(viewer2, position2, title, html, offsetHeight) {
  121566. if (!viewer2)
  121567. throw new Cesium.DeveloperError("no viewer object!");
  121568. if (!position2)
  121569. throw new Cesium.DeveloperError("no position object!");
  121570. this.viewer = viewer2;
  121571. this.offsetHeight = offsetHeight;
  121572. if (position2 instanceof Cesium.Cartesian3) {
  121573. this.position = position2;
  121574. } else {
  121575. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121576. }
  121577. if (document.getElementsByClassName("popup1").length > 0) {
  121578. document.getElementsByClassName("popup1")[0].remove();
  121579. viewer2.entities.remove(viewer2.entities.getById("popupPoint"));
  121580. }
  121581. this.id = "popup_" + getGuid();
  121582. this.popupDiv = document.createElement("div");
  121583. this.popupDiv.classList.add("popup1");
  121584. this.popupDiv.id = this.id;
  121585. this.viewer.container.append(this.popupDiv);
  121586. this.popupDiv.innerHTML = this._createHtml(title, html);
  121587. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121588. this.initPoint();
  121589. document.getElementsByClassName("popup1-close-button")[0].onclick = () => {
  121590. this.close();
  121591. };
  121592. }
  121593. postRender() {
  121594. this.viewer.scene.canvas.height;
  121595. const windowPosition = new Cesium.Cartesian2();
  121596. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121597. this.viewer.scene,
  121598. this.position,
  121599. windowPosition
  121600. );
  121601. let elWidth = this.popupDiv.offsetWidth;
  121602. let elHeight = this.popupDiv.offsetHeight;
  121603. if (!!this.offsetHeight) {
  121604. elHeight += this.offsetHeight;
  121605. }
  121606. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121607. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121608. const camerPosition = this.viewer.camera.position;
  121609. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121610. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121611. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121612. this.popupDiv.style.display = "block";
  121613. } else {
  121614. this.popupDiv.style.display = "none";
  121615. }
  121616. }
  121617. _createHtml(header, content) {
  121618. let html = `
  121619. <div class="popup-header">
  121620. ${header}
  121621. <span class="popup1-close-button">\xD7</span>
  121622. </div>
  121623. <div class="popup-content">
  121624. ${content}
  121625. </div>
  121626. <div class="popup-tip">
  121627. </div>
  121628. `;
  121629. return html;
  121630. }
  121631. initPoint() {
  121632. this.billboard = this.viewer.entities.add({
  121633. id: "popupPoint",
  121634. name: "popupPoint",
  121635. position: this.position,
  121636. billboard: {
  121637. image: "jt3dSDK/imgs/point/point.png",
  121638. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121639. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121640. scale: 1,
  121641. pixelOffset: new Cesium.Cartesian2(0, 0),
  121642. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121643. }
  121644. });
  121645. }
  121646. }
  121647. Object.assign(HtmlWindow.prototype, {
  121648. close() {
  121649. this.popupDiv.remove();
  121650. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121651. this.viewer.entities.remove(this.billboard);
  121652. }
  121653. });
  121654. var HtmlWindow2$1 = "";
  121655. class HtmlWindow2 {
  121656. constructor(viewer2, position2, title, html) {
  121657. if (!viewer2)
  121658. throw new Cesium.DeveloperError("no viewer object!");
  121659. if (!position2)
  121660. throw new Cesium.DeveloperError("no position object!");
  121661. this.viewer = viewer2;
  121662. this.position = position2;
  121663. if (position2 instanceof Cesium.Cartesian3) {
  121664. this.position = position2;
  121665. } else {
  121666. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121667. }
  121668. if (document.getElementsByClassName("popup2").length > 0) {
  121669. document.getElementsByClassName("popup2")[0].remove();
  121670. }
  121671. this.id = "popup_" + getGuid();
  121672. this.popupDiv = document.createElement("div");
  121673. this.popupDiv.classList.add("popup2");
  121674. this.popupDiv.id = this.id;
  121675. this.viewer.container.append(this.popupDiv);
  121676. this.popupDiv.innerHTML = this._createHtml(title, html);
  121677. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121678. document.getElementsByClassName("popup2-close-button")[0].onclick = () => {
  121679. this.close();
  121680. };
  121681. }
  121682. postRender() {
  121683. this.viewer.scene.canvas.height;
  121684. const windowPosition = new Cesium.Cartesian2();
  121685. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121686. this.viewer.scene,
  121687. this.position,
  121688. windowPosition
  121689. );
  121690. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121691. this.popupDiv.style.top = windowPosition.y + "px";
  121692. const camerPosition = this.viewer.camera.position;
  121693. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121694. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121695. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121696. this.popupDiv.style.display = "block";
  121697. } else {
  121698. this.popupDiv.style.display = "none";
  121699. }
  121700. }
  121701. _createHtml(title, content) {
  121702. let html = `
  121703. <div class="rightLine-1"></div>
  121704. <div class="rightLine-2"></div>
  121705. <div class="rightLine-3"></div>
  121706. <div class="popup-header">
  121707. <span class="popup-title" >${title}</span>
  121708. <span class="popup2-close-button" title="\u5173\u95ED" >\xD7</span>
  121709. </div>
  121710. <div class="popup-content">
  121711. ${content}
  121712. </div>
  121713. `;
  121714. return html;
  121715. }
  121716. }
  121717. Object.assign(HtmlWindow2.prototype, {
  121718. close() {
  121719. this.popupDiv.remove();
  121720. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121721. }
  121722. });
  121723. var HtmlWindow3$1 = "";
  121724. class HtmlWindow3 {
  121725. constructor(viewer2, position2, title, html) {
  121726. if (!viewer2)
  121727. throw new Cesium.DeveloperError("no viewer object!");
  121728. if (!position2)
  121729. throw new Cesium.DeveloperError("no position object!");
  121730. this.viewer = viewer2;
  121731. this.position = position2;
  121732. if (position2 instanceof Cesium.Cartesian3) {
  121733. this.position = position2;
  121734. } else {
  121735. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121736. }
  121737. if (document.getElementsByClassName("popup3").length > 0) {
  121738. document.getElementsByClassName("popup3")[0].remove();
  121739. }
  121740. this.id = "popup_" + getGuid();
  121741. this.popupDiv = document.createElement("div");
  121742. this.popupDiv.classList.add("popup3");
  121743. this.popupDiv.id = this.id;
  121744. this.viewer.container.append(this.popupDiv);
  121745. this.popupDiv.innerHTML = this._createHtml(title, html);
  121746. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121747. document.getElementsByClassName("popup3-close-button")[0].onclick = () => {
  121748. this.close();
  121749. };
  121750. }
  121751. postRender() {
  121752. this.viewer.scene.canvas.height;
  121753. const windowPosition = new Cesium.Cartesian2();
  121754. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121755. this.viewer.scene,
  121756. this.position,
  121757. windowPosition
  121758. );
  121759. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121760. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121761. const camerPosition = this.viewer.camera.position;
  121762. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121763. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121764. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121765. this.popupDiv.style.display = "block";
  121766. } else {
  121767. this.popupDiv.style.display = "none";
  121768. }
  121769. }
  121770. _createHtml(title, content) {
  121771. let html = `
  121772. <div class="leftLine-1"></div>
  121773. <div class="leftLine-2"></div>
  121774. <div class="popup-header">
  121775. <span class="popup-title" >${title}</span>
  121776. <span class="popup3-close-button" title="\u5173\u95ED" >\xD7</span>
  121777. </div>
  121778. <div class="popup-content">
  121779. ${content}
  121780. </div>
  121781. `;
  121782. return html;
  121783. }
  121784. }
  121785. Object.assign(HtmlWindow3.prototype, {
  121786. close() {
  121787. this.popupDiv.remove();
  121788. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121789. }
  121790. });
  121791. let PopupWindow = {
  121792. MultiFieldAdaptWindow,
  121793. VideoWindow,
  121794. VideoWindow2,
  121795. VideoWindow3,
  121796. HtmlWindow,
  121797. HtmlWindow2,
  121798. HtmlWindow3
  121799. };
  121800. class AroundPoint {
  121801. constructor(viewer2, amount, position2) {
  121802. this._viewer = viewer2;
  121803. this._amount = amount;
  121804. this._position = position2;
  121805. this._range = this._viewer.camera.positionCartographic.height;
  121806. }
  121807. _bindEvent() {
  121808. let _self = this;
  121809. this._viewer.clock.onTick.addEventListener(this._aroundPoint, this);
  121810. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121811. handler.setInputAction(function(click) {
  121812. _self.stop();
  121813. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121814. }
  121815. _unbindEvent() {
  121816. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121817. this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);
  121818. }
  121819. start() {
  121820. this._viewer.clock.shouldAnimate = true;
  121821. this._unbindEvent();
  121822. this._bindEvent();
  121823. return this;
  121824. }
  121825. stop() {
  121826. this._unbindEvent();
  121827. return this;
  121828. }
  121829. _aroundPoint() {
  121830. let heading = this._viewer.camera.heading;
  121831. let pitch = this._viewer.camera.pitch;
  121832. let range3 = this._range;
  121833. heading += Cesium.Math.toRadians(this._amount);
  121834. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121835. heading = 0;
  121836. }
  121837. this._viewer.camera.lookAt(
  121838. this._position,
  121839. new Cesium.HeadingPitchRange(
  121840. heading,
  121841. pitch,
  121842. range3
  121843. )
  121844. );
  121845. }
  121846. }
  121847. class AroundView {
  121848. constructor(viewer2, amount) {
  121849. this._viewer = viewer2;
  121850. this._amount = amount;
  121851. }
  121852. _bindEvent() {
  121853. let _self = this;
  121854. this._viewer.clock.onTick.addEventListener(this._aroundView, this);
  121855. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121856. handler.setInputAction(function(click) {
  121857. _self.stop();
  121858. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121859. }
  121860. _unbindEvent() {
  121861. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121862. this._viewer.clock.onTick.removeEventListener(this._aroundView, this);
  121863. }
  121864. start() {
  121865. this._viewer.clock.shouldAnimate = true;
  121866. this._unbindEvent();
  121867. this._bindEvent();
  121868. return this;
  121869. }
  121870. stop() {
  121871. this._unbindEvent();
  121872. return this;
  121873. }
  121874. _aroundView() {
  121875. let heading = this._viewer.camera.heading;
  121876. let pitch = this._viewer.camera.pitch;
  121877. let roll = this._viewer.camera.roll;
  121878. heading += Cesium.Math.toRadians(this._amount);
  121879. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121880. heading = 0;
  121881. }
  121882. this._viewer.camera.setView({
  121883. orientation: {
  121884. heading,
  121885. pitch,
  121886. roll
  121887. }
  121888. });
  121889. }
  121890. }
  121891. 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 };